/* ============================================================
   FLOOD SENTINEL v4 — Premium Design System
   Flood Sentinel v5 — Multi-Catchment Monitoring
   ============================================================ */

/* ---------- Web Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Core Palette — Clean, Professional (Google Flood Dashboard inspired) */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f4;
  --bg-card: rgba(255, 255, 255, 0.98);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --text-inverse: #ffffff;
  --border-color: rgba(218, 220, 224, 0.8);
  --border-hover: rgba(26, 115, 232, 0.3);
  --divider: rgba(218, 220, 224, 0.6);

  /* Accent — Google Blue (muted, professional) */
  --accent-start: #1a73e8;
  --accent-mid: #1a73e8;
  --accent-end: #4285f4;
  --accent: var(--accent-mid);
  --accent-hover: #1557b0;
  --accent-glow: rgba(26, 115, 232, 0.05);
  --accent-gradient: linear-gradient(135deg, #1a73e8, #4285f4);
  --accent-gradient-h: linear-gradient(90deg, #1a73e8, #4285f4);

  /* Google Flood Dashboard Status Colors */
  --status-normal: #34a853;
  --status-normal-bg: rgba(52, 168, 83, 0.12);
  --status-minor: #fbbc04;
  --status-minor-bg: rgba(251, 188, 4, 0.12);
  --status-moderate: #FF8C00;
  --status-moderate-bg: rgba(255, 140, 0, 0.12);
  --status-major: #ea4335;
  --status-major-bg: rgba(234, 67, 53, 0.12);
  --status-info: #4285f4;
  --status-info-bg: rgba(66, 133, 244, 0.12);

  /* Risk Badge Colors */
  --risk-normal: var(--status-normal);
  --risk-minor: var(--status-minor);
  --risk-moderate: var(--status-moderate);
  --risk-major: var(--status-major);

  /* Semantic Aliases (used in templates) */
  --accent-primary: var(--accent-mid);
  --accent-secondary: var(--accent-end);
  --border-primary: var(--border-color);
  --border-secondary: var(--border-hover);
  --text-muted: var(--text-tertiary);

  /* Chart Palette — Google Material */
  --chart-1: #4285f4;
  --chart-2: #a142f4;
  --chart-3: #24c1e0;
  --chart-4: #34a853;
  --chart-5: #fbbc04;
  --chart-6: #ea4335;
  --chart-7: #e8710a;
  --chart-8: #5e6ad2;

  /* Flat cards — no glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.97);
  --glass-bg-strong: rgba(255, 255, 255, 0.99);
  --glass-border: rgba(218, 220, 224, 0.8);
  --glass-blur: 8px;
  --glass-blur-heavy: 16px;

  /* Shadow System — Google Material */
  --shadow-xs: 0 1px 2px rgba(60, 64, 67, 0.1);
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.15);
  --shadow-md: 0 1px 3px rgba(60, 64, 67, 0.2), 0 1px 2px rgba(60, 64, 67, 0.15);
  --shadow-lg: 0 2px 6px rgba(60, 64, 67, 0.15), 0 1px 3px rgba(60, 64, 67, 0.1);
  --shadow-xl: 0 4px 12px rgba(60, 64, 67, 0.2), 0 2px 4px rgba(60, 64, 67, 0.1);
  --shadow-glow: none;
  --shadow-glow-sm: none;
  --shadow-card: 0 1px 2px rgba(60, 64, 67, 0.1), 0 0 0 1px rgba(218, 220, 224, 0.5);
  --shadow-card-hover: 0 2px 8px rgba(60, 64, 67, 0.15), 0 0 0 1px rgba(26, 115, 232, 0.2);

  /* Radius System — Tighter, more professional */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 150ms var(--ease-smooth);
  --transition-base: 250ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);
  --transition-spring: 500ms var(--ease-spring);

  /* Z-Index */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-navbar: 1000;
  --z-modal: 1100;
  --z-toast: 1200;
  --z-tooltip: 1300;

  /* Layout */
  --navbar-height: 64px;
  --sidebar-width: 280px;

  /* Template compatibility aliases */
  --color-bg: var(--bg-primary);
  --color-surface: var(--bg-secondary);
  --color-surface-alt: var(--bg-tertiary);
  --color-text: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-text-muted: var(--text-tertiary);
  --color-accent: var(--accent);
  --color-accent-hover: var(--accent-hover);
  --color-border: var(--border-color);
  --color-normal: var(--status-normal);
  --color-minor: var(--status-minor);
  --color-moderate: var(--status-moderate);
  --color-major: var(--status-major);
  --font-ui: var(--font-primary);
  --flood-bg: var(--bg-primary);
  --flood-card: var(--bg-secondary);
  --flood-text: var(--text-primary);
  --flood-text-secondary: var(--text-secondary);
  --flood-text-muted: var(--text-tertiary);
  --flood-border: var(--border-color);
  --flood-accent: var(--accent);
  --flood-accent-hover: var(--accent-hover);
  --flood-normal: var(--status-normal);
  --flood-minor: var(--status-minor);
  --flood-moderate: var(--status-moderate);
  --flood-major: var(--status-major);
}

