/* Estilos base y comportamiento del sidebar colapsable. */
body {
    font-family: 'Inter', sans-serif;
    background-color: #F8FAFC;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.card-elevation {
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.05);
}

#sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}

#sidebar-nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
    border-radius: 10px;
}

/*
 * Sidebar anclado al borde izquierdo.
 * Anchos: expandido 280px, colapsado 88px.
 */
#sidebar {
    width: 280px;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-width: 0;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
    html[data-sidebar="collapsed"] #sidebar {
        width: 88px;
    }

    html[data-sidebar="collapsed"] #main-content {
        margin-left: 88px;
        width: calc(100% - 88px);
    }

    html[data-sidebar="collapsed"] .sidebar-label {
        display: none;
    }

    html[data-sidebar="collapsed"] .nav-item,
    html[data-sidebar="collapsed"] #sidebar-header {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        gap: 0;
    }

    /* Tooltip elegente en modo colapsado */
    html[data-sidebar="collapsed"] [data-tooltip] {
        position: relative;
    }

    html[data-sidebar="collapsed"] [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%) scale(0.95);
        background: #1e293b;
        color: #fff;
        padding: 6px 12px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease, transform 0.15s ease;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.08);
        z-index: 100;
    }

    html[data-sidebar="collapsed"] [data-tooltip]:hover::after {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/*
 * Teléfono: el menú no ocupa espacio, se abre como panel sobre el contenido
 * con el botón #sidebar-abrir.
 */
#sidebar-abrir,
#sidebar-fondo {
    display: none;
}

@media (max-width: 767px) {
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        max-width: 85vw;
    }

    html[data-sidebar-abierto] #sidebar {
        transform: none;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }

    #main-content {
        margin-left: 0;
        width: 100%;
        padding-top: 3.5rem;
    }

    #sidebar-abrir {
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 40;
        width: 2.5rem;
        height: 2.5rem;
        align-items: center;
        justify-content: center;
        border-radius: 0.75rem;
        background: #fff;
        color: #475569;
        border: 1px solid #e2e8f0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        display: flex;
    }

    html[data-sidebar-abierto] #sidebar-fondo {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(0, 0, 0, 0.4);
    }
}
