/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */

:root {
  /* Fonts */
  --font-sans: 'Outfit', sans-serif;
  --font-serif: 'Playfair Display', serif;

  /* Theme-specific variables (Defaulted to Midnight Neon) */
  --bg-app: #060913;
  --bg-gradient: radial-gradient(circle at 50% 50%, #0c1229 0%, #060913 100%);
  --bg-card: rgba(13, 20, 41, 0.65);
  --border-card: rgba(255, 255, 255, 0.08);
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  
  /* Accent Colors */
  --color-accent: #3b82f6; /* Glowing blue */
  --color-accent-rgb: 59, 130, 246;
  --color-glow: #60a5fa;
  --state-fill: #111a36;
  --state-stroke: #1e293b;
  --state-stroke-hover: #60a5fa;
  --state-fill-hover: rgba(59, 130, 246, 0.25);
  --state-selected: rgba(59, 130, 246, 0.45);
  
  /* Constants */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   THEME STYLES
   ========================================================================== */

/* 1. Midnight Neon Theme */
body.theme-midnight {
  --bg-app: #060913;
  --bg-gradient: radial-gradient(circle at 50% 50%, #0d1633 0%, #050811 100%);
  --bg-card: rgba(12, 19, 39, 0.7);
  --border-card: rgba(255, 255, 255, 0.07);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.1);
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-accent: #3b82f6;
  --color-accent-rgb: 59, 130, 246;
  --color-glow: #60a5fa;
  --state-fill: #111a36;
  --state-stroke: #1e293b;
  --state-stroke-hover: #3b82f6;
  --state-fill-hover: rgba(59, 130, 246, 0.25);
  --state-selected: rgba(59, 130, 246, 0.45);
}

/* 2. Vintage Cartographer Theme */
body.theme-vintage {
  --bg-app: #eae2cf;
  --bg-gradient: linear-gradient(135deg, #e3dac9 0%, #f0ebd8 100%);
  --bg-card: rgba(247, 243, 230, 0.85);
  --border-card: rgba(139, 115, 85, 0.35);
  --shadow-card: 8px 8px 24px rgba(62, 51, 38, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  --color-text: #2c251e;
  --color-text-muted: #6e5e4f;
  --color-accent: #8b6e4e;
  --color-accent-rgb: 139, 110, 78;
  --color-glow: #a6845e;
  --state-fill: #f5f0e1;
  --state-stroke: #bda285;
  --state-stroke-hover: #73593f;
  --state-fill-hover: rgba(189, 162, 133, 0.25);
  --state-selected: rgba(139, 110, 78, 0.35);
}
body.theme-vintage .panel-card {
  box-shadow: var(--shadow-card), inset 0 0 40px rgba(139, 110, 78, 0.05);
}
body.theme-vintage h1,
body.theme-vintage h2,
body.theme-vintage h3 {
  font-family: var(--font-serif);
}

/* 3. Aurora Borealis Theme */
body.theme-aurora {
  --bg-app: #080d0c;
  --bg-gradient: radial-gradient(circle at 50% 50%, #0d1f19 0%, #050a0a 100%);
  --bg-card: rgba(11, 23, 20, 0.7);
  --border-card: rgba(16, 185, 129, 0.12);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.7), inset 0 1px 1px rgba(16, 185, 129, 0.1);
  --color-text: #f0fdf4;
  --color-text-muted: #86efac;
  --color-accent: #10b981; /* Emerald green */
  --color-accent-rgb: 16, 185, 129;
  --color-glow: #34d399;
  --state-fill: #0c1814;
  --state-stroke: #142e26;
  --state-stroke-hover: #10b981;
  --state-fill-hover: rgba(16, 185, 129, 0.22);
  --state-selected: rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   GLOBAL RESET & BASIC BASE
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  background-image: var(--bg-gradient);
  color: var(--color-text);
  min-height: 100vh;
  overflow: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
  position: relative;
}

/* Atmospheric Ambient Canvas Particles Background */
.stars-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 150px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 300px 240px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 450px 100px, rgba(255,255,255,0.7), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 700px 320px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 900px 150px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 1150px 290px, rgba(255,255,255,0.5), rgba(0,0,0,0));
  background-size: 1200px 600px;
  opacity: 0.15;
  z-index: 0;
}
body.theme-vintage .stars-bg {
  display: none; /* No space stars on vintage parchment */
}

/* Main Container Grid */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 10;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  font-size: 2.2rem;
  animation: logo-bounce 4s infinite ease-in-out;
}

@keyframes logo-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(4deg); }
}

