/* ========== ESTILOS DESKTOP ========== */

/* Menú nivel 1: negro #333 y bold */
.navbar-nav .nav-link {
    color: #333 !important;
    font-weight: bold;
	font-size: 1.125rem;
}

/* Hover nivel 1: primary de Bootstrap */
.navbar-nav .nav-link:hover {
    color: var(--bs-primary) !important;
}

/* Menú activo nivel 1: primary */
.navbar-nav .nav-link.active {
    color: var(--bs-primary) !important;
}

/* Menú nivel 1 cuando el dropdown está abierto: primary */
.navbar-nav .nav-item.dropdown.show > .nav-link,
.navbar-nav .nav-item.dropdown:hover > .nav-link {
    color: var(--bs-primary) !important;
}

/* Animación del dropdown-toggle arrow */
.navbar-nav .dropdown-toggle::after {
    transition: transform 0.3s ease;
}

/* Rotar arrow cuando está abierto o en hover */
.navbar-nav .nav-item.dropdown.show > .dropdown-toggle::after,
.navbar-nav .nav-item.dropdown:hover > .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Dropdown nivel 2+: fondo blanco y quitar padding */
.dropdown-menu {
    background-color: #ffffff;
    padding: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border-radius: 0.375rem;
}

/* Posicionar dropdowns anidados (nivel 3+) hacia la derecha en DESKTOP */
@media (min-width: 992px) {
    .dropdown-menu .dropdown-menu {
        position: absolute;
        top: 0;
        left: 100%;
        margin-top: 0;
        margin-left: 0;
    }
}

/* Quitar padding de los li */
.dropdown-menu > li {
    padding: 0;
    position: relative;
}

/* Separador entre items del dropdown */
.dropdown-menu > li:not(:last-child) {
    border-bottom: 1px solid #D9D9D9;
}

/* Dropdown items nivel 2+: texto #333 normal (sin bold) */
.dropdown-menu .dropdown-item {
    color: #333;
    font-weight: normal;
    background-color: transparent;
    padding: 0.5rem 1rem;
    border-radius: 0;
	font-size: 1rem;
}

