/* ─── Reset & Base ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: linear-gradient(135deg, #0f0f1e 0%, #1a1a2e 100%);
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* ─── Header ────────────────────────────────────────────────── */
header { text-align: center; margin-bottom: 30px; }

h1 {
    font-size: 2.4em;
    background: linear-gradient(120deg, #00d4ff, #0099ff, #7d5ba6);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.subtitle { color: #666; font-size: 1em; }

/* ─── Main tabs ─────────────────────────────────────────────── */
.main-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.1);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.main-tab-btn {
    background: rgba(30, 30, 50, 0.6);
    border: 2px solid rgba(0, 212, 255, 0.2);
    color: #888;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
}

.main-tab-btn:hover { border-color: rgba(0, 212, 255, 0.5); color: #00d4ff; }

.main-tab-btn.active {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border-color: #00d4ff;
    color: #0a0a14;
}

.main-tab-content { display: none; }
.main-tab-content.active { display: block; animation: fadeIn 0.3s ease-out; }

/* ─── Stats row ─────────────────────────────────────────────── */
.stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 110px;
    background: rgba(30, 30, 50, 0.7);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 10px;
    padding: 12px 16px;
    text-align: center;
}

.stat-card .label {
    font-size: 0.72em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 1.35em;
    font-family: 'Monaco', monospace;
    color: #00d4ff;
    font-weight: 700;
    margin-top: 4px;
}

.stat-card .card-hint {
    font-size: 0.7em;
    color: #444;
    margin-top: 4px;
}

/* ─── Panels ────────────────────────────────────────────────── */
.panel {
    background: rgba(30, 30, 50, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.panel h2 {
    color: #00d4ff;
    font-size: 1.15em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel h3 {
    color: #0099ff;
    font-size: 1em;
    margin: 18px 0 8px;
}

.panel.mystique { border-left: 3px solid #7d5ba6; }
.panel.science  { border-left: 3px solid #00d4ff; }
.panel.sources  { border-left: 3px solid #0099ff; }

/* ─── Inner chart tabs ──────────────────────────────────────── */
.chart-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.chart-tab-btn {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: #888;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 600;
    transition: all 0.2s;
}

.chart-tab-btn:hover { color: #00d4ff; border-color: rgba(0, 212, 255, 0.5); }

.chart-tab-btn.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border-color: #00d4ff;
}

.chart-view { display: none; }
.chart-view.active { display: block; }

/* ─── Chart wrapper (CRITICAL for Chart.js sizing) ──────────── */
.chart-wrapper {
    position: relative;
    height: 320px;
    width: 100%;
}

canvas { display: block; }

/* ─── Legend ────────────────────────────────────────────────── */
.legend {
    display: flex;
    gap: 16px;
    margin: 6px 0 10px;
    font-size: 0.82em;
    flex-wrap: wrap;
}

.legend-item { display: flex; align-items: center; gap: 6px; color: #888; }
.legend-dot  { width: 14px; height: 3px; border-radius: 2px; flex-shrink: 0; }

/* ─── Live indicator ────────────────────────────────────────── */
.live-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.88em;
    color: #888;
    flex-wrap: wrap;
}

.live-dot {
    width: 10px;
    height: 10px;
    background: #00ff88;
    border-radius: 50%;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

/* ─── Harmonics ─────────────────────────────────────────────── */
.harmonics-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.harmonic-card {
    flex: 1;
    min-width: 90px;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 8px;
    padding: 10px 12px;
    text-align: center;
}

.harmonic-card .h-freq  { color: #00d4ff; font-size: 1.1em; font-weight: 700; }
.harmonic-card .h-label { color: #555; font-size: 0.78em; margin-top: 3px; }

/* ─── Info / prose text ─────────────────────────────────────── */
.info-text {
    color: #aaa;
    font-size: 0.9em;
    line-height: 1.8;
    margin: 8px 0;
}

.highlight {
    background: rgba(0, 212, 255, 0.12);
    padding: 2px 7px;
    border-radius: 4px;
    color: #00ffff;
    font-family: 'Monaco', monospace;
    font-size: 0.95em;
}

.quote-block {
    border-left: 3px solid #7d5ba6;
    padding: 10px 16px;
    margin: 14px 0;
    background: rgba(125, 91, 166, 0.06);
    border-radius: 0 8px 8px 0;
    color: #b0a0cc;
    font-style: italic;
    font-size: 0.92em;
}

/* ─── Sources / links ───────────────────────────────────────── */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.source-card {
    background: rgba(0, 153, 255, 0.05);
    border: 1px solid rgba(0, 153, 255, 0.2);
    border-radius: 8px;
    padding: 14px 16px;
}

.source-card .src-title { color: #00d4ff; font-weight: 700; font-size: 0.95em; margin-bottom: 4px; }
.source-card .src-desc  { color: #888; font-size: 0.83em; line-height: 1.6; }
.source-card a          { color: #0099ff; text-decoration: none; font-size: 0.82em; }
.source-card a:hover    { color: #00d4ff; text-decoration: underline; }

/* ─── Alerts ────────────────────────────────────────────────── */
.alert-item {
    background: rgba(255, 100, 100, 0.07);
    border-left: 3px solid #ff6b9d;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 0.88em;
}

.alert-item.high { border-left-color: #ff3333; background: rgba(255, 50, 50, 0.1); }

.alert-time { font-size: 0.82em; color: #666; margin-top: 3px; }

/* ─── Controls & buttons ────────────────────────────────────── */
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 10px 0;
}

button {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border: none;
    color: #0a0a14;
    padding: 8px 16px;
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.88em;
    transition: all 0.2s;
}

button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 212, 255, 0.3); }

.timeframe-btn {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: #888;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88em;
    font-weight: 600;
    transition: all 0.2s;
}

.timeframe-btn.active {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    border-color: #00d4ff;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.07);
    color: #aaa;
}

/* ─── Settings ──────────────────────────────────────────────── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.setting-row {
    background: rgba(0, 212, 255, 0.04);
    border: 1px solid rgba(0, 212, 255, 0.12);
    border-radius: 8px;
    padding: 14px;
}

.setting-row label { display: block; color: #888; font-size: 0.85em; margin-bottom: 6px; }

.setting-row input[type="number"],
.setting-row input[type="email"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: #e0e0e0;
    padding: 6px 10px;
    border-radius: 5px;
    font-size: 0.95em;
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

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

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    h1 { font-size: 1.7em; }
    .chart-wrapper { height: 240px; }
    .stats-row .stat-card { min-width: 80px; }
}
