@php($announcement = $announcement ?? null)

<div style="display:grid; grid-template-columns: repeat(2, 1fr); gap:16px;">
    <div class="form-group" style="grid-column: span 2;">
        <label class="form-label" for="title">Title</label>
        <input class="input" type="text" id="title" name="title" value="{{ old('title', $announcement?->title) }}" required>
    </div>
    <div class="form-group">
        <label class="form-label" for="audience">Audience</label>
        <select class="input" id="audience" name="audience">
            @foreach (['all', 'staff', 'students', 'parents'] as $audience)
                <option value="{{ $audience }}" @selected(old('audience', $announcement?->audience ?? 'all') === $audience)>{{ ucfirst($audience) }}</option>
            @endforeach
        </select>
    </div>
    <div class="form-group">
        <label class="form-label" for="status">Status</label>
        <select class="input" id="status" name="status">
            @foreach (['draft', 'published', 'archived'] as $status)
                <option value="{{ $status }}" @selected(old('status', $announcement?->status ?? 'draft') === $status)>{{ ucfirst($status) }}</option>
            @endforeach
        </select>
    </div>
    <div class="form-group">
        <label class="form-label" for="published_at">Publish At</label>
        <input class="input" type="datetime-local" id="published_at" name="published_at" value="{{ old('published_at', optional($announcement?->published_at)->format('Y-m-d\TH:i')) }}">
    </div>
    <div class="form-group">
        <label class="form-label" for="expires_at">Expires At</label>
        <input class="input" type="datetime-local" id="expires_at" name="expires_at" value="{{ old('expires_at', optional($announcement?->expires_at)->format('Y-m-d\TH:i')) }}">
    </div>
    <div class="form-group" style="grid-column: span 2;">
        <label class="form-label" for="body">Body</label>
        <textarea class="input" id="body" name="body" rows="6" required>{{ old('body', $announcement?->body) }}</textarea>
    </div>
</div>
