/* ═══════════════════════════════════════════
   DASHBOARD — Dark Analytics Theme
   ═══════════════════════════════════════════ */

:root {
    --bg: #0d0d12;
    --surface: #14141c;
    --surface-2: #1a1a24;
    --border: #252530;
    --border-light: #32323e;
    --text: #e4e2dd;
    --text-muted: #8a8a9a;
    --text-dim: #5a5a6a;
    --plaza: #5ba3f5;
    --plaza-dim: rgba(91, 163, 245, 0.12);
    --tara: #e84545;
    --tara-dim: rgba(232, 69, 69, 0.12);
    --gold: #d4a853;
    --gold-dim: rgba(212, 168, 83, 0.12);
    --green: #4ade80;
    --green-dim: rgba(74, 222, 128, 0.12);
    --yellow: #facc15;
    --orange: #fb923c;
    --red: #f87171;
    --purple: #a78bfa;
    --purple-dim: rgba(167, 139, 250, 0.12);
    --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
    --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
    --radius: 10px;
    --radius-sm: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Header ─── */

.dash-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 13, 18, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.dash-header .wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo-img {
    width: 28px;
    height: 28px;
    border-radius: 5px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: 3px;
    color: var(--gold);
}

.header-right {
    margin-left: auto;
}

.theater-toggles {
    display: flex;
    gap: 4px;
}

.theater-toggles .toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 14px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
    white-space: nowrap;
}

.theater-toggles .toggle:hover {
    background: var(--surface-2);
    color: var(--text);
}

.theater-toggles .toggle.active {
    background: var(--surface-2);
    border-color: var(--text-dim);
    color: var(--text);
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-plaza { background: var(--plaza); }
.dot-tara { background: var(--tara); }

/* ─── Loading ─── */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 0;
    gap: 16px;
    color: var(--text-dim);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── KPI Cards ─── */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 24px 0 20px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    font-weight: 500;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    line-height: 1.1;
}

.kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kpi-card.kpi-gold .kpi-value { color: var(--gold); }
.kpi-card.kpi-green .kpi-value { color: var(--green); }
.kpi-card.kpi-plaza .kpi-value { color: var(--plaza); }
.kpi-card.kpi-purple .kpi-value { color: var(--purple); }

/* ─── Chart Cards ─── */

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-card, .table-card, .full-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.chart-title {
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.chart-subtitle {
    font-size: 11px;
    color: var(--text-dim);
    margin: 0 0 16px;
}

.chart-card canvas {
    max-height: 260px;
}

/* ─── Tables ─── */

.table-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.table-wrap {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.table-wrap::-webkit-scrollbar { width: 5px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dash-table th {
    position: sticky;
    top: 0;
    background: var(--surface);
    text-align: left;
    padding: 8px 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.dash-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.dash-table tr:hover td {
    background: var(--surface-2);
}

.dash-table .movie-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.dash-table .num {
    font-family: var(--font-mono);
    font-size: 12px;
    text-align: right;
}

.dash-table .source-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* Capacity bar in table */
.mini-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.mini-bar-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    min-width: 40px;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 2px;
}

.mini-bar-label {
    font-family: var(--font-mono);
    font-size: 11px;
    min-width: 32px;
    text-align: right;
}

/* ─── Daily Chart ─── */

.full-card {
    margin-bottom: 40px;
}

.daily-chart-wrap {
    height: 200px;
    position: relative;
}

.daily-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
    .chart-row, .table-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .dash-header .wrap {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-right {
        width: 100%;
        margin-left: 0;
    }

    .kpi-value {
        font-size: 22px;
    }

    .chart-card, .table-card, .full-card {
        padding: 14px;
    }
}

/* ─── Animations ─── */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-card, .chart-card, .table-card, .full-card {
    animation: fadeIn 0.35s ease both;
}

.kpi-row .kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-row .kpi-card:nth-child(2) { animation-delay: 50ms; }
.kpi-row .kpi-card:nth-child(3) { animation-delay: 100ms; }
.kpi-row .kpi-card:nth-child(4) { animation-delay: 150ms; }
.kpi-row .kpi-card:nth-child(5) { animation-delay: 200ms; }
.kpi-row .kpi-card:nth-child(6) { animation-delay: 250ms; }
