/* ===========================================
   NAVBAR
   =========================================== */

a:focus:not(:focus-visible) {
    outline: none;
}

.site-navbar {
    background-color: #ffffff;
    padding: 6px 0;
    position: sticky;
    top: 0;
    z-index: 1001;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

    .site-navbar .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 15px;
    }

/* Wrapper principal - FLEX HORIZONTAL */
.navbar-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
}

/* --- LOGO (izquierda) --- */
.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    height: 70px;
}

    .navbar-brand img {
        height: 100%;
        width: auto;
        object-fit: contain;
    }

/* --- MENÚ + BOTÓN (derecha) - FLEX HORIZONTAL --- */
.navbar-menu {
    display: flex !important;
    align-items: center;
    flex-direction: row !important;
}

/* --- NAVEGACIÓN - FLEX HORIZONTAL --- */
.navbar-nav {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

    .navbar-nav .nav-item {
        position: relative;
        display: inline-block;
    }

    .navbar-nav .nav-link {
        font-family: 'Poppins', sans-serif;
        font-weight: 500;
        font-size: 15px;
        color: #2C3D85;
        padding: 10px 18px;
        text-decoration: none;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: color 0.2s ease;
        white-space: nowrap;
    }

        .navbar-nav .nav-link:hover {
            color: #9BB643;
        }

        /* Flecha dropdown */
        .navbar-nav .nav-link .arrow {
            width: 6px;
            height: 6px;
            border-right: 1.5px solid currentColor;
            border-bottom: 1.5px solid currentColor;
            transform: rotate(45deg);
            margin-top: -2px;
            margin-left: 3px;
            transition: transform 0.3s ease;
        }

    .navbar-nav .nav-item:hover .nav-link .arrow {
        transform: rotate(-135deg);
        margin-top: 3px;
    }

/* ===========================================
   DROPDOWN FLOTANTE
   =========================================== */
.site-navbar .navbar-nav .nav-item .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 320px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    z-index: 9999;
    display: block !important;
    border: none;
}

    /* Puente invisible */
    .site-navbar .navbar-nav .nav-item .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -15px;
        left: 0;
        width: 100%;
        height: 20px;
        background: transparent;
    }

/* Mostrar con hover */
.site-navbar .navbar-nav .nav-item:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Items del dropdown */
.site-navbar .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    background-color: transparent;
}

    .site-navbar .dropdown-menu .dropdown-item:last-child {
        margin-bottom: 0;
    }

    .site-navbar .dropdown-menu .dropdown-item:hover {
        background-color: #f5f7fa;
    }

/* Icono */
.site-navbar .dropdown-item .item-icon {
    width: 44px;
    height: 44px;
    background-color: #e8f5e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

    .site-navbar .dropdown-item .item-icon i {
        font-size: 18px;
        color: #9BB643;
    }

.site-navbar .dropdown-item:hover .item-icon {
    background-color: #9BB643;
}

    .site-navbar .dropdown-item:hover .item-icon i {
        color: #ffffff;
    }

/* Texto */
.site-navbar .dropdown-item .item-text {
    flex: 1;
    min-width: 0;
}

.site-navbar .dropdown-item .item-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #2C3D85;
    margin: 0 0 3px 0;
    transition: color 0.2s ease;
}

.site-navbar .dropdown-item:hover .item-title {
    color: #9BB643;
}

.site-navbar .dropdown-item .item-desc {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.4;
}

/* Flecha */
.site-navbar .dropdown-item .item-arrow {
    color: #d1d5db;
    font-size: 12px;
    margin-left: 12px;
    transition: all 0.2s ease;
    opacity: 0;
    transform: translateX(-5px);
}

.site-navbar .dropdown-item:hover .item-arrow {
    opacity: 1;
    transform: translateX(0);
    color: #9BB643;
}

/* --- BOTÓN INICIAR SESIÓN --- */
.btn-login {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: #ffffff !important;
    background-color: #2C3D85;
    padding: 12px 28px;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    margin-left: 25px;
    white-space: nowrap;
    display: inline-block;
}

    .btn-login:hover,
    .btn-login:focus {
        background-color: #9BB643;
        color: #ffffff !important;
        text-decoration: none;
    }

