/* ==========================================================================
   CEMRCB-RIVER Web GIS Portal - Main Stylesheet
   Theme: Emerald/Teal (#005d52), Crisp Slate, Glassmorphism, Responsive
   ========================================================================== */

:root {
  --primary-color: #005d52;
  --primary-dark: #00453d;
  --primary-light: #00897b;
  --accent-color: #f39c12;
  --accent-coral: #e74c3c;
  --bg-dark: #1e293b;
  --bg-light: #f8fafc;
  --bg-panel: #ffffff;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-light: #ffffff;
  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  --sidebar-width: 380px;
  --header-height: 58px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  inset: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background-color: var(--bg-light);
}

/* App Container Layout */
#app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100dvh);
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}

/* ------------------- HEADER ------------------- */
#gis-header {
  height: var(--header-height);
  background-color: var(--primary-color);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  user-select: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}

.portal-logo-svg,
.portal-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.portal-title-block {
  display: flex;
  flex-direction: column;
}

.portal-main-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
  line-height: 1.2;
}

.portal-sub-title {
  font-size: 0.75rem;
  color: #b2dfdb;
  font-weight: 400;
}

/* Header Nav Menu */
/* Header Horizontal GIS Portal Toolbar */
.header-nav.header-portal-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: 24px;
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.15);
}

.header-tool-group {
  display: flex;
  align-items: center;
  gap: 3px;
}

.header-toolbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 4px;
}

.header-tool-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  padding: 0;
  user-select: none;
}

.header-tool-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

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

.header-tool-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.3) !important;
}

.header-tool-btn.has-text-label {
  width: auto;
  padding: 0 10px;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.header-tool-text {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.header-tool-btn.btn-unselect-community.has-active-focus {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #fda4af !important;
  animation: focusPulse 1.8s infinite;
}

#btn-nav-hard-refresh i {
  transition: transform 0.3s ease;
}

#btn-nav-hard-refresh:hover i {
  transform: rotate(60deg);
}

#btn-nav-hard-refresh.refreshing i {
  animation: fa-spin 0.8s infinite linear;
}

/* Decommission floating vertical toolbar */
.gis-vertical-toolbar,
.map-left-zoom-widget {
  display: none !important;
}

@media (max-width: 1350px) {
  .header-tool-text {
    display: none;
  }
  .header-tool-btn.has-text-label {
    width: 34px !important;
    padding: 0 !important;
  }
  .header-search-box input {
    width: 180px;
  }
}

@media (max-width: 1080px) {
  .header-portal-toolbar {
    gap: 2px;
    padding: 2px 4px;
  }
  .header-tool-btn {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }
  .header-tool-btn.has-text-label {
    width: 30px !important;
  }
  .header-toolbar-divider {
    margin: 0 2px;
  }
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search-box input {
  background: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  color: #1e293b !important;
  padding: 6px 12px 6px 34px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  width: 250px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  transition: all 0.2s ease;
}

.header-search-box input::placeholder {
  color: #64748b !important;
  opacity: 0.9;
  font-weight: 400;
}

.header-search-box input:focus {
  background: #ffffff !important;
  color: #0f172a !important;
  width: 280px;
  border-color: #00796b !important;
  box-shadow: 0 0 0 3px rgba(0, 121, 107, 0.3), 0 4px 12px rgba(0, 0, 0, 0.16);
}

.header-search-box i {
  position: absolute;
  left: 11px;
  color: #00796b !important;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 2;
}

/* ------------------- ENHANCED SEARCH DROPDOWN ------------------- */
.search-box-wrapper {
  position: relative;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-height: 440px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
  z-index: 2000;
  display: none;
  animation: fadeInDropdown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.search-dropdown-header {
  padding: 9px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-count-badge {
  background: #00796b;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.search-results-list {
  display: flex;
  flex-direction: column;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f0fdfa;
}

.search-result-item:active {
  background: #ccfbf1;
}

.result-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

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

.result-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.result-layer-pill {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}

.result-cat-tag {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 500;
}

.result-location-tag {
  font-size: 0.7rem;
  color: #0288d1;
  font-weight: 600;
}

.result-action-icon {
  color: #cbd5e1;
  font-size: 0.85rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.search-result-item:hover .result-action-icon {
  color: #00796b;
  transform: scale(1.15);
}

.search-highlight {
  background: #fef08a;
  color: #854d0e;
  font-weight: 800;
  padding: 0 2px;
  border-radius: 2px;
}

.search-empty-state {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.84rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.search-empty-state i {
  font-size: 1.8rem;
  color: #94a3b8;
}

/* Pulse Marker on Selection */
.search-pulse-marker {
  position: relative;
}

.pulse-ring {
  width: 40px;
  height: 40px;
  border: 3px solid #d50000;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 0;
  animation: pulseAnim 1.4s infinite ease-out;
}

.pulse-core {
  width: 12px;
  height: 12px;
  background: #d50000;
  border-radius: 50%;
  position: absolute;
  top: 14px;
  left: 14px;
  box-shadow: 0 0 8px rgba(213, 0, 0, 0.8);
}

@keyframes pulseAnim {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* ------------------- BODY LAYOUT ------------------- */
#gis-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  height: auto;
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

/* Sidebar */
#gis-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.06);
  z-index: 500;
  margin-left: 0;
  transition: margin-left var(--transition-normal), box-shadow var(--transition-normal);
}

#gis-sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
  border-right: none;
  box-shadow: none;
}

/* Map Container */
#map-container {
  flex: 1;
  height: 100%;
  position: relative;
  transition: margin-left var(--transition-normal);
}

#map {
  width: 100%;
  height: 100%;
  background: #0f172a;
  z-index: 1;
}

/* ------------------- UNIFIED VERTICAL MAP TOOLBAR (LEFT DOCK) ------------------- */
.map-floating-toolbar {
  display: none !important;
}

.map-left-zoom-widget,
.gis-vertical-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
  padding: 4px;
  gap: 3px;
  z-index: 450;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  transition: top 0.25s ease, left 0.25s ease, opacity 0.2s ease;
}

.map-left-zoom-widget::-webkit-scrollbar,
.gis-vertical-toolbar::-webkit-scrollbar {
  display: none;
}

#gis-sidebar.collapsed ~ #map-container .map-left-zoom-widget,
#gis-sidebar.collapsed ~ #map-container .gis-vertical-toolbar {
  top: 58px;
  max-height: calc(100vh - 140px);
}

