@extends('layouts.app')

@section('page_title', 'Die Kaffeeliste - Redaktion')

@php
    $editorial = $editorial ?? [
        'sections' => [],
        'rules' => [],
        'editable_items' => [
            'announcement' => [],
            'faq' => [],
        ],
    ];
@endphp

@section('content')
    <section class="hero hero--split">
        <div class="hero__content">
            <div>
                <p class="hero__kicker">Redaktion</p>
                <h2 class="hero__title">Redaktion</h2>
                <p class="hero__lead">
                    Diese Sicht ist fuer Tenant-Admins gedacht: Hinweise, FAQ und spaetere Textbausteine
                    folgen einer klaren Redaktionslogik mit Freigabe, Sichtbarkeit und tenantbezogener Pflege.
                </p>
            </div>
            <div class="hero__actions">
                <span class="badge badge--solid">Redaktion</span>
                <span class="badge">Freigabe</span>
                <span class="badge">Tenant Override</span>
            </div>
        </div>

        <aside class="hero__aside">
            @foreach (($editorial['rules'] ?? []) as $rule)
                <article class="card metric metric--compact">
                    <p class="metric__label">Redaktionsregel</p>
                    <div class="metric__value">OK</div>
                    <p class="muted">{{ $rule }}</p>
                </article>
            @endforeach
        </aside>
    </section>

    <section class="grid grid--2">
        <article class="panel">
            <p class="card__eyebrow">Workflow</p>
            <h3>Wie Inhalte durch den Tenant laufen</h3>
            <div class="timeline" style="margin-top: 18px;">
                @foreach (($editorial['sections'] ?? []) as $section)
                    <div class="timeline__item">
                        <p class="timeline__title">{{ $section['title'] ?? '-' }}</p>
                        <p class="timeline__meta">{{ $section['description'] ?? '-' }}</p>
                    </div>
                @endforeach
            </div>
        </article>

        <article class="panel">
            <p class="card__eyebrow">Bearbeitbar</p>
            <h3>Was Tenant-Admins erfassen koennen</h3>
            <ul class="list-reset" style="margin-top: 18px;">
                @foreach (($editorial['editable_items']['announcement'] ?? []) as $announcement)
                    <li>
                        <strong style="display: block;">Hinweis: {{ $announcement['title'] ?? '-' }}</strong>
                        <span class="muted">{{ $announcement['visible_until'] ?? '-' }}</span>
                    </li>
                @endforeach
                @foreach (($editorial['editable_items']['faq'] ?? []) as $faqItem)
                    <li style="margin-top: 14px;">
                        <strong style="display: block;">FAQ: {{ $faqItem['question'] ?? '-' }}</strong>
                        <span class="muted">Sortierung {{ $faqItem['sort_order'] ?? '-' }}</span>
                    </li>
                @endforeach
            </ul>
        </article>
    </section>

    <section class="card" style="margin-top: 18px;">
        <p class="card__eyebrow">Empfehlung</p>
        <h3>Standardvorlage plus Tenant-Override</h3>
        <p class="muted">
            Die Redaktion startet mit Standardinhalten, erlaubt aber je Tenant eigene Anpassungen.
            Sichtbarkeit, Ablauf und Ausspielkanal werden im selben Modell gepflegt, damit spaeter
            Mailtexte und weitere Redaktionskanaele nahtlos anschliessen koennen.
        </p>
    </section>
@endsection