/* ---------- Dark Mode — Dark as Fallback */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: rgba(30, 41, 59, 0.9);
  --bg-card-hover: rgba(51, 65, 85, 0.95);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(66, 133, 244, 0.4);
  --divider: rgba(148, 163, 184, 0.08);

  --accent-glow: rgba(66, 133, 244, 0.25);

  --status-normal-bg: rgba(52, 168, 83, 0.18);
  --status-minor-bg: rgba(251, 188, 4, 0.18);
  --status-moderate-bg: rgba(249, 171, 0, 0.18);
  --status-major-bg: rgba(234, 67, 53, 0.18);
  --status-info-bg: rgba(66, 133, 244, 0.18);

  --glass-bg: rgba(15, 23, 42, 0.7);
  --glass-bg-strong: rgba(15, 23, 42, 0.88);
  --glass-border: rgba(148, 163, 184, 0.08);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(148, 163, 184, 0.06);
  --shadow-card-hover: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(59, 130, 246, 0.2);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Selection & Focus ---------- */
::selection {
  background: rgba(59, 130, 246, 0.25);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ---------- Custom Scrollbars ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
  background-clip: content-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  background-clip: content-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
  background-clip: content-box;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-tertiary) transparent;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}

/* Subtle animated background mesh */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.04), transparent),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(99, 102, 241, 0.03), transparent),
    radial-gradient(ellipse 50% 60% at 50% 90%, rgba(6, 182, 212, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(59, 130, 246, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(99, 102, 241, 0.06), transparent),
    radial-gradient(ellipse 50% 60% at 50% 90%, rgba(6, 182, 212, 0.05), transparent);
}

main {
  position: relative;
  z-index: var(--z-base);
  padding-top: calc(var(--navbar-height) + 3rem);
  padding-bottom: 3rem;
  min-height: calc(100vh - var(--navbar-height));
}

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

/* ============================================================
   NAVBAR — Frosted Glass Premium
   ============================================================ */
.navbar {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  z-index: var(--z-navbar);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur-heavy));
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  transition: all var(--transition-base);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.navbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow-sm);
  transition: transform var(--transition-spring);
}

.navbar-brand:hover .brand-icon {
  transform: scale(1.08) rotate(-3deg);
}

.navbar-brand .brand-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand .brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  -webkit-text-fill-color: var(--text-tertiary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 2rem;
  list-style: none;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-link.active {
  color: var(--accent);
  background: var(--status-info-bg);
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent-gradient-h);
  border-radius: var(--radius-full);
}

/* Dropdown Menus — Consistent theming */
.navbar .dropdown-menu {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem 0;
  min-width: 180px;
  z-index: var(--z-dropdown);
}