.logo-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(120deg, var(--color-text), var(--color-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Search Box Container */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-card);
  border-radius: 9999px;
  padding: 0.4rem 0.8rem;
  width: 280px;
  transition: width var(--transition-normal), border-color var(--transition-fast);
}
body.theme-vintage .search-box {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.4);
}
.search-box:focus-within {
  width: 380px;
  border-color: var(--color-accent);
  box-shadow: 0 0 12px rgba(var(--color-accent-rgb), 0.2);
}

.search-icon {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-right: 0.5rem;
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  width: 100%;
}
.search-box input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.2rem;
}
.btn-clear.hidden {
  display: none;
}

/* Dropdown Suggestions List */
.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
}
.suggestions-dropdown.hidden {
  display: none;
}

.suggestion-item {
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  transition: background var(--transition-fast);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
body.theme-vintage .suggestion-item {
  border-bottom: 1px solid rgba(139, 110, 78, 0.1);
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover,
.suggestion-item.selected {
  background: rgba(var(--color-accent-rgb), 0.18);
}

.suggestion-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.suggestion-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.15rem;
  flex: 1;
}

.suggestion-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.suggestion-title {
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-subtitle {
  font-size: 0.73rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.suggestion-badge.city { background: rgba(56, 189, 248, 0.18); color: #38bdf8; }
.suggestion-badge.street { background: rgba(245, 158, 11, 0.18); color: #f59e0b; }
.suggestion-badge.county { background: rgba(168, 85, 247, 0.18); color: #c084fc; }
.suggestion-badge.state { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.suggestion-badge.landmark { background: rgba(244, 63, 94, 0.18); color: #fb7185; }
.suggestion-badge.park { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.suggestion-badge.airport { background: rgba(14, 165, 233, 0.18); color: #38bdf8; }

/* Animated Search Pin Marker */
.search-pin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.search-pin-pulse {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.45);
  animation: searchPinPulse 1.8s infinite ease-out;
}
@keyframes searchPinPulse {
  0% { transform: scale(0.5); opacity: 0.95; }
  100% { transform: scale(1.6); opacity: 0; }
}
.search-pin-icon {
  width: 26px;
  height: 26px;
  background: #0284c7;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

/* Styled Theme Dropdown */
.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.styled-select {
  background: rgba(0, 0, 0, 0.25);
  color: var(--color-text);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
body.theme-vintage .styled-select {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.4);
  color: var(--color-text);
}
.styled-select:hover,
.styled-select:focus {
  border-color: var(--color-accent);
}

/* Header Audio Button */
.btn-icon {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-card);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  outline: none;
}
body.theme-vintage .btn-icon {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.4);
}
.btn-icon:hover {
  transform: scale(1.05);
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.1);
}
.btn-icon:active {
  transform: scale(0.95);
}

/* ==========================================================================
   WORKSPACE GRID LAYOUT
   ========================================================================== */

.workspace {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  height: calc(100vh - 70px);
}

/* ==========================================================================
   SIDEBAR & INFORMATION CARDS
   ========================================================================== */

/* Floating Sidebar Collapse/Expand Button */
.sidebar-toggle-btn {
  position: absolute;
  top: 1.2rem;
  left: 415px;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  outline: none;
}
.sidebar-toggle-btn:hover {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.18);
  transform: translateY(-1px);
}
.sidebar-toggle-btn:active {
  transform: translateY(1px);
}
body.theme-vintage .sidebar-toggle-btn {
  background: rgba(247, 243, 230, 0.95);
  border: 1px solid rgba(139, 110, 78, 0.4);
  color: #2c251e;
}
.workspace.sidebar-collapsed .sidebar-toggle-btn {
  left: 1.2rem;
}

.sidebar {
  width: 400px;
  min-width: 400px;
  max-width: 400px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 1000;
  background: linear-gradient(90deg, rgba(6, 9, 19, 0.85) 0%, rgba(6, 9, 19, 0.2) 100%);
  overflow-y: auto;
  pointer-events: auto;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
body.theme-vintage .sidebar {
  background: linear-gradient(90deg, rgba(234, 226, 207, 0.85) 0%, rgba(234, 226, 207, 0.2) 100%);
}
.workspace.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  margin-left: -400px;
  opacity: 0;
  pointer-events: none;
}

.panel-card {
  pointer-events: auto; /* Re-enable clicks inside the card */
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 1.8rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  transition: opacity var(--transition-normal), transform var(--transition-normal), display var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  transform: translateX(0);
}
.panel-card.hidden {
  display: none;
  opacity: 0;
  transform: translateX(-40px);
}

/* 1. Welcome Card Elements */
.panel-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.intro-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
body.theme-vintage .stat-pill {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.2);
  color: var(--color-text);
}

.welcome-guide {
  background: rgba(var(--color-accent-rgb), 0.08);
  border-left: 3px solid var(--color-accent);
  border-radius: 4px 12px 12px 4px;
  padding: 0.8rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Interactive Map Layers Panel */
.layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}
body.theme-vintage .layer-toggles {
  border-top: 1px solid rgba(139, 110, 78, 0.25);
}

.layer-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}
.group-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.basemap-selector-row {
  margin-bottom: 0.4rem;
}
.basemap-dropdown {
  width: 100%;
}

.layer-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
body.theme-vintage .layer-section {
  border-bottom: 1px solid rgba(139, 110, 78, 0.15);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  width: 100%;
}
.toggle-row.master-toggle {
  font-weight: 600;
}
.layer-name {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.83rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Status Badges Attached to Toggles */
.status-badge-inline,
.status-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.16rem 0.52rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
  line-height: 1.3;
  transition: all var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.status-badge-inline.online,
.status-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}
.status-badge-inline.connecting,
.status-badge.connecting {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
}
.status-badge-inline.offline,
.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}
.status-badge-inline.climate,
.status-badge.climate {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.12);
}
.status-badge-inline.neutral,
.status-badge.neutral {
  background: rgba(255, 255, 255, 0.07);
  color: var(--color-text-muted);
  border-color: rgba(255, 255, 255, 0.12);
}

body.theme-vintage .status-badge-inline.online,
body.theme-vintage .status-badge.online {
  background: rgba(46, 117, 89, 0.1);
  color: #2e7d32;
  border-color: rgba(46, 117, 89, 0.35);
}

/* Subtoggles Nested Tree */
.subtoggle-group {
  margin-left: 1.3rem;
  padding-left: 0.8rem;
  border-left: 2px solid rgba(var(--color-accent-rgb), 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.35rem;
  margin-bottom: 0.2rem;
  transition: all var(--transition-normal);
}
.subtoggle-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.77rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}
.subtoggle-item:hover {
  color: var(--color-text);
}
.subtoggle-item input[type="radio"],
.subtoggle-item input[type="checkbox"] {
  accent-color: var(--color-accent);
  cursor: pointer;
  width: 14px;
  height: 14px;
}
.flight-mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.25rem 0 0.4rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  margin-bottom: 0.2rem;
}
body.theme-vintage .flight-mode-options {
  border-bottom-color: rgba(139, 110, 78, 0.25);
}
.subtoggle-filter-chips {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}
.chip-filter {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--color-text-muted);
  border-radius: 6px;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}
