/* Aurora Forecast - Professional Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(17, 24, 39, 0.95);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-green: #22c55e;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0d1525 50%, #0a1628 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Subtle aurora background effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60vh;
    background: radial-gradient(ellipse at 50% 0%, rgba(34, 197, 94, 0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 30% 10%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
                radial-gradient(ellipse at 70% 5%, rgba(139, 92, 246, 0.05) 0%, transparent 35%);
    pointer-events: none;
    z-index: 0;
}

main {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Navbar */
.navbar {
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent-green);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--accent-green); }
    50% { opacity: 0.7; box-shadow: 0 0 20px var(--accent-green); }
}

.navbar-nav { display: flex; align-items: center; gap: 20px; }
.navbar-text { color: var(--text-muted); font-size: 14px; }
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-link:hover { color: var(--text-primary); }

/* Dashboard */
.dashboard { max-width: 1200px; margin: 0 auto; }

/* Global Header */
.global-header {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 24px 32px;
    border-radius: var(--radius-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.global-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.5), rgba(59, 130, 246, 0.5), transparent);
}

.global-kp {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    min-width: 100px;
}

.kp-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.kp-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-green);
    line-height: 1;
    text-shadow: 0 0 30px rgba(34, 197, 94, 0.4);
}

.kp-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.r-scale {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
    width: 100%;
}

.r-scale-bar {
    position: relative;
    height: 6px;
    background: linear-gradient(to right, #22c55e 0%, #22c55e 17%, #eab308 17%, #eab308 50%, #ef4444 50%, #ef4444 100%);
    border-radius: 3px;
    overflow: visible;
}

.r-scale-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.r-scale-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 12px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
    transition: left 0.3s ease;
}

.r-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: var(--text-muted);
}

.global-info h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.global-info .update-info {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 6px;
}

.global-info .update-info span {
    color: var(--accent-green);
    font-weight: 600;
}

