/* ========================================
   SIDEBAR (ASIDE) - Base Styles
   ======================================== */

/* Aside background */
#app-aside {
    background: #d6d9e0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 16.666667%;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Aside inner — flex column para empujar versión al fondo */
#app-aside>aside.menu {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* Toggle sidebar - ocultar */
#app-aside.is-aside-hidden {
    transform: translateX(-100%);
    width: 0;
    overflow: hidden;
}

/* Scrollbar personalizado para aside */
#app-aside::-webkit-scrollbar {
    width: 6px;
}

#app-aside::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

#app-aside::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

#app-aside::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ========================================
   SIDEBAR RESPONSIVE BREAKPOINTS
   ======================================== */

/* Desktop (>1024px) - Sidebar fijo */
@media screen and (min-width: 1024px) {
    #app-aside {
        position: relative;
        width: 16.666667%;
        transform: translateX(0);
    }

    #app-aside.is-aside-hidden {
        transform: translateX(-100%);
        width: 0;
    }
}

/* Tablet & Mobile (<1024px) - Sidebar overlay */
@media screen and (max-width: 1023px) {
    #app-aside {
        position: fixed;
        top: var(--navbar-height, 3.5rem);
        left: 0;
        width: 280px;
        max-width: 100%;
        height: calc(100dvh - var(--navbar-height, 3.5rem));
        z-index: 30;
        transform: translateX(-100%);
        box-shadow: none;
    }

    #app-aside.is-aside-hidden {
        transform: translateX(-100%);
    }

    #app-aside:not(.is-aside-hidden) {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
        background: var(--bulma-link-45-invert);
    }

    /* Overlay oscuro cuando sidebar está abierto en móvil */
    #app-aside:not(.is-aside-hidden)::before {
        content: "";
        position: fixed;
        top: var(--navbar-height);
        left: 100%;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: -1;
        animation: fadeIn 0.3s;
    }
}

/* Mobile (<769px) - Sidebar más estrecho */
@media screen and (max-width: 768px) {
    #app-aside {
        width: 250px;
    }

    #app-aside:not(.is-aside-hidden)::before {
        left: 100%;
    }
}

/* Small Mobile (<481px) - Sidebar responsive */
@media screen and (max-width: 480px) {
    #app-aside {
        width: 85%;
        max-width: 300px;
    }

    #app-aside:not(.is-aside-hidden)::before {
        left: 100%;
    }
}

/* ========================================
   SIDEBAR MENU - 3 Level Navigation
   ======================================== */

/* Menu items base */
#app-aside .menu-list a {
    border-radius: 0;
    transition: background-color 0.2s, color 0.2s;
    padding: 0.35em 0.75em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bulma-text, #4a4a4a);
}

/* Quitar border-left de Bulma en submenús */
#app-aside .menu-list ul {
    border-left: none;
    border-inline-start: none;
}

#app-aside .menu-list a:hover:not(.is-active) {
    background: var(--bulma-success);
}

#app-aside .menu-list a:hover:not(.is-active) .icon {
    color: white !important;
}

#app-aside .menu-list a.is-active {
    background: linear-gradient(135deg,
            var(--bulma-text-100-invert) 0%,
            var(--bulma-text-dark) 100%);
    color: var(--bulma-success);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#app-aside .menu-list a.is-active .icon {
    color: white !important;
}

/* Parent item with submenu — toggle trigger */
#app-aside .menu-list .has-submenu>a {
    cursor: pointer;
    justify-content: space-between;
}

#app-aside .menu-list .has-submenu {
    transition: margin-bottom 0.35s ease-in-out;
    margin-bottom: 0;
}

/* Chevron icon for expandable items */
#app-aside .menu-list .has-submenu>a .submenu-chevron {
    transition: transform 0.35s ease-in-out, opacity 0.35s ease-in-out;
    margin-left: auto;
    opacity: 0.4;
    font-size: 0.85rem;
}

#app-aside .menu-list .has-submenu.is-expanded>a .submenu-chevron {
    transform: rotate(90deg);
    opacity: 0.8;
}

/* Submenu (level 2 and 3) — collapsed by default */
#app-aside .menu-list .has-submenu>ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-in-out;
    margin: 0;
    padding-left: 0;
}

/* Level 2 items */
#app-aside .menu-list .has-submenu>ul>li>a {
    padding-left: 1.5em;
    padding-top: 0.3em;
    padding-bottom: 0.3em;
    font-size: 0.9em;
}

/* Level 3 items */
#app-aside .menu-list .has-submenu>ul>li>ul>li>a {
    padding-left: 2.75em;
    padding-top: 0.25em;
    padding-bottom: 0.25em;
    font-size: 0.85em;
}

/* Nested levels — no extra margin */
#app-aside .menu-list .has-submenu>ul {
    margin-left: 0;
}