/* ========================================
   Nashville Storm Monitor - Design System
   ======================================== */

/* CSS Custom Properties */
:root {
    /* Colors - Cold Storm Palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-panel: rgba(17, 24, 39, 0.8);
    --bg-panel-solid: #1a2332;

    --accent-ice: #60a5fa;
    --accent-ice-dim: #3b82f6;
    --accent-frost: #93c5fd;
    --accent-snow: #e0f2fe;

    --alert-warning: #fbbf24;
    --alert-watch: #f97316;
    --alert-danger: #ef4444;
    --alert-advisory: #a78bfa;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(148, 163, 184, 0.15);
    --border-glow: rgba(96, 165, 250, 0.3);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(96, 165, 250, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;

    /* Subtle animated snow background */
    background-image:
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(147, 197, 253, 0.02) 0%, transparent 40%),
        radial-gradient(circle at 40% 80%, rgba(96, 165, 250, 0.02) 0%, transparent 45%);
}

a {
    color: var(--accent-ice);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-frost);
}

/* ========================================
   Header
   ======================================== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-ice);
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.4));
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-frost) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.storm-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--alert-danger);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--alert-danger);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.current-conditions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.temp-display {
    display: flex;
    align-items: flex-start;
}

.temp-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.temp-unit {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 4px;
}

.conditions-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 120px;
}

.last-update {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.last-update time {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

/* ========================================
   Main Dashboard Grid
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-lg);
    padding: var(--space-lg) var(--space-xl);
    min-height: calc(100vh - 140px);

    grid-template-areas:
        "alerts cameras weather"
        "map map feed";
    /* Note: 'alerts' grid area now contains the livestream panel */
}

/* ========================================
   Panel Base Styles
   ======================================== */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.panel:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.panel-header h2 svg {
    width: 18px;
    height: 18px;
    color: var(--accent-ice);
}

/* ========================================
   Alerts Ticker
   ======================================== */
.alerts-ticker-container {
    display: flex;
    align-items: stretch;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(251, 191, 36, 0.1) 50%, rgba(239, 68, 68, 0.15) 100%);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    overflow: hidden;
    min-height: 44px;
}

.alerts-ticker-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: rgba(239, 68, 68, 0.2);
    border-right: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--alert-danger);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    white-space: nowrap;
    flex-shrink: 0;
}

.alerts-ticker-label svg {
    width: 16px;
    height: 16px;
    animation: pulse 2s infinite;
}

.alerts-ticker-track {
    flex: 1;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.alerts-ticker-content {
    display: flex;
    gap: var(--space-2xl);
    padding: var(--space-sm) var(--space-lg);
    animation: ticker-scroll 30s linear infinite;
    white-space: nowrap;
    width: max-content;
}

.alerts-ticker-content:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.ticker-alert-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xs) var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.ticker-alert-item:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.02);
}

.ticker-alert-item.danger {
    border-left: 3px solid var(--alert-danger);
}

.ticker-alert-item.watch {
    border-left: 3px solid var(--alert-watch);
}

.ticker-alert-item.warning {
    border-left: 3px solid var(--alert-warning);
}

.ticker-alert-item.advisory {
    border-left: 3px solid var(--alert-advisory);
}

.ticker-alert-item .alert-event {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.ticker-alert-item .alert-headline {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ticker-alert-item .alert-divider {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ========================================
   Live Stream Panel
   ======================================== */
.livestream-panel {
    grid-area: alerts;
    height: 620px;
    display: flex;
    flex-direction: column;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-xl);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--alert-danger);
    letter-spacing: 0.05em;
}

.livestream-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    background: var(--bg-secondary);
}

.livestream-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Channel Selector */
.channel-selector {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
    overflow: hidden;
}

.channel-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.channel-selector-header h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.live-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.channel-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    overflow-y: auto;
    flex: 1;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.channel-item:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--border-glow);
}

.channel-item.active {
    background: rgba(96, 165, 250, 0.15);
    border-color: var(--accent-ice);
}

.channel-thumbnail {
    width: 60px;
    height: 34px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-secondary);
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-status {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.channel-live-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--alert-danger);
    text-transform: uppercase;
}

.channel-live-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--alert-danger);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.channel-live-indicator.offline {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}

.channel-live-indicator.offline::before {
    background: var(--text-muted);
    animation: none;
}

/* ========================================
   Alerts Panel (Legacy - now used for ticker)
   ======================================== */
.alerts-panel {
    grid-area: alerts;
}

.alert-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--space-sm);
    background: var(--alert-danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-xl);
}

.alerts-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.alert-item {
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--alert-warning);
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.alert-item:hover {
    transform: translateX(4px);
    background: rgba(0, 0, 0, 0.4);
}