body.theme-vintage .chip-filter {
  background: rgba(139, 110, 78, 0.08);
  border-color: rgba(139, 110, 78, 0.25);
  color: #5c4d3c;
}
.chip-filter:hover {
  color: var(--color-text);
  border-color: var(--color-accent);
}
.chip-filter.active {
  background: rgba(var(--color-accent-rgb), 0.22);
  color: var(--color-accent);
  border-color: var(--color-accent);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(var(--color-accent-rgb), 0.2);
}

/* Custom CSS Switches */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: .4s;
  border-radius: 34px;
}
body.theme-vintage .slider {
  background-color: rgba(139, 110, 78, 0.15);
  border: 1px solid rgba(139, 110, 78, 0.3);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--color-text-muted);
  transition: .4s;
  border-radius: 50%;
}
body.theme-vintage .slider:before {
  background-color: #8b7355;
}

input:checked + .slider {
  background-color: var(--color-accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 4px 15px rgba(var(--color-accent-rgb), 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--color-accent-rgb), 0.45), 0 0 10px rgba(var(--color-accent-rgb), 0.2);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
body.theme-vintage .btn-secondary {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.35);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-accent);
}

.btn-back {
  background: transparent;
  border: none;
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  align-self: flex-start;
  transition: color var(--transition-fast);
}
.btn-back:hover {
  color: var(--color-glow);
}

