<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>@yield('title', 'SARLAFT - Hospital San Juan de Dios')</title>

    {{-- Bootstrap 5.3 --}}
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    {{-- Bootstrap Icons --}}
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    {{-- Google Fonts --}}
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">

    <style>
        :root {
            --husda-blue:    #003d7a;
            --husda-blue-light: #005aad;
            --husda-green:   #00875a;
            --husda-red:     #c0392b;
            --husda-gray:    #f4f6f9;
            --husda-border:  #dee2e6;
        }

        * { font-family: 'Inter', sans-serif; }

        body {
            background-color: var(--husda-gray);
            color: #2c3e50;
        }

        /* ── Navbar ── */
        .navbar-husda {
            background: linear-gradient(135deg, var(--husda-blue) 0%, var(--husda-blue-light) 100%);
            box-shadow: 0 2px 12px rgba(0,0,0,.18);
        }
        .navbar-husda .navbar-brand {
            color: #fff !important;
            font-weight: 700;
            font-size: 1.1rem;
        }
        .navbar-husda .nav-subtitle {
            color: rgba(255,255,255,.75);
            font-size: .78rem;
        }

        /* ── Card principal ── */
        .card-form {
            border: none;
            border-radius: 16px;
            box-shadow: 0 4px 24px rgba(0,0,0,.08);
        }
        .card-form .card-header {
            background: linear-gradient(135deg, var(--husda-blue) 0%, var(--husda-blue-light) 100%);
            border-radius: 16px 16px 0 0 !important;
            padding: 1.8rem 2rem;
        }
        .card-form .card-header h4 { color: #fff; font-weight: 700; margin:0; }
        .card-form .card-header p  { color: rgba(255,255,255,.8); margin:0; font-size:.88rem; }

        /* ── Secciones del formulario ── */
        .section-badge {
            display: inline-flex;
            align-items: center;
            gap: .45rem;
            background: rgba(0,61,122,.08);
            color: var(--husda-blue);
            font-weight: 600;
            font-size: .78rem;
            padding: .3rem .75rem;
            border-radius: 20px;
            text-transform: uppercase;
            letter-spacing: .05em;
            margin-bottom: .6rem;
        }
        .section-title {
            font-size: 1rem;
            font-weight: 600;
            color: var(--husda-blue);
            border-bottom: 2px solid rgba(0,61,122,.12);
            padding-bottom: .5rem;
            margin-bottom: 1.2rem;
        }

        /* ── Inputs ── */
        .form-control, .form-select {
            border-radius: 8px;
            border: 1.5px solid var(--husda-border);
            padding: .6rem .9rem;
            font-size: .9rem;
            transition: border-color .2s, box-shadow .2s;
        }
        .form-control:focus, .form-select:focus {
            border-color: var(--husda-blue-light);
            box-shadow: 0 0 0 3px rgba(0,90,173,.12);
        }
        .form-label {
            font-weight: 500;
            font-size: .88rem;
            color: #495057;
            margin-bottom: .35rem;
        }
        .form-label .required { color: var(--husda-red); margin-left: 2px; }

        /* ── Checkbox cards ── */
        .check-card {
            border: 1.5px solid var(--husda-border);
            border-radius: 10px;
            padding: .75rem 1rem;
            cursor: pointer;
            transition: all .2s;
            display: flex;
            align-items: center;
            gap: .6rem;
            font-size: .9rem;
        }
        .check-card:hover { border-color: var(--husda-blue-light); background: rgba(0,90,173,.04); }
        .check-card input[type="radio"]:checked + .check-card,
        .check-card.selected {
            border-color: var(--husda-blue);
            background: rgba(0,61,122,.06);
            font-weight: 600;
        }
        .form-check-input:checked { background-color: var(--husda-blue); border-color: var(--husda-blue); }

        /* ── Info box ── */
        .info-box {
            background: #e8f4fd;
            border-left: 4px solid var(--husda-blue-light);
            border-radius: 0 8px 8px 0;
            padding: 1rem 1.2rem;
            font-size: .85rem;
            color: #2c3e50;
        }
        .info-box i { color: var(--husda-blue-light); }

        /* ── Warning box ── */
        .warn-box {
            background: #fff8e1;
            border-left: 4px solid #f39c12;
            border-radius: 0 8px 8px 0;
            padding: 1rem 1.2rem;
            font-size: .85rem;
        }

        /* ── Step indicator ── */
        .step-indicator {
            display: flex;
            gap: .4rem;
            margin-bottom: 1.5rem;
        }
        .step-indicator .step {
            flex: 1;
            height: 5px;
            border-radius: 4px;
            background: #dee2e6;
            transition: background .3s;
        }
        .step-indicator .step.active  { background: var(--husda-blue); }
        .step-indicator .step.done    { background: var(--husda-green); }

        /* ── Botón principal ── */
        .btn-husda {
            background: linear-gradient(135deg, var(--husda-blue) 0%, var(--husda-blue-light) 100%);
            color: #fff;
            border: none;
            border-radius: 10px;
            font-weight: 600;
            padding: .7rem 1.8rem;
            font-size: .95rem;
            transition: opacity .2s, transform .15s;
        }
        .btn-husda:hover  { opacity: .9; transform: translateY(-1px); color: #fff; }
        .btn-husda:active { transform: translateY(0); }

        /* ── Firma canvas ── */
        #signature-pad {
            border: 2px dashed var(--husda-border);
            border-radius: 10px;
            background: #fafafa;
            cursor: crosshair;
            touch-action: none;
            display: block;
            width: 100%;
        }
        #signature-pad.signed { border-color: var(--husda-green); border-style: solid; }

        /* ── Preview modal ── */
        .preview-section { margin-bottom: 1rem; }
        .preview-section strong { color: var(--husda-blue); }
        .document-preview {
            font-size: .85rem;
            line-height: 1.7;
            color: #2c3e50;
        }
        .document-preview .doc-title {
            text-align: center;
            font-weight: 700;
            font-size: 1rem;
            color: var(--husda-blue);
            margin-bottom: 1.2rem;
        }
        .document-preview .clause { margin-bottom: .9rem; }
        .document-preview .clause strong { color: #000; }

        /* ── Alerts ── */
        .alert { border-radius: 10px; }

        /* ── Footer ── */
        footer {
            background: var(--husda-blue);
            color: rgba(255,255,255,.7);
            font-size: .78rem;
            padding: 1rem 0;
            text-align: center;
        }

        @media (max-width: 576px) {
            .card-form .card-header { padding: 1.2rem 1.2rem; }
        }
    </style>
    @stack('styles')
</head>
<body>

{{-- Navbar --}}
<nav class="navbar navbar-husda py-2 mb-4">
    <div class="container">
        <span class="navbar-brand d-flex align-items-center gap-2">
            <i class="bi bi-hospital fs-5"></i>
            <div>
                <div>E.S.E. Hospital San Juan de Dios</div>
                <div class="nav-subtitle">Sistema de Gestión SARLAFT · Quindío</div>
            </div>
        </span>
    </div>
</nav>

{{-- Contenido --}}
<main class="container pb-5">
    @if(session('success'))
        <div class="alert alert-success alert-dismissible fade show mb-4" role="alert">
            <i class="bi bi-check-circle-fill me-2"></i>
            {{ session('success') }}
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    @endif
    @if(session('error'))
        <div class="alert alert-danger alert-dismissible fade show mb-4" role="alert">
            <i class="bi bi-exclamation-triangle-fill me-2"></i>
            {{ session('error') }}
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    @endif

    @yield('content')
</main>

<footer>
    <div class="container">
        <i class="bi bi-shield-lock me-1"></i>
        E.S.E. Hospital Departamental Universitario del Quindío San Juan de Dios &mdash;
        Política SARLAFT &amp; Integridad &mdash; {{ date('Y') }}
    </div>
</footer>

{{-- Bootstrap 5 JS --}}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
@stack('scripts')
</body>
</html>
