@extends('admin.layout')

@section('title', 'Agregar Slide')

@section('content')
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2 class="mb-0">➕ Agregar Slide</h2>
    <a href="{{ route('admin.carousel.index') }}" class="btn btn-secondary shadow-sm">
        <i class="bi bi-arrow-left"></i> Volver a la Lista
    </a>
</div>

<div class="card shadow-sm border-0">
    <div class="card-body">
        <form action="{{ route('admin.carousel.store') }}" method="POST" enctype="multipart/form-data">
            @csrf

            <div class="row mb-3">
                <div class="col-md-6">
                    <label class="form-label font-weight-bold">Título</label>
                    <input type="text" name="titulo" class="form-control" value="{{ old('titulo') }}">
                </div>
                <div class="col-md-6">
                    <label class="form-label font-weight-bold">Subtítulo</label>
                    <input type="text" name="subtitulo" class="form-control" value="{{ old('subtitulo') }}">
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-6">
                    <label class="form-label font-weight-bold">Texto del Botón</label>
                    <input type="text" name="boton_texto" class="form-control" value="{{ old('boton_texto') }}">
                </div>
                <div class="col-md-6">
                    <label class="form-label font-weight-bold">Enlace del Botón (URL)</label>
                    <input type="text" name="boton_enlace" class="form-control" value="{{ old('boton_enlace') }}" placeholder="Ej: /eventos o https://...">
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-8">
                    <label class="form-label font-weight-bold">Imagen <span class="text-danger">*</span></label>
                    <input type="file" name="imagen" class="form-control" required accept="image/*">
                    <small class="text-muted d-block mt-1">Formatos: JPG, PNG, WEBP. Tamaño ideal: ancho de pantalla, bajo peso.</small>
                    @error('imagen')
                        <div class="text-danger small mt-1">{{ $message }}</div>
                    @enderror
                </div>
                <div class="col-md-2 mt-4">
                    <div class="form-check form-switch fs-5 h-100 d-flex align-items-center">
                        <input class="form-check-input mt-0 me-2" type="checkbox" role="switch" name="activo" id="activo" checked value="1" style="height: 25px; width: 50px;">
                        <label class="form-check-label ms-2 mt-1 fs-6" for="activo">Visible</label>
                    </div>
                </div>
                <div class="col-md-2">
                    <label class="form-label font-weight-bold">Orden</label>
                    <input type="number" name="orden" class="form-control" value="{{ old('orden', 0) }}">
                </div>
            </div>

            <div class="text-end mt-4">
                <button type="submit" class="btn btn-primary px-4 shadow-sm">
                    <i class="bi bi-save me-1"></i> Guardar Slide
                </button>
            </div>
        </form>
    </div>
</div>
@endsection
