/* TWF Analytics Dashboard — Glass UI */
:root {
    --bg: #070d17;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.07);
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gold: #C8A84E;
    --gold-dim: rgba(200, 168, 78, 0.3);
    --blue: #4FB8E0;
    --blue-dim: rgba(79, 184, 224, 0.3);
    --green: #4ADE80;
    --red: #F87171;
    --yellow: #FBBF24;
    --text: #E2E8F0;
    --text-dim: #94A3B8;
    --text-muted: #64748B;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
}

/* Header */
header {
    padding: 24px 32px 16px;
    border-bottom: 1px solid var(--glass-border);
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}
.accent { color: var(--gold); }
.last-updated {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Navigation Tabs */
nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 32px 0;
    display: flex;
    gap: 4px;
}
.tab {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.2s;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active {
    color: var(--gold);
    background: var(--surface);
    border-bottom: 2px solid var(--gold);
}

/* Tab Content */
.tab-content {
    display: none;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}
.tab-content.active { display: block; }

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
}
.card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
}
.card-delta {
    font-size: 0.85rem;
    margin-top: 4px;
}
.card-delta.up { color: var(--green); }
.card-delta.down { color: var(--red); }

/* Chart Panels */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.chart-panel {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
    position: relative;
}
.chart-panel.wide {
    grid-column: 1 / -1;
}
.chart-panel h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.range-toggle {
    position: absolute;
    top: 18px;
    right: 20px;
    display: flex;
    gap: 2px;
}
.range {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}
.range:hover { color: var(--text); border-color: var(--text-dim); }
.range.active {
    background: var(--gold-dim);
    color: var(--gold);
    border-color: var(--gold);
}

/* Videos Table */
.table-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.filter-group select {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}
.filter-group select option {
    background: var(--bg);
}
.table-wrap {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow-x: auto;
    backdrop-filter: blur(12px);
}
table {
    width: 100%;
    border-collapse: collapse;
}
thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}
tbody td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
}
tbody tr:hover { background: var(--surface-hover); }
.type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.type-badge.short { background: var(--blue-dim); color: var(--blue); }
.type-badge.mid { background: var(--gold-dim); color: var(--gold); }
.ctr-good { color: var(--green); }
.ctr-ok { color: var(--yellow); }
.ctr-bad { color: var(--red); }

/* Top Performers */
.top-performers {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(12px);
    margin-top: 16px;
}
.top-performers h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.top-item:last-child { border-bottom: none; }
.top-rank {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    width: 40px;
}
.top-info { flex: 1; }
.top-title { font-size: 0.9rem; color: var(--text); }
.top-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.top-stats {
    text-align: right;
}
.top-stats .views { font-size: 1rem; font-weight: 600; color: var(--text); }
.top-stats .ctr { font-size: 0.8rem; color: var(--text-dim); }

/* Milestones */
.milestones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.milestone {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.milestone.reached {
    border-color: var(--gold);
    background: var(--gold-dim);
}
.milestone-target {
    font-size: 1.4rem;
    font-weight: 700;
}
.milestone.reached .milestone-target { color: var(--gold); }
.milestone:not(.reached) .milestone-target { color: var(--text-muted); }
.milestone-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.milestone-progress {
    margin-top: 8px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}
.milestone-bar {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Footer */
footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    header { padding: 16px; }
    nav { padding: 12px 16px 0; }
    .tab-content { padding: 16px; }
    .chart-row { grid-template-columns: 1fr; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .table-controls { flex-wrap: wrap; }
}