.navbar .dropdown-item {
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  transition: background var(--transition-fast);
}

.navbar .dropdown-item:hover,
.navbar .dropdown-item:focus {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.navbar .dropdown-item-text {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.navbar .dropdown-divider {
  border-color: var(--border-color);
}

.user-menu-btn {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.user-menu-btn:hover,
.user-menu-btn:focus {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-hover) !important;
}

/* Desktop nav overflow — scroll nav links when too many items */
@media (min-width: 992px) {
  .navbar {
    max-width: 100vw;
    overflow-x: clip;  /* clip prevents scroll but allows dropdown paint */
    overflow-y: visible;
  }

  #navContent {
    flex: 1 1 0;
    min-width: 0;
    display: flex !important;
    align-items: center;
  }

  .navbar-nav.me-auto {
    flex: 1 1 0;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 0.125rem;
  }

  .navbar-nav.me-auto::-webkit-scrollbar {
    display: none;
  }

  /* Right-side controls: don't shrink */
  #navContent > .d-flex {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }
}

/* Hide less-important nav controls at tight desktop widths */
@media (min-width: 992px) and (max-width: 1399.98px) {
  #navContent > .d-flex {
    gap: 0.4rem !important;
  }
  .tour-trigger-btn,
  #notification-toggle,
  #last-update {
    display: none !important;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  #keeper-status,
  #data-health {
    display: none !important;
  }
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

/* System Status Pill */
.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: default;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-normal);
  box-shadow: 0 0 6px var(--status-normal);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.warning { background: var(--status-minor); box-shadow: 0 0 6px var(--status-minor); }
.status-dot.error { background: var(--status-major); box-shadow: 0 0 6px var(--status-major); }
.status-text { font-size: 0.72rem; font-weight: 500; color: var(--text-secondary); }

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

/* Data Quality Dots */
.data-quality-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-tertiary); vertical-align: middle;
}
.data-quality-dot.fresh { background: var(--status-normal); box-shadow: 0 0 4px var(--status-normal); }
.data-quality-dot.aging { background: var(--status-minor); box-shadow: 0 0 4px var(--status-minor); }
.data-quality-dot.stale { background: var(--status-major); box-shadow: 0 0 4px var(--status-major); }
.data-quality-dot.none  { background: var(--text-tertiary); opacity: 0.4; }

/* Trend Icons */
.trend-icon { font-size: 0.95rem; vertical-align: middle; }
.trend-icon.trend-rising  { color: var(--status-major); }
.trend-icon.trend-falling { color: var(--status-normal); }
.trend-icon.trend-stable  { color: var(--status-minor); }

/* Last Update */
.last-update {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* Dark Mode Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: scale(1.05);
}

/* Notification Toggle (extends .theme-toggle) */
#notification-toggle {
  width: auto;
  padding: 0 12px;
  font-size: 0.75rem;
  gap: 4px;
  white-space: nowrap;
}
#notification-toggle.active {
  color: var(--accent-primary);
  background: rgba(37, 99, 235, 0.1);
}
#notification-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   ALERT BANNER — Animated Gradient
   ============================================================ */
.alert-banner {
  position: fixed;
  top: var(--navbar-height);
  left: 0; right: 0;
  z-index: calc(var(--z-navbar) - 1);
  padding: 0.65rem 1.5rem;
  background: linear-gradient(90deg, #ea4335, #f9ab00, #ea4335);
  background-size: 200% 100%;
  animation: alertShimmer 3s ease-in-out infinite;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3);
  transform: translateY(-100%);
  transition: transform 0.5s var(--ease-spring);
}

.alert-banner.visible {
  transform: translateY(0);
}

.alert-banner .dismiss-btn {
  position: absolute;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.alert-banner .dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

@keyframes alertShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ============================================================
   GLASS CARDS — Premium Components
   ============================================================ */
.card, .glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  overflow: hidden;
}

