@extends('layouts.public')
@section('title', 'Admisiones')

@section('content')
@include('partials.page-header', ['title' => $settings?->admissions_title ?: 'Admisiones'])

<section class="section">
    <div class="container">
        <div class="row g-5">
            <div class="col-lg-5">
                <span class="badge-pill mb-3">Admisiones</span>
                <h2 class="section-title mb-3">Solicita tu matricula</h2>
                <p class="text-muted mb-4">Completa el formulario y nuestro equipo de admisiones se pondra en contacto contigo para completar el proceso de inscripcion.</p>
                <div class="d-grid gap-3">
                    <div class="d-flex gap-3">
                        <div class="icon-circle bg-primary bg-opacity-10 text-primary"><i class="bi bi-1-circle"></i></div>
                        <div><h6 class="fw-bold mb-1">Envia tu solicitud</h6><p class="text-muted small mb-0">Completa el formulario con tus datos.</p></div>
                    </div>
                    <div class="d-flex gap-3">
                        <div class="icon-circle bg-warning bg-opacity-10 text-warning"><i class="bi bi-2-circle"></i></div>
                        <div><h6 class="fw-bold mb-1">Evaluacion</h6><p class="text-muted small mb-0">Revisaremos la solicitud y verificaremos vacantes.</p></div>
                    </div>
                    <div class="d-flex gap-3">
                        <div class="icon-circle bg-success bg-opacity-10 text-success"><i class="bi bi-3-circle"></i></div>
                        <div><h6 class="fw-bold mb-1">Matricula</h6><p class="text-muted small mb-0">Completamos el proceso de inscripcion.</p></div>
                    </div>
                </div>
            </div>
            <div class="col-lg-7">
                <div class="card card-hover shadow-sm">
                    <div class="card-body p-4 p-md-5">
                        @if(session('success'))
                            <div class="alert alert-success alert-dismissible fade show" role="alert">
                                <i class="bi bi-check-circle me-1"></i> {{ session('success') }}
                                <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                            </div>
                        @endif
                        <form action="{{ route('admissions.store') }}" method="POST">
                            @csrf
                            <h6 class="fw-bold mb-3">Datos del estudiante</h6>
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label class="form-label fw-semibold">Nombre del estudiante</label>
                                    <input type="text" name="student_name" class="form-control @error('student_name') is-invalid @enderror" value="{{ old('student_name') }}" required>
                                    @error('student_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
                                </div>
                                <div class="col-md-6 mb-3">
                                    <label class="form-label fw-semibold">Fecha de nacimiento</label>
                                    <input type="date" name="birth_date" class="form-control @error('birth_date') is-invalid @enderror" value="{{ old('birth_date') }}">
                                    @error('birth_date')<div class="invalid-feedback">{{ $message }}</div>@enderror
                                </div>
                            </div>
                            <div class="mb-3">
                                <label class="form-label fw-semibold">Nivel solicitado</label>
                                <select name="level_id" class="form-select @error('level_id') is-invalid @enderror">
                                    <option value="">Selecciona un nivel</option>
                                    @foreach($levels as $level)
                                        <option value="{{ $level->id }}" {{ old('level_id') == $level->id ? 'selected' : '' }}>{{ $level->name }}</option>
                                    @endforeach
                                </select>
                                @error('level_id')<div class="invalid-feedback">{{ $message }}</div>@enderror
                            </div>

                            <h6 class="fw-bold mb-3 mt-4">Datos del apoderado</h6>
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label class="form-label fw-semibold">Nombre del apoderado</label>
                                    <input type="text" name="guardian_name" class="form-control @error('guardian_name') is-invalid @enderror" value="{{ old('guardian_name') }}" required>
                                    @error('guardian_name')<div class="invalid-feedback">{{ $message }}</div>@enderror
                                </div>
                                <div class="col-md-6 mb-3">
                                    <label class="form-label fw-semibold">Telefono</label>
                                    <input type="text" name="phone" class="form-control @error('phone') is-invalid @enderror" value="{{ old('phone') }}">
                                    @error('phone')<div class="invalid-feedback">{{ $message }}</div>@enderror
                                </div>
                            </div>
                            <div class="mb-3">
                                <label class="form-label fw-semibold">Email</label>
                                <input type="email" name="email" class="form-control @error('email') is-invalid @enderror" value="{{ old('email') }}" required>
                                @error('email')<div class="invalid-feedback">{{ $message }}</div>@enderror
                            </div>
                            <div class="mb-4">
                                <label class="form-label fw-semibold">Mensaje (opcional)</label>
                                <textarea name="message" rows="3" class="form-control @error('message') is-invalid @enderror">{{ old('message') }}</textarea>
                                @error('message')<div class="invalid-feedback">{{ $message }}</div>@enderror
                            </div>
                            <button type="submit" class="btn btn-admission btn-lg w-100"><i class="bi bi-send me-2"></i> Enviar Solicitud</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
@endsection