/* 2. State Detail Card Elements */
.state-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
}
body.theme-vintage .state-header {
  border-bottom: 1px solid rgba(139, 110, 78, 0.2);
}

.state-emoji {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.04);
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
body.theme-vintage .state-emoji {
  background: rgba(139, 110, 78, 0.08);
}

.state-title-wrap h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

.state-nickname {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--color-text-muted);
}

/* Quick Stats Grid */
.quick-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.quick-stat {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}
body.theme-vintage .quick-stat {
  background: rgba(139, 110, 78, 0.05);
  border: 1px solid rgba(139, 110, 78, 0.15);
}

.stat-icon {
  font-size: 1.1rem;
  opacity: 0.9;
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-details .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.stat-details .value {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Details Sections */
.details-section h3,
.fun-fact-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.famous-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.famous-list li {
  font-size: 0.85rem;
  line-height: 1.4;
  padding-left: 1.2rem;
  position: relative;
}

.famous-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--color-accent);
}

.fun-fact-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  position: relative;
}
body.theme-vintage .fun-fact-box {
  background: rgba(139, 110, 78, 0.03);
  border: 1px solid rgba(139, 110, 78, 0.15);
}

.quote-mark {
  position: absolute;
  top: -5px;
  left: 10px;
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--color-accent);
  opacity: 0.3;
}

.fun-fact-box p {
  font-size: 0.82rem;
  line-height: 1.5;
  font-style: italic;
  position: relative;
  z-index: 1;
}

/* 3. Quiz Card Elements */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.8rem;
}
body.theme-vintage .quiz-header {
  border-bottom: 1px solid rgba(139, 110, 78, 0.2);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}
.btn-text:hover {
  color: var(--color-text);
}

.quiz-progress-bar {
  background: rgba(255,255,255,0.05);
  border-radius: 9999px;
  height: 6px;
  width: 100%;
  overflow: hidden;
}
body.theme-vintage .quiz-progress-bar {
  background: rgba(139, 110, 78, 0.15);
}

.quiz-progress-fill {
  background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-glow) 100%);
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  transition: width var(--transition-normal);
}

.quiz-score-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.quiz-question-box {
  background: rgba(var(--color-accent-rgb), 0.05);
  border: 1px dashed rgba(var(--color-accent-rgb), 0.25);
  border-radius: 12px;
  padding: 1.2rem;
  min-height: 90px;
  display: flex;
  align-items: center;
}

.quiz-question-box p {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  width: 100%;
}