.card:hover, .glass-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--divider);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

/* ============================================================
   RISK / STATUS SYSTEM
   ============================================================ */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.risk-badge.normal { background: var(--status-normal-bg); color: var(--status-normal); }
.risk-badge.minor { background: var(--status-minor-bg); color: var(--status-minor); }
.risk-badge.moderate { background: var(--status-moderate-bg); color: var(--status-moderate); }
.risk-badge.major {
  background: var(--status-major-bg);
  color: var(--status-major);
  animation: riskPulse 1.5s ease-in-out infinite;
}

@keyframes riskPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.risk-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.risk-dot.normal { background: var(--status-normal); }
.risk-dot.minor { background: var(--status-minor); }
.risk-dot.moderate { background: var(--status-moderate); }
.risk-dot.major { background: var(--status-major); animation: statusPulse 1.5s ease-in-out infinite; }

/* ============================================================
   EMERGENCY DASHBOARD — Summary Bar
   ============================================================ */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient-h);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.summary-card:hover::before { opacity: 1; }

.summary-card.normal::before { background: var(--status-normal); opacity: 1; }
.summary-card.minor::before { background: var(--status-minor); opacity: 1; }
.summary-card.moderate::before { background: var(--status-moderate); opacity: 1; }
.summary-card.major::before { background: linear-gradient(90deg, var(--status-major), #f9ab00); opacity: 1; }

.summary-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.summary-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* ============================================================
   STATION CARDS — Emergency List
   ============================================================ */
.station-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.station-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: var(--status-normal);
  transition: width var(--transition-base);
}

.station-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
}

.station-card:hover::before { width: 5px; }

.station-card.minor::before { background: var(--status-minor); }
.station-card.moderate::before { background: var(--status-moderate); }
.station-card.major::before {
  background: linear-gradient(180deg, var(--status-major), #f9ab00);
  animation: majorBorderPulse 2s ease-in-out infinite;
}

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

.station-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.station-level {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.station-unit {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.station-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.station-trend {
  font-size: 0.75rem;
  font-weight: 600;
}

.station-trend.rising { color: var(--status-major); }
.station-trend.falling { color: var(--status-normal); }
.station-trend.stable { color: var(--text-tertiary); }

/* ============================================================
   RIVER MAP — Enhanced SVG
   ============================================================ */
.river-map-container {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.river-map-svg {
  width: 100%;
  height: auto;
  min-height: 400px;
}

.river-path {
  fill: none;
  stroke: var(--accent-mid);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.3));
}

.river-path.main {
  stroke-width: 4;
  opacity: 0.7;
}

.river-path.tributary {
  stroke-width: 2;
  opacity: 0.35;
}

.station-marker {
  cursor: pointer;
  transition: transform var(--transition-spring);
}

.station-marker:hover {
  transform: scale(1.25);
}

.station-marker .marker-ring {
  fill: none;
  stroke: var(--status-normal);
  stroke-width: 2;
  transition: all var(--transition-fast);
}

.station-marker .marker-dot {
  fill: var(--status-normal);
  transition: fill var(--transition-fast);
}

.station-marker.minor .marker-ring { stroke: var(--status-minor); }
.station-marker.minor .marker-dot { fill: var(--status-minor); }
.station-marker.moderate .marker-ring { stroke: var(--status-moderate); }
.station-marker.moderate .marker-dot { fill: var(--status-moderate); }
.station-marker.major .marker-ring { stroke: var(--status-major); }
.station-marker.major .marker-dot { fill: var(--status-major); }
.station-marker.major .marker-ring {
  animation: markerPulse 1.5s ease-in-out infinite;
}

@keyframes markerPulse {
  0%, 100% { r: 10; opacity: 1; }
  50% { r: 14; opacity: 0.3; }
}

.station-marker .marker-label {
  fill: var(--text-primary);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-primary);
  pointer-events: none;
}

.map-title {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-legend {
  position: absolute;
  bottom: 1rem;
  right: 1.25rem;
  display: flex;
  gap: 1rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ============================================================
   PROFESSIONAL VIEW — Station Selector
   ============================================================ */
.station-selector-bar {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.station-pill {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.station-pill:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.station-pill.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow-sm);
  font-weight: 600;
}

/* Current Conditions */
.conditions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.condition-metric {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.condition-metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-hover);
}

.condition-metric .metric-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.condition-metric .metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.condition-metric .metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-top: 0.35rem;
}

/* Professional Tabs */
.pro-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.pro-tab {
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
  position: relative;
}

.pro-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.pro-tab.active {
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-glow-sm);
}