.map-left-zoom-widget .map-tool-btn,
.map-left-zoom-widget .map-left-zoom-btn,
.gis-vertical-toolbar .map-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: none;
  background: #f8fafc;
  color: #334155;
  font-size: 0.90rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
  flex-shrink: 0;
}

.map-left-zoom-widget .map-tool-btn:hover,
.map-left-zoom-widget .map-left-zoom-btn:hover,
.gis-vertical-toolbar .map-tool-btn:hover {
  background: var(--primary-color, #005d52);
  color: #ffffff;
  transform: scale(1.06);
}

.map-left-zoom-widget .map-tool-btn.active,
.gis-vertical-toolbar .map-tool-btn.active {
  background: var(--accent-coral, #ef4444);
  color: #ffffff;
}

/* Vertical Toolbar Separator Line */
.toolbar-v-divider {
  width: 20px;
  height: 1px;
  background: #cbd5e1;
  margin: 3px auto;
  flex-shrink: 0;
}

/* Unselect / Clear Focus Community Button */
.btn-unselect-community {
  color: #64748b !important;
  position: relative;
  transition: all 0.2s ease !important;
}

.btn-unselect-community:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.btn-unselect-community.has-active-focus {
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.65) !important;
  animation: pulse-unselect-focus-btn 1.8s infinite !important;
}

@keyframes pulse-unselect-focus-btn {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* ------------------- TOP RIGHT FLOATING WIDGET (BASEMAPS & KEY MAP) ------------------- */
.map-top-right-widget {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 278px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 500;
  pointer-events: auto;
  transition: all 0.25s ease;
}

/* Master Top-Right Hide / Unhide Header Bar */
.widget-master-toggle-header {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.widget-master-toggle-header:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.master-toggle-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.master-toggle-chevron {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.master-toggle-chevron:hover {
  background: #e2e8f0;
  color: var(--primary-color);
}

.widget-collapsible-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  transition: all 0.25s ease;
}

.widget-collapsible-body::-webkit-scrollbar {
  width: 5px;
}

.widget-collapsible-body::-webkit-scrollbar-track {
  background: transparent;
}

.widget-collapsible-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.widget-collapsible-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Master Collapsed (Hidden) State */
.map-top-right-widget.collapsed .widget-collapsible-body {
  display: none !important;
}

.map-top-right-widget.collapsed .master-toggle-chevron i {
  transform: rotate(180deg);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-collapse-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.card-collapse-btn:hover {
  background: #e2e8f0;
  color: var(--primary-color);
  border-color: #94a3b8;
}

/* 1. Basemaps Card */
.basemap-card-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.basemap-card-header {
  background: #f8fafc;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.basemap-card-header:hover {
  background: #f1f5f9;
}

.basemap-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Basemap Grid Options (2-Column Grid) */
.basemap-grid-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.basemap-option {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  text-align: left;
}

.basemap-option:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary-color);
}

.basemap-option.active {
  background: #e0f2f1;
  border-color: #00796b;
  color: #004d40;
  font-weight: 700;
  box-shadow: 0 0 0 1px #00796b;
}

.basemap-option i {
  font-size: 0.85rem;
  color: inherit;
}

/* 2. Key Map / Index Map Panel (Directly Below Basemaps) */
.keymap-card-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.keymap-card-header {
  background: #f8fafc;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.keymap-card-header:hover {
  background: #f1f5f9;
}

.keymap-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d47a1;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.keymap-btn-reset {
  background: #e3f2fd;
  color: #0d47a1;
  border: 1px solid #bbdefb;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.keymap-btn-reset:hover {
  background: #bbdefb;
  color: #0a3875;
}

.keymap-canvas-container {
  padding: 6px;
  position: relative;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.key-map-canvas {
  width: 100%;
  height: 160px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  cursor: crosshair;
}

.keymap-viewport-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 2px 0;
}

.keymap-tag-indicator {
  display: inline-block;
  width: 12px;
  height: 9px;
  border: 2px solid #d50000;
  background: rgba(213, 0, 0, 0.25);
  border-radius: 2px;
}

/* 3. Weather & Climate Card Panel */
.weather-card-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.weather-card-header {
  background: #f8fafc;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.weather-card-header:hover {
  background: #f1f5f9;
}

.weather-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0284c7;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Key Map Style Bar & Pills */
.keymap-style-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  margin-bottom: 5px;
  border: 1px solid #e2e8f0;
}

.keymap-style-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 4px;
}

.keymap-style-btns {
  display: flex;
  gap: 4px;
}

.keymap-style-pill {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.keymap-style-pill:hover {
  background: #f8fafc;
  color: var(--primary-color);
  border-color: #94a3b8;
}

.keymap-style-pill.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.35);
}

/* ================== COLLAPSED / HIDE STATES ================== */
.basemap-card-panel.collapsed .basemap-grid-options {
  display: none !important;
}

.basemap-card-panel.collapsed .basemap-card-header {
  border-bottom: none;
}

.keymap-card-panel.collapsed .keymap-canvas-container {
  display: none !important;
}

.keymap-card-panel.collapsed .keymap-card-header {
  border-bottom: none;
}

.weather-card-panel.collapsed .weather-layers-container {
  display: none !important;
}

.weather-card-panel.collapsed .weather-card-header {
  border-bottom: none;
}

.basemap-card-panel.collapsed #btn-collapse-basemaps i,
.keymap-card-panel.collapsed #btn-collapse-keymap i,
.weather-card-panel.collapsed #btn-collapse-weather i {
  transform: rotate(180deg);
}

/* Basemap Toggle Row */
.basemap-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

.basemap-toggle-row:hover {
  background: #f1f5f9;
}

.basemap-toggle-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.basemap-toggle-btn {
  width: 38px;
  height: 20px;
  border-radius: 10px;
  border: none;
  background: #cbd5e1;
  position: relative;
  cursor: pointer;
  transition: background 0.22s ease;
  padding: 0;
  flex-shrink: 0;
}

