/* DataHub Sidebar - Premium Design v2.4 (Taller Header) */

/* =========================================
   1. VARIABLES & BASICS
   ========================================= */
:root {
    --sidebar-width: 280px;
    --sidebar-bg-dark: #0f172a;
    --sidebar-bg-light: #ffffff;
    --accent-color: #6366f1;
    /* Indigo 500 */
    --accent-glow: rgba(99, 102, 241, 0.4);
    --text-dark-primary: #f8fafc;
    --text-dark-secondary: #94a3b8;
    --text-light-primary: #1e293b;
    --text-light-secondary: #64748b;
    --transition-speed: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. CONTAINER & LAYOUT (Desktop)
   ========================================= */
.sidebar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    z-index: 1000;

    display: flex;
    flex-direction: column;

    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-speed);

    /* SCROLLBAR LOGIC */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) transparent;
}

/* FIX: Push content to the right on Desktop */
@media (min-width: 993px) {
    .main-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
        transition: margin-left var(--transition-speed);
        padding: 2rem;
    }
}

/* Custom Scrollbar Styling (Webkit) */
.sidebar-container::-webkit-scrollbar {
    width: 8px;
    /* Wider/Visible */
}

.sidebar-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
}

.sidebar-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.6);
}

/* Light Mode Scrollbar */
body.light-mode .sidebar-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.light-mode .sidebar-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
}

body.light-mode .sidebar-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* =========================================
   3. HEADER AREA
   ========================================= */
.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    /* Header doesn't shrink */
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    cursor: default;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: white;
    padding: 2px;
    box-shadow: 0 0 15px var(--accent-glow);
}

.brand-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark-primary);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-sidebar-btn {
    display: none;
    /* Mobile only */
}

/* =========================================
   4. WALLET CARD
   ========================================= */
.sidebar-wallet-card {
    position: relative;
    margin: 0.5rem 1.25rem 1.5rem;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    /* Wallet card doesn't shrink */
}

/* Decorative circle background */
.sidebar-wallet-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    transform: rotate(45deg);
    pointer-events: none;
}

.sidebar-wallet-card .label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.9;
    margin-bottom: 0.25rem;
}

.sidebar-wallet-card .amount {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0.25rem 0 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-topup {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-topup:hover {
    background: white;
    color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* User Profile Section */
.user-profile-section {
    padding: 0 1.5rem 1rem;
    text-align: center;
    flex-shrink: 0;
}

.user-profile-section.admin-profile {
    text-align: left;
}

.user-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.user-role,
.user-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.user-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

/* =========================================
   5. NAVIGATION MENU
   ========================================= */
.sidebar-menu {
    flex: 1;
    /* Takes remaining space */
    padding: 0 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-dark-secondary);
    margin: 1.5rem 0 0.5rem;
    padding-left: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-dark-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* Menu items don't shrink */
}

.menu-item .icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* Hover State */
.menu-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.menu-item:hover .icon {
    transform: scale(1.1);
}

/* Active State */
.menu-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    /* Light Indigo */
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 3px;
    background: #818cf8;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Theme Button */
.menu-item.theme-btn {
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Logout Button */
.menu-item.logout {
    margin-top: auto;
    color: #ff8a80;
}

.menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 1.5rem 0;
    flex-shrink: 0;
}

/* =========================================
   6. LIGHT MODE OVERRIDES
   ========================================= */
body.light-mode .sidebar-container {
    background: var(--sidebar-bg-light);
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 24px rgba(148, 163, 184, 0.15);
}

body.light-mode .brand-text {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light-mode .menu-label {
    color: var(--text-light-secondary);
}

body.light-mode .menu-item {
    color: var(--text-light-secondary);
}

body.light-mode .menu-item:hover {
    background: #f1f5f9;
    color: var(--text-light-primary);
}

body.light-mode .menu-item.active {
    background: #eff6ff;
    color: var(--accent-color);
}

body.light-mode .menu-item.active::before {
    background: var(--accent-color);
}

body.light-mode .menu-item.theme-btn {
    border-color: #e2e8f0;
}

body.light-mode .sidebar-header {
    border-bottom: 1px solid #f1f5f9;
}

body.light-mode .user-name {
    color: var(--text-light-primary);
}

body.light-mode .user-role,
body.light-mode .user-email,
body.light-mode .user-label {
    color: var(--text-light-secondary);
}

/* =========================================
   7. MOBILE RESPONSIVE & HEADER
   ========================================= */
.mobile-header-bar {
    display: none;
    /* Hidden on Desktop */
}

@media (max-width: 991px) {

    /* Mobile Header Bar */
    .mobile-header-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 80px;
        /* INCREASED HEIGHT */
        background: rgba(15, 23, 42, 0.95);
        /* Dark */
        backdrop-filter: blur(10px);
        padding: 0 1.25rem;
        z-index: 99990;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: all var(--transition-speed);
    }

    body.light-mode .mobile-header-bar {
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid #e2e8f0;
    }

    .mobile-brand {
        font-weight: 800;
        font-size: 1.2rem;
        color: white;
        letter-spacing: -0.5px;
    }

    body.light-mode .mobile-brand {
        color: #0f172a;
    }

    /* Mobile Balance */
    .mob-balance {
        color: #fff;
    }

    body.light-mode .mob-balance {
        color: #0f172a;
    }

    .mobile-toggle-btn {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.4rem;
        cursor: pointer;
        transition: background 0.2s;
    }

    body.light-mode .mobile-toggle-btn {
        background: #f1f5f9;
        color: #0f172a;
    }

    /* Sidebar Transformation */
    .sidebar-container {
        transform: translateX(-100%);
        box-shadow: none;
        width: 85%;
        /* Make slightly narrower than screen */
        max-width: 300px;
        z-index: 99999;
        /* Top priority */
        height: 100vh;
        height: 100dvh;
        /* FIX: Full dynamic height */
        top: 0;
        bottom: 0;
    }

    /* Active State (Slide In) */
    body.sidebar-open .sidebar-container {
        transform: translateX(0);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.3);
    }

    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 99998;
        opacity: 0;
        transition: opacity var(--transition-speed);
    }

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

    /* Prevent Scrolling of body when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }

    /* Close Button */
    .close-sidebar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        border: none;
        font-size: 1.5rem;
        color: white;
        cursor: pointer;
    }

    body.light-mode .close-sidebar-btn {
        background: #f1f5f9;
        color: #475569;
    }

    /* Push content down depending on header */
    .main-content {
        margin-left: 0 !important;
        padding-top: 100px !important;
        /* Adjusted for taller header */
    }
}