<x-admin-layout :title="$item->exists ? 'Edit FAQ' : 'Create FAQ'">
    <x-admin.form-panel :back-route="route('admin.faqs.index')">
        <form method="POST" action="{{ $item->exists ? route('admin.faqs.update', $item) : route('admin.faqs.store') }}" class="space-y-4">
            @csrf
            @if ($item->exists) @method('PUT') @endif

            <div>
                <label class="block text-sm font-medium">Question</label>
                <input name="question" value="{{ old('question', $item->question) }}" class="admin-input" required>
            </div>
            <div>
                <label class="block text-sm font-medium">Answer</label>
                <textarea name="answer" rows="4" class="admin-input" required>{{ old('answer', $item->answer) }}</textarea>
            </div>
            <div class="grid grid-cols-2 gap-4">
                <div>
                    <label class="block text-sm font-medium">Context</label>
                    <input name="context" value="{{ old('context', $item->context ?? 'membership') }}" class="admin-input" required>
                </div>
                <div>
                    <label class="block text-sm font-medium">Sort Order</label>
                    <input type="number" name="sort_order" value="{{ old('sort_order', $item->sort_order ?? 0) }}" class="admin-input" required>
                </div>
            </div>
            <button type="submit" class="admin-btn-primary">Save</button>
        </form>
    </x-admin.form-panel>
</x-admin-layout>