.basemap-toggle-btn.active {
  background: var(--primary-color);
}

.basemap-toggle-btn .toggle-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.22s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.basemap-toggle-btn.active .toggle-dot {
  transform: translateX(18px);
}

.basemap-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0;
}

/* ================= ZOOM.EARTH WEATHER & PRECIPITATION RADAR UI ================= */
.weather-layers-container {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  padding: 8px;
  gap: 8px;
  transition: all 0.25s ease;
}

.weather-section-divider {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 2px;
}

.precipitation-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.precipitation-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.precip-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.precip-main-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.precip-sub-title {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 500;
}

.text-cyan {
  color: #06b6d4 !important;
}

.text-sky {
  color: #0284c7 !important;
}

.radar-controls-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  animation: fadeIn 0.2s ease-in-out;
}

.radar-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
}

.radar-indicator-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulseDot 1.8s infinite;
}

.pulse-indicator-dot.past {
  background: #f59e0b;
  animation: none;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.radar-time-text {
  font-size: 0.74rem;
  font-weight: 600;
  color: #1e293b;
}

.badge-live-tag {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

.badge-forecast-tag {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

.radar-source-tag {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ================= PRECIPITATION RADAR LIVE BUTTON CARD ================= */
.radar-live-hero-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.btn-radar-live-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.btn-radar-live-hero .radar-hero-left,
.btn-radar-live-hero .radar-hero-right {
  position: relative;
  z-index: 2;
}

.btn-radar-live-hero:hover {
  border-color: #38bdf8;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.3);
  transform: translateY(-1px);
}

.btn-radar-live-hero.is-playing {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  border-color: #7dd3fc;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.45);
}

.btn-radar-live-hero.is-playing::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -20%;
  width: 140%;
  height: 220%;
  background: conic-gradient(from 0deg at 50% 50%, transparent 0deg, transparent 270deg, rgba(56, 189, 248, 0.15) 330deg, rgba(56, 189, 248, 0.45) 360deg);
  animation: radarSweepConic 3.5s linear infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes radarSweepConic {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-hero-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.radar-hero-play-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  color: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding-left: 2px;
}

.btn-radar-live-hero.is-playing .radar-hero-play-icon {
  background: #ffffff;
  color: #0369a1;
  padding-left: 0;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
}

.radar-hero-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.radar-hero-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-hero-sub {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-radar-live-hero.is-playing .radar-hero-sub {
  color: #e0f2fe;
}

.radar-hero-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
}

.radar-live-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 86px;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 14px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.beacon-glow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: beaconPulse 1.8s infinite;
  flex-shrink: 0;
}

@keyframes beaconPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.radar-hero-sub-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-radar-sub-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
}

.btn-radar-sub-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-radar-sub-action.active,
.btn-radar-sub-action.is-active-live {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
}

.btn-radar-sub-action.is-active-live i {
  color: #059669 !important;
}

/* Opacity Slider Row */
.radar-opacity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #475569;
}

.radar-opacity-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  flex-shrink: 0;
}

.radar-opacity-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: #e2e8f0;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.radar-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #0f766e;
  cursor: pointer;
}

.radar-opacity-val {
  font-weight: 700;
  color: #0f172a;
  min-width: 28px;
  text-align: right;
}

/* Legend Gradient Bar */
.radar-legend-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #f8fafc;
  padding: 5px 6px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}

.radar-legend-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  font-weight: 600;
  color: #64748b;
}

.radar-legend-gradient-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, 
    #00ffff 0%, 
    #0099ff 20%, 
    #00ff00 40%, 
    #ffff00 60%, 
    #ff6600 80%, 
    #ff0000 90%, 
    #ff00ff 100%);
  border: 1px solid rgba(0,0,0,0.1);
}

/* Windy View Trigger Button */
.btn-windy-modal-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-windy-modal-trigger:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
  color: #0284c7;
}

.btn-windy-modal-trigger .mini-ext-icon {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* Weather Sub-Tabs Switcher */
.weather-sub-tabs {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 4px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: var(--radius-sm);
}

.weather-tab-btn {
  border: none;
  background: transparent;
  padding: 5px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.weather-tab-btn:hover {
  color: #0369a1;
  background: rgba(255, 255, 255, 0.6);
}

.weather-tab-btn.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* TAB 2: Forecast Styles */
.forecast-panel-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.forecast-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
}

.forecast-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.forecast-location-select {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.73rem;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  cursor: pointer;
}

.forecast-cards-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.forecast-loading-spinner {
  text-align: center;
  padding: 16px 8px;
  font-size: 0.74rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.forecast-day-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease;
}

.forecast-day-card:hover {
  border-color: #7dd3fc;
  transform: translateY(-1px);
}

.forecast-day-card.alert-border {
  border-left: 3px solid #f97316;
  background: #fffbf5;
}

.forecast-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forecast-day-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #0f172a;
}

.forecast-date-small {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 500;
}

.badge-rain-warning {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.forecast-day-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.forecast-weather-icon-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.forecast-weather-icon-box i {
  font-size: 1.15rem;
}

.forecast-condition-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
}

.forecast-metrics-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  color: #334155;
}

.forecast-metric-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.btn-full-forecast-modal {
  width: 100%;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-full-forecast-modal:hover {
  background: #e0f2fe;
  color: #0284c7;
}

/* TAB 3: Wind Styles */
.wind-panel-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wind-toggle-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.wind-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.wind-main-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wind-sub-title {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 500;
}

.wind-table-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wind-table-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wind-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
}

.wind-summary-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #e2e8f0;
}

.wind-summary-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
}

/* Map Wind Vector Markers V2 (Windy / Zoom Earth Style) */
.leaflet-wind-vector-icon {
  background: transparent !important;
  border: none !important;
}

.map-wind-vector-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.map-wind-vector-v2:hover {
  transform: scale(1.18);
  z-index: 9999 !important;
}

.wind-circle-badge {
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.96);
  border: 2.2px solid #0284c7;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.wind-arrow-rotate {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
  margin-top: 1px;
}