.tab-pane { display: none; }
.tab-pane.show { display: block; animation: fadeInUp 0.3s var(--ease-out); }

/* Forecast Table */
.forecast-table-pro {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
}

.forecast-table-pro thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--divider);
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
}

.forecast-table-pro thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.forecast-table-pro thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.forecast-table-pro tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.forecast-table-pro tbody tr:hover td {
  background: var(--bg-tertiary);
}

.forecast-table-pro .confidence-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: visible;
  position: relative;
  min-width: 120px;
}

.confidence-bar .bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gradient-h);
  position: relative;
}

.confidence-bar .p50-marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 12px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transform: translateX(-50%);
}

/* Chart Area */
.chart-container {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  position: relative;
}

.chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.range-btn-group {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  padding: 0.2rem;
}

.range-btn {
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-btn:hover { color: var(--text-primary); }

.range-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow-sm);
}

/* Model Comparison Table */
.model-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
}

.model-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--divider);
  background: var(--bg-tertiary);
}

.model-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
  transition: background var(--transition-fast);
}

.model-table tbody tr:hover td {
  background: var(--bg-tertiary);
}

.model-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--status-info-bg);
  color: var(--accent);
}

.metric-bar {
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 80px;
}

.metric-bar .fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gradient-h);
  transition: width 0.8s var(--ease-out);
}

/* Thresholds */
.threshold-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--divider);
}

.threshold-row:last-child { border-bottom: none; }

.threshold-label {
  width: 80px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.threshold-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  width: 60px;
  text-align: right;
}

.threshold-bar-container {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  position: relative;
  overflow: visible;
}

.threshold-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out);
}

.threshold-bar.minor { background: var(--status-minor); }
.threshold-bar.moderate { background: var(--status-moderate); }
.threshold-bar.major { background: var(--status-major); }

.current-marker {
  position: absolute;
  top: -6px;
  width: 3px;
  height: 20px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transform: translateX(-50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   TRAINING PAGE
   ============================================================ */
.training-config {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.config-section {
  margin-bottom: 1.25rem;
}

.config-section:last-child { margin-bottom: 0; }

.config-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

/* Station Checkboxes */
.station-check-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.station-check-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.station-check-grid label:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.station-check-grid input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.station-check-grid input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.station-check-grid input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 4px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Model Chips */
.model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.model-chip {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.model-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.model-chip.selected {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow-sm);
}

/* Horizon Pills */
.horizon-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.horizon-pill {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.horizon-pill:hover {
  border-color: var(--accent);
}

.horizon-pill.selected {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* Log Output */
.log-output {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-height: 400px;
  overflow-y: auto;
  line-height: 1.7;
  color: var(--text-secondary);
}

.log-output .log-info { color: var(--accent); }
.log-output .log-success { color: var(--status-normal); }
.log-output .log-warning { color: var(--status-minor); }
.log-output .log-error { color: var(--status-major); }

/* Progress Ring */
.progress-ring-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring .ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 6;
}

.progress-ring .ring-fill {
  fill: none;
  stroke: url(#progressGrad);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease-out);
}

.progress-percent {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Results Table */
.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}

.results-table thead th {
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--divider);
  background: var(--bg-tertiary);
  text-align: left;
}

.results-table tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--divider);
}

.results-table tbody tr:hover td {
  background: var(--bg-tertiary);
}

/* Registry Stats */
.registry-stat-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
}

.registry-stat-card .stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.registry-stat-card .stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-top: 0.35rem;
}