/* Bordes redondeados para el primer item */
.dropdown-menu > li:first-child > .dropdown-item {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

/* Bordes redondeados para el último item */
.dropdown-menu > li:last-child > .dropdown-item {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Dropdown hover: fondo #F7F7F7 con texto primary normal */
.dropdown-menu .dropdown-item:hover {
    color: var(--bs-primary);
    font-weight: normal;
    background-color: #F7F7F7;
}

/* Mantener bordes redondeados en hover para primer item */
.dropdown-menu > li:first-child > .dropdown-item:hover {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

/* Mantener bordes redondeados en hover para último item */
.dropdown-menu > li:last-child > .dropdown-item:hover {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Dropdown item activo: fondo #F7F7F7 con texto primary */
.dropdown-menu .dropdown-item.active {
    color: var(--bs-primary);
    font-weight: normal;
    background-color: #F7F7F7;
}

/* Mantener color primary en nivel 2 cuando hay hover en nivel 3 */
@media (min-width: 992px) {
    .dropdown-menu .dropend:hover > .dropdown-toggle,
    .dropdown-menu .dropend.show > .dropdown-toggle {
        color: var(--bs-primary) !important;
        background-color: #F7F7F7;
    }
}

/* Dropdown toggle arrow nivel 1 */
.navbar-nav .dropdown-toggle::after {
    color: #333;
}

/* Dropdown toggle arrow nivel 1 cuando está abierto o en hover */
.navbar-nav .nav-item.dropdown.show > .dropdown-toggle::after,
.navbar-nav .nav-item.dropdown:hover > .dropdown-toggle::after {
    color: var(--bs-primary);
}

/* Dropdown toggle arrow nivel 2+ en DESKTOP */
@media (min-width: 992px) {
    .dropdown-menu .dropdown-toggle::after {
        color: #333;
        transition: transform 0.3s ease;
        border-left: 0.3em solid;
        border-right: 0;
        border-top: 0.3em solid transparent;
        border-bottom: 0.3em solid transparent;
        margin-left: auto;
    }
    
    /* Dropdown toggle nivel 2+: flexbox para alinear flecha a la derecha */
    .dropdown-menu .dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Dropdown toggle arrow nivel 2+ en hover */
    .dropdown-menu .dropdown-toggle:hover::after {
        color: var(--bs-primary);
    }
    
    /* Arrow nivel 2 en primary cuando nivel 3 está abierto */
    .dropdown-menu .dropend:hover > .dropdown-toggle::after,
    .dropdown-menu .dropend.show > .dropdown-toggle::after {
        color: var(--bs-primary);
    }
    
    /* Rotar flecha nivel 2+ cuando está abierto */
    .dropdown-menu .dropend.show > .dropdown-toggle::after,
    .dropdown-menu .dropend:hover > .dropdown-toggle::after {
        transform: translateX(3px);
    }
    
    /* Asegurar que los submenús nivel 3+ se muestren correctamente */
    .dropend:hover > .dropdown-menu,
    .dropend.show > .dropdown-menu {
        display: block;
    }
}

/* Quitar padding del container-fluid */
.navbar .container-fluid {
    padding-right: 0;
}

/* ========== ESTILOS MÓVILES ========== */

/* Ocultar elementos móviles en desktop */
.mobile-header,
.mobile-menu-panel,
.mobile-menu-overlay {
    display: none;
}

@media (max-width: 991.98px) {
    /* ===== HEADER MÓVIL ===== */
    .mobile-header {
        display: block;
        background-color: #2B3643;
        padding: 0.75rem 1rem;
        position: sticky;
        top: 0;
        z-index: 1030;
        width: 100%;
    }
    
    /* Botón hamburguesa */
    .mobile-menu-toggle {
        background: none;
        border: none;
        padding: 0;
        width: 30px;
        height: 25px;
        position: relative;
        cursor: pointer;
        display: block;
    }
    
    .mobile-menu-toggle::before,
    .mobile-menu-toggle::after {
        content: '';
        display: block;
        width: 30px;
        height: 3px;
        background-color: #ffffff;
        position: absolute;
        left: 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 30px;
        height: 3px;
        background-color: #ffffff;
        position: absolute;
        left: 0;
        top: 11px;
        transition: all 0.3s ease;
        border-radius: 2px;
    }
    
    .mobile-menu-toggle::before {
        top: 0;
    }
    
    .mobile-menu-toggle::after {
        bottom: 0;
    }
    
    /* Animación cuando está abierto */
    .mobile-menu-toggle.active::before {
        top: 11px;
        transform: rotate(45deg);
    }
    
    .mobile-menu-toggle.active span {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active::after {
        bottom: 11px;
        transform: rotate(-45deg);
    }
    
    /* ===== OVERLAY ===== */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-menu-overlay.show {
        display: block;
        opacity: 1;
    }
    
    /* ===== PANEL LATERAL ===== */
    .mobile-menu-panel {
        display: block;
        position: fixed;
        top: 0;
        left: -60%;
        width: 60%;
        height: 100vh;
        background-color: #2B3643;
        z-index: 1050;
        overflow-y: auto;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    }
    
    .mobile-menu-panel.show {
        left: 0;
    }
    
    /* Header del panel con botón cerrar */
    .mobile-menu-header {
        background-color: #1f2631;
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 10;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        color: #ffffff;
        padding: 0.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s ease;
    }
    
    .mobile-menu-close:hover {
        transform: scale(1.1);
    }
    
    /* Contenido del menú */
    .mobile-menu-content {
        padding: 0;
    }
    
    .mobile-menu-content .navbar-nav {
        flex-direction: column;
        margin: 0;
        padding: 0;
    }
    
    /* Items del menú móvil - Nivel 1 */
    .mobile-menu-content > .navbar-nav > .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
    }
    
    .mobile-menu-content .nav-link {
        color: #ffffff !important;
        padding: 1rem 1.5rem;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: transparent;
        transition: background-color 0.2s ease, color 0.2s ease;
    }
    
    .mobile-menu-content .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.05) !important;
        color: var(--bs-primary) !important;
    }
    
    /* Nivel 1 abierto: fondo #36404D y texto primary */
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show > .nav-link {
        background-color: #36404D !important;
        color: var(--bs-primary) !important;
    }
    
    /* Flecha nivel 1 hover: color primary */
    .mobile-menu-content .nav-link:hover.dropdown-toggle::after {
        border-top-color: var(--bs-primary);
    }
    
    /* Flecha nivel 1 abierto: color primary */
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show > .nav-link.dropdown-toggle::after {
        border-top-color: var(--bs-primary);
    }
    
    /* Cuando un nivel 2 está abierto dentro del nivel 1, nivel 1 vuelve a blanco */
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show:has(.dropdown-menu .dropdown.show) > .nav-link,
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show:has(.dropdown-menu .dropend.show) > .nav-link {
        color: #ffffff !important;
    }
    
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show:has(.dropdown-menu .dropdown.show) > .nav-link.dropdown-toggle::after,
    .mobile-menu-content > .navbar-nav > .nav-item.dropdown.show:has(.dropdown-menu .dropend.show) > .nav-link.dropdown-toggle::after {
        border-top-color: #ffffff;
    }
    
    /* Dropdown - todos los niveles hacia abajo */
    .mobile-menu-content .dropdown-menu {
        display: none;
        position: static !important;
        float: none;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
        border: none;
        box-shadow: none;
        background-color: #36404D;
        border-radius: 0;
        top: auto !important;
        left: 0 !important;
        right: auto !important;
        transform: translate3d(0, 0, 0) !important;
        will-change: auto !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }
    
    .mobile-menu-content .dropdown-menu.show {
        display: block !important;
        max-height: 2000px;
        transition: max-height 0.4s ease-in;
    }
    
    .mobile-menu-content .dropdown-menu[data-bs-popper] {
        position: static !important;
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        right: auto !important;
    }
    
    /* Items del nivel 2 */
    .mobile-menu-content .dropdown-menu > li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        margin: 0;
        padding: 0;
        background-color: transparent;
    }
    
    .mobile-menu-content .dropdown-item {
        color: #ffffff !important;
        padding: 0.75rem 1.5rem 0.75rem 1.5rem;
        font-weight: normal;
        background-color: transparent !important;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border: none;
        border-radius: 0 !important;
        transition: background-color 0.2s ease, color 0.2s ease;
    }
    
    .mobile-menu-content .dropdown-item:hover {
        background-color: #36404D !important;
        color: #ffffff !important;
    }
    
    /* Nivel 2 abierto: texto primary */
    .mobile-menu-content .dropdown-menu > li.dropdown.show > .dropdown-item,
    .mobile-menu-content .dropdown-menu > li.dropend.show > .dropdown-item {
        color: var(--bs-primary) !important;
    }
    
    /* Nivel 3 - también hacia abajo, más indentado */
    .mobile-menu-content .dropdown-menu .dropdown-menu {
        background-color: #36404D;
        position: static !important;
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        right: auto !important;
        top: auto !important;
    }
    
    .mobile-menu-content .dropdown-menu .dropdown-menu[data-bs-popper] {
        position: static !important;
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        right: auto !important;
    }
    
    .mobile-menu-content .dropdown-menu .dropdown-item {
        padding-left: 2.5rem;
    }
    
    /* Nivel 3 abierto: texto primary */
    .mobile-menu-content .dropdown-menu .dropdown-menu > li.dropdown.show > .dropdown-item,
    .mobile-menu-content .dropdown-menu .dropdown-menu > li.dropend.show > .dropdown-item {
        color: var(--bs-primary) !important;
    }
    
    /* Nivel 4 - más indentado aún */
    .mobile-menu-content .dropdown-menu .dropdown-menu .dropdown-menu {
        background-color: #36404D;
        position: static !important;
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        right: auto !important;
        top: auto !important;
    }
    
    .mobile-menu-content .dropdown-menu .dropdown-menu .dropdown-menu[data-bs-popper] {
        position: static !important;
        transform: translate3d(0, 0, 0) !important;
        left: 0 !important;
        right: auto !important;
    }
    
    .mobile-menu-content .dropdown-menu .dropdown-menu .dropdown-item {
        padding-left: 3.5rem;
    }
    
    /* Flechas en móvil: hacia abajo, blancas */
    .mobile-menu-content .dropdown-toggle::after {
        border-top: 0.3em solid #ffffff;
        border-right: 0.3em solid transparent;
        border-bottom: 0;
        border-left: 0.3em solid transparent;
        margin-left: auto;
        transition: transform 0.3s ease, border-top-color 0.3s ease;
    }
    
    /* Flecha color primary cuando el dropdown está abierto */
    .mobile-menu-content .dropdown.show > .dropdown-toggle::after,
    .mobile-menu-content .dropend.show > .dropdown-toggle::after {
        transform: rotate(180deg);
        border-top-color: var(--bs-primary);
    }
    
    /* Asegurar que todos los niveles funcionen */
    .mobile-menu-content .dropdown.show > .dropdown-menu,
    .mobile-menu-content .dropend.show > .dropdown-menu {
        display: block !important;
    }
    
    /* Quitar separadores innecesarios */
    .mobile-menu-content .dropdown-menu > li:last-child {
        border-bottom: none;
    }
    
    /* Evitar scroll del body cuando el menú está abierto */
    body.mobile-menu-open {
        overflow: hidden;
    }
    
    /* Ocultar el navbar desktop en móvil */
    .navbar-expand-lg {
        display: none !important;
    }
}