.wind-speed-val {
  font-size: 9px;
  font-weight: 800;
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
  margin-top: 1px;
  letter-spacing: -0.2px;
}

.wind-speed-val .wind-unit {
  font-size: 7.5px;
  font-weight: 600;
  opacity: 0.9;
  margin-left: 1px;
}

.wind-beacon-pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #0284c7;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: windBeaconWave 2.4s cubic-bezier(0.1, 0.8, 0.2, 1) infinite;
  opacity: 0.8;
}

@keyframes windBeaconWave {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(2.1); opacity: 0; }
}

.wind-district-pill {
  margin-top: 2px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.2px;
}

.wind-marker-popup {
  padding: 4px;
  font-size: 0.8rem;
  min-width: 190px;
}

.wind-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 5px;
  margin-bottom: 6px;
}

.wind-popup-live-tag {
  background: #10b981;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
}

.wind-popup-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  color: #334155;
  margin-bottom: 8px;
}

.btn-popup-view-forecast {
  width: 100%;
  border: none;
  background: #0284c7;
  color: #ffffff;
  padding: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-popup-view-forecast:hover {
  background: #0369a1;
}

/* Modal 7-Day Forecast Grid */
.modal-forecast-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
}

.modal-forecast-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modal-forecast-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.modal-forecast-card.risk-highlight {
  border: 2px solid #ea580c;
  background: #fff7ed;
}

.m-forecast-day-header {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.m-day-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
}

.m-date-text {
  font-size: 0.7rem;
  color: #64748b;
}

.m-weather-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 4px 0;
}

.m-cond-text {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
}

.m-stats-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 6px;
}

.m-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  color: #475569;
}

.m-alert-banner {
  width: 100%;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px;
  border-radius: 4px;
  margin-top: 4px;
}

