/* ═══════════════════════════════════════════════════════
   AskEcho Analytics Dashboard — Custom CSS
   Only rules that have no Bootstrap 5 equivalent.
   Bootstrap 5.3 handles all layout, colour tokens,
   spacing, cards, badges, modals, dropdowns etc.
   ═══════════════════════════════════════════════════════ */

/* ── 1. Brand accent tokens ── */
:root {
    --accent: #00e5b0;
    --accent2: #3b82f6;
    --accent3: #f59e0b;
    --accent4: #ef4444;
    --sw: 240px; /* sidebar width */
    --sw0: 56px; /* collapsed width */
    --hh: 56px; /* header height */
}

body {
    font-family:'DM Sans',sans-serif;
}

/* ── 2. Subtle grid background overlay ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: linear-gradient(rgba(0,229,176,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(0,229,176,.025) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ── 3. Fixed full-width header ── */
#topheader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hh);
    z-index: 1030;
}

/* ── 4. Header logo zone: width tracks sidebar ── */
.header-logo {
    width: var(--sw);
    min-width: var(--sw);
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
    transition: width .25s ease, min-width .25s ease;
}

body.sc .header-logo {
    width: var(--sw0);
    min-width: var(--sw0);
}

body.sc .logo-text {
    display: none !important;
}

/* ── 5. Fixed sidebar ── */
#sidebar {
    position: fixed;
    top: var(--hh);
    left: 0;
    bottom: 0;
    width: var(--sw);
    z-index: 1020;
    overflow: hidden;
    transition: width .25s ease;
}

body.sc #sidebar {
    width: var(--sw0);
}

/* Collapsed: hide text elements, centre dots */
body.sc .sb-label,
body.sc .sb-section,
body.sc .sb-badge,
body.sc .sb-council,
body.sc .sb-footer-text {
    display: none !important;
}

body.sc #sidebar .nav-link {
    justify-content: center;
    padding: 10px 0;
}

body.sc .sb-dot {
    width: 8px !important;
    height: 8px !important;
    opacity: 1 !important;
}

body.sc .sb-footer {
    justify-content: center !important;
}

/* ── 6. Sidebar nav active state (brand colour) ── */
#sidebar .nav-link.active {
    background: rgba(0,229,176,.12);
    color: var(--accent) !important;
}

    #sidebar .nav-link.active .sb-dot {
        opacity: 1;
    }

/* ── 7. Tiny nav indicator dot ── */
.sb-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .4;
    flex-shrink: 0;
}

/* ── 8. Main content area: offset + animated transition ── */
#mainwrap {
    margin-top: var(--hh);
    margin-left: var(--sw);
    min-height: calc(100vh - var(--hh));
    transition: margin-left .25s ease;
    position: relative;
    z-index: 1;
}

body.sc #mainwrap {
    margin-left: var(--sw0);
}

/* ── 9. Sub-topbar backdrop blur ── */
#pagetopbar {
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent);
}

/* ── 10. Pulsing AI status dot ── */
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: ae-pulse 2s infinite;
}

@keyframes ae-pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: .2;
    }
}

/* ── 11. Stat card: per-card accent top bar (::before + CSS var trick) ── */
.stat-card {
    transition: border-color .2s;
    animation: ae-in .4s ease both;
}

    .stat-card::before {
        content: '';
        position: absolute;
        inset: 0 0 auto 0;
        height: 2px;
        background: var(--ca, var(--accent));
        opacity: .75;
    }

    .stat-card:hover {
        border-color: var(--ca, var(--accent)) !important;
    }

@keyframes ae-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── 12. Bar chart ── */
.chart-area {
    height: 160px;
    display: flex;
    align-items: flex-end;
    gap: 5px;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: filter .2s;
    cursor: pointer;
}

    .bar:hover {
        filter: brightness(1.3);
    }

/* ── 13. Hour chart ── */
.hour-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 50px;
}

.hour-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    background: var(--accent2);
    opacity: .5;
    min-height: 4px;
    transition: opacity .15s;
    cursor: pointer;
}

    .hour-bar:hover {
        opacity: 1;
    }

    .hour-bar.peak {
        opacity: 1;
        background: var(--accent);
    }

/* ── 14. Query mini progress bar ── */
.q-track {
    width: 80px;
    height: 4px;
    background: var(--bs-border-color);
}

.q-fill {
    height: 100%;
    background: var(--accent);
}

/* ── 15. User avatar gradient ── */
.user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    color: #0b0f1a;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ── 16. Thin scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 2px;
}
