:root {
    --bg-color: #090610;
    --card-bg: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --accent-color: #ff007f;
    --accent-glow: rgba(255, 0, 127, 0.15);
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #0b0813;
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Background Glows */
.background-glows {
    position: absolute;
    width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.3;
    animation: pulseGlow 15s ease infinite alternate;
}
.glow-1 { width: 500px; height: 500px; background: #ff007f; top: -100px; left: 10%; }
.glow-2 { width: 500px; height: 500px; background: #7b2cbf; bottom: -100px; right: 10%; }

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); opacity: 0.25; }
    100% { transform: scale(1.1) translate(20px, -20px); opacity: 0.4; }
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.2; }
    100% { transform: scale(1.1); opacity: 0.35; }
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    background: rgba(9, 6, 16, 0.78);
    backdrop-filter: blur(8px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.sidebar-header .logo-text { 
    font-weight: 800; 
    font-size: 1rem; 
    background: linear-gradient(135deg, #ff007f, #7928ca, #ff8c00); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
}
.nav-item:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(6px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.15);
}
.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(255, 0, 127, 0.2);
}
.nav-item svg {
    width: 20px;
    height: 20px;
    transition: filter 0.3s;
}
.nav-item:hover svg, .nav-item.active svg {
    filter: drop-shadow(0 0 5px rgba(255, 0, 127, 0.6));
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #ff007f, #7928ca);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 1.5rem; font-weight: 600; }

.glass-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

/* Content Viewport */
.content-viewport {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Common Card Style */
.glass-panel {
    background: rgba(18, 12, 30, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
}
.glass-panel:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 0, 127, 0.2) !important;
    box-shadow: 0 12px 30px rgba(255, 0, 127, 0.1);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 0, 127, 0.1);
    color: #ff007f;
    border: 1px solid rgba(255, 0, 127, 0.15);
}
.stat-icon.docs { background: rgba(255, 0, 127, 0.1); color: #ff007f; }
.stat-icon.queries { background: rgba(123, 40, 202, 0.15); color: #bc8cf2; border-color: rgba(123, 40, 202, 0.2); }
.stat-icon.usage { background: rgba(25, 200, 150, 0.1); color: #19c896; border-color: rgba(25, 200, 150, 0.15); }

.stat-details h3 { font-size: 0.75rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-details .value { font-size: 1.6rem; font-weight: 800; margin-top: 4px; color: #ffffff; }

/* Loading View */
.loading-view {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; gap: 16px; color: var(--text-secondary);
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.05);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Mobile Responsiveness & Hamburger Menu Overlay */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    body {
        overflow-y: auto !important;
        height: auto !important;
    }

    .dashboard-layout {
        flex-direction: column !important;
        height: auto !important;
    }

    /* ☰ Hamburger Menu Toggle Button */
    .hamburger-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: white !important;
        font-size: 1.25rem !important;
        cursor: pointer;
        padding: 8px 12px !important;
        border-radius: 10px !important;
        min-height: 44px;
        min-width: 44px;
        transition: all 0.3s ease;
    }
    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.12) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
    }

    /* Transform Sidebar into Off-Screen Sliding Menu */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: -280px !important; /* Fully off-screen left */
        width: 280px !important;
        height: 100vh !important;
        background: rgba(11, 8, 19, 0.96) !important;
        backdrop-filter: blur(25px) !important;
        z-index: 10000 !important;
        transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.15) !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.7) !important;
        flex-direction: column !important;
    }

    /* Open State for Sliding */
    .sidebar.open {
        left: 0 !important;
    }

    /* Sidebar headers & footers stay visible inside overlay */
    .sidebar-header, .sidebar-footer {
        display: flex !important;
    }

    .sidebar-nav {
        flex-direction: column !important;
        padding: 24px 16px !important;
        gap: 12px !important;
        overflow-y: auto !important;
    }

    .nav-item {
        padding: 14px 18px !important;
        font-size: 0.95rem !important;
        flex-direction: row !important;
        width: 100% !important;
        gap: 14px !important;
    }
    .nav-item span {
        display: block !important;
    }

    /* Dark Overlay Backdrop */
    .sidebar-overlay {
        position: fixed !important;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(4px);
        z-index: 9999 !important;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Main Content offsets securely */
    .main-content {
        margin-bottom: 0 !important;
        height: auto !important;
        width: 100% !important;
    }

    /* Fixed Sticky Topbar Header on Mobile */
    .topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 999 !important;
        background: rgba(9, 6, 16, 0.85) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding: 0 16px !important;
        height: 60px !important;
        backdrop-filter: blur(15px) !important;
    }
    .topbar h1 {
        font-size: 1.15rem !important;
    }

    .content-viewport {
        padding: 16px !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .dashboard-hero {
        padding: 24px 16px !important;
        text-align: center !important;
    }
    .dashboard-hero h2 {
        font-size: 1.6rem !important;
    }
    .dashboard-hero h2 span {
        font-size: 1.6rem !important;
    }
    .dashboard-hero p {
        font-size: 0.88rem !important;
    }

    /* Quick Chat Containers scaling */
    .chat-container {
        height: calc(100vh - 160px) !important;
    }
    .chat-input-wrapper {
        padding: 12px 16px !important;
    }
    
    /* Buttons Scaling on mobile touches */
    button, .action-btn {
        min-height: 44px !important;
    }
}

