/* =====================================================
   SIDEBAR - Menu Lateral Premium
   Diseño limpio + transiciones suaves
   ===================================================== */

/* --- Base del Sidebar --- */
.sf-sidebar,
.e-sidebar {
    position: fixed !important;
    top: 75px !important;
    left: 0;
    height: calc(100vh - 75px) !important;
    background: linear-gradient(180deg,
        #060051 0%,
        #0E1A4E 40%,
        #1a237e 100%);
    box-shadow: 4px 0 30px rgba(6, 0, 81, 0.25);
    color: var(--pidt-text-white);
    border: none;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1000;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Linea de acento superior */
.e-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--pidt-primary) 0%,
        var(--pidt-secondary) 100%);
}

/* --- Contenedor del Menu --- */
.main-menu {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 0;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.5rem;
}

/* --- Etiquetas de Seccion --- */
.menu-section-label {
    color: rgba(54, 193, 255, 0.6);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 18px 14px 8px 14px;
    margin-top: 4px;
    font-family: var(--pidt-font-secondary);
    transition: opacity 0.2s ease 0.1s;
}

/* --- Items del Menu --- */
.menu-item {
    position: relative;
    color: rgba(255, 255, 255, 0.8);
    padding: 11px 12px;
    margin: 3px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--pidt-font-primary);
    user-select: none;
    transition: background 0.25s ease, transform 0.2s ease, color 0.2s ease;
    min-height: 44px;
}

.menu-item:hover {
    background: rgba(54, 193, 255, 0.12);
    color: #fff;
    transform: translateX(3px);
}

/* Estado activo */
.menu-item.active {
    background: linear-gradient(90deg,
        rgba(54, 193, 255, 0.2) 0%,
        rgba(104, 119, 247, 0.1) 100%);
    color: #fff;
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: linear-gradient(180deg, var(--pidt-primary), var(--pidt-secondary));
    border-radius: 0 3px 3px 0;
}

/* --- Iconos del Menu --- */
.menu-item .menu-icon {
    font-size: 18px;
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    /* SIN animaciones ni transiciones en los iconos */
}

.menu-item:hover .menu-icon {
    background: rgba(54, 193, 255, 0.2);
}

.menu-item.active .menu-icon {
    background: rgba(54, 193, 255, 0.25);
    color: #fff;
}

/* Colores por posicion */
.menu-item:nth-child(2) .menu-icon { color: #36C1FF; }
.menu-item:nth-child(4) .menu-icon { color: #6877F7; }
.menu-item:nth-child(5) .menu-icon { color: #4CD964; }
.menu-item:nth-child(6) .menu-icon { color: #FF9500; }
.menu-item:nth-child(7) .menu-icon { color: #FF6B6B; }
.menu-item:nth-child(9) .menu-icon { color: #43A047; }
.menu-item:nth-child(11) .menu-icon { color: #9E9E9E; }

/* --- Texto del Menu --- */
.menu-item .menu-text {
    flex: 1;
    white-space: normal;
    word-wrap: break-word;
    transition: opacity 0.15s ease;
    line-height: 1.3;
}

/* --- Sidebar Colapsado --- */
.e-sidebar.e-close {
    width: 70px !important;
}

.e-sidebar.e-close .menu-content {
    padding: 0 6px;
}

.e-sidebar.e-close .menu-section-label {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: none;
}

.e-sidebar.e-close .menu-text {
    display: none;
}

.e-sidebar.e-close .menu-item {
    justify-content: center;
    padding: 10px;
    margin: 4px auto;
    gap: 0;
    width: 52px;
    border-radius: 12px;
}

.e-sidebar.e-close .menu-item:hover {
    transform: scale(1.08);
}

.e-sidebar.e-close .menu-item .menu-icon {
    margin: 0;
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 17px;
}

.e-sidebar.e-close .menu-item.active::before {
    display: none;
}

/* --- Sin animaciones en iconos NUNCA --- */
.menu-icon,
.e-sidebar .menu-icon,
.e-sidebar.e-close .menu-icon,
.e-sidebar.e-open .menu-icon,
.e-sidebar.e-transition .menu-icon,
.e-sidebar:not(.e-close) .menu-icon {
    animation: none !important;
    transition: background 0.2s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
}

/* --- Animacion suave solo para texto al expandir --- */
.e-sidebar:not(.e-close) .menu-text {
    animation: fadeText 0.25s ease forwards;
}

@keyframes fadeText {
    from { opacity: 0; }
    to { opacity: 1; }
}

.e-sidebar:not(.e-close) .menu-section-label {
    animation: fadeText 0.25s ease 0.1s forwards;
    opacity: 0;
}

/* --- Footer del Sidebar --- */
.footer-content {
    padding: 1rem 0.75rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.footer-content p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-family: var(--pidt-font-secondary);
    margin: 0;
}

.footer-content.invisible-box,
.e-sidebar.e-close .footer-content {
    display: none;
}

/* --- Version Info --- */
.version-info-sidebar {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
}

/* --- Scrollbar --- */
.menu-content::-webkit-scrollbar {
    width: 3px;
}

.menu-content::-webkit-scrollbar-track {
    background: transparent;
}

.menu-content::-webkit-scrollbar-thumb {
    background: rgba(54, 193, 255, 0.25);
    border-radius: 3px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .e-sidebar {
        top: 64px !important;
        height: calc(100vh - 64px) !important;
    }

    .menu-item {
        font-size: 13px;
        padding: 10px 12px;
    }

    .menu-item .menu-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 16px;
    }
}