.alert-item.warning {
    border-left-color: var(--alert-warning);
}

.alert-item.watch {
    border-left-color: var(--alert-watch);
}

.alert-item.danger {
    border-left-color: var(--alert-danger);
}

.alert-item.advisory {
    border-left-color: var(--alert-advisory);
}

.alert-item h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.alert-item p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.alert-item .alert-meta {
    display: flex;
    justify-content: space-between;
    margin-top: var(--space-sm);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========================================
   Traffic Cameras Panel
   ======================================== */
.cameras-panel {
    grid-area: cameras;
    height: 620px;
    display: flex;
    flex-direction: column;
}

.view-all-link {
    font-size: 0.75rem;
    font-weight: 500;
}

.cameras-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--space-sm);
    padding: var(--space-md);
    overflow: hidden;
}

.camera-card {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 16 / 10;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.camera-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.camera-card .camera-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.9);
    transition: opacity var(--transition-normal), filter var(--transition-fast);
    z-index: 1;
}

.camera-card .camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.camera-card .camera-error {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(96, 165, 250, 0.1) 100%);
    color: var(--text-muted);
    font-size: 0.7rem;
}

.camera-card .camera-error svg {
    opacity: 0.5;
}

.camera-card .camera-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: 0.75rem;
    font-weight: 500;
}

.camera-card .camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 5;
    cursor: pointer;
}

.camera-card:hover .camera-overlay {
    opacity: 1;
}

.camera-card .camera-overlay svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.camera-card .camera-overlay span {
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.camera-card .camera-live {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.9);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
}

.camera-card .camera-live::before {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.camera-card .camera-external {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    z-index: 15;
}

.camera-card:hover .camera-external {
    opacity: 1;
    transform: translateY(0);
}

.camera-card .camera-external:hover {
    background: rgba(0, 0, 0, 0.8);
    color: var(--accent-ice);
}

/* ========================================
   Camera Modal
   ======================================== */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.camera-modal.active {
    opacity: 1;
}

.camera-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.camera-modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    max-height: 700px;
    background: var(--bg-panel-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.camera-modal.active .camera-modal-content {
    transform: scale(1);
}

.camera-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
}

.camera-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.camera-modal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.modal-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.modal-btn:hover {
    border-color: var(--accent-ice);
    color: var(--accent-ice);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.camera-modal-body {
    flex: 1;
    background: var(--bg-secondary);
}

.camera-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ========================================
   Weather Panel
   ======================================== */
.weather-panel {
    grid-area: weather;
    height: 620px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.weather-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    padding: var(--space-md);
}

.stat-card {
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-frost);
}

.forecast-section {
    border-top: 1px solid var(--border-color);
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
}

.forecast-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.forecast-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.forecast-item .forecast-day {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 80px;
}

.forecast-item .forecast-icon {
    font-size: 1.25rem;
}

.forecast-item .forecast-desc {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.forecast-item .forecast-temp {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-ice);
}

/* ========================================
   Map Panel
   ======================================== */
.map-panel {
    grid-area: map;
    max-height: 500px;
}

.map-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.radar-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-ice);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.radar-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.opacity-control {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: var(--space-sm);
    padding-left: var(--space-sm);
    border-left: 1px solid var(--border-color);
}

.opacity-control label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.opacity-control input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 2px;
    cursor: pointer;
}

.opacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-ice);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.opacity-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.opacity-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-ice);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.map-btn {
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.map-btn:hover {
    border-color: var(--accent-ice);
    color: var(--accent-ice);
}

.map-btn.active {
    background: var(--accent-ice);
    border-color: var(--accent-ice);
    color: var(--bg-primary);
}

/* Incidents Toggle Button */
.incidents-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: var(--space-sm);
}

.incidents-toggle:hover {
    border-color: var(--alert-watch);
    color: var(--alert-watch);
}

.incidents-toggle.active {
    border-color: var(--alert-watch);
    color: var(--alert-watch);
}

.incidents-toggle.active svg {
    fill: var(--alert-watch);
    fill-opacity: 0.2;
}

.incident-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--alert-watch);
    color: var(--bg-primary);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
}

.weather-map {
    flex: 1;
    min-height: 300px;
    max-height: 450px;
    background: var(--bg-secondary);
}

/* Leaflet custom styling */
.leaflet-container {
    background: var(--bg-secondary);
    font-family: var(--font-sans);
}

.leaflet-control-zoom a {
    background: var(--bg-panel-solid) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-secondary) !important;
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-panel-solid) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
    margin: 12px 14px !important;
    font-size: 0.875rem !important;
}