.activity-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    cursor: help;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.activity-dot.low { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.activity-dot.increased { background: #eab308; box-shadow: 0 0 8px #eab308; }
.activity-dot.moderate { background: #f97316; box-shadow: 0 0 8px #f97316; }
.activity-dot.high { background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: pulse 1s infinite; }
.activity-dot.storm { background: #dc2626; box-shadow: 0 0 15px #dc2626; animation: pulse 0.5s infinite; }

.activity-text {
    color: var(--text-secondary);
}

.activity-desc {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.global-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-hint {
    width: 100%;
    text-align: right;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: -8px;
}

.active-users {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
}

.user-stats-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.users-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}
.users-count { font-weight: 700; color: var(--text-primary); }
.users-label { font-size: 13px; color: var(--text-secondary); }

.total-users {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.total-count { font-weight: 600; color: var(--text-primary); }
.total-label { color: var(--text-muted); }

.last-active {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.last-user { color: var(--text-secondary); }

.lang-select {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.lang-select:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.lang-select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.lang-select option {
    background: #111827;
    color: #f8fafc;
    padding: 12px;
}

.lang-select option:hover,
.lang-select option:focus,
.lang-select option:checked {
    background: linear-gradient(135deg, #1a3a2a 0%, #1a2a3a 100%);
    color: #22c55e;
}

/* Data Sources Section */
.data-sources-section {
    margin-bottom: 24px;
}

.data-sources-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.data-sources-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--text-primary);
}

.toggle-icon {
    font-size: 16px;
}

.toggle-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.data-sources-toggle[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

.data-sources-content {
    display: none;
    margin-top: 16px;
    padding: 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.data-sources-content.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.data-source {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-source:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.data-source h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-source ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.data-source li {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 6px 0;
    padding-left: 16px;
    position: relative;
}

.data-source li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-green);
}

.data-source li strong {
    color: var(--text-primary);
    font-weight: 600;
}

.data-source p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.data-source .formula {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(6, 182, 212, 0.2);
    margin-top: 12px;
}

.data-sources-close {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.data-sources-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: var(--text-primary);
}

/* Responsive - Data Sources */
@media (max-width: 640px) {
    .data-sources-content {
        padding: 16px;
    }

    .data-source h4 {
        font-size: 14px;
    }

    .data-source li,
    .data-source p {
        font-size: 12px;
    }

    .data-source .formula {
        font-size: 10px;
        padding: 8px 10px;
        word-break: break-word;
    }
}

/* Map Section */
.map-section {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Finland Map */
.finland-map {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-self: start;
}

.map-container {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
}

.map-wrapper {
    position: relative;
    width: 90%;
    max-width: 280px;
    margin: 8px auto 24px;
    background: linear-gradient(180deg, #1a2744 0%, #0f1729 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    aspect-ratio: 1 / 1;
}

.finland-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    opacity: 0.85;
}

.map-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.map-svg .city-marker {
    pointer-events: auto;
}

.city-marker {
    cursor: pointer;
}

.city-marker circle {
    transition: r 0.15s ease, opacity 0.15s ease;
}

.city-marker:hover circle {
    r: 2.5;
    opacity: 1 !important;
}

.city-marker:hover circle:first-child {
    r: 5;
}

.map-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.legend-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.legend-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px currentColor;
}

.legend-note {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    opacity: 0.8;
}

/* City Panel */
.city-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.city-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.city-selector select {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.city-selector select:hover {
    border-color: rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.city-selector select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.city-selector select option {
    background: #111827;
    color: #f8fafc;
    padding: 12px;
}

.city-selector select option:hover,
.city-selector select option:focus,
.city-selector select option:checked {
    background: linear-gradient(135deg, #1a3a2a 0%, #1a2a3a 100%);
    color: #22c55e;
}

.btn-favorite {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.btn-favorite:hover {
    border-color: #fbbf24;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
}

.btn-favorite.active {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e293b;
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

/* City Stats */
.city-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.2);
}

.stat-card.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.stat-card.primary .stat-value {
    color: #60a5fa;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.stat-card.primary .stat-label { color: var(--text-secondary); }

.stat-icon { font-size: 28px; opacity: 0.8; }
.stat-content { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 14px; color: var(--text-secondary); margin-top: 4px; font-weight: 600; }
.stat-desc { font-size: 11px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 12px currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-desc {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Charts Section */
.charts-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, var(--accent-green), var(--accent-blue));
    border-radius: 2px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.chart-box:hover {
    border-color: rgba(148, 163, 184, 0.2);
}

.chart-box.main-chart {
    grid-column: span 2;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-info {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.chart-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: -12px 0 16px 0;
}

.chart-box canvas {
    height: 180px !important;
}

.chart-box.main-chart canvas {
    height: 240px !important;
}

/* Cities Section */
.cities-section {
    margin-bottom: 24px;
}

.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.city-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.city-card:hover {
    transform: translateY(-3px);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

.city-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.city-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.city-prob {
    font-size: 20px;
    font-weight: 700;
}

.city-card-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
}

.darkness-status {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.darkness-status.dark {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.darkness-status.light {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

/* Loading */
.loading {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: var(--text-muted); font-weight: 500; }

/* Error */
.error-msg {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px 28px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

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

/* Footer */
.footer {
    background: rgba(10, 15, 26, 0.95);
    backdrop-filter: blur(20px);
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Auth pages */
.auth-card {
    max-width: 420px;
    margin: 60px auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-card .card-header {
    position: relative;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 32px;
    text-align: center;
}

.auth-card .card-header h4 {
    font-size: 24px;
    font-weight: 700;
    margin-top: 8px;
}

.auth-logo {
    margin-bottom: 16px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.auth-card .card-body { padding: 32px; }

.auth-card .card-footer {
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-card .card-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-card .card-footer a:hover {
    text-decoration: underline;
}

.auth-lang-switch {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.lang-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    background: rgba(34, 197, 94, 0.05);
}

.lang-btn:hover {
    color: var(--text-primary);
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

.lang-btn.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.btn-primary, .btn-success {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-green) 0%, #16a34a 100%);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.text-danger { color: #fca5a5; font-size: 13px; margin-top: 6px; }
.mb-3 { margin-bottom: 20px; }

/* Responsive - Tablet */
@media (max-width: 900px) {
    .map-section {
        grid-template-columns: 1fr;
    }

    .finland-map {
        max-width: 400px;
        margin: 0 auto;
    }

    .map-wrapper {
        max-width: 350px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .chart-box.main-chart {
        grid-column: span 1;
    }

    .global-header {
        padding: 20px 24px;
    }

    .global-info h1 {
        font-size: 24px;
    }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    body::before {
        height: 40vh;
    }

    main { padding: 16px; }

    .navbar { padding: 14px 20px; }
    .navbar-brand { font-size: 16px; }

    .global-header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        text-align: center;
    }

    .global-kp {
        flex-direction: row;
        gap: 16px;
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
    }

    .kp-value { font-size: 32px; }

    .global-info h1 { font-size: 22px; }

    .global-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .map-section {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .finland-map {
        max-width: 100%;
        padding: 16px;
    }

    .map-wrapper {
        max-width: 100%;
        aspect-ratio: 1 / 1;
    }

    .city-panel {
        padding: 20px;
    }

    .city-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value { font-size: 24px; }

    .chart-box {
        padding: 20px;
    }

    .chart-box canvas {
        height: 160px !important;
    }

    .chart-box.main-chart canvas {
        height: 200px !important;
    }

    .cities-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .city-card {
        padding: 16px;
    }

    .city-name { font-size: 14px; }
    .city-prob { font-size: 18px; }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
    }

    .footer { padding: 16px; font-size: 12px; }

    /* Auth pages mobile */
    .auth-card {
        margin: 24px 16px;
    }

    .auth-card .card-header { padding: 24px; }
    .auth-card .card-header h4 { font-size: 20px; }
    .auth-card .card-body { padding: 24px; }
}

/* Very small screens */
@media (max-width: 360px) {
    .cities-grid {
        grid-template-columns: 1fr;
    }

    .global-kp {
        flex-direction: column;
        gap: 8px;
    }

    .kp-value { font-size: 28px; }

    .stat-card {
        gap: 12px;
    }
}