/* --- HAMBURGER MENU --- */
.navbar-toggler {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

    .navbar-toggler span {
        display: block;
        width: 24px;
        height: 2px;
        background-color: #2C3D85;
        border-radius: 2px;
        transition: all 0.3s ease;
    }

    /* El JS solo conmuta aria-expanded en el toggler (no le añade clases); la
       animación de hamburguesa a X se ancla a ese estado accesible. */
    .navbar-toggler[aria-expanded="true"] span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .navbar-toggler[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .navbar-toggler[aria-expanded="true"] span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

/* ===========================================
   RESPONSIVE - MOBILE (< 992px)
   =========================================== */
@media (max-width: 991px) {
    .site-navbar {
        padding: 6px 0;
    }

    .navbar-toggler {
        display: flex;
    }

    /* El nav de escritorio se oculta en mobile; el menú mobile es el off-canvas drawer */
    .navbar-menu {
        display: none !important;
    }
}

/* ===========================================
   OFF-CANVAS DRAWER MÓVIL
   Posicionado fuera del <header> → z-index
   ROOT sin problemas de stacking context.
   =========================================== */

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 27, 56, 0.55);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    background: #ffffff;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.18);
}

    .mobile-drawer.is-open {
        transform: translateX(0);
    }

/* Bloqueo de scroll del fondo mientras el drawer está abierto (el JS conmuta esta
   clase en <body>). */
body.mobile-menu-open {
    overflow: hidden;
}

/* Ocultar en escritorio */
@media (min-width: 992px) {
    .mobile-overlay,
    .mobile-drawer {
        display: none !important;
    }
}

/* --- Cabecera del drawer --- */
.mobile-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.mobile-drawer__brand img {
    height: 55px;
    width: auto;
    object-fit: contain;
}

.mobile-drawer__close {
    background: #f5f7fa;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2C3D85;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

    .mobile-drawer__close:hover {
        background: #2C3D85;
        color: #ffffff;
    }

/* --- Navegación --- */
.mobile-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    flex: 1;
}

.mobile-nav__item {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: #2C3D85;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    gap: 8px;
}

    .mobile-nav__link:hover,
    .mobile-nav__link.is-active {
        color: #9BB643;
        background: #fafafa;
    }

/* Chevron accordion */
.mobile-nav__chevron {
    font-size: 11px;
    color: #9ca3af;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.mobile-nav__item--has-sub.is-open > .mobile-nav__toggle .mobile-nav__chevron {
    transform: rotate(180deg);
    color: #9BB643;
}

/* Submenú accordion */
.mobile-nav__sub {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f9fafb;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-nav__item--has-sub.is-open .mobile-nav__sub {
    max-height: 300px;
}

.mobile-nav__sub-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px 13px 28px;
    color: #4a5568;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
    transition: color 0.2s, background 0.2s;
}

    .mobile-nav__sub-link i {
        font-size: 13px;
        color: #9BB643;
        flex-shrink: 0;
        width: 16px;
        text-align: center;
    }

    .mobile-nav__sub-link:hover,
    .mobile-nav__sub-link.is-active {
        color: #9BB643;
        background: #f0f5e8;
    }

/* --- Pie del drawer --- */
.mobile-drawer__footer {
    padding: 20px;
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
}

.mobile-drawer__btn-login {
    display: block !important;
    width: 100%;
    text-align: center;
    margin-left: 0 !important;
}

/* ===========================================
   RESPONSIVE - MOBILE PEQUEÑO
   =========================================== */
@media (max-width: 576px) {
    .navbar-brand img {
        height: 60px;
    }
}

/* ===========================================
   NAVBAR SCROLLED
   =========================================== */
.site-navbar.scrolled {
    padding: 8px 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

    .site-navbar.scrolled .navbar-brand img {
        height: 60px;
    }