/* Coverage Items */
.coverage-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.coverage-item .coverage-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  width: 140px;
  flex-shrink: 0;
}

.coverage-item .coverage-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.coverage-item .coverage-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-gradient-h);
  transition: width 0.8s var(--ease-out);
}

.coverage-item .coverage-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  width: 40px;
  text-align: right;
}

/* ============================================================
   BUTTONS — Premium
   ============================================================ */
.btn-primary, .btn.btn-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-glow-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
  color: white;
}

.btn-primary:hover::before { opacity: 1; }

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary, .btn.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-outline-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-outline-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-danger, .btn.btn-danger {
  background: linear-gradient(135deg, #ea4335, #dc2626);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
  color: white;
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent-gradient-h);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes floatUp {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes shimmerGlow {
    0% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.2); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3), 0 0 40px rgba(59, 130, 246, 0.1); }
    100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.2); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state .empty-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.empty-state .empty-desc {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================================
   LOADING & ANIMATIONS
   ============================================================ */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    var(--bg-card) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text { height: 14px; margin-bottom: 0.5rem; width: 80%; }
.skeleton-value { height: 24px; width: 60px; margin-bottom: 0.5rem; }
.skeleton-card { height: 100px; width: 100%; }

/* Fade In Up Animation */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.4s var(--ease-out) both; }
.fade-in { animation: fadeInUp 0.5s var(--ease-out) both; }

/* Staggered entrance */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }

/* Slide In Right */
@keyframes slideInRight {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.slide-in-right { animation: slideInRight 0.4s var(--ease-out) both; }

/* Scale In */
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.scale-in { animation: scaleIn 0.3s var(--ease-spring) both; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: calc(var(--navbar-height) + 1rem);
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast,
.toast-notification {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur-heavy));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 280px;
  max-width: 400px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s var(--ease-out);
}
.toast-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.toast .toast-icon { flex-shrink: 0; font-size: 1.1rem; }
.toast.success .toast-icon { color: var(--status-normal); }
.toast.warning .toast-icon { color: var(--status-minor); }
.toast.error .toast-icon { color: var(--status-major); }
.toast.info .toast-icon { color: var(--accent); }

/* ============================================================
   FORM CONTROLS — Bootstrap overrides
   ============================================================ */
.form-select, .form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  transition: all var(--transition-fast);
}

.form-select:focus, .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.form-select::placeholder, .form-control::placeholder {
  color: var(--text-tertiary);
}

/* Disabled button states */
.btn:disabled, .btn.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

/* Smooth number inputs */
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-mono { font-family: var(--font-mono); }
.text-xs { font-size: 0.7rem; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-tertiary) !important; }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-normal { color: var(--status-normal); }
.text-minor { color: var(--status-minor); }
.text-moderate { color: var(--status-moderate); }
.text-major { color: var(--status-major); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.06em; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ============================================================
   NAVBAR MOBILE COLLAPSE
   ============================================================ */
@media (max-width: 991.98px) {
  .navbar {
    height: auto !important;
    min-height: var(--navbar-height);
    flex-wrap: wrap;
  }

  #navContent {
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 0.5rem 0;
    max-height: 70vh;
    overflow-y: auto;
  }

  #navContent .navbar-nav {
    flex-direction: column;
    gap: 0;
    padding: 0.25rem 0.5rem;
  }

  #navContent .navbar-nav .nav-link {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
  }

  #navContent .navbar-nav .nav-link:hover {
    background: var(--bg-tertiary);
  }

  #navContent .navbar-nav .nav-link.active::after {
    display: none;
  }

  #navContent > .d-flex {
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  /* User dropdown in mobile */
  #navContent .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    box-shadow: none;
    border: 1px solid var(--border-color);
    margin-top: 0.25rem;
  }
}

