@extends('layouts.app')

@section('title', 'Demander un devis')

@section('content')
@include('components.page-banner', [
'title' => 'Demander un devis',
{{-- 'subtitle' => 'Décrivez votre projet, nous vous répondrons rapidement',  --}}
'image' => asset('img/test_7.jpg')
])

<section class="py-20 bg-white">
    <div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8">
        @if(session('success'))
        <div class="mb-8 p-4 rounded-lg bg-green-50 border border-green-200 text-green-800">
            {{ session('success') }}
        </div>
        @endif

        @if($errors->any())
        <div class="mb-8 p-4 rounded-lg bg-red-50 border border-red-200 text-red-800">
            <ul class="list-disc list-inside">
                @foreach($errors->all() as $error)
                <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
        @endif

        <form action="{{ route('devis.store') }}" method="POST" class="space-y-6">
            @csrf
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label for="nom" class="block text-sm font-medium text-slate-700 mb-2">Nom complet *</label>
                    <input type="text" name="nom" id="nom" value="{{ old('nom') }}" required class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                </div>
                <div>
                    <label for="email" class="block text-sm font-medium text-slate-700 mb-2">Email *</label>
                    <input type="email" name="email" id="email" value="{{ old('email') }}" required class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                </div>
            </div>
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div>
                    <label for="telephone" class="block text-sm font-medium text-slate-700 mb-2">Téléphone</label>
                    <input type="tel" name="telephone" id="telephone" value="{{ old('telephone') }}" class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                </div>
                <div>
                    <label for="entreprise" class="block text-sm font-medium text-slate-700 mb-2">Entreprise</label>
                    <input type="text" name="entreprise" id="entreprise" value="{{ old('entreprise') }}" class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                </div>
            </div>
            <div>
                <label for="type_prestation" class="block text-sm font-medium text-slate-700 mb-2">Type de prestation</label>
                <select name="type_prestation" id="type_prestation" class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500">
                    <option value="">Sélectionnez...</option>
                    <option value="Maintenance matériel industriel" {{ old('type_prestation') == 'Maintenance matériel industriel' ? 'selected' : '' }}>Maintenance matériel industriel</option>
                    <option value="Éclairage public" {{ old('type_prestation') == 'Éclairage public' ? 'selected' : '' }}>Éclairage public</option>
                    <option value="Ouvrage bâtiment" {{ old('type_prestation') == 'Ouvrage bâtiment' ? 'selected' : '' }}>Ouvrage bâtiment</option>
                    <option value="Addition eau potable" {{ old('type_prestation') == 'Addition eau potable' ? 'selected' : '' }}>Addition eau potable</option>
                    <option value="Froid industriel/domestique" {{ old('type_prestation') == 'Froid industriel/domestique' ? 'selected' : '' }}>Froid industriel/domestique</option>
                    <option value="Mécanique électricité HTA BTA EP" {{ old('type_prestation') == 'Mécanique électricité HTA BTA EP' ? 'selected' : '' }}>Mécanique électricité (HTA BTA EP)</option>
                    <option value="Climatisation" {{ old('type_prestation') == 'Climatisation' ? 'selected' : '' }}>Climatisation</option>
                    <option value="Maintenance chaudières" {{ old('type_prestation') == 'Maintenance chaudières' ? 'selected' : '' }}>Maintenance chaudières</option>
                    <option value="Maintenance compresseur air" {{ old('type_prestation') == 'Maintenance compresseur air' ? 'selected' : '' }}>Maintenance compresseur air</option>
                    <option value="Maintenance compresseur froid" {{ old('type_prestation') == 'Maintenance compresseur froid' ? 'selected' : '' }}>Maintenance compresseur froid</option>
                    <option value="Groupes électrogènes" {{ old('type_prestation') == 'Groupes électrogènes' ? 'selected' : '' }}>Groupes électrogènes</option>
                    <option value="Autre" {{ old('type_prestation') == 'Autre' ? 'selected' : '' }}>Autre</option>
                </select>
            </div>
            <div>
                <label for="description" class="block text-sm font-medium text-slate-700 mb-2">Description du projet *</label>
                <textarea name="description" id="description" rows="6" required class="w-full px-4 py-3 rounded-lg border border-slate-200 focus:ring-2 focus:ring-amber-500 focus:border-amber-500" placeholder="Décrivez votre projet en détail : nature des travaux, localisation, délais souhaités...">{{ old('description') }}</textarea>
            </div>
            <button type="submit" class="w-full bg-amber-500 hover:bg-amber-600 text-white py-4 rounded-lg font-semibold text-lg transition">
                Envoyer ma demande de devis
            </button>
        </form>
    </div>
</section>
@endsection
