/* stats_history.css — Stats History page styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Twemoji Flags', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

h1 {
    text-align: center;
    font-size: 2em;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.subtitle {
    text-align: center;
    font-size: 1.05em;
    opacity: 0.75;
    margin-bottom: 18px;
}

/* ── Nav links ─────────────────────────────────────────────────────────── */
.nav-link {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9em;
    transition: background 0.2s;
}
.nav-link:hover { background: rgba(255,255,255,0.2); }

/* ── Tab bar ───────────────────────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 6px;
    margin: 18px 0 0;
    border-bottom: 2px solid rgba(255,255,255,0.15);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px 8px 0 0;
    background: rgba(255,255,255,0.07);
    color: #ccc;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.tab-btn.active {
    background: rgba(99,179,237,0.18);
    color: #63b3ed;
    border-bottom: 2px solid #63b3ed;
}

/* ── Controls ──────────────────────────────────────────────────────────── */
.controls {
    background: rgba(255,255,255,0.06);
    border-radius: 0 8px 8px 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
}

.control-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 140px;
}

.control-group label {
    font-size: 0.82em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.label-hint {
    font-size: 0.85em;
    opacity: 0.6;
    text-transform: none;
    letter-spacing: 0;
}

.control-group input,
.control-group select {
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: #e0e0e0;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}
.control-group input:focus,
.control-group select:focus {
    border-color: #63b3ed;
}
.control-group select option { background: #1a1a2e; color: #e0e0e0; }

.btn-group { justify-content: flex-end; }

.btn-primary {
    padding: 9px 22px;
    border: none;
    border-radius: 6px;
    background: #3182ce;
    color: #fff;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-primary:hover { background: #2b6cb0; }
.btn-primary:disabled { background: #4a5568; cursor: not-allowed; }

/* ── Status bar ────────────────────────────────────────────────────────── */
.status-bar {
    text-align: center;
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    font-size: 0.9em;
    margin-bottom: 16px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.status-bar.error { background: rgba(245,101,101,0.2); color: #fc8181; }
.status-bar.success { background: rgba(72,187,120,0.15); color: #68d391; }
.status-bar.loading { background: rgba(99,179,237,0.12); color: #90cdf4; }

/* ── Tab content ───────────────────────────────────────────────────────── */
.tab-content { display: flex; flex-direction: column; gap: 20px; }
.tab-content.hidden { display: none; }

/* ── Chart cards ───────────────────────────────────────────────────────── */
.chart-card {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px 24px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.chart-card h2 {
    font-size: 1.05em;
    font-weight: 600;
    margin-bottom: 12px;
    color: #e2e8f0;
}

.callsign-label {
    font-size: 0.85em;
    color: #63b3ed;
    font-weight: 400;
}

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

/* ── Window / band sub-tabs ────────────────────────────────────────────── */
.window-tabs,
.band-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.win-btn,
.band-btn {
    padding: 5px 14px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: #ccc;
    font-size: 0.82em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.win-btn:hover,
.band-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.win-btn.active,
.band-btn.active {
    background: rgba(99,179,237,0.2);
    color: #63b3ed;
    border-color: #63b3ed;
}

/* ── Point-in-time leaderboard tables ──────────────────────────────────── */
.at-hint {
    font-size: 0.82em;
    color: #a0aec0;
    margin-bottom: 12px;
    max-width: 70ch;
}

.rank-table-note {
    font-size: 0.78em;
    color: #a0aec0;
    margin-bottom: 6px;
}

.at-controls {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 14px;
}

.at-controls .btn-primary { padding: 8px 18px; }

.rank-tables {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.rank-table-wrap h3 {
    font-size: 0.92em;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
}

/* Long band lists scroll inside the card rather than stretching the page. */
.rank-table-scroll {
    max-height: 420px;
    overflow: auto;
}

table.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84em;
}

table.rank-table th {
    position: sticky;
    top: 0;
    background: #1f2740;
    color: #a0aec0;
    font-weight: 600;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
}

table.rank-table td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: #e0e0e0;
}

table.rank-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.rank-table td.rank { color: #a0aec0; width: 3em; }
table.rank-table td.software { color: #9aa5b1; font-size: 0.92em; }
table.rank-table tbody tr:hover { background: rgba(255,255,255,0.05); }
table.rank-table tbody tr.is-station { background: rgba(99,179,237,0.14); }
table.rank-table tbody tr.is-station td { color: #90cdf4; }
table.rank-table tbody tr.is-ubersdr td.software { color: #68d391; }

.rank-band-heading {
    color: #63b3ed;
    font-weight: 600;
    background: rgba(99,179,237,0.08);
}

/* ── No-data message ───────────────────────────────────────────────────── */
.no-data {
    text-align: center;
    padding: 40px;
    opacity: 0.6;
    font-size: 1.05em;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85em;
    opacity: 0.7;
}
.site-footer a { color: #63b3ed; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ── Awards bar ────────────────────────────────────────────────────────── */
.awards-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
    align-items: center;
}

.awards-bar-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
    margin-right: 4px;
    white-space: nowrap;
}

.award-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.award-badge.gold {
    background: rgba(214,158,46,0.18);
    border-color: rgba(214,158,46,0.45);
    color: #f6e05e;
}
.award-badge.silver {
    background: rgba(160,174,192,0.18);
    border-color: rgba(160,174,192,0.45);
    color: #cbd5e0;
}
.award-badge.bronze {
    background: rgba(180,107,60,0.18);
    border-color: rgba(180,107,60,0.45);
    color: #f6ad55;
}

.awards-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.12);
    margin: 0 4px;
}

/* ── Snapshot summary bar ──────────────────────────────────────────────── */
.snapshot-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 10px 18px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 4px;
    align-items: center;
    font-size: 0.82em;
    line-height: 1.4;
}

.summary-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 10px;
    align-items: center;
}

.summary-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
    white-space: nowrap;
    margin-right: 2px;
}

/* Callsign heading in front of a station's pills when comparing two stations. */
.summary-station {
    font-weight: 700;
    font-size: 0.86em;
    color: #63b3ed;
    letter-spacing: 0.03em;
    margin-right: 4px;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: #cbd5e0;
    font-size: 0.82em;
    white-space: nowrap;
}

.summary-pill .pill-key {
    color: #718096;
    font-size: 0.9em;
}

.summary-pill .pill-val {
    color: #e2e8f0;
    font-weight: 600;
}

.summary-pill .pill-rank {
    color: #63b3ed;
    font-weight: 700;
}

.summary-divider {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 2px;
    flex-shrink: 0;
}

/* ── Space weather toggle ──────────────────────────────────────────────── */
.sw-toggle-group {
    justify-content: flex-end;
    min-width: auto;
}

.sw-toggle-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 0.88em !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    opacity: 1 !important;
    color: #e0e0e0;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    background: rgba(255,255,255,0.06);
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    user-select: none;
}

.sw-toggle-label:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(246,173,85,0.5);
}

.sw-toggle-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #f6ad55;
    cursor: pointer;
    flex-shrink: 0;
    /* override the generic control-group input styles */
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Highlight the label when checked */
#sw-overlay:checked + .sw-toggle-label,
.sw-toggle-label:has(#sw-overlay:checked) {
    border-color: rgba(246,173,85,0.6);
    background: rgba(246,173,85,0.1);
    color: #f6ad55;
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    body { padding: 12px; }
    h1 { font-size: 1.5em; }
    .tab-btn { padding: 8px 14px; font-size: 0.85em; }
    .chart-wrap { height: 220px; }
    .control-group { min-width: 100%; }
}
