<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>@yield('title', $settings?->name ?? 'Colegio') - {{ $settings?->name ?? 'Colegio' }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    @stack('styles')
    @php
        $primary = $settings?->primary_color ?: '#2563eb';
        $accent = $settings?->accent_color ?: '#facc15';
        $primaryDark = adjust_hex($primary, -22);
        $primaryLight = adjust_hex($primary, 86);
        $accentDark = adjust_hex($accent, -16);
        [$pr, $pg, $pb] = hex_to_rgb($primary);
        [$ar, $ag, $ab] = hex_to_rgb($accent);
    @endphp
    <style>
        :root {
            --primary: {{ $primary }};
            --primary-dark: {{ $primaryDark }};
            --primary-light: {{ $primaryLight }};
            --accent: {{ $accent }};
            --accent-dark: {{ $accentDark }};
            --primary-rgb: {{ $pr }}, {{ $pg }}, {{ $pb }};
            --dark: #0f172a;
            --muted: #64748b;
            --bg-soft: #f8fafc;
            --bs-primary: {{ $primary }};
            --bs-primary-rgb: {{ $pr }}, {{ $pg }}, {{ $pb }};
            --bs-warning: {{ $accent }};
            --bs-warning-rgb: {{ $ar }}, {{ $ag }}, {{ $ab }};
        }
        body { font-family: 'Poppins', system-ui, sans-serif; color: #0f172a; background: #fff; }
        h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; }
        a { text-decoration: none; }
        .text-primary-brand { color: var(--primary) !important; }
        .bg-primary-brand { background-color: var(--primary) !important; }
        .text-accent { color: var(--accent) !important; }

        /* Navbar */
        .navbar-main {
            background: rgba(255,255,255,0.9);
            backdrop-filter: blur(12px);
            box-shadow: 0 1px 0 rgba(15,23,42,0.06);
            padding: 0.7rem 0;
        }
        .navbar-main .brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
        .navbar-main .brand-logo-horizontal {
            width: 260px; height: auto; max-width: 70vw;
            object-fit: contain;
            display: block;
            background: #fff;
            border: 0;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(15,23,42,0.06);
        }
        @media (max-width: 576px) {
            .navbar-main .brand-logo-horizontal { width: 260px; max-width: 70vw; }
        }
        .navbar-main .brand-name { font-weight: 700; color: var(--dark); line-height: 1.1; font-size: 1.05rem; }
        .navbar-main .brand-slogan { font-size: 0.68rem; color: var(--muted); }
        .navbar-main .nav-link { font-weight: 500; color: #334155; padding: 0.45rem 0.7rem !important; font-size: 0.88rem; border-radius: 8px; }
        .navbar-main .nav-link:hover { color: var(--primary); background: var(--primary-light); }
        .navbar-main .nav-link.active { color: var(--primary); font-weight: 600; }
        .btn-admission { background: var(--accent); color: #0f172a; border: none; font-weight: 700; padding: 0.55rem 1.4rem; border-radius: 50px; transition: 0.2s; }
        .btn-admission:hover { background: var(--accent-dark); color: #0f172a; transform: translateY(-1px); }
        .navbar-main .dropdown-toggle::after { margin-left: 0.4em; opacity: 0.6; }
        .navbar-main .dropdown-menu {
            border: none;
            border-radius: 14px;
            box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14);
            padding: 0.6rem;
            min-width: 220px;
        }
        .navbar-main .dropdown-item {
            font-weight: 500;
            font-size: 0.9rem;
            color: #334155;
            padding: 0.5rem 0.9rem;
            border-radius: 8px;
        }
        .navbar-main .dropdown-item:hover { color: var(--primary); background: var(--primary-light); }
        .navbar-main .dropdown-submenu { position: relative; }
        .navbar-main .dropdown-submenu > .dropdown-menu {
            left: 100%; top: 0; margin-top: 0; margin-left: 0;
        }

        .navbar-main .mega-dropdown { position: static; }
        .navbar-main .mega-menu {
            width: auto;
            max-width: 680px;
            min-width: 260px;
            padding: 1rem;
            border-radius: 18px;
            background: #fff;
            border: 1px solid #e8ecf1;
            left: 50% !important;
            transform: translateX(-50%) !important;
            margin-top: 0.5rem !important;
        }
        .navbar-main .mega-menu::before {
            content: '';
            position: absolute;
            top: -7px;
            left: 50%;
            transform: translateX(-50%);
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-bottom: 8px solid #fff;
            filter: drop-shadow(0 -2px 2px rgba(15,23,42,0.02));
        }
        .navbar-main .mega-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
            gap: 6px;
        }
        .navbar-main .mega-card {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border-radius: 10px;
            color: #475569;
            text-decoration: none;
            transition: all 0.15s;
            border: 1px solid #f1f5f9;
        }
        .navbar-main .mega-card:hover {
            background: #f8fafc;
            color: var(--primary);
            border-color: #e2e8f0;
        }
        .navbar-main .mega-card-icon {
            width: 38px; height: 38px;
            border-radius: 9px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
        }
        .navbar-main .mega-card-body { flex: 1; min-width: 0; }
        .navbar-main .mega-card-title {
            display: block;
            font-weight: 500;
            font-size: 0.85rem;
            line-height: 1.3;
            color: #334155;
        }
        .navbar-main .mega-card:hover .mega-card-title { color: var(--primary); }
        .navbar-main .mega-card-arrow {
            flex-shrink: 0;
            color: #cbd5e1;
            font-size: 0.75rem;
            opacity: 0;
            transition: opacity 0.2s, color 0.2s, transform 0.2s;
        }
        .navbar-main .mega-card:hover .mega-card-arrow {
            opacity: 1;
            color: var(--primary);
            transform: translateX(2px);
        }

        @media (max-width: 991.98px) {
            .navbar-main .dropdown-submenu > .dropdown-menu {
                left: 0; top: 100%;
                transform: none !important;
                position: static !important;
                box-shadow: none;
                padding-left: 0.6rem;
                background: transparent;
            }
            .navbar-main .mega-dropdown { position: relative; }
            .navbar-main .mega-menu {
                max-width: 100%;
                min-width: 100%;
                left: 0 !important;
                transform: none !important;
                position: static !important;
                box-shadow: none;
                border: none;
                background: transparent;
                padding: 0.25rem 0.4rem;
                margin-top: 0 !important;
            }
            .navbar-main .mega-menu::before { display: none; }
            .navbar-main .mega-grid {
                grid-template-columns: 1fr;
                gap: 1px;
            }
            .navbar-main .mega-card {
                padding: 8px 10px;
                border-radius: 8px;
                border-color: #f1f5f9;
            }
            .navbar-main .mega-card-arrow { opacity: 0.4; }
        }

        /* Buttons */
        .btn-brand { background: var(--primary); color: #fff; border: none; font-weight: 600; border-radius: 50px; padding: 0.55rem 1.35rem; font-size: 0.88rem; transition: 0.2s; }
        .btn-brand:hover { background: var(--btn-dark, var(--primary-dark)); color: #fff; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.22); }
        .btn-primary-brand { background: var(--primary); color: #fff; border: none; font-weight: 600; border-radius: 50px; padding: 0.55rem 1.35rem; font-size: 0.88rem; transition: 0.2s; }
        .btn-primary-brand:hover { background: var(--primary-dark); color: #fff; }
        .btn-outline-light-brand { background: transparent; color: #fff; border: 2px solid #fff; font-weight: 600; border-radius: 50px; padding: 0.6rem 1.7rem; }
        .btn-outline-light-brand:hover { background: #fff; color: var(--primary); }

        /* Sections */
        .section { padding: 5.5rem 0; }
        .section-soft { background: var(--bg-soft); }
        section[id] { scroll-margin-top: 76px; }
        .section-title { font-size: clamp(1.25rem, 4vw, 2rem); font-weight: 800; color: var(--dark); }
        .section-subtitle { color: var(--muted); max-width: 600px; font-size: clamp(0.875rem, 2vw, 1rem); }
        .badge-pill { display: inline-flex; align-items: center; background: var(--primary-light); color: var(--primary); font-weight: 600; font-size: 0.75rem; padding: 0.35rem 1rem; border-radius: 50px; text-transform: uppercase; letter-spacing: 0.6px; }
        .icon-box { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
        .icon-circle { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }
        .card-hover { border: none; border-radius: 18px; transition: transform 0.25s, box-shadow 0.25s; }
        .card-hover:hover { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(15,23,42,0.1); }
        .card-img-cover { width: 100%; height: 220px; object-fit: cover; border-radius: 18px 18px 0 0; }
        .level-card { position: relative; overflow: hidden; }
        .level-card .level-overlay {
            position: absolute; inset: 0; z-index: 2;
            background: rgba(15, 23, 42, 0.5);
            display: flex; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.3s;
        }
        .level-card:hover .level-overlay { opacity: 1; }
        .level-card .level-overlay i {
            color: #fff; font-size: 3rem;
            width: 72px; height: 72px;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            background: rgba(255,255,255,0.2);
            transform: scale(0.7); transition: transform 0.3s;
        }
        .level-card:hover .level-overlay i { transform: scale(1); }
        .level-img-wrapper { position: relative; }
        .level-avatar {
            position: absolute; left: 50%; bottom: -56px; z-index: 3;
            transform: translateX(-50%);
            width: 112px; height: 112px;
            border-radius: 50%;
            overflow: hidden;
            border: 4px solid #fff;
            box-shadow: 0 4px 14px rgba(15,23,42,0.18);
            background: #fff;
        }
        .level-avatar img { width: 100%; height: 100%; object-fit: cover; }
        .levels-slider-wrapper { position: relative; }
        .levels-panel {
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            padding: 24px;
            box-shadow: 0 4px 20px rgba(15,23,42,0.05);
        }
        .levels-slider-btn {
            position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
            width: 44px; height: 44px;
            border-radius: 50%;
            background: #fff;
            border: 1px solid #e2e8f0;
            color: var(--primary);
            font-size: 1.3rem;
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 4px 12px rgba(15,23,42,0.12);
            cursor: pointer;
            transition: all 0.2s;
        }
        .levels-slider-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
        .levels-slider-btn.prev { left: -16px; }
        .levels-slider-btn.next { right: -16px; }
        @media (max-width: 768px) {
            .levels-slider-btn.prev { left: 0; }
            .levels-slider-btn.next { right: 0; }
        }

        /* Hero */
        .hero { position: relative; min-height: 88vh; display: flex; align-items: center; overflow: hidden; }
        .hero .hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
        .hero .hero-overlay { position: absolute; inset: 0; background: linear-gradient(92deg, rgba(15,23,42,0.92) 0%, rgba(var(--primary-rgb), 0.6) 55%, rgba(var(--primary-rgb), 0.15) 100%); }
        .hero .hero-content { position: relative; z-index: 2; padding: 6rem 0; }
        .hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); }
        .hero-carousel { width: 100%; height: 100%; min-height: 88vh; }
        .hero-carousel .carousel-inner, .hero-carousel .carousel-item { height: 100%; min-height: 88vh; }
        .hero-carousel .carousel-item .hero-content { position: relative; z-index: 2; }
        .hero-nav {
            position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
            width: 48px; height: 48px; border-radius: 50%;
            background: rgba(255,255,255,0.12); border: none; color: #fff;
            font-size: 1.4rem; display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: 0.2s; backdrop-filter: blur(4px);
        }
        .hero-nav:hover { background: var(--accent); color: #0f172a; }
        .hero-nav-prev { left: 1.5rem; }
        .hero-nav-next { right: 1.5rem; }
        .hero-indicators { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; }
        .hero-indicators button { width: 12px; height: 12px; border-radius: 50%; border: none; background: rgba(255,255,255,0.4); cursor: pointer; transition: 0.2s; padding: 0; }
        .hero-indicators button.active { background: #fff; width: 28px; border-radius: 6px; }
        .hero-cta-wrap { position: absolute; bottom: 9rem; left: 0; right: 0; z-index: 6; }
        .hero-cta-wrap .container { padding-left: 0.75rem; padding-right: 0.75rem; }
        .hero-carousel-vertical .carousel-item { transition: transform 0.8s ease-in-out; }
        .hero-carousel-vertical .carousel-item-next:not(.carousel-item-start),
        .hero-carousel-vertical .active.carousel-item-end {
            transform: translateY(100%);
        }
        .hero-carousel-vertical .carousel-item-prev:not(.carousel-item-end),
        .hero-carousel-vertical .active.carousel-item-start {
            transform: translateY(-100%);
        }
        @media (max-width: 768px) {
            .hero-nav { width: 40px; height: 40px; font-size: 1.1rem; }
            .hero-nav-prev { left: 0.75rem; }
            .hero-nav-next { right: 0.75rem; }
            .hero-carousel, .hero-carousel .carousel-inner, .hero-carousel .carousel-item { min-height: 70vh; }
        }
        @media (max-width: 480px) {
            .hero-carousel, .hero-carousel .carousel-inner, .hero-carousel .carousel-item { min-height: 62vh; }
        }

        /* Page header */
        .page-header { position: relative; color: #fff; overflow: hidden; background: linear-gradient(120deg, var(--primary), var(--primary-dark)); }
        .page-header .content { position: relative; z-index: 2; padding: 4.5rem 0; }

        /* Feature band */
        .feature-band { background: #fff; border-radius: 20px; box-shadow: 0 20px 50px rgba(15,23,42,0.08); }

        /* Admission CTA button (accesos directos) */
        .admission-cta-btn {
            display: inline-flex; align-items: center; gap: 12px;
            padding: 15px 26px;
            background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
            color: #0f172a; font-weight: 800; font-size: 1.05rem;
            border-radius: 50px; text-decoration: none; line-height: 1.2;
            box-shadow: 0 12px 28px rgba(250, 204, 21, 0.45);
            transition: transform .2s ease, box-shadow .2s ease;
        }
        .admission-cta-btn:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 18px 36px rgba(250, 204, 21, 0.55); color: #0f172a; }
        .admission-cta-btn .cta-icon { font-size: 1.6rem; }
        .admission-cta-btn .cta-main { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
        .admission-cta-btn .cta-main .cta-title { font-size: 1.25rem; font-weight: 900; letter-spacing: .3px; }
        .admission-cta-btn .cta-main .cta-sub { font-size: .72rem; font-weight: 600; opacity: .85; }
        .admission-cta-btn .cta-arrow { margin-left: 2px; font-size: 1.25rem; }

        /* Access blocks interactive buttons */
        .acc-btn {
            display: inline-flex; align-items: center; gap: 8px;
            padding: 11px 22px; font-weight: 700; font-size: .9rem;
            border-radius: 50px; text-decoration: none; line-height: 1.2;
            white-space: nowrap;
            transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
        }
        .acc-btn:hover { transform: translateY(-2px); }
        .acc-btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(var(--primary-rgb), .35); }
        .acc-btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: 0 12px 26px rgba(var(--primary-rgb), .5); }
        .acc-btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #0f172a; box-shadow: 0 8px 20px rgba(250,204,21,.4); }
        .acc-btn-accent:hover { box-shadow: 0 12px 26px rgba(250,204,21,.55); color: #0f172a; }
        .acc-btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
        .acc-btn-outline:hover { background: var(--primary); color: #fff; }
        .acc-btn-whatsapp { background: #25d366; color: #fff; box-shadow: 0 8px 20px rgba(37,211,102,.35); }
        .acc-btn-whatsapp:hover { background: #1ebe5d; color: #fff; box-shadow: 0 12px 26px rgba(37,211,102,.5); }

        /* Access blocks big card buttons (accesos directos) */
        .acc-card-btn {
            display: flex; align-items: center; gap: 14px;
            width: 100%; padding: clamp(14px, 2vw, 22px);
            border-radius: 18px; text-decoration: none; color: #fff;
            transition: transform .22s ease, box-shadow .22s ease;
            overflow: hidden;
        }
        .acc-card-btn:hover { transform: translateY(-4px); color: #fff; }
        .acc-card-btn .acc-ico { flex: 0 0 auto; width: clamp(44px, 5vw, 56px); height: clamp(44px, 5vw, 56px); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: clamp(1.3rem, 2.2vw, 1.7rem); background: rgba(255,255,255,.2); }
        .acc-card-btn .acc-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1.2; min-width: 0; }
        .acc-card-btn .acc-txt .acc-titulo { font-size: clamp(0.95rem, 1.8vw, 1.15rem); font-weight: 800; letter-spacing: .2px; }
        .acc-card-btn .acc-txt .acc-sub { font-size: clamp(0.68rem, 1.3vw, 0.78rem); font-weight: 600; opacity: .92; }
        .acc-card-btn .acc-txt .acc-titulo, .acc-card-btn .acc-txt .acc-sub { white-space: normal; overflow-wrap: break-word; }
        .acc-card-mesa { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 12px 28px rgba(37,99,235,.32); }
        .acc-card-mesa:hover { box-shadow: 0 20px 38px rgba(37,99,235,.45); }
        .acc-card-doc { background: linear-gradient(135deg, #059669, #047857); box-shadow: 0 12px 28px rgba(5,150,105,.32); }
        .acc-card-doc:hover { box-shadow: 0 20px 38px rgba(5,150,105,.45); }
        .acc-card-plataforma { background: linear-gradient(135deg, #7c3aed, #6d28d9); box-shadow: 0 12px 28px rgba(124,58,237,.32); }
        .acc-card-plataforma:hover { box-shadow: 0 20px 38px rgba(124,58,237,.45); }
        .acc-card-admision { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #0f172a; box-shadow: 0 12px 28px rgba(250,204,21,.35); }
        .acc-card-admision:hover { box-shadow: 0 20px 38px rgba(250,204,21,.5); color: #0f172a; }
        .acc-card-admision .acc-ico { background: rgba(0,0,0,.12); }
        @media (max-width: 575px) {
            .acc-card-btn { padding: 14px 12px; gap: 10px; }
            .acc-card-btn .acc-ico { width: 42px; height: 42px; font-size: 1.25rem; border-radius: 11px; }
            .acc-card-btn .acc-txt .acc-titulo { font-size: 0.9rem; }
            .acc-card-btn .acc-txt .acc-sub { font-size: 0.66rem; }
        }

        /* Timeline */
        .timeline { position: relative; }
        .timeline::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #e2e8f0; transform: translateX(-50%); }
        .timeline-item { position: relative; padding: 1.5rem 0; }
        .timeline-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--primary); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--primary); position: absolute; left: 50%; transform: translate(-50%, -50%); top: 50%; z-index: 2; }
        @media (max-width: 767px) {
            .timeline::before { left: 16px; transform: none; }
            .timeline-item { padding-left: 40px; }
            .timeline-item .card { margin-top: 4px; }
        }

        /* Footer */
        .footer { background: var(--dark); color: #cbd5e1; padding: 4.5rem 0 1.5rem; }
        .footer h6 { color: #fff; font-weight: 700; margin-bottom: 1rem; }
        .footer a { color: #94a3b8; }
        .footer a:hover { color: var(--accent); }
        .footer .social a { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,0.08); color: #fff; margin-right: 8px; transition: 0.2s; }
        .footer .social a:hover { background: var(--accent); color: var(--dark); }
        .footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 3rem; padding-top: 1.5rem; font-size: 0.85rem; }

        .gallery-item { position: relative; border-radius: 14px; overflow: hidden; cursor: pointer; }
        .gallery-item img { width: 100%; height: 220px; object-fit: cover; transition: transform 0.4s; }
        .gallery-item:hover img { transform: scale(1.08); }
        .gallery-item .caption { position: absolute; inset: 0; background: linear-gradient(to top, rgba(15,23,42,0.85), transparent); opacity: 0; transition: 0.3s; display: flex; align-items: flex-end; padding: 1rem; color: #fff; }
        .gallery-item:hover .caption { opacity: 1; }
        .news-content img { max-width: 100%; border-radius: 12px; }
        .about-content img { max-width: 100%; border-radius: 12px; }
        .about-content p { line-height: 1.7; }
        .about-content img, .news-content img, .access-block-content img, .section img { max-width: 100%; height: auto; }
        .about-content .about-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
        .about-content .about-row[data-cols="1"] { grid-template-columns: 1fr; }
        .about-content .about-row[data-cols="2"] { grid-template-columns: 1fr 1fr; }
        .about-content .about-row[data-cols="3"] { grid-template-columns: 1fr 1fr 1fr; }
        .about-content .about-col { min-height: 40px; }
        .stat-num { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; color: var(--primary); }

        /* Quill inline formats */
        .ql-size-small { font-size: 0.75em; }
        .ql-size-large { font-size: 1.5em; }
        .ql-size-huge { font-size: 2.5em; }
        .ql-font-serif { font-family: Georgia, 'Times New Roman', serif; }
        .ql-font-monospace { font-family: 'Courier New', monospace; }
        .ql-align-center { text-align: center; }
        .ql-align-right { text-align: right; }
        .ql-align-justify { text-align: justify; }

        /* WhatsApp float */
        .whatsapp-wrapper {
            position: fixed; bottom: 24px; right: 24px; z-index: 1500;
            display: flex; align-items: flex-end; gap: 12px;
        }
        .whatsapp-float {
            width: 60px; height: 60px; flex-shrink: 0;
            background: #25D366; color: #fff;
            border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            font-size: 2rem; line-height: 1;
            box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
            transition: transform 0.2s, box-shadow 0.2s;
            animation: wa-pulse 2s infinite;
        }
        .whatsapp-float:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(37, 211, 102, 0.55); color: #fff; }
        @keyframes wa-pulse {
            0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
            70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
            100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
        }
        .whatsapp-tooltip {
            position: relative;
            background: #fff; color: #1e293b;
            border-radius: 14px;
            padding: 14px 34px 14px 16px;
            max-width: 250px;
            box-shadow: 0 10px 30px rgba(15,23,42,0.16);
            font-size: 0.85rem; line-height: 1.45;
            opacity: 0; visibility: hidden;
            transform: translateY(10px);
            transition: opacity 0.35s, transform 0.35s, visibility 0.35s;
        }
        .whatsapp-tooltip.show { opacity: 1; visibility: visible; transform: translateY(0); }
        .whatsapp-tooltip::after {
            content: ''; position: absolute; bottom: 20px; right: -8px;
            width: 0; height: 0;
            border-left: 8px solid #fff;
            border-top: 8px solid transparent;
            border-bottom: 8px solid transparent;
        }
        .whatsapp-tooltip strong { display: block; margin-bottom: 4px; color: #0f172a; }
        .whatsapp-tooltip p { margin: 0; color: #64748b; }
        .wa-tooltip-close {
            position: absolute; top: 6px; right: 6px;
            background: none; border: none; color: #94a3b8;
            font-size: 0.9rem; cursor: pointer; padding: 2px 6px; border-radius: 6px;
        }
        .wa-tooltip-close:hover { color: #475569; }

        /* Documents */
        .doc-calendar {
            width: 64px; min-width: 64px;
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            overflow: hidden;
            text-align: center;
            box-shadow: 0 2px 8px rgba(15,23,42,0.05);
        }
        .doc-calendar .doc-month {
            background: var(--primary);
            color: #fff;
            font-size: 0.72rem;
            text-transform: uppercase;
            font-weight: 700;
            padding: 4px 0;
            letter-spacing: 0.5px;
        }
        .doc-calendar .doc-day {
            font-size: 1.5rem;
            font-weight: 800;
            color: #1e293b;
            padding: 6px 0 4px;
            line-height: 1;
        }
        .doc-icon {
            width: 52px; height: 52px; min-width: 52px;
            border-radius: 14px;
            display: flex; align-items: center; justify-content: center;
            font-size: 1.5rem;
        }
        .doc-block { margin-bottom: 3rem; }
        .doc-block-header { border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; }
        .doc-block-icon {
            width: 42px; height: 42px; min-width: 42px;
            border-radius: 12px;
            background: var(--primary-light);
            color: var(--primary);
            display: flex; align-items: center; justify-content: center;
            font-size: 1.3rem;
        }
        .documents-panel {
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 16px;
            box-shadow: 0 6px 24px rgba(15,23,42,0.07);
            overflow: hidden;
        }
        .documents-panel-header {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            color: #fff;
            padding: 20px;
        }
        .documents-panel-header .panel-title { font-weight: 700; margin: 0; color: #fff; }
        .documents-panel-header .panel-subtitle { color: rgba(255,255,255,0.82); font-size: 0.8rem; margin: 4px 0 0; }
        .documents-panel-body { padding: 0; }
        .documents-panel-footer { padding: 0 16px 16px; }
        .documents-panel-footer .btn { font-size: 0.875rem; }
        .doc-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; transition: background 0.2s; }
        .doc-row:last-child { border-bottom: none; }
        .doc-row:nth-child(even) { background: #f8fafc; }
        .doc-row:hover { background: #eef2ff; }
        .doc-row .doc-title { font-size: 0.82rem; font-weight: 600; }
        .doc-row .doc-date { font-size: 0.82rem; }

        /* Gallery filters */
        .filter-btn { border: 1px solid #e2e8f0; background: #fff; color: #334155; font-weight: 600; font-size: 0.85rem; border-radius: 50px; padding: 0.45rem 1.2rem; transition: 0.2s; }
        .filter-btn:hover { border-color: var(--primary); color: var(--primary); }
        .filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

        /* Lightbox */
        .lightbox { position: fixed; inset: 0; background: rgba(15,23,42,0.94); z-index: 2000; display: flex; align-items: center; justify-content: center; flex-direction: column; opacity: 0; visibility: hidden; transition: opacity 0.3s; padding: 2rem; }
        .lightbox.open { opacity: 1; visibility: visible; }
        .lightbox img { max-width: 90%; max-height: 80vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
        .lightbox-close { position: absolute; top: 1.5rem; right: 1.5rem; background: rgba(255,255,255,0.12); border: none; color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; transition: 0.2s; }
        .lightbox-close:hover { background: var(--accent); color: #0f172a; }
        .lightbox-caption { color: #fff; margin-top: 1rem; font-weight: 600; text-align: center; }
        .lightbox-counter { position: absolute; top: 1.75rem; left: 1.5rem; color: #cbd5e1; font-size: 0.9rem; font-weight: 600; }
        .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.12); border: none; color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
        .lightbox-nav:hover { background: var(--accent); color: #0f172a; }
        .lightbox-prev { left: 1.5rem; }
        .lightbox-next { right: 1.5rem; }
        .video-embed { position: relative; width: 90%; max-width: 900px; aspect-ratio: 16/9; }
        .video-embed iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; }
        .video-thumb { position: relative; border-radius: 14px; overflow: hidden; cursor: pointer; }
        .video-thumb img { width: 100%; height: 200px; object-fit: cover; transition: transform 0.4s; }
        .video-thumb:hover img { transform: scale(1.08); }
        .video-thumb .play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15,23,42,0.35); transition: 0.3s; }
        .video-thumb .play-overlay i { font-size: 3rem; color: #fff; transition: transform 0.3s; }
        .video-thumb:hover .play-overlay { background: rgba(15,23,42,0.5); }
        .video-thumb:hover .play-overlay i { transform: scale(1.2); }

        @media (max-width: 768px) {
            .timeline::before { left: 16px; }
            .about-content .about-row,
            .about-content .about-row[data-cols="1"],
            .about-content .about-row[data-cols="2"],
            .about-content .about-row[data-cols="3"] { grid-template-columns: 1fr; gap: 14px; }
            .about-content .about-col { min-width: 0; }
            .about-content h2 { font-size: 1.5rem !important; }
            .about-content h3 { font-size: 1.05rem !important; }
            .about-content p, .about-content li { font-size: 0.9rem !important; }
            .section { padding: 3.5rem 0; }
            .hero { min-height: 70vh; }
            .hero .hero-content { padding: 4rem 0; }
            .feature-band { padding: 1.25rem !important; }
            .card-img-cover { height: 180px; }
            .gallery-item img { height: 180px; }
            .video-thumb img { height: 180px; }
        }

        @media (max-width: 480px) {
            .section { padding: 2.75rem 0; }
            .hero { min-height: 62vh; }
            .card-img-cover, .gallery-item img, .video-thumb img { height: 160px; }
            .documents-panel-header { padding: 16px; }
            .btn-brand, .btn-primary-brand, .btn-outline-light-brand, .btn-admission { width: 100%; }
            .hero .btn { width: auto; }
        }
    </style>
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-main sticky-top">
    <div class="container">
        <a class="navbar-brand d-flex align-items-center gap-2" href="{{ route('home') }}">
            @if(($settings?->logo_mode ?? 'shield') === 'horizontal' && $settings?->logo_horizontal)
                <img src="{{ image_url($settings->logo_horizontal) }}" alt="Logo" class="brand-logo-horizontal">
            @elseif($settings?->logo)
                <img src="{{ image_url($settings->logo) }}" alt="Logo" class="brand-logo">
                <span>
                    <span class="brand-name d-block">{{ $settings?->name ?? 'Colegio' }}</span>
                    @if($settings?->slogan)<span class="brand-slogan d-block">{{ $settings->slogan }}</span>@endif
                </span>
            @else
                <div class="brand-logo bg-primary-brand d-flex align-items-center justify-content-center text-white"><i class="bi bi-mortarboard fs-4"></i></div>
                <span>
                    <span class="brand-name d-block">{{ $settings?->name ?? 'Colegio' }}</span>
                    @if($settings?->slogan)<span class="brand-slogan d-block">{{ $settings->slogan }}</span>@endif
                </span>
            @endif
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="mainNav">
            <ul class="navbar-nav ms-auto align-items-lg-center">
                @foreach($navItems ?? [] as $item)
                    @include('partials.nav-item', ['item' => $item, 'depth' => 0])
                @endforeach
            </ul>
        </div>
    </div>
</nav>

<main>
    @yield('content')
</main>

<footer class="footer">
    <div class="container">
        <div class="row g-4">
            <div class="col-lg-4 d-none d-md-block">
                <div class="d-flex align-items-center gap-2 mb-3">
                    @if($settings?->logo)
                        <img src="{{ image_url($settings->logo) }}" alt="Logo" style="width:44px;height:44px;border-radius:12px;object-fit:cover;">
                    @else
                        <div class="bg-primary-brand d-flex align-items-center justify-content-center text-white" style="width:44px;height:44px;border-radius:12px;"><i class="bi bi-mortarboard fs-4"></i></div>
                    @endif
                    <div>
                        <div class="text-white fw-bold">{{ $settings?->name ?? 'Colegio' }}</div>
                        @if($settings?->slogan)<div class="small">{{ $settings->slogan }}</div>@endif
                    </div>
                </div>
                <p class="small">{{ $settings?->history ? Str::limit($settings->history, 150) : '' }}</p>
                <div class="social mt-3">
                    @if($settings?->facebook)<a href="{{ $settings->facebook }}" target="_blank"><i class="bi bi-facebook"></i></a>@endif
                    @if($settings?->instagram)<a href="{{ $settings->instagram }}" target="_blank"><i class="bi bi-instagram"></i></a>@endif
                    @if($settings?->twitter)<a href="{{ $settings->twitter }}" target="_blank"><i class="bi bi-twitter-x"></i></a>@endif
                    @if($settings?->youtube)<a href="{{ $settings->youtube }}" target="_blank"><i class="bi bi-youtube"></i></a>@endif
                </div>
            </div>
            <div class="col-lg-2 col-md-4 d-none d-md-block">
                <h6>Enlaces</h6>
                <ul class="list-unstyled small d-grid gap-2">
                    <li><a href="{{ route('home') }}">Inicio</a></li>
                    @if($settings?->show_levels ?? true)<li><a href="{{ route('levels.index') }}">Niveles</a></li>@endif
                    @if($settings?->show_news ?? true)<li><a href="{{ route('news.index') }}">Noticias</a></li>@endif
                    @if($settings?->show_events ?? true)<li><a href="{{ route('events.index') }}">Eventos</a></li>@endif
                    <li><a href="{{ route('admissions.index') }}">Admisiones</a></li>
                </ul>
            </div>
            @if($settings?->show_levels ?? true)
            <div class="col-lg-3 col-md-4 d-none d-md-block">
                <h6>Niveles</h6>
                <ul class="list-unstyled small d-grid gap-2">
                    @foreach(\App\Models\Level::active()->orderBy('order')->get() as $level)
                        <li><a href="{{ route('levels.show', $level->slug) }}">{{ $level->name }}</a></li>
                    @endforeach
                </ul>
            </div>
            @endif
            @if($settings?->show_contact ?? true)
            <div class="col-lg-3 col-md-4 mx-auto text-center text-md-start">
                <h6>Contacto</h6>
                <ul class="list-unstyled small d-grid gap-2">
                    @if($settings?->address)<li><i class="bi bi-geo-alt me-1 text-accent"></i> {{ $settings->address }}</li>@endif
                    @if($settings?->phone)<li><i class="bi bi-telephone me-1 text-accent"></i> {{ $settings->phone }}</li>@endif
                    @if($settings?->email)<li><i class="bi bi-envelope me-1 text-accent"></i> {{ $settings->email }}</li>@endif
                </ul>
            </div>
            @endif
        </div>
        <div class="footer-bottom text-center">
            &copy; {{ date('Y') }} {{ $settings?->name ?? 'Colegio' }}. Todos los derechos reservados.
        </div>
    </div>
</footer>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>AOS.init({ duration: 700, once: true, offset: 60 });</script>
@stack('scripts')

<div class="lightbox" id="lightbox">
    <button type="button" class="lightbox-close" id="lightboxClose" aria-label="Cerrar"><i class="bi bi-x-lg"></i></button>
    <div class="lightbox-counter" id="lightboxCounter"></div>
    <button type="button" class="lightbox-nav lightbox-prev" id="lightboxPrev" aria-label="Anterior"><i class="bi bi-chevron-left"></i></button>
    <img src="" alt="" id="lightboxImg">
    <button type="button" class="lightbox-nav lightbox-next" id="lightboxNext" aria-label="Siguiente"><i class="bi bi-chevron-right"></i></button>
    <div class="lightbox-caption" id="lightboxCaption"></div>
</div>

<div class="lightbox" id="videoModal">
    <button type="button" class="lightbox-close" id="videoModalClose" aria-label="Cerrar"><i class="bi bi-x-lg"></i></button>
    <div class="video-embed" id="videoEmbed"></div>
    <div class="lightbox-caption" id="videoCaption"></div>
</div>

<script>
(function () {
    var images = [];
    var current = 0;
    var lb = document.getElementById('lightbox');

    function collectImages() {
        images = Array.prototype.slice.call(document.querySelectorAll('.gallery-item[data-src]'));
    }
    function show(index) {
        if (!images.length) return;
        if (index < 0) index = images.length - 1;
        if (index >= images.length) index = 0;
        current = index;
        var item = images[current];
        document.getElementById('lightboxImg').src = item.getAttribute('data-src');
        document.getElementById('lightboxCaption').textContent = item.getAttribute('data-title') || '';
        document.getElementById('lightboxCounter').textContent = (current + 1) + ' / ' + images.length;
        lb.classList.add('open');
    }
    function close() { lb.classList.remove('open'); }
    function next() { show(current + 1); }
    function prev() { show(current - 1); }

    document.addEventListener('click', function (e) {
        var item = e.target.closest('.gallery-item[data-src]');
        if (!item) return;
        collectImages();
        show(images.indexOf(item));
    });

    document.getElementById('lightboxClose').addEventListener('click', close);
    document.getElementById('lightboxNext').addEventListener('click', next);
    document.getElementById('lightboxPrev').addEventListener('click', prev);
    lb.addEventListener('click', function (e) { if (e.target === lb) close(); });
    document.addEventListener('keydown', function (e) {
        if (!lb.classList.contains('open')) return;
        if (e.key === 'Escape') close();
        if (e.key === 'ArrowRight') next();
        if (e.key === 'ArrowLeft') prev();
    });
})();
</script>
<script>
(function () {
    var modal = document.getElementById('videoModal');
    if (!modal) return;

    document.addEventListener('click', function (e) {
        var item = e.target.closest('.video-thumb[data-embed]');
        if (!item) return;
        var embed = item.getAttribute('data-embed');
        var title = item.getAttribute('data-title') || '';
        document.getElementById('videoEmbed').innerHTML = '<iframe src="' + embed + '?autoplay=1" allow="autoplay; encrypted-media; picture-in-picture" allowfullscreen></iframe>';
        document.getElementById('videoCaption').textContent = title;
        modal.classList.add('open');
    });

    function closeVideo() {
        modal.classList.remove('open');
        document.getElementById('videoEmbed').innerHTML = '';
    }
    document.getElementById('videoModalClose').addEventListener('click', closeVideo);
    modal.addEventListener('click', function (e) { if (e.target === modal) closeVideo(); });
    document.addEventListener('keydown', function (e) {
        if (e.key === 'Escape' && modal.classList.contains('open')) closeVideo();
    });
})();
</script>
<script>
    document.querySelectorAll('.navbar-main .nav-link').forEach(function (link) {
        var href = link.getAttribute('href') || '';
        var hashIndex = href.indexOf('#');
        if (hashIndex === -1) return;
        var hash = href.substring(hashIndex);
        link.addEventListener('click', function (e) {
            var target = document.querySelector(hash);
            if (target) {
                e.preventDefault();
                target.scrollIntoView({ behavior: 'smooth', block: 'start' });
                if (history.replaceState) history.replaceState(null, '', hash);
            }
        });
    });
</script>

@php
    $waNumber = preg_replace('/[^0-9]/', '', $settings?->whatsapp_number ?? '');
@endphp
@if(($settings?->show_whatsapp ?? true) && $waNumber)
    <div class="whatsapp-wrapper">
        <div class="whatsapp-tooltip" id="waTooltip">
            <button type="button" class="wa-tooltip-close" id="waTooltipClose" aria-label="Cerrar"><i class="bi bi-x"></i></button>
            <strong>¡Hola! Bienvenido a {{ $settings->name }}</strong>
            <p>Estamos listos para conversar. ¿En qué podemos ayudarte?</p>
        </div>
        <a href="https://wa.me/{{ $waNumber }}?text={{ urlencode('Hola, deseo mas informacion.') }}" target="_blank" class="whatsapp-float" aria-label="WhatsApp">
            <i class="bi bi-whatsapp"></i>
        </a>
    </div>
@endif
<script>
    var waTooltip = document.getElementById('waTooltip');
    var waTooltipClose = document.getElementById('waTooltipClose');
    if (waTooltip) {
        setTimeout(function () {
            if (!localStorage.getItem('waTooltipClosed')) {
                waTooltip.classList.add('show');
            }
        }, 1800);
    }
    if (waTooltipClose) {
        waTooltipClose.addEventListener('click', function () {
            waTooltip.classList.remove('show');
            localStorage.setItem('waTooltipClosed', '1');
        });
    }
</script>
</body>
</html>
