* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background-color: #0d1117;
    color: #ffffff;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Cinematic Glow Background */
.glow-bg {
    position: absolute;
    top: -20%; left: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(14, 116, 144, 0.25) 0%, rgba(234, 88, 12, 0.15) 30%, transparent 60%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.container { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 2rem; }

header h1 {
    font-size: 3rem; font-weight: 800; letter-spacing: -1px;
    background: linear-gradient(90deg, #38bdf8, #f97316);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
header h1 span { font-weight: 400; color: #94a3b8; -webkit-text-fill-color: #94a3b8; }
header p { color: #64748b; font-size: 1.1rem; margin-top: 0.5rem; }
.header-row { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; }
.header-right { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }

/* Health Badge */
.health-badge { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem !important; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.health-info { display: flex; flex-direction: column; }
.health-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; }
.health-badge strong { font-size: 0.9rem; color: #22c55e; }

/* Analytics Badges */
.analytics-badges { display: flex; gap: 0.75rem; }
.stat-badge { padding: 0.8rem 1.5rem; display: flex; flex-direction: column; align-items: center; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; }
.stat-value { font-size: 1.25rem; }
.stat-value.views { color: #38bdf8; }
.stat-value.subs { color: #10b981; }
.stat-value.vids { color: #f97316; }

/* Top Performer Hero */
.top-performer { background: linear-gradient(135deg, rgba(14,116,144,0.15), rgba(234,88,12,0.1)) !important; border: 1px solid rgba(249,115,22,0.2) !important; }
.top-performer-inner { display: flex; flex-direction: column; gap: 0.75rem; }
.top-badge { font-size: 0.75rem; font-weight: 700; letter-spacing: 2px; color: #f97316; }
.top-content { display: flex; align-items: center; gap: 1.5rem; }
.top-thumb { width: 120px; height: 68px; border-radius: 8px; object-fit: cover; border: 1px solid rgba(255,255,255,0.1); }
.top-details { flex: 1; }
.top-title { font-size: 1.1rem; font-weight: 600; color: #f8fafc; text-decoration: none; transition: color 0.2s; }
.top-title:hover { color: #38bdf8; }
.top-stats { display: flex; gap: 2rem; margin-top: 0.5rem; font-size: 0.9rem; color: #94a3b8; }
.top-stat strong { margin-right: 0.25rem; }
.top-stat:nth-child(1) strong { color: #38bdf8; }
.top-stat:nth-child(2) strong { color: #f472b6; }
.top-stat:nth-child(3) strong { color: #a78bfa; }

/* Timer Bar */
.timer-bar { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem !important; }
.timer-label { font-size: 0.9rem; color: #94a3b8; }
.timer-countdown { font-size: 1.1rem; font-weight: 600; color: #38bdf8; font-variant-numeric: tabular-nums; }

/* Glassmorphism Panel */
.glass-panel {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.dashboard-grid h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5rem;}

.button-group { display: flex; flex-direction: column; gap: 1rem; }
.btn {
    padding: 1rem 1.5rem; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center; justify-content: flex-start; gap: 1rem;
}
.btn.primary { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: white; box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4); }
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(14, 165, 233, 0.6); }
.btn.secondary { background: rgba(51, 65, 85, 0.6); color: white; border: 1px solid rgba(255,255,255,0.1); }
.btn.secondary:hover { background: rgba(51, 65, 85, 0.9); transform: translateY(-2px); }

.status-message { margin-top: 1rem; font-size: 0.9rem; color: #10b981; min-height: 20px;}

.video-list { display: flex; flex-direction: column; gap: 0.8rem; max-height: 300px; overflow-y: auto; }
.video-item {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(15, 23, 42, 0.6); padding: 1rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); transition: background 0.2s;
}
.video-item:hover { background: rgba(30, 41, 59, 0.8); }
.video-name { font-size: 0.9rem; color: #cbd5e1; font-weight: 600;}
.video-size { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem;}
.video-link { color: #38bdf8; text-decoration: none; font-size: 0.9rem; background: rgba(56, 189, 248, 0.1); padding: 0.4rem 0.8rem; border-radius: 4px; transition: background 0.2s; }
.video-link:hover { background: rgba(56, 189, 248, 0.2); }

/* ═══════ Growth Section ═══════ */
.growth-section h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0; border: none; padding: 0; }

/* ═══════ Analytics Section ═══════ */
.analytics-section h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0; border: none; padding: 0; }
.analytics-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.75rem; margin-bottom: 1.5rem;
}
.btn-refresh {
    background: rgba(56, 189, 248, 0.1); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s;
}
.btn-refresh:hover { background: rgba(56, 189, 248, 0.2); transform: translateY(-1px); }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.chart-container {
    background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px; padding: 1.25rem; position: relative; height: 300px; overflow: hidden;
}
.chart-container h3 { font-size: 0.9rem; font-weight: 500; color: #94a3b8; margin-bottom: 1rem; }

/* Per-Video Table */
.video-analytics-table-wrap { overflow-x: auto; }
.video-analytics-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.video-analytics-table thead { border-bottom: 2px solid rgba(255,255,255,0.08); }
.video-analytics-table th {
    text-align: left; padding: 0.75rem 1rem; font-weight: 500; font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.5px; color: #64748b;
}
.th-num { text-align: right !important; }
.th-thumb { width: 60px; }
.th-sort { cursor: pointer; user-select: none; transition: color 0.2s; }
.th-sort:hover { color: #38bdf8; }
.sort-arrow { font-size: 0.7rem; margin-left: 2px; color: #38bdf8; }
.video-analytics-table td { padding: 0.75rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.video-analytics-table tbody tr { transition: background 0.2s; }
.video-analytics-table tbody tr:hover { background: rgba(56, 189, 248, 0.05); }

.video-thumb { width: 56px; height: 32px; border-radius: 4px; object-fit: cover; }
.video-title-cell { color: #cbd5e1; font-weight: 500; max-width: 400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-title-cell a { color: #cbd5e1; text-decoration: none; transition: color 0.2s; }
.video-title-cell a:hover { color: #38bdf8; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.td-views { color: #38bdf8; font-weight: 600; }
.td-likes { color: #f472b6; }
.td-comments { color: #a78bfa; }
.td-date { color: #64748b; font-size: 0.82rem; }
.loading-row { color: #64748b; text-align: center; padding: 2rem !important; }

/* Pagination */
.pagination-controls { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 1rem !important; border: none !important; }
.btn-page {
    background: rgba(56, 189, 248, 0.1); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.4rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s;
}
.btn-page:hover:not(:disabled) { background: rgba(56, 189, 248, 0.25); transform: translateY(-1px); }
.btn-page:disabled { opacity: 0.3; cursor: not-allowed; }
.page-info { font-size: 0.85rem; color: #64748b; font-variant-numeric: tabular-nums; }

/* Terminal */
.terminal { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 450px;}
.terminal-header { background: #1e293b; padding: 0.8rem 1rem; display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ef4444; } .dot.yellow { background: #eab308; } .dot.green { background: #22c55e; }
.terminal-header .title { margin-left: 1rem; font-size: 0.8rem; font-family: monospace; color: #94a3b8; }
#logTerminal {
    flex: 1; margin: 0; padding: 1rem; background: #0f172a; color: #34d399;
    font-family: 'Courier New', Courier, monospace; font-size: 0.85rem; line-height: 1.5; overflow-y: scroll; white-space: pre-wrap;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    .header-row { flex-direction: column; align-items: flex-start; }
    .top-content { flex-direction: column; align-items: flex-start; }
}

/* Toggle Switch */
.publish-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 0.95rem; color: #cbd5e1; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #334155; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #10b981; }
input:checked + .slider:before { transform: translateX(20px); }