.quiz-hint-box {
  background: rgba(241, 196, 15, 0.08);
  border-left: 3px solid #f1c40f;
  border-radius: 4px 12px 12px 4px;
  padding: 0.8rem;
  font-size: 0.8rem;
  line-height: 1.4;
  animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-controls-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.quiz-instruction {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: pulse-guide 2s infinite ease-in-out;
}

@keyframes pulse-guide {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Feedback Box */
.quiz-feedback-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  animation: feedback-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quiz-feedback-box.correct {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: #2ecc71;
}

.quiz-feedback-box.incorrect {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e74c3c;
}

@keyframes feedback-pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   MAP VIEWPORT & RENDERING LAYERS
   ========================================================================== */

.map-viewport {
  flex: 1;
  position: relative;
  height: 100%;
}

/* Navigation Overlay */
.map-controls {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 950;
}

.btn-map {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--color-text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  outline: none;
}
body.theme-vintage .btn-map {
  background: rgba(247, 243, 230, 0.95);
  border: 1px solid rgba(139, 110, 78, 0.4);
  color: #2c251e;
}
.btn-map:hover {
  border-color: var(--color-accent);
  background: rgba(var(--color-accent-rgb), 0.1);
  transform: translateY(-1px);
}
.btn-map:active {
  transform: translateY(1px);
}

/* Map Layers Holder */
.map-holder-element {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}
.map-holder-element:active {
  cursor: grabbing;
}

.map-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.pointer-events-none {
  pointer-events: none;
}

/* ==========================================================================
   SVG MAP PRESENTATION
   ========================================================================== */

/* State Paths Styling */
.state-path {
  fill: var(--state-fill);
  stroke: var(--state-stroke);
  stroke-width: 1;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill var(--transition-normal), stroke var(--transition-normal), stroke-width var(--transition-fast);
}

.state-path:hover {
  fill: var(--state-fill-hover);
  stroke: var(--state-stroke-hover);
  stroke-width: 1.8;
  filter: drop-shadow(0 0 6px rgba(var(--color-accent-rgb), 0.3));
}
body.theme-vintage .state-path:hover {
  filter: drop-shadow(0 4px 8px rgba(62, 51, 38, 0.15));
}

.state-path.selected {
  fill: var(--state-selected);
  stroke: var(--color-accent);
  stroke-width: 2.2;
}

/* Label markers & overlay icons */
.state-icon-group {
  pointer-events: none; /* Let clicks fall through to the state path */
  transition: opacity var(--transition-normal);
}
.state-icon-group.hidden {
  opacity: 0;
}

.state-label-icon {
  font-size: 1.1rem;
  text-anchor: middle;
  dominant-baseline: central;
  animation: float-icon 5s infinite ease-in-out;
}

/* Float Animation for State Icons */
@keyframes float-icon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* State Nickname Labels (SVG Text) */
.state-label-text {
  font-size: 9px;
  font-weight: 600;
  fill: var(--color-text-muted);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  opacity: 0.7;
}

/* Map Dynamic Tooltip */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.8rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1200;
  transition: opacity var(--transition-fast);
  transform: translate(-50%, -100%);
  margin-top: -15px; /* Offset above cursor */
}
.map-tooltip.hidden {
  opacity: 0;
}

.tooltip-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.tooltip-nickname {
  font-style: italic;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ==========================================================================
   REAL-TIME DATA OVERLAYS & STATUS BADGES
   ========================================================================== */

.live-status-container {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-right: 0.8rem;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition-normal);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-badge.online {
  background: rgba(46, 204, 113, 0.12);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.25);
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.15);
}

.status-badge.connecting {
  background: rgba(241, 196, 15, 0.12);
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.25);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.1);
}

.status-badge.offline {
  background: rgba(231, 76, 60, 0.1);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.2);
}

body.theme-vintage .status-badge {
  border: 1px solid rgba(139, 110, 78, 0.35);
}
body.theme-vintage .status-badge.online {
  background: rgba(46, 117, 89, 0.08);
  color: #2e7d32;
  border-color: rgba(46, 117, 89, 0.3);
}

.live-label {
  font-weight: 600;
  color: var(--color-glow);
  text-shadow: 0 0 6px rgba(var(--color-accent-rgb), 0.2);
}

/* Weather Display Box */
.weather-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(var(--color-accent-rgb), 0.15);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-card), inset 0 0 10px rgba(var(--color-accent-rgb), 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: feedback-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.theme-vintage .weather-box {
  background: rgba(139, 110, 78, 0.04);
  border: 1px solid rgba(139, 110, 78, 0.3);
}

.weather-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.weather-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weather-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 8px rgba(var(--color-accent-rgb), 0.2));
}

.weather-numbers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex: 1;
  padding-right: 1.2rem;
}

