/* ============================================================================
   LAYOUT - SIDEBAR & MAIN CONTENT STRUCTURE
   ============================================================================
   
   Description:
   Core layout components for the application including sidebar navigation,
   main content area, header, and user information display. Used across all
   dashboard pages.
   
   Layout Structure:
   - Fixed sidebar on the left
   - Main content area with margin-left offset
   - Responsive behavior for mobile devices
   
   Sections:
   1. Sidebar
   2. Sidebar Navigation
   3. Sidebar Footer & Stats
   4. User Info
   5. Main Content Area
   6. Header
   7. Responsive Layout
   
   ============================================================================ */

/* ============================================================================
   1. SIDEBAR
   ============================================================================ */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================================================
   2. SIDEBAR NAVIGATION
   ============================================================================ */

.sidebar-nav {
    flex: 1;
    padding: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    margin-bottom: 4px;
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   3. SIDEBAR FOOTER & STATS
   ============================================================================ */

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stats-card {
    background: linear-gradient(135deg, var(--primary) 0%, #5B6BE8 100%);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
}

.stats-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stats-value {
    font-size: 2rem;
    color: #fff;
}

/* ============================================================================
   4. USER INFO
   ============================================================================ */

/* User Info in Sidebar */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #5B6BE8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
}

.btn-logout:hover {
    color: var(--text-primary);
}

/* ============================================================================
   5. MAIN CONTENT AREA
   ============================================================================ */
/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: 100vh;
    width: 100%;
}

/* ============================================================================
   6. HEADER
   ============================================================================ */

/* Header */
.main-header {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    display: flex;
}

/* ============================================================================
   7. RESPONSIVE LAYOUT
   ============================================================================ */

/* Responsive Layout */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
