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

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255,255,255,0.05);
    --bg-card-hover: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255,255,255,0.7);
    --text-muted: rgba(255,255,255,0.5);
    --accent: #4285f4;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --globe-bg: #050510;
    --ocean: #0a1628;
    --land: rgba(40, 80, 60, 0.9);
}

[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-card: rgba(0,0,0,0.03);
    --bg-card-hover: rgba(0,0,0,0.06);
    --border: rgba(0,0,0,0.1);
    --text-primary: #1a1a2e;
    --text-secondary: rgba(0,0,0,0.7);
    --text-muted: rgba(0,0,0,0.5);
    --globe-bg: #e8f4fc;
    --ocean: #a8d5e5;
    --land: rgba(80, 140, 100, 0.9);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

/* Loading */
#loading {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 60px; height: 60px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 20px; color: var(--text-secondary); }
.progress-bar {
    width: 200px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    width: 0%;
    transition: width 0.3s;
}

/* Header */
header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 600;
}
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), #9c27b0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.theme-toggle {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}
.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #3367d6; }

/* Main Layout */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}
.dashboard {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}
@media (max-width: 1200px) {
    .dashboard { grid-template-columns: 1fr; }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}
.card:hover { border-color: var(--accent); }
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 1.5rem; }

/* Globe */
.globe-card {
    position: relative;
    aspect-ratio: 16/10;
    min-height: 500px;
}
#globe-container {
    position: absolute;
    inset: 0;
    background: var(--globe-bg);
    border-radius: 16px;
}

/* Globe Controls */
.globe-overlay {
    position: absolute;
    inset: 1rem;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.globe-overlay > * { pointer-events: auto; }
.globe-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.model-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.6);
    padding: 4px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}
[data-theme="light"] .model-tabs { background: rgba(255,255,255,0.9); }
.model-tab {
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}
.model-tab.active { background: var(--accent); color: white; }
.model-tab:hover:not(.active) { background: rgba(255,255,255,0.1); }
[data-theme="light"] .model-tab:hover:not(.active) { background: rgba(0,0,0,0.1); }

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.6);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    backdrop-filter: blur(10px);
}
[data-theme="light"] .live-badge { background: rgba(255,255,255,0.9); color: var(--text-primary); }
.live-dot {
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Timeline */
.timeline-panel {
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1rem;
}
[data-theme="light"] .timeline-panel { background: rgba(255,255,255,0.95); }
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.timeline-date { font-size: 1rem; font-weight: 500; }
.timeline-btns { display: flex; gap: 6px; }
.timeline-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.timeline-btn:hover, .timeline-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.timeline-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 4px;
    outline: none;
}
.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.timeline-marks {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Legend */
.legend {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.75rem;
}
[data-theme="light"] .legend { background: rgba(255,255,255,0.9); }
.legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.legend-item:last-child { margin-bottom: 0; }
.legend-line { width: 20px; height: 3px; border-radius: 2px; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }

/* Storm Info */
.storm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.storm-icon {
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--danger), var(--warning));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
.storm-name { font-size: 1.3rem; font-weight: 600; }
.storm-cat {
    display: inline-block;
    padding: 3px 8px;
    background: var(--danger);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    margin-top: 4px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* Storm List */
.storm-list { display: flex; flex-direction: column; gap: 0.5rem; }
.storm-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.storm-item:hover, .storm-item.active {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.storm-item-icon { font-size: 1.2rem; }
.storm-item-info { flex: 1; }
.storm-item-name { font-weight: 500; font-size: 0.9rem; }
.storm-item-meta { font-size: 0.7rem; color: var(--text-muted); }

/* Accuracy Bars */
.accuracy-item { margin-bottom: 0.75rem; }
.accuracy-item:last-child { margin-bottom: 0; }
.accuracy-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
}
.accuracy-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.accuracy-fill { height: 100%; border-radius: 3px; transition: width 1s; }

/* Chart */
.chart-card { margin-top: 1.5rem; }
.chart-container { height: 220px; }

/* Weather Grid */
.weather-section { margin-top: 1.5rem; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.section-title { font-size: 1.2rem; font-weight: 600; }
.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}
.weather-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s;
}
.weather-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.weather-location { font-weight: 600; }
.weather-country { font-size: 0.75rem; color: var(--text-muted); }
.weather-icon { font-size: 2.5rem; }
.weather-temp { font-size: 2rem; font-weight: 300; }
.weather-details {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: 2rem;
    padding: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* 7-Day Forecast */
.week-forecast {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    gap: 0.25rem;
}
.forecast-day {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    transition: background 0.3s;
}
.forecast-day.today {
    background: var(--bg-card-hover);
}
.forecast-day-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.forecast-icon {
    font-size: 1.2rem;
    margin: 0.25rem 0;
}
.forecast-temps {
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.temp-high { color: var(--danger); font-weight: 500; }
.temp-low { color: var(--accent); }
.precip-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.6rem;
    margin-top: 4px;
    background: rgba(66,133,244,0.2);
    color: var(--accent);
}
.precip-badge.high {
    background: rgba(239,68,68,0.2);
    color: var(--danger);
}
.precip-badge.medium {
    background: rgba(251,188,4,0.2);
    color: var(--warning);
}
.precip-badge.low {
    background: rgba(52,168,83,0.2);
    color: var(--success);
}

/* AI Prediction */
.ai-prediction {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.75rem;
}
.ai-pred-header {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.ai-pred-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.ai-accuracy {
    font-weight: 600;
}

/* Mobile */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .globe-card { min-height: 350px; }
    .header-controls .btn span { display: none; }
    .week-forecast { flex-wrap: wrap; }
    .forecast-day { min-width: 13%; }
}
