/* ========== SIDEBAR LATERAL ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 72px;
    background: var(--color-dark);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 300ms cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.sidebar:hover {
    width: 260px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 72px;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    white-space: nowrap;
}

.sidebar-logo i {
    font-size: 1.8rem;
    color: var(--color-cyan);
    min-width: 30px;
    text-align: center;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-title {
    opacity: 1;
    transform: translateX(0);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Módulos dinámicos en sidebar */
.modulos-dinamicos-container {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 10px;
    padding-top: 10px;
}

.modulos-dinamicos-container .nav-item {
    opacity: 0.9;
}

.modulos-dinamicos-container .nav-item:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

/* Contenido de módulos dinámicos */
.modulo-dinamico-contenido {
    min-height: 300px;
}

.nav-item {
    width: calc(100% - 8px);
    margin: 0 4px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 8px;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 24px;
    background: var(--color-cyan);
    border-radius: 0 4px 4px 0;
    transition: width 200ms ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
    transform: translateX(2px);
}

.nav-item:hover::before {
    width: 3px;
}

.nav-item.active {
    background: rgba(0, 162, 181, 0.15);
    color: var(--color-cyan);
}

.nav-item.active::before {
    width: 3px;
    background: var(--color-cyan);
}

.nav-item i {
    font-size: 1.125rem;
    min-width: 24px;
    text-align: center;
    transition: transform 200ms ease;
}

.nav-item:hover i {
    transform: scale(1.05);
}

.nav-text {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-weight: 500;
}

.sidebar:hover .nav-text {
    opacity: 1;
    transform: translateX(0);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-dark-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 162, 181, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar:hover .user-details {
    opacity: 1;
    transform: translateX(0);
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    text-transform: capitalize;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: white;
    transform: translateX(2px);
}

.action-btn.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

.action-btn i {
    font-size: 1.1rem;
    min-width: 30px;
    text-align: center;
}

.action-text {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-weight: 500;
}

.sidebar:hover .action-text {
    opacity: 1;
    transform: translateX(0);
}

/* Main Wrapper - Se ajusta automáticamente con el sidebar */
.main-wrapper {
    margin-left: 72px;
    transition: margin-left 300ms cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    width: calc(100% - 72px);
}

/* Cuando el sidebar se expande (usando clase) */
.sidebar.expanded ~ .main-wrapper,
body.sidebar-expanded .main-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
}

/* Scrollbar para sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Overlay para móviles */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar:hover {
        width: 280px;
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .sidebar:hover ~ .main-wrapper,
    .sidebar.active ~ .main-wrapper {
        margin-left: 0;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Botón hamburguesa para móviles */
    .mobile-menu-btn {
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: var(--color-dark-navy);
        color: white;
        border: none;
        width: 50px;
        height: 50px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
    }
}

/* Animación de entrada */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.sidebar {
    animation: slideInLeft 0.3s ease;
}

/* Mejoras en modo oscuro */
[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0C090D 0%, #001524 100%);
}

/* Tooltip para cuando está colapsado */
.sidebar:not(:hover) .nav-item::after {
    content: attr(title);
    position: absolute;
    left: 80px;
    background: var(--color-dark-navy);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.sidebar:not(:hover) .nav-item:hover::after {
    opacity: 1;
}

.sidebar:not(:hover) .action-btn::after {
    content: attr(title);
    position: absolute;
    left: 80px;
    background: var(--color-dark-navy);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.sidebar:not(:hover) .action-btn:hover::after {
    opacity: 1;
}