[data-theme="dark"] #navContent {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .summary-bar { grid-template-columns: repeat(3, 1fr); }
  .conditions-grid { grid-template-columns: repeat(3, 1fr); }
  .station-check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --navbar-height: 56px; }
  .navbar { padding: 0 1rem; }
  .nav-links { display: none; }
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .conditions-grid { grid-template-columns: repeat(2, 1fr); }
  .station-selector-bar { flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 576px) {
  .summary-bar { grid-template-columns: 1fr 1fr; }
  .summary-card:last-child { grid-column: span 2; }
}

/* ============================================================
   REDUCED MOTION — Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner { animation: spin 0.8s linear infinite !important; }
  body::before { animation: none !important; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .navbar, .alert-banner, .theme-toggle, #notification-toggle, .toast-container,
  .system-status, .station-selector-bar, .btn, button { display: none !important; }
  body { background: white !important; color: black !important; }
  body::before { display: none !important; }
  main { padding-top: 0 !important; }
  .card, .glass-card, .station-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    backdrop-filter: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .badge, .risk-badge { border: 1px solid currentColor; }
  a { text-decoration: none !important; color: black !important; }
  @page { margin: 1.5cm; }
}

/* ============================================================
   RESPONSIVE DESIGN — Mobile & Tablet for Field Operators
   ============================================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
  .command-center-panel {
    grid-template-columns: 1fr !important;
  }
  .station-selector-bar {
    flex-wrap: wrap;
    gap: 4px;
  }
  .station-pill {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
  .chart-card {
    min-height: 300px;
  }
  .summary-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  .forecast-table-pro {
    font-size: 0.85rem;
  }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
  .hero-section h1,
  .hero-section .display-5,
  .hero-title {
    font-size: 1.5rem !important;
  }
  .hero-section {
    padding: 1rem !important;
  }
  .hero-catchment {
    font-size: 1rem;
  }
  .hero-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .navbar-brand {
    font-size: 0.9rem;
  }
  .navbar-brand .brand-text {
    font-size: 0.9rem;
  }
  .station-selector-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .station-selector-bar::-webkit-scrollbar {
    display: none;
  }
  .chart-card {
    min-height: 250px;
    border-radius: 0;
    margin: 0 -1rem;
    padding: 0.5rem;
  }
  .forecast-table-pro {
    font-size: 0.75rem;
  }
  .forecast-table-pro thead th,
  .forecast-table-pro tbody td {
    padding: 4px 6px;
  }
  .flood-warning-banner {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
  }
  .command-center-panel {
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
  }
  .card {
    border-radius: 8px;
  }
  .container, .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  /* Stack summary stats/bar vertically */
  .summary-bar,
  .summary-stats {
    grid-template-columns: 1fr !important;
    flex-direction: column;
    gap: 0.5rem;
  }
  /* Make station cards full width */
  .stations-grid {
    grid-template-columns: 1fr !important;
  }
  .station-card {
    margin-left: 0;
    margin-right: 0;
  }
  .chart-controls {
    flex-wrap: wrap;
    gap: 4px;
  }
  .chart-controls .btn {
    font-size: 0.75rem;
    padding: 4px 8px;
  }
}

/* Small mobile (< 375px) */
@media (max-width: 375px) {
  body {
    font-size: 13px;
  }
  .navbar {
    padding: 0.25rem 0.5rem;
  }
  .chart-controls .btn {
    font-size: 0.65rem;
    padding: 2px 4px;
  }
  .summary-card {
    padding: 0.75rem;
  }
  .station-pill {
    font-size: 0.7rem;
    padding: 3px 6px;
  }
}