.weather-temp {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.weather-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.weather-wind {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  min-width: 60px;
}

body.theme-vintage .weather-wind {
  background: rgba(139, 110, 78, 0.06);
  border: 1px solid rgba(139, 110, 78, 0.2);
}

.wind-icon {
  font-size: 0.95rem;
  animation: wind-spin 3s infinite linear;
}

@keyframes wind-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.wind-speed {
  font-weight: 600;
}

/* Pulsing Live Dot */
.live-dot {
  width: 7px;
  height: 7px;
  background-color: #2ecc71;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #2ecc71;
  animation: pulse-dot 1.8s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.65; box-shadow: 0 0 4px #2ecc71; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 10px #2ecc71; }
}

/* ==========================================================================
   RESPONSIVENESS AND SMALL SCREEN FALLBACK
   ========================================================================== */

@media (max-width: 1024px) {
  .workspace {
    flex-direction: column-reverse;
    overflow-y: auto;
  }
  
  .sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    padding: 1rem;
    background: transparent;
    overflow-y: visible;
  }

  .map-viewport {
    height: 60vh;
    min-height: 400px;
    width: 100%;
  }

  .search-box {
    width: 180px;
  }
  .search-box:focus-within {
    width: 220px;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    height: auto;
  }
}


/* ==========================================================================
   LEAFLET TOPO MAP OVERLAYS & CONTROLS
   ========================================================================== */

#leaflet-map {
  width: 100%;
  height: 100%;
  background: #0b1120;
}

body.theme-midnight .leaflet-tile-pane {
  filter: brightness(0.92) contrast(1.08);
}

body.theme-vintage .leaflet-tile-pane {
  filter: sepia(0.35) contrast(1.1) brightness(0.95);
}

body.theme-aurora .leaflet-tile-pane {
  filter: hue-rotate(15deg) saturate(1.1);
}

.basemap-dropdown {
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

/* State Emoji DivIcon Marker */
.state-emoji-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: none !important;
  text-align: center;
}

.state-emoji-marker .emoji {
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
  transition: transform 0.2s ease;
  line-height: 1;
}

.state-emoji-marker .abbr {
  font-size: 0.65rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 4px #000000;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 1px;
}

/* Live Commercial Airplane Markers */
.live-plane-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

.live-plane-svg {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.85));
  transition: transform 0.4s ease-out;
}

.live-plane-callsign {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: #bae6fd;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  padding: 1px 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* Live Earthquake Sonar Pulse */
.live-quake-marker {
  background: transparent !important;
  border: none !important;
  position: relative !important;
  cursor: pointer !important;
}

.live-quake-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.live-quake-ring {
  border: 2px solid rgba(239, 68, 68, 0.8);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: quake-pulse 2s infinite ease-out;
}

.live-quake-label {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  color: #fca5a5;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

@keyframes quake-pulse {
  0% { width: 8px; height: 8px; opacity: 1; }
  100% { width: 38px; height: 38px; opacity: 0; }
}

/* ISS Satellite Marker */
.iss-satellite-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

.iss-satellite-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.9));
  animation: iss-hover 3s infinite ease-in-out;
}

.iss-satellite-tag {
  font-size: 0.62rem;
  font-weight: 800;
  color: #e9d5ff;
  background: rgba(88, 28, 135, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.5);
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: -2px;
  white-space: nowrap;
}

@keyframes iss-hover {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Leaflet Glassmorphic Popup Overrides */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.9) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  color: #f8fafc !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.9) !important;
}

.leaflet-container {
  font-family: var(--font-sans) !important;
}

.leaflet-control-attribution {
  background: rgba(15, 23, 42, 0.75) !important;
  color: #94a3b8 !important;
  font-size: 0.65rem !important;
  border-radius: 6px 0 0 0;
  backdrop-filter: blur(4px);
}

.leaflet-control-attribution a {
  color: #38bdf8 !important;
}

.hidden-zoom {
  display: none !important;
}

/* Wildfire & Weather Hazard Overlays */
.fire-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