.leaflet-popup-tip {
    background: var(--bg-panel-solid) !important;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* ========================================
   News/Feed Panel
   ======================================== */
.feed-panel {
    grid-area: feed;
}

.feed-tabs {
    display: flex;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.feed-tab {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.feed-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.feed-tab.active {
    color: var(--accent-ice);
    background: rgba(96, 165, 250, 0.1);
}

.feed-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.feed-list.hidden {
    display: none;
}

.feed-item {
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.feed-item:hover {
    background: rgba(0, 0, 0, 0.3);
}

.feed-item h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

.feed-item h4 a:hover {
    text-decoration: underline;
}

.feed-item .feed-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.social-embed {
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

/* Bluesky embed custom styling */
.social-embed bsky-embed {
    --bsky-bg: transparent;
}

.social-embed::-webkit-scrollbar {
    width: 6px;
}

.social-embed::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.social-embed::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 3px;
}

.social-embed::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

/* ========================================
   Coverage Tabs (Live Coverage Panel)
   ======================================== */
.coverage-tabs {
    display: flex;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.coverage-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.coverage-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.coverage-tab.active {
    color: var(--accent-ice);
    background: rgba(96, 165, 250, 0.15);
}

.coverage-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Allow flex shrinking */
}

.coverage-pane {
    display: none;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    /* Allow flex shrinking */
}

.coverage-pane.active {
    display: flex;
    flex-direction: column;
}

.coverage-pane .channel-selector {
    border-top: none;
}

.coverage-pane .social-embed {
    padding: var(--space-md);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.coverage-pane .feed-list {
    padding: var(--space-md);
}

/* ========================================
   Incidents Panel
   ======================================== */
.incidents-panel {
    grid-area: feed;
    max-height: 500px;
}

.incident-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--alert-danger);
}

.incident-badge .pulse {
    width: 8px;
    height: 8px;
}

.incidents-filter {
    display: flex;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.incident-filter-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.incident-filter-btn:hover {
    color: var(--text-secondary);
    border-color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

.incident-filter-btn.active {
    color: var(--accent-ice);
    background: rgba(96, 165, 250, 0.1);
    border-color: var(--accent-ice);
}

.incidents-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 380px;
}

.incident-item {
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent-ice);
    transition: all var(--transition-fast);
}

.incident-item:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateX(2px);
}

.incident-item.severe {
    border-left-color: #ef4444;
}

.incident-item.major {
    border-left-color: #f97316;
}

.incident-item.traffic {
    border-left-color: #eab308;
}

.incident-item.fire {
    border-left-color: #dc2626;
}

.incident-item.medical {
    border-left-color: #ec4899;
}

.incident-item.alarm {
    border-left-color: #a78bfa;
}

.incident-item .incident-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.incident-item .incident-type {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.incident-item .incident-source {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.incident-item .incident-source.police {
    background: rgba(96, 165, 250, 0.2);
    color: var(--accent-ice);
}

.incident-item .incident-source.fire {
    background: rgba(220, 38, 38, 0.2);
    color: #ef4444;
}

.incident-item .incident-location {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.incident-item .incident-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

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

.no-incidents {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.no-incidents svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

/* Scrollbar for incidents list */
.incidents-list::-webkit-scrollbar {
    width: 6px;
}

.incidents-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.incidents-list::-webkit-scrollbar-thumb {
    background: rgba(239, 68, 68, 0.3);
    border-radius: 3px;
}

.incidents-list::-webkit-scrollbar-thumb:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* ========================================
   Footer
   ======================================== */

.dashboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer-left .divider {
    color: var(--border-color);
}

.footer-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.refresh-btn:hover {
    border-color: var(--accent-ice);
    color: var(--accent-ice);
}

.refresh-btn svg {
    width: 14px;
    height: 14px;
}

.refresh-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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

/* ========================================
   Loading States
   ======================================== */
.loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            rgba(255, 255, 255, 0.05) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-line.short {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "alerts weather"
            "cameras cameras"
            "map feed";
    }

    .cameras-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "alerts"
            "weather"
            "cameras"
            "map"
            "feed";
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .cameras-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }

    .weather-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-footer {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .footer-left,
    .footer-right {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cameras-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .camera-card {
        aspect-ratio: 16 / 9;
        margin-bottom: var(--space-sm);
    }

    /* Remove fixed heights on mobile */
    .livestream-panel,
    .cameras-panel,
    .weather-panel {
        height: auto;
    }

    .weather-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .logo h1 {
        font-size: 1rem;
    }

    .temp-value {
        font-size: 2rem;
    }
}

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}