<x-app-layout>
    <x-ui.page-header title="Nouveau formulaire" description="Définir le titre et les champs dynamiques" />
    <x-alert />

    <div class="card p-6 max-w-4xl">
        <form method="POST" action="{{ route('admin.forms.store') }}">
            @csrf
            <div class="grid grid-cols-1 gap-5 mb-6">
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Titre *</label>
                    <input type="text" name="title" value="{{ old('title') }}" class="input-modern" required>
                </div>
                <div>
                    <label class="block text-sm font-medium text-slate-700 mb-1">Description</label>
                    <textarea name="description" rows="3" class="input-modern">{{ old('description') }}</textarea>
                </div>
            </div>

            <h3 class="font-semibold text-slate-800 mb-4">Champs du formulaire</h3>
            @include('partials.form-builder', ['fieldTypes' => $fieldTypes])

            <div class="flex gap-3 mt-8">
                <button type="submit" class="btn-primary">Créer le formulaire</button>
                <a href="{{ route('admin.forms.index') }}" class="btn-secondary">Annuler</a>
            </div>
        </form>
    </div>
</x-app-layout>