/* Color utilities */
.text-yellow { color: #eab308 !important; }
.text-orange { color: #f97316 !important; }
.text-red { color: #ef4444 !important; }
.text-gray { color: #64748b !important; }

/* Quick Launch Button in Satellite & Weather Panel */
.btn-launch-bottom-timeline {
  width: 100%;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-launch-bottom-timeline:hover {
  background: #ffedd5;
  color: #9a3412;
  border-color: #fdba74;
  transform: translateY(-1px);
}

/* ================= WINDY & ZOOM-EARTH STYLE FLOATING BOTTOM TIMELINE PLAYER ================= */
.weather-bottom-timeline-widget {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(780px, calc(100vw - 32px));
  width: auto;
  pointer-events: auto;
  animation: slideUpFade 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translate(-50%, 18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Circular Glowing Play Button */
.bottom-timeline-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dc2626;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.1);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  padding-left: 3px; /* optical centering */
  position: relative;
}

.bottom-timeline-play-btn:hover {
  transform: scale(1.08);
  background: #ffffff;
  color: #b91c1c;
  box-shadow: 0 10px 28px rgba(220, 38, 38, 0.35), 0 0 0 3px rgba(239, 68, 68, 0.25);
}

.bottom-timeline-play-btn.playing {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  padding-left: 0;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5), 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.bottom-timeline-play-btn.playing:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px rgba(2, 132, 199, 0.65), 0 0 0 4px rgba(56, 189, 248, 0.4);
}

/* Inner Container - Ultra Glassmorphic Obsidian Bar */
.bottom-timeline-inner-box {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(24, 32, 47, 0.96) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
  min-width: 480px;
  max-width: 700px;
  flex: 1;
}

/* Top Mini Header Bar */
.bottom-timeline-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
}

.bottom-timeline-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bottom-timeline-mode-pill {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.bottom-timeline-mode-pill:hover {
  background: rgba(2, 132, 199, 0.38);
  color: #ffffff;
  border-color: #38bdf8;
}

.bottom-timeline-mode-pill.forecast-active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

.bottom-timeline-live-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
}

.live-beacon-micro {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: beaconPulse 1.6s infinite;
}

.bottom-timeline-actions-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bottom-timeline-action-pill {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.bottom-timeline-action-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.bottom-timeline-action-pill.pill-live {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-weight: 800;
}

.bottom-timeline-action-pill.pill-live:hover,
.bottom-timeline-action-pill.pill-live.active {
  background: rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
}

.bottom-timeline-action-pill.pill-nav {
  padding: 3px 7px;
}

.bottom-timeline-close-btn {
  border: none;
  background: transparent;
  color: #64748b;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.15s;
}

.bottom-timeline-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Timeline Track Wrapper */
.bottom-timeline-track-wrapper {
  padding: 6px 10px 4px 10px;
  background: rgba(15, 23, 42, 0.85);
}

.bottom-timeline-track {
  position: relative;
  height: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  cursor: pointer;
  overflow: visible;
  transition: background 0.15s;
}

.bottom-timeline-track:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Glowing Neon Progress Bar */
.bottom-timeline-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #10b981 100%);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  pointer-events: none;
  transition: width 0.12s ease-out;
}

/* Neon Scrubber Handle with Floating Tooltip */
.bottom-timeline-scrubber {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 100%;
  width: 2px;
  background: transparent;
  z-index: 10;
  pointer-events: none;
  transition: left 0.12s ease-out;
}

.bottom-timeline-scrubber-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #0284c7;
  box-shadow: 0 0 10px #38bdf8, 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Amber/Cyan Tooltip Badge above scrubber */
.bottom-timeline-badge {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2);
  line-height: 1.3;
  letter-spacing: 0.3px;
}

.bottom-timeline-badge::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: #0369a1 transparent transparent transparent;
}

/* Day & Milestone Slots Row */
.bottom-timeline-days-row {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 30px;
  background: rgba(30, 41, 59, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.bottom-day-slot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
  position: relative;
}

.bottom-day-slot:last-child {
  border-right: none;
}

.bottom-day-slot:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.bottom-day-slot.active {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
  font-weight: 800;
  box-shadow: inset 0 2px 0 #38bdf8;
}

.bottom-day-slot.slot-live {
  color: #34d399;
}

.bottom-day-slot.slot-live.active {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  box-shadow: inset 0 2px 0 #10b981;
}

.slot-text-main {
  letter-spacing: 0.2px;
}

/* Floating Reopen Weather Timeline Button */
.btn-reopen-weather-timeline {
  position: absolute;
  bottom: 30px;
  left: 16px;
  z-index: 550;
  background: rgba(30, 41, 59, 0.94);
  backdrop-filter: blur(6px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.btn-reopen-weather-timeline:hover {
  background: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

/* Responsive Overrides for Bottom Timeline Player */
@media (max-width: 768px) {
  .weather-bottom-timeline-widget {
    bottom: 25px;
    max-width: calc(100vw - 16px);
    gap: 6px;
  }

  .bottom-timeline-play-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .bottom-timeline-inner-box {
    min-width: 0;
    width: 100%;
  }

  .bottom-day-slot {
    font-size: 9px;
    height: 25px;
  }

  .bottom-timeline-actions-group .bottom-timeline-action-pill:not(#btn-bottom-timeline-wind-toggle) {
    display: none;
  }
}

/* FFWC Panel in Satellite & Weather (Zoom Earth / BWDB) */
.ffwc-panel-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ffwc-panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.ffwc-panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ffwc-panel-main-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ffwc-panel-sub-title {
  font-size: 0.67rem;
  color: #64748b;
  font-weight: 500;
}

.ffwc-panel-scope-row {
  display: flex;
  gap: 6px;
}

.ffwc-panel-scope-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.ffwc-panel-scope-btn:hover {
  border-color: #0284c7;
}

.ffwc-panel-scope-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.ffwc-panel-status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.ffwc-panel-status-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ffwc-panel-status-card:hover,
.ffwc-panel-status-card.active {
  background: #f0f9ff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

.ffwc-panel-status-card .st-card-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ffwc-panel-status-card .st-card-info {
  display: flex;
  flex-direction: column;
}

.ffwc-panel-status-card .st-card-num {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.ffwc-panel-status-card .st-card-lbl {
  font-size: 0.65rem;
  color: #64748b;
  font-weight: 600;
}

.ffwc-panel-dropdown-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ffwc-panel-dropdown-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ffwc-panel-select {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.74rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
}

.ffwc-panel-actions-row {
  display: flex;
  gap: 6px;
}

.btn-ffwc-panel-action {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0284c7;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-ffwc-panel-action:hover {
  background: #f0f9ff;
  border-color: #0284c7;
}

/* ================= FFWC WATER LEVEL MAP & INTERACTIVE LEGEND UI (LEFT SIDE) ================= */
.ffwc-water-level-legend-widget {
  position: absolute;
  bottom: 28px;
  left: 14px;
  right: auto;
  z-index: 520;
  width: 295px;
  max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-family: inherit;
  animation: slideUpFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.ffwc-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
}

.ffwc-legend-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ffwc-legend-main-title {
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.ffwc-legend-date-sub {
  font-size: 0.65rem;
  color: #bae6fd;
  font-weight: 500;
}

.ffwc-legend-close-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.ffwc-legend-close-btn:hover {
  background: rgba(239, 68, 68, 0.8);
}

.ffwc-legend-scope-row {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.ffwc-scope-chip {
  flex: 1;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.ffwc-scope-chip:hover {
  background: #e0f2fe;
  color: #0284c7;
}

.ffwc-scope-chip.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
}

.ffwc-legend-items-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  max-height: 220px;
  overflow-y: auto;
}

.ffwc-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ffwc-legend-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ffwc-legend-item.active {
  background: #e0f2fe;
  border-color: #0284c7;
}

.leg-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ffwc-leg-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.leg-text-block {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.leg-text-block strong {
  font-size: 0.72rem;
  color: #0f172a;
}

.leg-text-block span {
  font-size: 0.64rem;
  color: #64748b;
}

.ffwc-count-pill {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  color: #ffffff;
  min-width: 22px;
  text-align: center;
}

.ffwc-count-pill.normal { background: #008000; }
.ffwc-count-pill.warning { background: #FF8C00; }
.ffwc-count-pill.flood { background: #FF0000; }
.ffwc-count-pill.severe { background: #FF00FF; }

.ffwc-legend-trend-footnote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: #f8fafc;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.65rem;
  color: #475569;
}

.footnote-title {
  font-weight: 700;
  color: #0369a1;
}

.footnote-symbols {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ffwc-legend-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: #e2e8f0;
  font-size: 0.63rem;
  color: #64748b;
  font-weight: 600;
}

.ffwc-legend-source-bar a {
  color: #0284c7;
  text-decoration: none;
  font-weight: 700;
}

.ffwc-legend-source-bar a:hover {
  text-decoration: underline;
}

/* Map Markers Pin Styling */
.ffwc-custom-div-icon {
  background: transparent !important;
  border: none !important;
  pointer-events: auto !important;
}

.ffwc-map-pin {
  position: relative;
  width: 28px;
  height: 36px;
  cursor: pointer;
  pointer-events: auto !important;
  transition: transform 0.18s ease;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.35));
}

.ffwc-map-pin:hover {
  transform: scale(1.22) translateY(-2px);
  z-index: 9999 !important;
}

.ffwc-map-pin.pulse-danger {
  animation: pulseDanger 1.8s infinite;
}

.ffwc-map-pin.pulse-warning {
  animation: pulseWarning 2.2s infinite;
}

@keyframes pulseDanger {
  0% { filter: drop-shadow(0 0 0 rgba(255, 0, 0, 0.8)); }
  70% { filter: drop-shadow(0 0 12px rgba(255, 0, 0, 0)); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 0, 0, 0)); }
}

@keyframes pulseWarning {
  0% { filter: drop-shadow(0 0 0 rgba(255, 140, 0, 0.7)); }
  70% { filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0)); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 140, 0, 0)); }
}

/* Animated Concentric Water Ripple Waves for Flood & Warning Stations */
.ffwc-ripple-ring {
  position: absolute;
  top: 13px;
  left: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: -1;
}

.ffwc-ripple-severe-1 {
  border: 2.5px solid #ff00ff;
  animation: floodWavePulse 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}
.ffwc-ripple-severe-2 {
  border: 2px solid #e11d48;
  animation: floodWavePulse 1.8s cubic-bezier(0.1, 0.8, 0.3, 1) infinite 0.6s;
}
.ffwc-ripple-flood-1 {
  border: 2.5px solid #ef4444;
  animation: floodWavePulse 1.9s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}
.ffwc-ripple-flood-2 {
  border: 2px solid #dc2626;
  animation: floodWavePulse 1.9s cubic-bezier(0.1, 0.8, 0.3, 1) infinite 0.65s;
}
.ffwc-ripple-warning {
  border: 2px solid #f59e0b;
  animation: floodWavePulse 2.3s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

@keyframes floodWavePulse {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(3.5); opacity: 0; }
}

.ffwc-pin-trend-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.ffwc-pin-trend-badge.trend-up { background: #dc2626; }
.ffwc-pin-trend-badge.trend-down { background: #10b981; }
.ffwc-pin-trend-badge.trend-steady { background: #64748b; }

/* Station Tooltip */
.ffwc-leaflet-tooltip {
  background: rgba(15, 23, 42, 0.95) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 5px !important;
  font-size: 0.72rem !important;
  padding: 4px 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
}

/* Station Popup */
.ffwc-station-popup .leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
}

.ffwc-station-popup .leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.ffwc-popup-card {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #ffffff;
}

.ffwc-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  border-top: 3.5px solid #008000;
  padding-top: 4px;
}

.ffwc-popup-title-box {
  display: flex;
  flex-direction: column;
}

.ffwc-popup-st-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
}

.ffwc-popup-en-name {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
}

.ffwc-popup-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.ffwc-popup-location-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #334155;
  background: #f8fafc;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}

.badge-project-area {
  margin-left: auto;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
}

.ffwc-popup-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ffwc-metric-cell {
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
}

.ffwc-metric-cell .m-label {
  font-size: 0.64rem;
  color: #475569;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ffwc-metric-cell .m-val {
  font-size: 0.88rem;
  font-weight: 800;
  margin-top: 2px;
}

.ffwc-metric-cell .m-sub {
  font-size: 0.6rem;
  color: #94a3b8;
}

.ffwc-popup-alert {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ffwc-popup-alert.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.ffwc-popup-alert.safe {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.ffwc-popup-trend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #334155;
  border-top: 1px solid #f1f5f9;
  padding-top: 5px;
}

.ffwc-popup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  padding-top: 5px;
}

.ffwc-popup-ext-link {
  color: #0284c7;
  text-decoration: none;
  font-weight: 700;
}

.ffwc-popup-ext-link:hover {
  text-decoration: underline;
}

/* Sidebar TOC and Legend Elements */
.ffwc-toc-item {
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

.ffwc-legend-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.ffwc-sidebar-legend-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.ffwc-s-leg-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: #334155;
}

.ffwc-pin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Mobile responsive for FFWC Legend */
@media (max-width: 768px) {
  .ffwc-water-level-legend-widget {
    bottom: 30px;
    left: 8px;
    right: auto;
    width: 270px;
  }
}

/* Map Bottom Status Bar */
#map-status-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 400;
  user-select: none;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Sidebar Toggle Trigger Button (only when collapsed) */
.btn-sidebar-collapse-trigger {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-lg);
  color: #ffffff;
  display: none; /* Hidden by default when sidebar is open */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 450;
  transition: var(--transition-fast);
}

.btn-sidebar-collapse-trigger:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* ------------------- LOADING OVERLAY ------------------- */
#app-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #004d40 0%, #005d52 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: #ffffff;
  transition: opacity 0.5s ease;
}

#app-loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 380px;
  text-align: center;
  padding: 24px;
}

.loading-logo-circle {
  width: 72px;
  height: 72px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  animation: pulseLogo 2s infinite ease-in-out;
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.loading-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.loading-subtitle {
  font-size: 0.88rem;
  color: #80cbc4;
}

.progress-bar-container {
  width: 280px;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: #00e676;
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.loading-status {
  font-size: 0.78rem;
  color: #e0f2f1;
  font-style: italic;
}

/* ==========================================================================
   LEAFLET CONTROLS OFFSET & POSITIONING (North Arrow & Scale Bar)
   ========================================================================== */
.leaflet-bottom {
  bottom: 28px !important;
  z-index: 1000 !important;
  pointer-events: none;
}

.leaflet-bottom.leaflet-left {
  position: absolute !important;
  left: 12px !important;
  bottom: 28px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  visibility: visible !important;
}

.leaflet-control-north-arrow {
  order: 1 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  pointer-events: auto !important;
  z-index: 1000 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.north-arrow-badge {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  height: 56px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(8px) !important;
  border: 1.5px solid rgba(0, 0, 0, 0.25) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  cursor: pointer !important;
  padding: 2px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
  user-select: none !important;
}

.north-arrow-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35) !important;
  background: #ffffff !important;
}

.north-arrow-badge svg {
  display: block !important;
}

.leaflet-control-scale {
  order: 2 !important;
  margin: 0 !important;
  pointer-events: auto !important;
  z-index: 1000 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  border-radius: 4px !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.leaflet-control-scale-line {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 2px solid #0f172a !important;
  border-top: none !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
  padding: 2px 6px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-scale-line:not(:first-child) {
  border-top: 2px solid #0f172a !important;
  border-bottom: none !important;
  margin-top: -2px !important;
}

/* ------------------- MOBILE & SMARTPHONE RESPONSIVE ------------------- */
@media (max-width: 992px) {
  #gis-header {
    height: auto !important;
    min-height: 84px;
    padding: 6px 12px 6px 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px 8px !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28) !important;
  }

  /* ROW 1 LEFT: Logo + Title (EXACTLY like Image 2, ALWAYS visible) */
  .header-left {
    order: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 0 0 auto !important;
    max-width: calc(100% - 140px) !important;
    min-width: 0 !important;
  }

  .portal-logo-wrapper {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  .portal-logo-img,
  .portal-logo-svg {
    width: 36px !important;
    height: 36px !important;
    object-fit: contain !important;
    display: block !important;
  }

  .portal-title-block {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
  }

  .portal-main-title {
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif !important;
    color: #ffffff !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    letter-spacing: -0.3px !important;
    overflow: visible !important;
  }

  .portal-sub-title {
    display: block !important;
    font-size: 0.72rem !important;
    color: #80cbc4 !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px !important;
    line-height: 1.1 !important;
    margin-top: 1px !important;
    white-space: nowrap !important;
  }

  /* ROW 1 RIGHT: Actions (Search, Lang, Feedback) */
  .header-right {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .header-search-box {
    position: relative;
    display: flex;
    align-items: center;
  }

  .header-search-box input {
    width: 120px !important;
    background: #ffffff !important;
    color: #1e293b !important;
    font-size: 0.74rem !important;
    font-weight: 500 !important;
    padding: 5px 8px 5px 28px !important;
    border: 1.5px solid #cbd5e1 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    border-radius: var(--radius-pill) !important;
    transition: width 0.25s ease !important;
  }

  .header-search-box input:focus {
    width: 155px !important;
    border-color: #00796b !important;
  }

  .header-search-box input::placeholder {
    color: #64748b !important;
    font-size: 0.70rem !important;
  }

  .header-search-box i {
    left: 9px !important;
    color: #00796b !important;
    font-size: 0.76rem !important;
    z-index: 2 !important;
  }

  .btn-lang-toggle {
    padding: 3px 8px !important;
    font-size: 0.74rem !important;
    height: 28px !important;
    line-height: 1 !important;
  }

  .btn-stealth-contact {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.80rem !important;
  }

  /* ROW 2: Auto-Adjustable Sleek Horizontal GIS Tools Strip */
  .header-nav.header-portal-toolbar {
    order: 3 !important;
    width: 100% !important;
    margin-top: 2px !important;
    padding: 2px 4px !important;
    background: rgba(0, 0, 0, 0.28) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3) !important;
  }

  .header-nav.header-portal-toolbar::-webkit-scrollbar {
    display: none !important;
  }

  .header-tool-group {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
  }

  .header-tool-btn {
    width: 27px !important;
    height: 27px !important;
    min-width: 27px !important;
    font-size: 0.78rem !important;
    flex-shrink: 0 !important;
    border-radius: 5px !important;
    padding: 0 !important;
  }

  .header-tool-text {
    display: none !important;
  }

  .header-tool-btn.has-text-label {
    width: 27px !important;
    min-width: 27px !important;
    padding: 0 !important;
  }

  .header-toolbar-divider {
    height: 16px !important;
    margin: 0 1px !important;
    background: rgba(255, 255, 255, 0.22) !important;
    flex-shrink: 0 !important;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100vw;
  }

  /* Full Screen Sidebar Drawer on Mobile */
  #gis-sidebar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    z-index: 1200 !important;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.4) !important;
    transform: translateX(0) !important;
    transition: transform var(--transition-normal) !important;
    background: #ffffff !important;
  }

  #gis-sidebar.collapsed {
    margin-left: 0 !important;
    transform: translateX(-100%) !important;
  }

  /* Floating Sidebar Open Trigger on Top Left */
  .btn-sidebar-collapse-trigger {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 900 !important;
    width: 38px !important;
    height: 38px !important;
    background: var(--primary-color) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
    border-radius: var(--radius-md) !important;
  }

  /* Search Dropdown on Mobile */
  .search-results-dropdown {
    width: min(320px, calc(100vw - 20px)) !important;
    right: 0 !important;
    left: auto !important;
    z-index: 2500 !important;
  }

  /* Floating Logo on Mobile */
  .map-floating-logo-badge {
    position: absolute !important;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px)) !important;
    right: 8px !important;
    z-index: 800 !important;
    display: flex !important;
    align-items: center !important;
    padding: 3px 6px !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35) !important;
    background: #ffffff !important;
    border-radius: 6px !important;
  }

  .map-floating-logo-img {
    height: 32px !important;
    width: auto !important;
    display: block !important;
  }

  /* Status Bar on Mobile */
  #map-status-bar {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    font-size: 0.65rem !important;
    padding: 0 8px env(safe-area-inset-bottom, 0px) 8px !important;
    z-index: 850 !important;
    background: rgba(15, 23, 42, 0.98) !important;
    display: flex !important;
    align-items: center !important;
  }

  .status-right {
    display: none !important;
  }

  /* Leaflet Controls (North Arrow & Scale Bar) on Mobile */
  .leaflet-bottom.leaflet-left {
    position: absolute !important;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    gap: 4px !important;
    z-index: 1000 !important;
    visibility: visible !important;
    pointer-events: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .north-arrow-badge {
    width: 36px !important;
    height: 46px !important;
  }

  .north-arrow-badge svg {
    width: 30px !important;
    height: 40px !important;
  }

  .leaflet-control-scale {
    margin: 0 !important;
    pointer-events: auto !important;
    z-index: 1000 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .leaflet-control-scale-line {
    font-size: 9.5px !important;
    line-height: 1.1 !important;
    padding: 1px 4px !important;
  }
}

@media (max-width: 480px) {
  #gis-header {
    padding: 4px 8px 5px 8px !important;
    min-height: 80px;
  }

  .header-left {
    gap: 8px !important;
    max-width: calc(100% - 110px) !important;
  }

  .portal-logo-wrapper {
    width: 42px !important;
    height: 42px !important;
  }

  .portal-logo-img,
  .portal-logo-svg {
    width: 34px !important;
    height: 34px !important;
  }

  .portal-main-title {
    font-size: 1.05rem !important;
  }

  .portal-sub-title {
    font-size: 0.68rem !important;
  }

  .header-search-box input {
    width: 85px !important;
    font-size: 0.70rem !important;
    padding: 4px 6px 4px 24px !important;
  }

  .header-search-box input:focus {
    width: 130px !important;
  }

  .header-search-box i {
    left: 8px !important;
    font-size: 0.72rem !important;
  }

  .header-tool-btn {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    font-size: 0.74rem !important;
    padding: 0 !important;
  }

  .header-tool-btn.has-text-label {
    width: 25px !important;
    min-width: 25px !important;
  }
}