.fire-icon {
  font-size: 1.3rem;
  filter: drop-shadow(0 0 6px #ea580c);
  animation: fire-flicker 1.5s infinite alternate;
}

.fire-label {
  font-size: 0.6rem;
  font-weight: 800;
  color: #fed7aa;
  background: rgba(124, 45, 18, 0.85);
  border: 1px solid rgba(234, 88, 12, 0.5);
  border-radius: 3px;
  padding: 1px 4px;
  white-space: nowrap;
  margin-top: -2px;
}

@keyframes fire-flicker {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px #ea580c); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 10px #f97316); }
}

.nws-alert-popup {
  max-width: 300px;
  max-height: 250px;
  overflow-y: auto;
  font-size: 0.82rem;
  line-height: 1.45;
}

.nws-alert-title {
  font-size: 0.98rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

/* Satellite, Drought, Disaster Stories & Climate Anomaly Styles */
.status-badge.climate {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  cursor: help;
}

.disaster-story-marker {
  background: transparent !important;
  border: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

.disaster-story-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px #f43f5e);
  animation: disaster-pulse 2s infinite ease-in-out;
}

.disaster-story-tag {
  font-size: 0.6rem;
  font-weight: 800;
  color: #ffe4e6;
  background: rgba(159, 18, 57, 0.88);
  border: 1px solid rgba(244, 63, 94, 0.5);
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: -2px;
  white-space: nowrap;
}

@keyframes disaster-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px #f43f5e); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 14px #e11d48); }
}

.btn-story-link {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.45rem 0.8rem;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-story-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.6);
  color: #fff !important;
}

.weather-anomaly {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 600;
  color: #fca5a5;
  margin-top: 0.3rem;
}

/* --- 🤖 GOOGLE DEEPMIND WEATHERNEXT 3 STYLING --- */
.weathernext-section {
  background: rgba(66, 133, 244, 0.05);
  border: 1px solid rgba(66, 133, 244, 0.25);
  border-radius: 12px;
  padding: 0.85rem !important;
  margin-top: 0.5rem;
}
body.theme-vintage .weathernext-section {
  background: rgba(139, 110, 78, 0.08);
  border: 1px solid rgba(139, 110, 78, 0.35);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.weathernext-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
body.theme-vintage .weathernext-title {
  color: #8b5cf6;
}

.ai-sparkle {
  font-size: 1rem;
}

.wn-docs-link {
  font-size: 0.72rem;
  font-weight: 600;
  color: #93c5fd;
  text-decoration: none;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.wn-docs-link:hover {
  background: rgba(59, 130, 246, 0.35);
  color: #ffffff;
}

.section-subtitle {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}

.status-badge-inline.ai {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.3) 0%, rgba(147, 51, 234, 0.3) 100%);
  color: #93c5fd;
  border: 1px solid rgba(147, 51, 234, 0.4);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wn-legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
}

.wn-legend-label {
  color: var(--color-text-muted);
  white-space: nowrap;
  font-size: 0.68rem;
}

.wn-gradient-bar {
  flex: 1;
  height: 6px;
  border-radius: 9999px;
}

.precip-bar {
  background: linear-gradient(90deg, #38bdf8 0%, #22c55e 35%, #eab308 70%, #ef4444 90%, #a855f7 100%);
}

.wind-bar {
  background: linear-gradient(90deg, #38bdf8 0%, #34d399 35%, #fbbf24 70%, #f43f5e 100%);
}

.solar-bar {
  background: linear-gradient(90deg, #475569 0%, #38bdf8 25%, #f59e0b 60%, #eab308 85%, #ef4444 100%);
}

.wn-legend-scale {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.wn-info-text {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.wn-point-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: pulse-ring-anim 1.8s infinite;
  flex-shrink: 0;
}
@keyframes pulse-ring-anim {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* 💨 WeatherNext 100m Wind Vector Markers */
.wn-wind-container {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.wn-wind-container:hover {
  transform: scale(1.15);
  border-color: #38bdf8;
  z-index: 1000 !important;
}
.wn-wind-arrow {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.3s ease;
}
.wn-wind-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffffff;
}
.wn-wind-yield {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.25);
  color: #4ade80;
}

/* ☀️ WeatherNext Solar Irradiance Markers */
.wn-solar-container {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 2px 6px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.wn-solar-container:hover {
  transform: scale(1.15);
  border-color: #fbbf24;
  z-index: 1000 !important;
}
.wn-solar-icon {
  font-size: 13px;
}
.wn-solar-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fbbf24;
}

/* 🤖 WeatherNext 3 Telemetry Popup Card */
.wn-telemetry-card {
  font-family: inherit;
  min-width: 270px;
  padding: 0.2rem;
}
.wn-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 0.4rem;
  margin-bottom: 0.5rem;
}
.wn-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.wn-card-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.wn-card-subtitle {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}
.wn-grid-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.5rem 0;
}
.wn-stat-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
}
.wn-stat-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.wn-stat-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 0.1rem;
}
.wn-stat-sub {
  font-size: 0.65rem;
  color: #34d399;
  font-weight: 600;
}
.wn-card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.4rem;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
}
.wn-card-footer a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}
.wn-card-footer a:hover {
  text-decoration: underline;
}

