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

@section('content')
@include('partials.page-header', ['title' => 'Contacto'])

<section class="section">
    <div class="container">
        <div class="row g-5">
            <div class="col-lg-5">
                <span class="badge-pill mb-3">Contacto</span>
                <h2 class="section-title mb-3">Ponte en contacto con nosotros</h2>
                <p class="text-muted mb-4">Estamos para ayudarte. Escribenos y te responderemos lo antes posible.</p>
                <div class="d-grid gap-4">
                    @if($settings?->address)
                        <div class="d-flex gap-3">
                            <div class="icon-circle bg-primary bg-opacity-10 text-primary"><i class="bi bi-geo-alt"></i></div>
                            <div><h6 class="fw-bold mb-1">Direccion</h6><p class="text-muted small mb-0">{{ $settings->address }}</p></div>
                        </div>
                    @endif
                    @if($settings?->phone)
                        <div class="d-flex gap-3">
                            <div class="icon-circle bg-warning bg-opacity-10 text-warning"><i class="bi bi-telephone"></i></div>
                            <div><h6 class="fw-bold mb-1">Telefono</h6><p class="text-muted small mb-0">{{ $settings->phone }}</p></div>
                        </div>
                    @endif
                    @if($settings?->email)
                        <div class="d-flex gap-3">
                            <div class="icon-circle bg-success bg-opacity-10 text-success"><i class="bi bi-envelope"></i></div>
                            <div><h6 class="fw-bold mb-1">Email</h6><p class="text-muted small mb-0">{{ $settings->email }}</p></div>
                        </div>
                    @endif
                    @if($settings?->schedule)
                        <div class="d-flex gap-3">
                            <div class="icon-circle bg-danger bg-opacity-10 text-danger"><i class="bi bi-clock"></i></div>
                            <div><h6 class="fw-bold mb-1">Horario</h6><p class="text-muted small mb-0">{{ $settings->schedule }}</p></div>
                        </div>
                    @endif
                </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('contact.store') }}" method="POST">
                            @csrf
                            <div class="row">
                                <div class="col-md-6 mb-3">
                                    <label class="form-label fw-semibold">Nombre</label>
                                    <input type="text" name="name" class="form-control @error('name') is-invalid @enderror" value="{{ old('name') }}" required>
                                    @error('name')<div class="invalid-feedback">{{ $message }}</div>@enderror
                                </div>
                                <div class="col-md-6 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>
                            <div class="mb-3">
                                <label class="form-label fw-semibold">Asunto</label>
                                <input type="text" name="subject" class="form-control @error('subject') is-invalid @enderror" value="{{ old('subject') }}">
                                @error('subject')<div class="invalid-feedback">{{ $message }}</div>@enderror
                            </div>
                            <div class="mb-4">
                                <label class="form-label fw-semibold">Mensaje</label>
                                <textarea name="message" rows="5" class="form-control @error('message') is-invalid @enderror" required>{{ old('message') }}</textarea>
                                @error('message')<div class="invalid-feedback">{{ $message }}</div>@enderror
                            </div>
                            <button type="submit" class="btn btn-primary-brand"><i class="bi bi-send me-2"></i> Enviar Mensaje</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
@endsection
