<x-layouts.tenant pageTitle="Nueva plantilla de consentimiento">
    <x-page-header title="Nueva plantilla de consentimiento" subtitle="Define el contenido del consentimiento informado.">
        <x-btn href="{{ route('tenant.consent-templates.index') }}" variant="secondary">Cancelar</x-btn>
    </x-page-header>

    <form method="POST" action="{{ route('tenant.consent-templates.store') }}" class="space-y-6">
        @csrf

        <x-card>
            <div class="space-y-4">
                <label class="block">
                    <span class="text-sm font-medium text-gray-700">Título <span class="text-red-500">*</span></span>
                    <input type="text" name="title" value="{{ old('title') }}" required
                           class="mt-1 w-full rounded-lg border-gray-300 text-sm focus:border-indigo-500 focus:ring-indigo-500 @error('title') border-red-400 @enderror"
                           placeholder="ej. Consentimiento para procedimiento estético">
                    @error('title')<p class="text-xs text-red-500 mt-1">{{ $message }}</p>@enderror
                </label>

                <label class="block">
                    <span class="text-sm font-medium text-gray-700">Contenido del consentimiento <span class="text-red-500">*</span></span>
                    <textarea name="content" rows="15" required
                              class="mt-1 w-full rounded-lg border-gray-300 text-sm focus:border-indigo-500 focus:ring-indigo-500 @error('content') border-red-400 @enderror"
                              placeholder="Redacta aquí el texto completo del consentimiento informado...">{{ old('content') }}</textarea>
                    @error('content')<p class="text-xs text-red-500 mt-1">{{ $message }}</p>@enderror
                </label>

                <div class="flex flex-col sm:flex-row gap-4">
                    <label class="flex items-center gap-2 cursor-pointer">
                        <input type="checkbox" name="requires_signature" value="1" @checked(old('requires_signature', true))
                               class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
                        <span class="text-sm text-gray-700">Requiere firma del paciente</span>
                    </label>
                    <label class="flex items-center gap-2 cursor-pointer">
                        <input type="checkbox" name="is_active" value="1" @checked(old('is_active', true))
                               class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
                        <span class="text-sm text-gray-700">Plantilla activa</span>
                    </label>
                </div>
            </div>
        </x-card>

        <div class="flex justify-end gap-3">
            <x-btn href="{{ route('tenant.consent-templates.index') }}" variant="secondary">Cancelar</x-btn>
            <x-btn type="submit" variant="primary">Guardar plantilla</x-btn>
        </div>
    </form>
</x-layouts.tenant>