/* ==========================================================================
   TOC BASEMAP ITEMS (In Sidebar beneath 12 Project Data Layers)
   ========================================================================== */
.toc-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 4px 8px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted, #64748b);
  border-top: 1px dashed #cbd5e1;
  padding-top: 12px;
}

.toc-section-divider i {
  color: var(--primary-color, #005d52);
  font-size: 0.8rem;
}

.toc-basemap-item {
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.toc-basemap-item.is-active-basemap {
  border-left-color: #0284c7;
  background: #f0f9ff;
}

.toc-basemap-swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.toc-basemap-swatch.swatch-satellite {
  background: linear-gradient(135deg, #1e3a1e, #134e4a);
}

.toc-basemap-swatch.swatch-googlemaps {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
}

/* ==========================================================================
   WEATHER TOC CARDS & ADVANCED ANIMATIONS (In Sidebar Weather Tab & Map)
   ========================================================================== */

/* Active Weather Count Badge in Header */
.weather-active-count-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #64748b;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.weather-active-count-badge.is-active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.weather-active-count-badge.is-active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: beaconPulse 1.8s infinite;
  flex-shrink: 0;
}

/* Glassmorphic Modern Weather TOC Card */
.weather-toc-item {
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: 4px solid #cbd5e1;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.weather-toc-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transform: translateY(-1.5px);
}

.weather-toc-item.expanded {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}

.weather-toc-item.expanded .toc-btn-expand i {
  transform: rotate(180deg);
}

.toc-btn-expand i {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Individual active theme accents for Weather Layers */
#weather-item-ffwc.is-active-weather {
  border-left-color: #0284c7;
  border-color: rgba(2, 132, 199, 0.35);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.15);
}

#weather-item-radar.is-active-weather {
  border-left-color: #0ea5e9;
  border-color: rgba(14, 165, 233, 0.4);
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.18);
}

