/* ==============================================================================
   APEX WEATHER v1.0.0 — Modern Dark Theme Stylesheet
   ============================================================================== */

:root {
    --bg-dark: #07090e;
    --bg-card: rgba(14, 20, 32, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f4f8;
    --text-secondary: #8a99ad;
    --text-muted: #536277;
    
    --accent-emerald: #00e676;
    --accent-emerald-glow: rgba(0, 230, 118, 0.25);
    --accent-amber: #ffb300;
    --accent-amber-glow: rgba(255, 179, 0, 0.25);
    --accent-cyan: #00e5ff;
    --accent-cyan-glow: rgba(0, 229, 255, 0.2);
    --accent-rose: #ff1744;
    --accent-purple: #b388ff;
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

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

body.apex-weather-body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Ambient Glows */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.15;
}
.glow-cyan {
    top: -100px;
    left: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-cyan), transparent 70%);
}
.glow-amber {
    bottom: -100px;
    right: -100px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-amber), transparent 70%);
}

.mono {
    font-family: var(--font-mono);
}

/* Header */
.apex-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 36px;
    background: rgba(7, 9, 14, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--bg-card-border);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.fleet-hub-link {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.fleet-hub-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}
.hub-icon {
    color: var(--accent-cyan);
    font-size: 1rem;
}

.brand-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.12);
}

.brand-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.brand-badge-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.engine-badge {
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(255, 179, 0, 0.2));
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.version-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
}
.option-badge {
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
}
.mode-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.mode-badge.shadow-mode {
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.4);
    color: var(--accent-emerald);
}
.mode-badge.live-mode {
    background: rgba(255, 23, 68, 0.2);
    border: 1px solid rgba(255, 23, 68, 0.6);
    color: var(--accent-rose);
    animation: livePulse 2s infinite;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Telemetry Pill */
.telemetry-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(14, 20, 32, 0.8);
    border: 1px solid var(--bg-card-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.telemetry-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-cyan);
}
.telemetry-dot.live-pulse {
    box-shadow: 0 0 10px var(--accent-cyan);
    animation: dotPulse 1.8s infinite;
}
.mono-time {
    color: var(--text-primary);
    font-weight: 600;
}

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Admin Controls */
.admin-control-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(14, 20, 32, 0.8);
    border: 1px solid var(--bg-card-border);
    padding: 6px 12px;
    border-radius: 20px;
}
.admin-auth-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.admin-auth-btn.locked { color: var(--accent-amber); }
.admin-auth-btn.unlocked { color: var(--accent-emerald); }

.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2b3545;
    transition: .3s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}
.slider.round { border-radius: 20px; }
.slider.round:before { border-radius: 50%; }
input:checked + .slider { background-color: var(--accent-cyan); }
input:checked + .slider:before { transform: translateX(16px); }
.master-switch-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

/* Main Container */
.apex-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    z-index: 1;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.kpi-card {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
}
.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.kpi-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
}
.kpi-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}
.cyan-pill { background: rgba(0, 229, 255, 0.12); color: var(--accent-cyan); border: 1px solid rgba(0, 229, 255, 0.3); }
.amber-pill { background: rgba(255, 179, 0, 0.12); color: var(--accent-amber); border: 1px solid rgba(255, 179, 0, 0.3); }
.green-pill { background: rgba(0, 230, 118, 0.12); color: var(--accent-emerald); border: 1px solid rgba(0, 230, 118, 0.3); }
.purple-pill { background: rgba(179, 136, 255, 0.12); color: var(--accent-purple); border: 1px solid rgba(179, 136, 255, 0.3); }

.kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.kpi-val {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
}
.kpi-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.kpi-footer-metric {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
}
.accent-dot { color: var(--text-muted); }

