/* Sidebar moderno inspirado en Shadcn Admin Dashboard */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: #2d3748;
    color: white;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 1.25rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 1rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0rem;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
    border-radius: 0px;
    border: 0px solid rgba(255,255,255,0.3);
}

.sidebar-logo h2 {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo h2 {
    display: none;
}

.sidebar-content {
    padding: 0 1rem;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.5rem;
    padding: 0 0.75rem;
    letter-spacing: 0.5px;
}

.sidebar.collapsed .nav-group-title {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.25rem;
    width:20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: auto;
}

.user-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-cuartel {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn-sidebar {
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: center;
}

.logout-btn-sidebar:hover {
    background: rgba(220, 53, 69, 1);
    transform: translateY(-1px);
}

.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .logout-btn-sidebar {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: -12px;
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid #2d3748;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #2d3748;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    z-index: 1001;
}

.sidebar-toggle:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

/* Main content adjustment */
.main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    background: #f8f9fa;
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 999;
        background: #2d3748;
        color: white;
        border: none;
        border-radius: 8px;
        padding: 0.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Overlay para móviles */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.sidebar-overlay.mobile-open {
    display: block;
}

/* Scrollbar personalizado */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}