/* --- WeatherNext 3 24-Hour Floating Player Dock --- */
.wn-player-dock {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  width: min(740px, 94%);
  background: var(--color-glass, rgba(13, 20, 36, 0.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border-glass, rgba(96, 165, 250, 0.35));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.2);
  border-radius: 16px;
  padding: 0.75rem 1.1rem;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.wn-player-dock.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 25px);
}

.wn-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 0.6rem;
}

.wn-player-title-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wn-player-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.wn-player-subtitle {
  font-size: 0.72rem;
  color: var(--color-text-muted, #94a3b8);
}

.wn-player-clock-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.wn-player-offset {
  font-size: 0.82rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.wn-player-timestamp {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--color-text, #f1f5f9);
}

.wn-player-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted, #94a3b8);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
  transition: all 0.15s;
}

.wn-player-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.wn-player-controls-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.wn-btn-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.wn-btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--color-text, #f1f5f9);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wn-btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.wn-btn-play {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  border: none;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.wn-btn-play:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.55);
}

.wn-btn-loop {
  color: var(--color-text-muted, #94a3b8);
}

.wn-btn-loop.active {
  color: #34d399;
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.25);
}

.wn-btn-text {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--color-text, #f1f5f9);
  height: 32px;
  padding: 0 0.55rem;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wn-btn-text:hover {
  background: rgba(255, 255, 255, 0.18);
}

.wn-scrubber-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.wn-scrubber-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
  transition: background 0.15s;
}

.wn-scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 2px 5px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  border: 2px solid #fff;
  transition: transform 0.1s, box-shadow 0.1s;
}

.wn-scrubber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 14px #38bdf8;
}

.wn-scrubber-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
  cursor: pointer;
  border: 2px solid #fff;
}

.wn-scrubber-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--color-text-muted, #94a3b8);
  padding: 0 0.15rem;
  user-select: none;
}

.wn-tick {
  cursor: pointer;
  transition: color 0.15s;
}

.wn-tick:hover, .wn-tick.active {
  color: #38bdf8;
  font-weight: 700;
}

.wn-player-summary {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.wn-player-metric-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* --- WeatherNext 3 Predictive Click Dialog Enhancements --- */
.wn-prediction-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.14));
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wn-pred-header {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #93c5fd;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.03em;
}

.wn-pred-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.wn-pred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.45rem;
  border-radius: 5px;
}

.wn-pred-badge {
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
}

.wn-pred-wind .wn-pred-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.wn-pred-solar .wn-pred-badge {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.wn-pred-rain .wn-pred-badge {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}

/* 24-Hour Interactive Timeline Sparkline / Chart */
.wn-chart-container {
  margin: 0.5rem 0;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
}

.wn-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.66rem;
  color: var(--color-text-muted, #94a3b8);
  margin-bottom: 0.4rem;
}

.wn-chart-bars {
  display: flex;
  align-items: flex-end;
  height: 48px;
  gap: 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wn-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s;
}

.wn-bar-col:hover {
  transform: translateY(-2px);
}

.wn-bar-col.active .wn-bar-fill {
  box-shadow: 0 0 8px #38bdf8;
  border: 1px solid #fff;
}

.wn-bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #3b82f6;
  transition: height 0.2s, background 0.2s;
}

.wn-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.58rem;
  color: var(--color-text-muted, #94a3b8);
  margin-top: 0.25rem;
}

/* Open Player button in sidebar */
.wn-open-player-btn {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(124, 58, 237, 0.25));
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #60a5fa;
  font-weight: 700;
  transition: all 0.15s ease;
}

.wn-open-player-btn:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(124, 58, 237, 0.4));
  color: #fff;
  border-color: #60a5fa;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}