/* Color utilities */
.c-green { color: var(--accent-emerald); }
.c-amber { color: var(--accent-amber); }
.c-cyan { color: var(--accent-cyan); }
.c-rose { color: var(--accent-rose); }
.c-rose-bright { color: #ff5252; }
.c-amber-glow { color: #ffe082; text-shadow: 0 0 12px rgba(255, 179, 0, 0.4); }
.c-amber-bright { color: #ffd54f; }
.font-bold { font-weight: 700; }

/* Section Styles */
.section-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-icon {
    font-size: 1.3rem;
}
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}
.section-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.badge-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.dot-legend {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.cooling-dot { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.peak-dot { background: var(--accent-amber); }

/* Stations Radar Grid */
.stations-radar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.station-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.station-card.ratchet-active {
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}
.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.station-code-badge {
    font-size: 0.85rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 229, 255, 0.12);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}
.station-stage-pill {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
}
.stage-cooling {
    background: rgba(0, 229, 255, 0.2);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.4);
}
.stage-peak {
    background: rgba(255, 179, 0, 0.2);
    color: var(--accent-amber);
    border: 1px solid rgba(255, 179, 0, 0.4);
}
.stage-night {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.station-temp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.station-metro {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}
.station-temp-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-cyan);
}
.station-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}
.station-peak-info strong {
    color: var(--accent-amber);
}

/* Visualizer Card */
.visualizer-card {
    padding: 26px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.visualizer-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}
.math-formula {
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--accent-cyan);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}
.corridor-diagram-wrap {
    display: grid;
    grid-template-columns: 1fr 1.6fr 1fr;
    gap: 16px;
}
.corridor-zone {
    padding: 20px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    position: relative;
}
.zone-impossible {
    background: rgba(255, 23, 68, 0.05);
    border: 1px dashed rgba(255, 23, 68, 0.3);
}
.zone-floor-right {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.zone-golden-corridor {
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.15), rgba(0, 229, 255, 0.15));
    border: 2px solid var(--accent-amber);
    box-shadow: 0 0 25px rgba(255, 179, 0, 0.2);
}
.golden-sparkle {
    position: absolute;
    top: 6px;
    right: 12px;
    font-size: 0.75rem;
    color: var(--accent-amber);
}
.zone-tag {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}
.zone-range {
    font-size: 0.95rem;
    font-weight: 700;
}
.zone-payout {
    font-size: 0.9rem;
    font-weight: 600;
}
.zone-roi {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.corridor-proof-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
}
.proof-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Tables */
.table-container {
    overflow-x: auto;
}
.apex-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}
.apex-table th {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--bg-card-border);
}
.apex-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.apex-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}
.table-empty {
    text-align: center;
    padding: 30px !important;
    color: var(--text-muted);
}

.table-pill {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}
.table-pill.shadow-pill {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
}
.table-pill.double-win {
    background: rgba(255, 179, 0, 0.2);
    color: var(--accent-amber);
    border: 1px solid rgba(255, 179, 0, 0.4);
}
.table-pill.floor-win {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-emerald);
}

/* Terminal Body */
.terminal-card {
    padding: 0;
    overflow: hidden;
}
.terminal-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--bg-card-border);
}
.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dot.red { background: #ff5252; }
.terminal-dot.yellow { background: #ffd740; }
.terminal-dot.green { background: #69f0ae; }
.terminal-title {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-left: 8px;
}
.terminal-body {
    padding: 16px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
}
.log-line {
    word-break: break-all;
}

/* Footer */
.apex-footer {
    border-top: 1px solid var(--bg-card-border);
    padding: 24px 36px;
    background: rgba(7, 9, 14, 0.9);
    margin-top: 40px;
}
.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.footer-right {
    display: flex;
    gap: 20px;
}
.footer-right a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-right a:hover {
    color: var(--accent-cyan);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-card {
    padding: 30px;
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.modal-card input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-card-border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-mono);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-primary {
    background: var(--accent-cyan);
    color: black;
    font-weight: 700;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.hidden { display: none !important; }

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@media (max-width: 900px) {
    .corridor-diagram-wrap {
        grid-template-columns: 1fr;
    }
    .apex-header {
        padding: 14px 20px;
        flex-direction: column;
        gap: 14px;
        align-items: flex-start;
    }
}
