/* Estilo para el menú fijo */
#menu {
    min-height: 100%; /* Asegura que ocupe toda la altura */
    font-size: 0.9em;
    padding-top: 1rem;
    z-index: 1045;
}

/* En móvil, el menú está oculto por defecto */
@media (max-width: 767px) {
    /* Breakpoint bootstrap Medium (md) ≥768px */
    #menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
        transform: translateX(-100%); /* Oculto inicialmente */
        transition: transform 0.3s ease-in-out;
    }

    #menu.show {
        transform: translateX(0); /* Visible cuando se abre */
    }

    .offcanvas-backdrop {
        display: none; /* Sin fondo en móvil */
    }
}

/* Estilos del menú de gestión */
.menu_gestion {
    background-color: #2d373c !important;
    color: #fff !important;
}

.menu_gestion .nav-link,
.menu_gestion .boton_logout {
    color: #eaebec !important;
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    width: 100%;
}

.menu_gestion .material-symbols-outlined {
    color: #40E0D0;
    margin-right: 0.2em;
}

.menu_gestion a:hover, .menu_gestion .boton_logout:hover, .menu_gestion .activo {
    text-decoration: none;
    border-radius: .25rem;
    background-color: #46505a;

}

.menu_gestion a:focus, .menu_gestion button:focus {
    color: #fff;
    text-decoration: none;
}

@media (max-width: 767px) {
    /* Breakpoint bootstrap Medium (md) ≥768px */
    .menu_mobile_gestion {
        background-color: #2d373c;
    }

    .menu_mobile_gestion button, .menu_mobile_gestion button:hover, .menu_mobile_gestion button:active {
        color: #fff;
        text-decoration: none;
    }
}


/* ── Escritorio (≥768px) ────────────────────────────────────────────────── */
/* Cadena de alturas: body(100vh) → container-fluid(flex:1) → row(flex:1) →
   aside/main(stretch). El aside queda exactamente debajo del header y llena
   el resto de la ventana sin position:fixed. El main scrollea internamente. */
@media (min-width: 768px) {
    /* 1. Body con altura fija para que los hijos puedan usar height:100% */
    body:has(aside.menu-lateral) {
        height: 100vh;
        overflow: hidden;
    }

    /* 2. Header: flex-shrink:0 para que no se comprima al repartir altura */
    body:has(aside.menu-lateral) > header {
        flex-shrink: 0;
    }

    /* 3. Container-fluid llena el espacio restante tras el header */
    body:has(aside.menu-lateral) > .container-fluid {
        flex: 1;
        min-height: 0;
        display: flex !important;
        flex-direction: column;
    }

    /* 4. Row ocupa toda la altura del container y no wrappea columnas */
    body:has(aside.menu-lateral) > .container-fluid > .row {
        flex: 1;
        min-height: 0;
        flex-wrap: nowrap;
    }

    /* 5. Main scrollable internamente (el aside ya ocupa su columna col-md-3/xl-2) */
    body:has(aside.menu-lateral) > .container-fluid > .row > main {
        overflow-y: auto;
    }

    /* 6. Aside: no position:fixed, se estira hasta el fondo por align-items:stretch */
    aside.menu-lateral {
        overflow: hidden;
        flex-shrink: 0;
    }

    /* 7. El offcanvas-md ocupa el 100% del aside — Bootstrap fuerza width/height:auto !important */
    aside.menu-lateral > .offcanvas-md {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column;
        padding-top: 1rem;
    }

    /* 8. sidebar-menu: ul con scroll (1fr) + sidebar-bottom siempre visible (auto) */
    .menu_gestion .sidebar-menu {
        flex: 1 1 0 !important;
        min-height: 0;
        padding: 0.5rem 0 0.5rem 0.75rem;
        display: grid !important;
        grid-template-rows: 1fr auto;
        overflow: hidden !important;
    }

    .menu_gestion .sidebar-menu > ul {
        flex-wrap: nowrap !important;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: #6b737b transparent;
    }

    .sidebar-bottom {
        padding: 0 0.25rem;
    }
}


/* dropdowns administrador */
.menu_gestion .dropdown-menu {
    background-color: #2d373c !important;
    color: #fff !important;
}

.menu_gestion .dropdown-item:hover, .menu_gestion .dropdown-item:active, .menu_gestion .dropdown-item:focus {
    background-color: #46505a !important;
    text-decoration: none;
}

.menu_gestion .nav-link:hover {
    background-color: #46505a;
    border-radius: .25rem;
    text-decoration: none;
}

.menu_gestion .dropdown-toggle, .menu_gestion .dropdown-toggle:hover, .menu_gestion .dropdown-toggle:active, .menu_gestion .dropdown-toggle:focus {
    color: #fff;
    text-decoration: none;
}