#weather-item-forecast.is-active-weather {
  border-left-color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.14);
}

#weather-item-wind.is-active-weather {
  border-left-color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

/* Swatches with glow */
.weather-toc-icon-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.weather-toc-item.is-active-weather .weather-toc-icon-swatch {
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  animation: swatchPulse 2.8s ease-in-out infinite;
}

@keyframes swatchPulse {
  0%, 100% { transform: scale(1.08); }
  50% { transform: scale(1.15); }
}

.weather-toc-icon-swatch.swatch-ffwc {
  background: #0284c7;
  color: #ffffff;
}

.weather-toc-icon-swatch.swatch-precip {
  background: #0ea5e9;
  color: #ffffff;
}

.weather-toc-icon-swatch.swatch-forecast {
  background: #f59e0b;
  color: #ffffff;
}

.weather-toc-icon-swatch.swatch-wind {
  background: #10b981;
  color: #ffffff;
}

/* Radar in-panel milestone slots */
.panel-timeline-slots-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-top: 8px;
}

.panel-timeline-slot {
  flex: 1;
  text-align: center;
  padding: 5px 2px;
  font-size: 0.66rem;
  font-weight: 700;
  color: #64748b;
  background: #ffffff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid #e2e8f0;
  user-select: none;
}

.panel-timeline-slot:hover {
  background: #e0f2fe;
  color: #0284c7;
  border-color: #7dd3fc;
  transform: translateY(-1px);
}

.panel-timeline-slot.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.panel-timeline-slot.slot-live {
  color: #ef4444;
  font-weight: 800;
}

.panel-timeline-slot.slot-live.active {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Weather Condition Micro-Animations */
@keyframes sunSpinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

@keyframes rainDropDrip {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2.5px); }
}

@keyframes thunderBoltFlash {
  0%, 88%, 100% { opacity: 1; filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
  90%, 94% { opacity: 0.3; }
  92%, 96% { opacity: 1; filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.9)); }
}

.weather-anim-sun {
  display: inline-block;
  animation: sunSpinSlow 18s linear infinite;
}

.weather-anim-cloud-sun {
  display: inline-block;
  animation: cloudSunFloat 3.5s ease-in-out infinite;
}

.weather-anim-rain {
  display: inline-block;
  animation: rainDropDrip 1.4s ease-in-out infinite;
}

.weather-anim-thunder {
  display: inline-block;
  animation: thunderBoltFlash 2.5s ease-in-out infinite;
}

/* Forecast District Hero Pill */
.forecast-district-hero-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-radius: 8px;
  color: #ffffff;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.f-hero-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.f-hero-district {
  font-size: 0.84rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ffffff;
}

.f-hero-today-cond {
  font-size: 0.68rem;
  color: #e0f2fe;
  font-weight: 500;
}

.f-hero-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.f-hero-today-temp {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Staggered Forecast Cards */
.forecast-day-card {
  animation: forecastCardEnter 0.28s ease-out both;
}

@keyframes forecastCardEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.temp-metric-range {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.temp-val-min {
  color: #0284c7;
  font-size: 0.68rem;
}

.temp-val-max {
  color: #f97316;
  font-size: 0.68rem;
}

.temp-range-bar {
  width: 32px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.temp-range-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #f97316 100%);
  border-radius: 2px;
}

/* Wind Table Enhancements */
.wind-table-row {
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.wind-table-row:hover {
  background: #f0f9ff;
}

.wind-table-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 12px;
  white-space: nowrap;
}

.wind-arrow-anim {
  display: inline-block;
  transition: transform 0.3s ease;
  font-size: 9px;
}

.wind-table-row:hover .wind-arrow-anim {
  transform: scale(1.25);
}

.wind-rain-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.68rem;
}

/* Floating On-Map Weather HUD */
.map-weather-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 540;
  pointer-events: auto;
  animation: hudSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes hudSlideDown {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.weather-hud-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 30px;
  padding: 5px 12px 5px 10px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.weather-hud-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: beaconPulse 1.6s infinite;
  flex-shrink: 0;
}

.weather-hud-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.weather-hud-content .hud-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.weather-hud-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  padding-left: 6px;
  margin-left: 2px;
}

.btn-hud-action {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-hud-action:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  transform: scale(1.1);
}


