/* ============================
   Table of Contents
   1. Global Styles & Layout
   2. Header & Navigation (see sidebar-layout.css for main header)
   3. Map Container & Elements (map positioning in sidebar-layout.css)
   4. Controls & UI Elements
   5. Panels & Modals
   6. Details Sidebar
   7. Notifications & Tooltips
   8. Pro Features & Indicators
   9. Responsive Design

   Last cleaned: 2025-12-23
   ============================ */

/* ============================
   1. Global Styles & Layout
   ============================ */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

/* Safe area inset variables */
:root {
  /* Provide a fallback of 0px if env() is not supported or returns nothing */
  --safe-area-inset-top: env(safe-area-inset-top, 0px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
  --safe-area-inset-right: env(safe-area-inset-right, 0px);

  /* Mobile bottom offset - reduced from 80px to prevent controls from being too high */
  /* env(safe-area-inset-bottom) typically returns ~34px on iPhones with home indicator */
  --mobile-bottom-offset-fallback: 15px;

  /* Calculate mobile padding: use safe area if available, otherwise small fallback */
  --calculated-mobile-bottom-padding: max(
    var(--safe-area-inset-bottom),
    var(--mobile-bottom-offset-fallback)
  );
}

/* ============================
   2. Header & Navigation
   ============================ */
/* Note: Main header styles are in sidebar-layout.css (.forayz-header) */

/* ============================
   3. Map Container & Elements
   ============================ */
/* Note: #map positioning is in sidebar-layout.css */
/* TODO drop all the deprecated js/mapbox/ references  */

/* MapLibre GL JS Controls (uses maplibregl-ctrl classes, compatible with mapboxgl legacy) */

/* Bottom-right controls (navigation, geolocate) */
.mapboxgl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-right {
  /* Use safe area inset for bottom positioning */
  bottom: calc(5px + var(--safe-area-inset-bottom)) !important;
  /* Ensure high z-index */
  z-index: 1001 !important;
  /* Add transition for smooth repositioning */
  transition: bottom 0.3s ease;
}

/* Bottom-left controls (attribution) */
.mapboxgl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-left {
  /* Position in safe area - higher up to avoid iPhone home indicator */
  bottom: calc(10px + var(--safe-area-inset-bottom)) !important;
  left: calc(10px + var(--safe-area-inset-left)) !important;
  /* Ensure high z-index */
  z-index: 1001 !important;
  /* Add transition for smooth repositioning */
  transition:
    bottom 0.3s ease,
    left 0.3s ease;
}

/* Ensure Mapbox control buttons are properly styled */
.mapboxgl-ctrl-group {
  background: #fff !important;
  border-radius: 4px !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.mapboxgl-ctrl-group button {
  background-color: transparent !important;
  border: 0 !important;
  box-sizing: border-box !important;
  cursor: pointer !important;
  display: block !important;
  height: 29px !important;
  width: 29px !important;
  outline: none !important;
  padding: 0 !important;
}

.mapboxgl-ctrl-group button + button {
  border-top: 1px solid #ddd !important;
}

/* Ensure icons are visible */
.mapboxgl-ctrl button .mapboxgl-ctrl-icon {
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 20px 20px !important;
  display: block !important;
  height: 100% !important;
  width: 100% !important;
}

/* Hover states */
.mapboxgl-ctrl-group button:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
}

/* Focus states */
.mapboxgl-ctrl-group button:focus {
  box-shadow: 0 0 2px 2px #0096ff !important;
}

/* DEFENSIVE: Ensure map controls always load with proper styling */
.mapboxgl-ctrl-bottom-right {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  pointer-events: auto !important;
}

/* Map Legend — Forayz Design System legend-card */
.map-legend {
  position: absolute;
  /* Positioned top-right to match iOS app design */
  top: calc(83px + var(--safe-area-inset-top));
  right: calc(16px + var(--safe-area-inset-right));
  background: var(--surface-map-overlay, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 14px 16px;
  border-radius: var(--r-lg, 12px);
  box-shadow: var(--sh-legend, 0 2px 8px rgba(0, 0, 0, 0.1));
  border: 0.5px solid var(--surface-hairline, rgba(0, 0, 0, 0.06));
  z-index: 1000;
  min-width: 180px;
  max-width: 220px;
  display: none;
  font-family: var(--font-body, inherit);
  transition: top var(--dur-slow, 360ms) var(--ease-standard, ease);
}

.map-legend h4 {
  margin: 0 0 10px 0;
  font-size: 0.875rem; /* 14px */
  color: var(--text-primary, #333);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.map-legend .freshness-note {
  font-size: 0.6875rem; /* 11px */
  color: var(--text-tertiary, #666);
  font-weight: 400;
  margin-top: 4px;
  margin-bottom: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: 0.75rem; /* 12px */
  color: var(--text-primary, #333);
}

.legend-color {
  width: 12px;
  height: 12px;
  margin-right: 0;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  color: var(--text-primary, #333);
  flex: 1;
}

/* Accessibility: High Contrast Mode Support */
@media (prefers-contrast: more) {
  .map-legend {
    background: rgba(255, 255, 255, 1); /* Solid white for better contrast */
    border: 1px solid rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  }

  .map-legend h4,
  .legend-label {
    color: #000; /* Pure black for maximum contrast */
    font-weight: 700; /* Bolder text */
  }

  .map-legend .freshness-note {
    color: #333; /* Darker gray for better readability */
  }

  .legend-color {
    border: 1px solid rgba(0, 0, 0, 0.4); /* Stronger border */
  }
}

/* Dark mode for the legend is handled by the design tokens in css/tokens.css
   (surface-map-overlay, text-*, sh-legend, surface-hairline) — no legend-specific
   override needed. Kept the high-contrast block above intact. */

/* ============================
   4. Controls & UI Elements
   ============================ */
/* Layer Control Floating Button — Forayz Design System pill */
.layer-control-button {
  position: fixed;
  bottom: 100px;
  left: 16px;
  width: auto;
  height: auto;
  padding: 10px 18px;
  background: var(--surface-card, white);
  border: none;
  border-radius: var(--r-full, 9999px);
  box-shadow: var(--sh-card, 0 4px 12px rgba(0, 0, 0, 0.15));
  cursor: pointer;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body, inherit);
  transition:
    background var(--dur-base, 220ms) var(--ease-standard, ease),
    transform var(--dur-fast, 120ms) var(--ease-standard, ease),
    box-shadow var(--dur-base, 220ms) var(--ease-standard, ease);
  transform-origin: center;
}

.layer-control-button:hover {
  background: var(--surface-hover, #f8f8f8);
  transform: scale(1.02);
  box-shadow: var(--sh-raised, 0 6px 16px rgba(0, 0, 0, 0.2));
}

.layer-control-button:active {
  transform: scale(0.98);
}

.layer-control-button i {
  font-size: 18px;
  color: var(--accent-interactive, #007cba);
  transition: transform var(--dur-base, 300ms) ease;
}

.layer-control-button span {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #333);
}

.layer-control-button.active {
  background: var(--forest-700, #007cba);
}

.layer-control-button.active i,
.layer-control-button.active span {
  color: white;
}

/* Basemap view-cycle button — bottom-right, sits above MapLibre nav/locate controls + tab bar.
   Exact bottom value overridden in the "Bottom-offset bumps" section near the end of this file. */
.view-toggle-btn {
  position: fixed;
  right: 12px;
  width: 64px;
  min-height: 64px;
  padding: 8px 6px;
  background: var(--surface-card, #ffffff);
  border: none;
  border-radius: 14px;
  box-shadow: var(--sh-card, 0 4px 12px rgba(0, 0, 0, 0.18));
  cursor: pointer;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-body, inherit);
  transition:
    background var(--dur-base, 220ms) var(--ease-standard, ease),
    transform var(--dur-fast, 120ms) var(--ease-standard, ease),
    box-shadow var(--dur-base, 220ms) var(--ease-standard, ease);
  transform-origin: center;
}

.view-toggle-btn:hover {
  background: var(--surface-hover, #f5f7f5);
  transform: scale(1.03);
  box-shadow: var(--sh-raised, 0 6px 16px rgba(0, 0, 0, 0.22));
}

.view-toggle-btn:active {
  transform: scale(0.97);
}

.view-toggle-btn .svg-icon {
  color: var(--accent-interactive, #2f5d3e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn .svg-icon svg {
  width: 22px;
  height: 22px;
}

.view-toggle-btn .view-toggle-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary, #1f2a23);
  letter-spacing: 0.1px;
}

.view-toggle-btn.active {
  background: var(--forest-800, #1f3d2a);
}

.view-toggle-btn.active .svg-icon,
.view-toggle-btn.active .view-toggle-label {
  color: #ffffff;
}

/* MapLibre Attribution Control - Force Compact (Minimized) by Default */
/* Apply to all viewports, not just mobile */
.maplibregl-ctrl-attrib.maplibregl-compact {
  min-height: 20px;
}

/* Hide attribution text by default - even if details has open attribute */
.maplibregl-ctrl-attrib-inner {
  display: none !important;
}

/* Show attribution text ONLY when user clicks to expand (compact-show class added) */
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
  display: block !important;
}

/* Always show the toggle button (i icon) */
.maplibregl-ctrl-attrib-button {
  display: block !important;
}

/* Ensure compact mode is applied */
.maplibregl-ctrl-attrib {
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
}

/* Control Icons Container */
.control-icons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Icon Button Styles */
.control-icons button {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  padding: 10px;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-icons button i {
  color: #333;
}

/* Toggle Switch Slider Styles */
.toggle-switch {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  gap: 8px;
  justify-content: space-between;
}

.toggle-switch:last-child {
  margin-bottom: 0;
}

.toggle-switch label {
  font-size: 15px;
  color: #333;
  line-height: 1.4;
  font-weight: 500;
}

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e0e0e0;
  transition: 0.2s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #0073aa;
}

input:focus + .slider {
  box-shadow: 0 0 1px #0073aa;
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* Disabled state */
input:disabled + .slider {
  background-color: #e0e0e0;
  cursor: not-allowed;
}

input:disabled + .slider:before {
  background-color: #f5f5f5;
}

/* ============================
   5. Panels & Modals
   ============================ */
/* Redesigned Layer Control Modal - Full Screen */
.layer-control-modal-redesigned {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
}

.layer-control-modal-redesigned.active {
  opacity: 1;
  visibility: visible;
}

.modal-close-x {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary, #666);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.modal-close-x:hover {
  background-color: var(--surface-sunken, #f0f0f0);
  color: var(--text-primary, #333);
}

/* Modal container */
.layer-control-modal-redesigned .modal-container {
  background: var(--surface-card, #ffffff);
  border-radius: 12px;
  box-shadow: var(--sh-card, 0 20px 60px rgba(0, 0, 0, 0.3));
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.3s ease-out;
  /* Prevent iOS Safari from interfering with modal */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  isolation: isolate;
}

/* Modal header */
.modal-header {
  background: var(--surface-sunken, #f8f9fa);
  padding: 20px 24px;
  border-bottom: 1px solid var(--divider, #e9ecef);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary, #212529);
  flex: 1;
}

/* Reset All button in modal header */
.modal-reset-btn {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.2);
  color: var(--text-secondary, #495057);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.modal-reset-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.35);
}

.modal-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #6c757d);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface-sunken, #e9ecef);
  color: var(--text-primary, #495057);
}

/* Modal content */
.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Modal sections */
.modal-section {
  border-bottom: 1px solid var(--divider, #f1f3f4);
}

.modal-section:last-child {
  border-bottom: none;
}

.section-header {
  padding: 16px 24px;
  background: var(--surface-sunken, #f8f9fa);
  border-bottom: 3px solid var(--divider, #dee2e6);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}

.section-header.collapsible:hover {
  background: var(--surface-sunken, #e9ecef);
  border-bottom-color: var(--accent-interactive, #007cba);
}

.section-header h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary, #2c3e50);
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.section-header h3 i {
  width: 20px;
  color: var(--accent-interactive, #007cba);
  font-size: 18px;
}

.section-description {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary, #495057);
  line-height: 1.4;
  font-weight: 500;
}

.pro-badge {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #333;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: auto;
}

.collapse-icon {
  margin-left: auto !important;
  transition: transform 0.2s ease;
  font-size: 12px !important;
}

/* Basemap selector */
.basemap-selector {
  padding: 0 24px 24px 24px;
  display: flex;
  gap: 16px;
  /* Ensure proper touch behavior for form elements */
  touch-action: manipulation;
}

.basemap-option {
  flex: 1;
  cursor: pointer;
  border: 2px solid var(--divider, #e9ecef);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
  background: var(--surface-card, #ffffff);
  /* Allow touch manipulation for form elements */
  touch-action: manipulation;
}

.basemap-option:hover {
  border-color: var(--accent-interactive, #007cba);
  background: var(--surface-hover, #f8fbff);
}

.basemap-option.selected {
  border-color: var(--accent-interactive, #007cba);
  background: var(--surface-selected, #f0f8ff);
}

.basemap-option input {
  display: none;
}

.basemap-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.basemap-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

.basemap-icon.streets {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
}

.basemap-icon.satellite {
  background: linear-gradient(135deg, #2196f3, #1565c0);
}

.basemap-name {
  font-weight: 600;
  color: var(--text-primary, #212529);
}

.basemap-description {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #6c757d);
  line-height: 1.3;
}

/* Layer controls */
.layer-controls {
  background: var(--surface-sunken, #fafafa);
  max-height: 400px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
  -webkit-overflow-scrolling: touch;
  /* Fix iOS Safari scrolling issues */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Allow scrolling in controls */
  touch-action: pan-y;
}

.layer-controls.collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

.layer-control {
  padding: 12px 24px;
  border-bottom: 1px solid var(--divider, #f1f3f4);
  position: relative;
}

.layer-control:last-child {
  border-bottom: none;
}

.layer-control.disabled {
  opacity: 0.6;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  width: 100%;
  /* Allow form interaction */
  touch-action: manipulation;
}

.layer-toggle.pro-locked {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Toggle slider for layers */
.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--divider, #ccc);
  border-radius: 12px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white; /* knob stays light in both themes */
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type='checkbox']:checked + .toggle-slider {
  background: var(--forest-700, #007cba);
}

input[type='checkbox']:checked + .toggle-slider::before {
  transform: translateX(20px);
}

input[type='checkbox']:disabled + .toggle-slider {
  background: var(--surface-sunken, #e9ecef);
  cursor: not-allowed;
}

input[type='checkbox'] {
  display: none;
}

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

.layer-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary, #212529);
  margin-bottom: 2px;
}

/* Layer description text */
.layer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layer-description {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #888);
  line-height: 1.3;
  font-weight: 400;
}

.layer-item-content .layer-text .layer-name {
  margin-bottom: 0;
}

.pro-indicator {
  font-size: 11px;
  color: #ffd700;
  margin-left: 4px;
}

.pro-lock-icon {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #6c757d);
  font-size: 16px;
}

/* Pro upgrade sections */
.pro-upgrade-section {
  background: linear-gradient(135deg, #fff9e6, #fff3cd);
}

.pro-upgrade-content {
  padding: 0 24px 24px 24px;
}

.pro-upgrade-message {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  border: 2px dashed #ffc107;
}

.pro-upgrade-message i {
  font-size: 24px;
  color: #ffd700;
  margin-bottom: 12px;
}

.pro-upgrade-message p {
  margin: 0 0 16px 0;
  color: #856404;
  font-weight: 500;
}

.btn-upgrade {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #333;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.btn-upgrade:hover {
  transform: translateY(-1px);
}

/* Login button - blue theme for logged-out users */
.btn-login {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.btn-login:hover {
  transform: translateY(-1px);
}

/* Login button in modal footer - full width */
.modal-footer .btn-login {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Modal footer */
.modal-footer {
  background: var(--surface-sunken, #f8f9fa);
  padding: 16px 24px;
  border-top: 1px solid var(--divider, #e9ecef);
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-shrink: 0;
}

/* Upgrade button in modal footer - full width */
.modal-footer .btn-upgrade {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-footer .btn-primary {
  flex: 1;
  max-width: 150px;
  min-width: 80px;
}

.modal-footer .modal-close.btn-primary {
  background: var(--forest-700, #007cba);
  color: white;
  width: auto;
  height: auto;
  border-radius: 6px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary,
.btn-primary {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 14px;
}

.btn-secondary {
  background: var(--text-secondary, #6c757d);
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-primary {
  background: var(--forest-700, #007cba);
  color: white;
}

.btn-primary:hover {
  background: #0056b3;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Modal animations */
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Mobile responsive adjustments - Bottom slide-up modal */
@media only screen and (max-width: 768px) {
  /* Floating button - circular icon only on mobile */
  .layer-control-button {
    bottom: 90px;
    left: 12px;
    padding: 14px;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    justify-content: center;
  }

  .layer-control-button span:not(.svg-icon) {
    display: none;
  }

  .layer-control-button i,
  .layer-control-button .svg-icon {
    font-size: 20px;
    margin: 0;
  }

  .layer-control-button .svg-icon svg {
    width: 20px;
    height: 20px;
  }

  /* View toggle stays bottom-right on mobile, slightly smaller (bottom value set in offset bumps section) */
  .view-toggle-btn {
    right: 10px;
    width: 58px;
    min-height: 58px;
    padding: 6px 4px;
    border-radius: 12px;
  }

  .view-toggle-btn .svg-icon svg {
    width: 20px;
    height: 20px;
  }

  .view-toggle-btn .view-toggle-label {
    font-size: 10px;
  }

  /* Mobile modal transforms to bottom slide-up */
  .layer-control-modal-redesigned {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    /* Prevent iOS Safari bounce/rubber-band scrolling */
    overscroll-behavior: none;
    -webkit-overscroll-behavior: none;
  }

  .layer-control-modal-redesigned .modal-container {
    width: 100%;
    height: 45vh; /* Gaia-style partial sheet - was 60vh */
    max-width: none;
    max-height: 80vh; /* Max height for very short screens */
    min-height: 35vh; /* Minimum height */
    border-radius: 16px 16px 0 0; /* Only round top corners */
    animation: modalSlideUpFromBottom 0.3s ease-out;
    margin: 0;
    position: relative;
    /* Additional iOS Safari fixes */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
    /* Remove touch-action restriction to allow content scrolling */
    /* touch-action is handled by child elements */
  }

  /* Hide modal when not active on mobile */
  .layer-control-modal-redesigned:not(.active) .modal-container {
    transform: translateY(100%);
  }

  /* Add drag handle for mobile */
  .modal-container::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--divider, #ccc);
    border-radius: 2px;
    z-index: 10001;
    pointer-events: none; /* Don't interfere with touch events */
  }

  .modal-header {
    padding: 24px 20px 16px 20px;
    padding-top: calc(24px + var(--safe-area-inset-top));
    border-radius: 16px 16px 0 0;
    /* Ensure header can be touched for drag */
    touch-action: none;
    /* Add visual indication that this area is draggable */
    cursor: grab;
    position: relative;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .section-header {
    padding: 16px 20px;
  }

  .basemap-selector {
    padding: 0 20px 20px 20px;
    flex-direction: column;
    gap: 12px;
    /* Ensure touch manipulation works on mobile */
    touch-action: manipulation;
  }

  .layer-control {
    padding: 16px 20px;
  }

  .pro-upgrade-content {
    padding: 0 20px 20px 20px;
  }

  .modal-footer {
    padding: 16px 20px;
    padding-bottom: calc(16px + var(--safe-area-inset-bottom));
  }

  /* Ensure modal content is scrollable on mobile */
  .modal-content {
    max-height: calc(70vh - 120px); /* Account for header and mobile UI */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Fix iOS Safari scrolling issues */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Prevent momentum scrolling interference */
    overscroll-behavior: contain;
    -webkit-overscroll-behavior: contain;
    /* Allow vertical scrolling only in content area */
    touch-action: pan-y;
  }
}

/* Mobile-specific slide-up animation */
@keyframes modalSlideUpFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0.8;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================
   6. Details Sidebar — Forayz Design System DetailSheet
   ============================ */
#details-sidebar {
  position: fixed;
  top: 50px;
  right: -300px;
  width: 300px;
  max-height: calc(100vh - 100px);
  height: auto;
  background: var(--surface-card, #fff);
  padding: 20px;
  box-shadow: var(--sh-raised, -2px 0 5px rgba(0, 0, 0, 0.5));
  transition: right var(--dur-slow, 300ms) var(--ease-standard, ease);
  z-index: 3200;
  overflow-y: auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body, inherit);
}

#details-sidebar.show {
  right: 0;
}

#details-sidebar #details-title {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #1b3a2d);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

#close-details {
  position: sticky;
  top: 0;
  align-self: flex-end;
  background-color: var(--surface-sunken, #818181);
  color: var(--text-secondary, #3b2818);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3201;
  margin-bottom: 10px;
  transition: background var(--dur-fast, 120ms) var(--ease-standard, ease);
}

#close-details:hover {
  background-color: var(--surface-selected, #818181);
}

/* Details Sections */
.details-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--divider, rgba(0, 0, 0, 0.1));
}

.details-section:last-child {
  border-bottom: none;
}

.details-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #1b3a2d);
  letter-spacing: -0.005em;
}

.details-section p {
  margin: 0.5rem 0;
}

.details-section p:empty {
  display: none;
}

/* ── Per-Town Fruiting Calendar (species × month grid) ───────────────── */
/* Populated by js/standalone/fruitingCalendar.js into #details-townFruitingCalendar.
   Cell colors come from the calendar's authoritative legend (inline rgba). */
#details-townFruitingCalendar {
  margin-top: var(--sp-md, 16px);
}

.fc-wrap {
  font-family: var(--font-body, inherit);
}

.fc-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary, #1b3a2d);
  letter-spacing: -0.005em;
}

.fc-grid {
  display: grid;
  grid-template-columns: minmax(56px, 88px) repeat(12, 1fr);
  gap: 2px;
  align-items: stretch;
}

.fc-corner {
  display: block;
}

.fc-month {
  font-size: 9.5px;
  font-weight: 600;
  text-align: center;
  color: var(--text-tertiary, #8a9b92);
  line-height: 1.4;
  text-transform: uppercase;
}

/* Static "current month" marker (climatology only — not the live nowcast) */
.fc-month.fc-now {
  color: var(--surface-card, #fff);
  background: var(--brand-accent, #d98b3a);
  border-radius: var(--r-sm, 4px);
  font-weight: 700;
}

.fc-label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--text-secondary, #5a6e63);
  padding-right: 4px;
}

.fc-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-swatch {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.fc-reg-mark {
  flex: 0 0 auto;
  font-size: 7.5px;
  font-weight: 700;
  color: var(--brand-accent, #d98b3a);
  cursor: help;
  letter-spacing: 0.02em;
}

.fc-reg-key {
  display: inline;
}

.fc-reg-key sup {
  font-weight: 700;
  color: var(--brand-accent, #d98b3a);
}

.fc-cell {
  min-height: 15px;
  border-radius: 2px;
  background: var(--surface-sunken, #f4efe8);
}

.fc-cell.fc-empty {
  background: var(--surface-sunken, #f4efe8);
  opacity: 0.5;
}

/* Outline the species' peak month(s) */
.fc-cell.fc-peak {
  box-shadow: inset 0 0 0 1.5px var(--text-primary, #1b3a2d);
}

.fc-note {
  grid-column: 1 / -1;
  font-size: 9.5px;
  font-style: italic;
  color: var(--text-tertiary, #8a9b92);
  margin: 2px 0 2px;
}

.fc-foot {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-tertiary, #8a9b92);
}

/* Environmental Freshness Badge (colors from design-tokens.json) */
.freshness-badge {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  cursor: help;
}

.freshness-badge span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  line-height: 1.4;
}

/* Freshness status colors */
.freshness-badge.freshness-current span {
  background-color: #4caf50;
}
.freshness-badge.freshness-recent span {
  background-color: #ffc107;
  color: #333;
}
.freshness-badge.freshness-stale span {
  background-color: #ff9800;
}
.freshness-badge.freshness-unavailable span {
  background-color: #9e9e9e;
}

/* Update date styling */
.update-date {
  font-style: italic;
  font-size: 0.85em;
  color: var(--text-secondary, #666);
  margin-top: -0.25rem !important;
  margin-bottom: 0.75rem !important;
}

/* Date range styling */
.date-range {
  font-style: italic;
  font-size: 0.85em;
  color: var(--text-secondary, #666);
  margin-top: -0.25rem !important;
  margin-bottom: 0.25rem !important;
}

/* Google Maps Link */
#details-google-maps {
  margin: 10px 0;
  display: block;
}

#details-google-maps a {
  display: inline-block;
  color: #0066cc;
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--divider, #ddd);
  border-radius: 4px;
  background: var(--surface-sunken, #f8f8f8);
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1.4;
}

#details-google-maps a:hover {
  background: var(--surface-sunken, #e8e8e8);
  border-color: var(--divider, #ccc);
  text-decoration: none;
  color: #004c99;
}

#details-google-maps a::before {
  content: '\f0ac'; /* globe icon */
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  margin-right: 6px;
  font-size: 14px;
}

/* AOI (Areas of Interest) Details Styling */
.aoi-details p {
  margin: 0.6rem 0;
  line-height: 1.5;
}

/* Weather info with special formatting */
#details-weather {
  background: #f0f7ff;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #0073aa;
  font-size: 0.9em;
  line-height: 1.6;
}

/* Weather data from AOI GeoJSON - nested HTML styling */
#details-weather .weather-data {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#details-weather .weather-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

#details-weather .weather-item strong {
  font-weight: 600;
  color: var(--text-primary, #333);
  flex-shrink: 0;
}

/* Ecoregion styling */
#details-ecoregion {
  font-weight: 500;
  color: #2c5530;
}

/* Trees information - allow wrapping for long lists */
#details-trees {
  font-size: 0.9em;
  line-height: 1.5;
  color: var(--text-primary, #444);
}

/* Summary text styling */
#details-summary {
  font-style: italic;
  color: var(--text-secondary, #555);
  line-height: 1.6;
  padding: 8px 0;
  border-top: 1px solid var(--divider, #eee);
  margin-top: 10px;
}

/* URL link styling in AOI */
#details-url a {
  color: #0073aa;
  text-decoration: none;
}

#details-url a:hover {
  text-decoration: underline;
}

/* Event Details Styling */
.event-details p {
  margin: 0.6rem 0;
  line-height: 1.5;
}

/* Event Featured Image */
.event-featured-image-container {
  margin: -15px -15px 15px -15px;
  overflow: hidden;
}

.event-featured-image {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

/* AOI Featured Image (reuses event image styles) */
.aoi-featured-image-container {
  margin: -15px -15px 15px -15px;
  overflow: hidden;
}

/* Event Description */
.event-description {
  font-size: 0.95em;
  line-height: 1.6;
  color: var(--text-primary, #444);
  padding: 8px 0;
  white-space: pre-wrap;
}

/* Event URL Link */
.event-link a {
  display: inline-block;
  color: #0073aa;
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid #0073aa;
  border-radius: 4px;
  background: #f0f7ff;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
}

.event-link a:hover {
  background: #0073aa;
  color: white;
  text-decoration: none;
}

/* Event Contact Link */
.event-contact-link {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider, #eee);
}

.event-contact-link a {
  display: inline-block;
  color: var(--text-secondary, #666);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--divider, #ddd);
  border-radius: 4px;
  background: var(--surface-sunken, #f8f8f8);
  transition: all 0.2s ease;
  font-size: 13px;
}

.event-contact-link a:hover {
  background: var(--surface-sunken, #e8e8e8);
  border-color: var(--divider, #ccc);
  color: var(--text-primary, #333);
}

.event-contact-link a::before {
  content: '\f0e0'; /* envelope icon */
  font-family: 'Font Awesome 6 Free';
  font-weight: 400;
  margin-right: 6px;
}

/* ============================
   7. Notifications & Tooltips
   ============================ */
/* Pro Notification */
.pro-notification {
  position: fixed;
  top: 70px; /* Position below header */
  right: 20px;
  background: var(--surface-card, white);
  border-left: 4px solid #0073aa;
  padding: 15px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 3500;
  max-width: 300px;
  border-radius: 4px;
  animation: slide-in 0.3s ease-out;
}

.pro-notification p {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--text-primary, #333);
}

.pro-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-button,
.upgrade-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: #0073aa;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.login-button:hover,
.upgrade-button:hover {
  background-color: #005a87;
  color: white;
  text-decoration: none;
}

.login-button {
  background-color: #5a5a5a;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.login-button:hover {
  background-color: #333333;
}

/* ============================
   8. Pro Features & Indicators
   ============================ */
/* Remove pro-control styles */
.pro-control {
  padding-right: 0;
}

.pro-control::after {
  display: none;
}

.pro-feature-link {
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
  display: inline-block;
  position: relative;
}

.pro-feature-link:hover {
  text-decoration: underline;
  color: #005a87;
}

.pro-feature-link::after {
  content: '↓';
  margin-left: 4px;
  font-size: 14px;
}

.pro-feature {
  color: var(--text-secondary, #666);
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pro-feature .pro-indicator {
  font-size: 9px;
  background-color: #0073aa;
  color: white;
  padding: 2px 4px;
  border-radius: 3px;
  margin-left: 6px;
  text-transform: uppercase;
  vertical-align: middle;
}

/* ============================
   9. Responsive Design
   ============================ */
/* Mobile Adjustments */
@media only screen and (max-width: 768px) {
  #map-container {
    height: calc(100vh - 50px - var(--calculated-mobile-bottom-padding));
    max-height: calc(100vh - 50px - var(--calculated-mobile-bottom-padding));
  }

  /* Adjust map controls for mobile */
  .mapboxgl-ctrl-bottom-right,
  .maplibregl-ctrl-bottom-right {
    bottom: calc(5px + var(--calculated-mobile-bottom-padding)) !important;
  }

  /* Attribution control - position just above Safari nav bar */
  /* Now minimized by default, so doesn't need to be as high */
  .mapboxgl-ctrl-bottom-left,
  .maplibregl-ctrl-bottom-left {
    bottom: calc(10px + var(--calculated-mobile-bottom-padding)) !important;
  }

  /* Force attribution to be compact (minimized) by default on mobile */
  .maplibregl-ctrl-attrib.maplibregl-compact {
    min-height: 20px;
  }

  /* Keep attribution minimized - hide full text by default */
  .maplibregl-ctrl-attrib:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner {
    display: none !important;
  }

  /* Show toggle button (i icon) always */
  .maplibregl-ctrl-attrib-button {
    display: block !important;
  }

  .map-legend {
    top: calc(83px + var(--safe-area-inset-top));
    right: calc(16px + var(--safe-area-inset-right));
  }

  /* Adjust pro notification for mobile */
  .pro-notification {
    top: 60px;
    right: 10px;
    max-width: 85%;
  }

  /* Details sidebar mobile adjustments */
  #details-sidebar {
    width: 75%;
    max-width: 280px;
    right: -75%;
    top: 50px;
    max-height: calc(100vh - 150px);
    padding: 15px;
  }

  #details-sidebar.show {
    right: 0;
  }

  #close-details {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  /* Modal section adjustments */
  .modal-close {
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .modal-section {
    margin-top: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
  }

  .modal-section:first-child {
    margin-top: 25px;
  }

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

  .toggle-switch label {
    font-size: 13px;
  }

  .modal-section h3 {
    font-size: 14px;
    margin: 0 0 12px 0;
  }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-width: 768px) {
  .pro-notification {
    top: 50px;
  }

  .map-legend {
    /* Landscape mode - position top-right with extra right padding to avoid control buttons */
    top: calc(8px + var(--safe-area-inset-top));
    right: calc(110px + var(--safe-area-inset-right));
  }
}

/* Admin Bar Adjustments - REMOVED (2025-12-23)
 * Not needed for standalone version which doesn't use WordPress admin bar.
 */

/* ============================
   Animations
   ============================ */
@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-in-up {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes tooltip-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes tooltip-fade-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================
   Performance Widget
   ============================ */
#performance-widget {
  position: fixed;
  bottom: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 9999;
  max-width: 300px;
}

#performance-widget h4 {
  margin: 0 0 5px 0;
}

#close-perf {
  position: absolute;
  top: 5px;
  right: 5px;
  background: none;
  border: none;
  cursor: pointer;
}

/* Temperature Legend - Continuous Gradient */
/* Matches PMTiles styling in pmtiles-config.js */
/* Blues (<45°F) = cold, Oranges (45-60°F) = optimal range, compressed above 60°F */
#temp-legend .legend-gradient {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#temp-legend .gradient-bar.temp-gradient {
  width: 100%;
  height: 10px;
  /* Gradient distribution: 32-45°F = 50%, 45-60°F = 40%, 60°F+ = 10% (compressed) */
  background: linear-gradient(
    to right,
    #08306b 0%,
    /* 32°F - Deep blue (frozen) */ #2166ac 15%,
    /* 35°F - Dark blue */ #4393c3 35%,
    /* 40°F - Medium blue */ #92c5de 48%,
    /* 45°F - Light blue (transition) */ #fddbc7 52%,
    /* 45°F - Pale orange (optimal begins) */ #f4a582 90%,
    /* 60°F - Orange (optimal ends) */ #d6604d 95%,
    /* 70°F - Red (compressed) */ #67000d 100% /* 80°F - Maroon (compressed) */
  );
  border: 0;
  border-radius: 5px;
}

#temp-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #333;
}

#temp-legend .gradient-label {
  font-weight: 500;
}

/* Freshness note styles - inherits from .map-legend .freshness-note */
#temp-legend .freshness-note {
  /* font-size inherited from .map-legend .freshness-note (0.6875rem) */
  /* Removed duplicate styles to ensure consistency */
}

/* Soil Moisture Legend - Continuous Gradient */
#moisture-legend .legend-gradient {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Soil Moisture gradient — brown ramp 0-25%, transparent above (field capacity cutoff) */
/* Matches PMTiles styling in pmtiles-config.js + iOS/Android */
#moisture-legend .gradient-bar {
  width: 100%;
  height: 10px;
  background: linear-gradient(
    to right,
    #4a2c0d 0%,
    #7b491b 20%,
    #a66c37 40%,
    #c8976b 60%,
    #e0c09c 80%,
    #f0dfc6 100%
  );
  border: 0;
  border-radius: 5px;
}

#moisture-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem; /* 12px at default, scales with browser zoom */
  color: #333;
}

#moisture-legend .gradient-label {
  font-weight: 500;
}

/* Snow Cover Legend - Continuous Gradient (light to heavy snow) */
/* Matches PMTiles styling in pmtiles-config.js with 8 contour levels */
/* Spec: 0.01m to 1.5m (0.4" to 59") */
#snow-legend .legend-gradient {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#snow-legend .gradient-bar.snow-gradient {
  width: 100%;
  height: 10px;
  background: linear-gradient(
    to right,
    #e6f2ff,
    #cce5ff,
    #b3d9ff,
    #99ccff,
    #6699ff,
    #4d80ff,
    #3366ff,
    #0033cc
  );
  border: 0;
  border-radius: 5px;
}

#snow-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem; /* 12px at default, scales with browser zoom */
  color: #333;
}

#snow-legend .gradient-label {
  font-weight: 500;
}

/* Precipitation Legend - Continuous Gradient (14-day accumulation) */
/* Matches PMTiles styling in pmtiles-config.js */
/* Near white to light blue (0-1.5") = improving, Medium blue (1.5-6.5") = optimal, Dark blue (>6.5") = excessive */
#precip-legend .legend-gradient {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#precip-legend .gradient-bar.precip-gradient {
  width: 100%;
  height: 10px;
  /* Gradient distribution: 0-1.5" = 25%, 1.5-6.5" = 50% (optimal range), 6.5-20+" = 25% */
  background: linear-gradient(
    to right,
    #f7fbff 0%,
    /* 0" - Near white (trace) */ #deebf7 4%,
    /* 0.25" - Very light blue */ #c6dbef 12%,
    /* 0.75" - Light blue (favorable begins) */ #9ecae1 25%,
    /* 1.5" - Pale blue (excellent) */ #6baed6 50%,
    /* 4.5" - Medium blue (peak conditions) */ #4292c6 75%,
    /* 6.5" - Blue (optimal ends) */ #2171b5 85%,
    /* 11.5" - Dark blue (very wet) */ #08519c 92%,
    /* 17.5" - Very dark blue (flooding) */ #08306b 100% /* 30" - Deepest blue (severe) */
  );
  border: 0;
  border-radius: 5px;
}

#precip-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #333;
}

#precip-legend .gradient-label {
  font-weight: 500;
}

/* Precipitation Normals Legend - Continuous Gradient */
/* Matches PRISM climate zones from data contract spec */
/* Browns/Tans (dry) → Greens (moderate) → Teals/Blues (wet) */
#precip-normals-legend .legend-gradient {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#precip-normals-legend .gradient-bar.precip-normals-gradient {
  width: 100%;
  height: 10px;
  /* Gradient matches zone_code 1-6 interpolation from REFERENCE-LAYERS-SPEC.md */
  background: linear-gradient(
    to right,
    #8c6d3b 0%,
    /* Zone 1 - Very Dry (0-15") - warm brown */ #c4a573 20%,
    /* Zone 2 - Dry (15-25") - tan */ #a8c68f 40%,
    /* Zone 3 - Moderate (25-50") - olive green */ #6fa8a3 60%,
    /* Zone 4 - Wet (50-80") - teal */ #4575b4 80%,
    /* Zone 5 - Very Wet (80-150") - blue */ #2e5c8a 100%
      /* Zone 6 - Rainforest (>150") - deep blue */
  );
  border: 0;
  border-radius: 5px;
}

#precip-normals-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #333;
}

#precip-normals-legend .gradient-label {
  font-weight: 500;
}

/* Forest Type Density Legend */
#forest-density-legend .legend-gradient {
  margin: 0.5rem 0;
}

#forest-density-legend .gradient-bar.forest-density-gradient {
  width: 100%;
  height: 14px;
  background: linear-gradient(
    90deg,
    rgba(251, 226, 185, 0.1) 0%,
    rgba(248, 215, 155, 0.55) 20%,
    rgba(234, 170, 80, 0.65) 40%,
    rgba(210, 115, 48, 0.72) 60%,
    rgba(175, 65, 28, 0.8) 80%,
    rgba(130, 35, 15, 0.88) 100%
  );
  border: 1px solid rgba(130, 35, 15, 0.18);
  border-radius: 5px;
}

#forest-density-legend .gradient-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #333;
}

#forest-density-legend .gradient-label {
  font-weight: 500;
}

/* Bioregions Legend Colors - Updated Ecoregions Palette */
.bioregion-coastal-forest {
  background: #fdd49e !important; /* Coastal Forest: pale yellow */
}
.bioregion-coast-range {
  background: #fc8d59 !important; /* Coastal Range: bright orange-coral */
}
.bioregion-olympics {
  background: #8c510a !important; /* Olympics: dark brown */
}
.bioregion-puget-lowland {
  background: #badedd !important; /* Puget Lowland: light blue-green */
}
.bioregion-willamette {
  background: #81fdf7 !important; /* Willamette: light cyan */
}
.bioregion-klamath {
  background: #cfd52a !important; /* Klamath: yellow-green */
}
.bioregion-n-rockies {
  background: #fca1c5 !important; /* N Rockies: light pink */
}
.bioregion-blue-mtns {
  background: #6687eb !important; /* Blue Mtns: light blue */
}

/* TODO: Re-enable weather elements when feature is ready for standalone */
/* Hidden until weather data integration is complete */
#details-weather-period,
#details-temp-avg,
#details-precip-14day,
#details-precip-data-updated,
#details-precip-forecast {
  display: none !important;
}

/* TODO: Re-enable Weather Forecast section when ready */
.details-section[data-feature-type='burn']:has(h3:contains('Weather Forecast')) {
  display: none !important;
}

/* Species Chart Link */
#details-species-chart-link {
  display: none;
  color: #0073aa;
  text-decoration: none;
  margin-top: 10px;
  font-size: 14px;
}

#details-species-chart-link:hover {
  text-decoration: underline;
}

.map-link {
  margin: 10px 0;
}

.map-link a {
  display: inline-block;
  color: #0066cc;
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--divider, #ddd);
  border-radius: 4px;
  background: var(--surface-sunken, #f8f8f8);
  transition: all 0.2s ease;
}

.map-link a:hover {
  background: var(--surface-sunken, #e8e8e8);
  border-color: var(--divider, #ccc);
  text-decoration: none;
}

.map-link a:before {
  content: '📍';
  margin-right: 6px;
}

/* Comments Section - REMOVED (2025-12-23)
 * Comments feature not implemented in standalone version.
 * If re-adding comments in the future, restore from git history.
 */

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-actions {
    gap: 4px;
  }

  .header-button {
    padding: 4px 8px;
    font-size: 12px;
  }

  .header-button i {
    font-size: 12px;
  }
}

.rate-limit-message {
  padding: 1rem;
  margin: 1rem 0;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  border-radius: 4px;
  color: #856404;
}

.rate-limit-message p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* User Status Notifications - REMOVED
 * This notification system was causing style conflicts and is no longer needed.
 * Only the pro-notification system is now used for feature access notifications.
 */

/* ============================
   Forest and Public Land Status Indicators
   ============================ */

/* Base styles for status fields */
.status-field {
  position: relative;
  padding-right: 20px;
}

/* Status indicators using pseudo-elements - positioned on the right */
.status-field::after {
  position: absolute;
  right: 0;
  font-weight: bold;
  font-size: 14px;
  margin-left: 8px;
}

/* True status - green checkmark */
.status-field.status-true::after {
  content: '✓';
  color: #28a745;
}

/* False status - red X */
.status-field.status-false::after {
  content: '✗';
  color: #dc3545;
}

/* Unknown status - red question mark */
.status-field.status-unknown::after {
  content: '?';
  color: #dc3545;
}

/* Text styling - keep text black for all states */
.status-field.status-true,
.status-field.status-false,
.status-field.status-unknown {
  color: inherit; /* Keep default text color (black) */
}

/* ============================
   Flat Layer List Styles
   ============================ */
.flat-layer-list {
  padding: 0 24px 24px 24px;
}

.layer-section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary, #6c757d);
  margin: 20px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--divider, #e9ecef);
}

.layer-section-header:first-child {
  margin-top: 0;
}

.flat-layer-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--divider, #e9ecef);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-card, #ffffff);
  margin-bottom: 8px;
  position: relative;
  min-height: 44px;
  touch-action: manipulation;
}

.flat-layer-item:hover {
  border-color: var(--accent-interactive, #007cba);
  background: var(--surface-hover, #f8fbff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.flat-layer-item.selected {
  border-color: var(--accent-interactive, #007cba);
  background: var(--surface-selected, #f0f8ff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.flat-layer-item.pro-locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.flat-layer-item input[type='radio'],
.flat-layer-item input[type='checkbox'] {
  display: none;
}

.layer-item-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.layer-icon {
  width: 20px;
  color: var(--text-secondary, #495057);
  font-size: 16px;
  flex-shrink: 0;
}

.flat-layer-item.selected .layer-icon {
  color: var(--accent-interactive, #007cba);
}

.layer-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary, #212529);
  word-wrap: break-word;
  hyphens: auto;
}

.flat-layer-item.selected .layer-name {
  font-weight: 600;
  color: var(--accent-interactive, #007cba);
}

/* Checkbox visual indicator */
.checkbox-item .checkbox-visual {
  width: 20px;
  height: 20px;
  border: 2px solid var(--divider, #ccc);
  border-radius: 4px;
  margin-right: 8px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.checkbox-item input:checked + .checkbox-visual {
  background: var(--forest-700, #007cba);
  border-color: var(--accent-interactive, #007cba);
}

.checkbox-item input:checked + .checkbox-visual::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 14px;
  font-weight: bold;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.checkbox-item:hover .checkbox-visual {
  border-color: var(--accent-interactive, #007cba);
}

/* Sidebar layer wrapper for date range controls */
.sidebar-layer-wrapper {
  margin-bottom: 4px;
}

.sidebar-layer-wrapper.has-date-range {
  margin-bottom: 8px;
}

/* Date range control in sidebar */
.date-range-control {
  display: flex;
  align-items: center;
  padding: 6px 12px 8px 40px;
  background: var(--surface-hover, rgba(0, 124, 186, 0.05));
  border-radius: 0 0 6px 6px;
  margin-top: -2px;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.date-range-start,
.date-range-end {
  padding: 5px 8px;
  border: 1px solid var(--divider, #d1d5db);
  border-radius: 4px;
  background-color: var(--surface-card, #ffffff);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #333);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 75px;
  text-align: center;
}

.date-range-start:hover,
.date-range-end:hover {
  border-color: var(--accent-interactive, #007cba);
}

.date-range-start:focus,
.date-range-end:focus {
  outline: none;
  border-color: var(--accent-interactive, #007cba);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.date-range-separator {
  color: var(--text-secondary, #6c757d);
  font-weight: 500;
  font-size: 13px;
  flex-shrink: 0;
}

/* Date range controls inline */
.flat-layer-item-wrapper {
  margin-bottom: 8px;
}

.flat-layer-item-wrapper .flat-layer-item {
  margin-bottom: 0;
}

/* Forest Types — collapsible section header */
.forest-types-toggle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary, #6c757d);
  margin: 20px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--divider, #e9ecef);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.forest-types-toggle:hover {
  color: var(--text-secondary, #495057);
}

.forest-types-toggle .collapse-chevron {
  font-style: normal;
  font-size: 10px;
  margin-left: 4px;
}

/* Collapsed state: hide the forest-types-content div */
.forest-types-content.forest-types-collapsed {
  display: none;
}

/* Land Ownership — collapsible section header (mirrors Forest Types) */
.land-ownership-toggle {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary, #6c757d);
  padding: 10px 6px 4px 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.land-ownership-toggle:hover {
  color: var(--text-secondary, #495057);
}

.land-ownership-toggle .collapse-chevron {
  font-style: normal;
  font-size: 10px;
  margin-left: 4px;
}

.land-ownership-content.land-ownership-collapsed {
  display: none;
}

/* WA Parcels popup */
.parcel-popup {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.parcel-popup-category {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
  color: #2d3748;
}

.maplibregl-popup-content {
  padding-right: 38px;
}

.maplibregl-popup .maplibregl-popup-close-button {
  width: 32px;
  height: 32px;
  font-size: 24px;
  line-height: 28px;
  color: #2d3748;
}

.parcel-popup-detail {
  color: #4a5568;
  margin-bottom: 2px;
}

.parcel-popup-detail strong {
  color: #2d3748;
}

/* Provenance line (e.g. BCGW dataset names) — long unbroken tokens like
   WHSE_FOREST_TENURE.FTEN_RANGE_POLY_SVW have no natural wrap points and
   overflow the popup without this. */
.parcel-popup-source {
  overflow-wrap: anywhere;
  font-size: 11px;
  font-style: italic;
  color: #718096;
  margin-top: 4px;
}

a.parcel-assessor-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #2d6b8a;
  text-decoration: none;
  font-weight: 600;
}

a.parcel-assessor-link:hover {
  text-decoration: underline;
}

/* Past Burns highlighted card */
.past-burns-card {
  background: rgba(180, 50, 30, 0.08);
  border: 1px solid rgba(180, 50, 30, 0.25);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
}

/* Spring King family card: static "Spring Kings (habitat)" parent with the
   seasonal "Fruiting Potential" forecast nested as a sub-toggle. Sea-green
   tint to match the habitat fill; mirrors .past-burns-card structure. */
.spring-king-card {
  background: rgba(46, 139, 87, 0.08);
  border: 1px solid rgba(46, 139, 87, 0.25);
  border-radius: 8px;
  margin-bottom: 4px;
  overflow: hidden;
}

.spring-king-card > .flat-layer-item {
  background: transparent;
  border-radius: 0;
  border-bottom: none;
}

.past-burns-card > .flat-layer-item {
  background: transparent;
  border-radius: 0;
  border-bottom: none;
}

/* Active Wildfires + Prescribed Burns are sibling rows inside the burns card
   (peers of Recent Burns, not nested). Divider separates them from the Recent
   Burns block above and from each other. */
.past-burns-card > .flat-layer-item:not(:first-child) {
  border-top: 1px solid rgba(180, 50, 30, 0.18);
}

/* Historical Burns sub-toggle — white background overrides the card's reddish tint */
.burns-subsection {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-left: 16px;
  background: var(--surface-card, #fff);
}

.sub-toggle-item {
  padding-left: 12px;
  font-size: 13px;
}

.sub-toggle-item .layer-icon {
  font-size: 13px;
}

/* Show all burns — compact inline sub-option, not a full row */
.show-all-burns-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 6px 48px;
  flex-wrap: wrap;
}

.show-all-burns-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Native input is hidden visually but still toggles (label wraps it). The
   .show-all-burns-visual span next to it is the visible checkbox. */
.show-all-burns-label input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

.show-all-burns-visual {
  width: 16px;
  height: 16px;
  border: 2px solid #b4321e;
  border-radius: 3px;
  background: var(--surface-card, #fff);
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease;
}

.show-all-burns-label:hover .show-all-burns-visual {
  background: #fde9e6;
}

.show-all-burns-label input[type='checkbox']:checked + .show-all-burns-visual {
  background: #b4321e;
}

.show-all-burns-label input[type='checkbox']:checked + .show-all-burns-visual::after {
  content: '✓';
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.show-all-burns-label input[type='checkbox']:focus-visible + .show-all-burns-visual {
  outline: 2px solid #b4321e;
  outline-offset: 2px;
}

.show-all-burns-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #555);
  white-space: nowrap;
}

.show-all-burns-hint {
  font-size: 11px;
  color: var(--text-secondary, #888);
  line-height: 1.3;
}

/* Environmental section collapsible toggle */
.env-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #495057);
  cursor: pointer;
  border-top: 1px solid var(--divider, #f0f0f0);
  user-select: none;
  background: var(--surface-sunken, #fafafa);
  margin-top: 4px;
}

.env-section-toggle:hover {
  background: var(--surface-sunken, #f0f0f0);
}

.env-section-collapsed {
  display: none;
}

.date-range-controls-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 48px;
  background: var(--surface-sunken, #f8f9fa);
  border: 1px solid var(--divider, #e9ecef);
  border-top: none;
  border-radius: 0 0 6px 6px;
  margin-top: -6px;
}

/* Inside the past-burns card, match the card's reddish tint instead of grey */
.past-burns-card .date-range-controls-inline {
  background: transparent;
  border: none;
  border-top: 1px solid rgba(180, 50, 30, 0.12);
  border-radius: 0;
  margin-top: 0;
}

.year-select-inline {
  padding: 6px 10px;
  border: 1px solid var(--divider, #d1d5db);
  border-radius: 4px;
  background-color: var(--surface-card, #ffffff);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-interactive, #007cba);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 80px;
}

.year-select-inline:hover {
  border-color: var(--accent-interactive, #007cba);
}

.year-select-inline:focus {
  outline: none;
  border-color: var(--accent-interactive, #007cba);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.date-range-controls-inline .year-separator {
  color: var(--text-secondary, #6c757d);
  font-weight: 500;
  font-size: 14px;
}

/* Carrier selector (for Cellular Coverage layer) */
.carrier-selector {
  padding: 8px 14px 12px 40px;
  background: var(--surface-hover, rgba(0, 124, 186, 0.05));
  border-radius: 0 0 6px 6px;
  margin-top: -2px;
}

.carrier-selector-label {
  font-size: 11px;
  color: var(--text-secondary, #666);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.carrier-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.carrier-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--divider, #e0e0e0);
}

.carrier-option:hover {
  background: var(--surface-selected, #f0f8ff);
  border-color: var(--accent-interactive, #007cba);
}

.carrier-option.selected {
  background: var(--surface-selected, #f0f8ff);
  border-color: var(--accent-interactive, #007cba);
}

.carrier-option input[type='radio'] {
  display: none;
}

.carrier-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.carrier-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary, #333);
}

.carrier-option.selected .carrier-name {
  color: var(--accent-interactive, #007cba);
  font-weight: 600;
}

/* Pro lock icon positioning */
.flat-layer-item .pro-lock-icon {
  position: absolute;
  right: 12px;
  color: var(--text-secondary, #999);
  font-size: 16px;
}

/* Mobile responsive adjustments */
@media only screen and (max-width: 768px) {
  .flat-layer-list {
    padding: 0 20px 20px 20px;
  }

  .flat-layer-item {
    padding: 10px 12px;
  }

  .date-range-controls-inline {
    padding: 8px 12px 8px 40px;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }

  .year-select-inline {
    max-width: none;
  }

  .date-range-controls-inline .year-separator {
    display: none;
  }

  .carrier-selector {
    padding: 8px 12px 12px 32px;
  }

  .carrier-option {
    padding: 10px 12px;
  }
}

/* Environmental selector styles (radio button style with icons) */
.environmental-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding: 0 4px;
}

.environmental-option {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border: 1px solid var(--divider, #e0e0e0);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-card, white);
  min-height: 44px; /* Touch target */
  position: relative;
  /* Allow form interaction but prevent scroll interference */
  touch-action: manipulation;
}

.environmental-option:hover {
  border-color: var(--accent-interactive, #007cba);
  background-color: var(--surface-sunken, #f8f9fa);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.environmental-option input[type='radio'] {
  display: none;
}

.environmental-option input[type='radio']:checked + .environmental-preview {
  color: var(--accent-interactive, #007cba);
  font-weight: 600;
}

.environmental-option input[type='radio']:checked + .environmental-preview .environmental-icon {
  background-color: var(--forest-700, #007cba);
  color: white;
  border: 2px solid var(--accent-interactive, #007cba);
}

.environmental-option.selected,
.environmental-option input[type='radio']:checked {
  border-color: var(--accent-interactive, #007cba);
  background-color: var(--surface-selected, #f0f8ff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.environmental-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.environmental-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background-color: var(--surface-sunken, #f0f0f0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary, #666);
  transition: all 0.2s ease;
}

.environmental-name {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0; /* Allow text to wrap */
  word-wrap: break-word;
  hyphens: auto;
}

.environmental-description {
  font-size: 13px;
  color: var(--text-secondary, #666);
  margin: 0;
  margin-left: 48px; /* Align with icon + gap */
  line-height: 1.3;
  word-wrap: break-word;
  hyphens: auto;
}

.environmental-option.pro-locked {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.environmental-option .pro-indicator {
  color: #ffd700;
  font-size: 12px;
}

.environmental-option .pro-lock-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--text-secondary, #999);
  font-size: 16px;
}

/* ============================
   Grouped Layer Controls & Filters
   ============================ */
.layer-control.grouped-control {
  border-left: 3px solid #ff6b35;
  background-color: #fff9f7;
}

/* Specific styling for timber harvests */
.layer-control.grouped-control[data-layer-id='timber-harvests'] {
  border-left-color: #28a745;
  background-color: #f8fff9;
}

.layer-control.filter-control {
  border-left: 3px solid #4a90e2;
  background-color: #f7f9ff;
  margin-top: 8px;
  margin-left: 20px;
  position: relative;
}

.layer-control.filter-control::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50%;
  width: 17px;
  height: 1px;
  background-color: #4a90e2;
}

.layer-control.filter-control.dependent-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.layer-control.filter-control .dependency-note {
  font-size: 10px;
  color: #666;
  font-style: italic;
  display: block;
  margin-top: 2px;
}

.layer-control.grouped-control .layer-info,
.layer-control.filter-control .layer-info {
  padding-left: 8px;
}

.layer-sub-description {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #888);
  font-style: italic;
  margin-top: 2px;
}

.layer-control.grouped-control .layer-name i {
  color: #ff6b35;
  margin-right: 6px;
}

/* Timber harvest icon color */
.layer-control.grouped-control[data-layer-id='timber-harvests'] .layer-name i {
  color: #28a745;
}

.layer-control.filter-control .layer-name i {
  color: #4a90e2;
  margin-right: 6px;
}

/* Date Range Controls */
.layer-control.date-range-control .date-range-controls {
  margin-top: 12px;
  padding: 12px;
  background-color: var(--surface-card, rgba(255, 255, 255, 0.7));
  border-radius: 8px;
  border: 1px solid var(--divider, #e0e0e0);
}

.date-range-header {
  margin-bottom: 16px;
  font-weight: 500;
  color: var(--text-secondary, #666);
  font-size: 13px;
  text-align: center;
}

.date-range-sliders {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
}

.range-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 120px;
}

.range-input-group label {
  font-size: 11px;
  color: var(--text-secondary, #888);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.year-select {
  padding: 8px 12px;
  border: 1px solid var(--divider, #d1d5db);
  border-radius: 8px;
  background-color: var(--surface-sunken, #f9fafb);
  font-size: 14px;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
  color: #007aff;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  padding-right: 32px;
}

.year-select:hover {
  border-color: #007aff;
  background-color: var(--surface-card, #ffffff);
}

.year-select:focus {
  outline: none;
  border-color: #007aff;
  background-color: var(--surface-card, #ffffff);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.year-separator {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-secondary, #666);
  align-self: center;
  margin-top: 16px; /* Align with the dropdowns */
  line-height: 1;
}

/* Mobile adjustments for date range controls */
@media only screen and (max-width: 768px) {
  .date-range-sliders {
    flex-direction: column;
    gap: 8px;
  }

  .range-input-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    max-width: none;
  }

  .range-input-group label {
    margin-bottom: 0;
    margin-right: 12px;
    text-transform: none;
    font-size: 13px;
  }

  .year-select {
    min-width: 100px;
  }

  .year-separator {
    display: none; /* Hide separator on mobile since we stack vertically */
  }
}

/* ============================
   Bottom Tab Bar (Phase C1) — Map / Layers / Search / Account
   ============================ */
/* Tab bar = iOS-style floating pill, all screen sizes. Map page (.forayz-header-minimal)
   uses logo-only header; Account opens via the Account tab below. */
.forayz-tab-bar {
  position: fixed;
  bottom: calc(16px + var(--safe-area-inset-bottom, 0px) + var(--cookie-bar-height, 0px));
  left: 50%;
  transform: translateX(-50%);
  transition: bottom 0.25s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface-card, #ffffff);
  border-radius: 9999px;
  box-shadow: var(--sh-sheet, 0 6px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08));
  z-index: 1100;
  font-family: var(--font-body, inherit);
}

.tab-btn {
  width: 72px;
  min-height: 52px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  color: var(--text-primary, #1f2a23);
  transition:
    background var(--dur-base, 220ms) var(--ease-standard, ease),
    color var(--dur-base, 220ms) var(--ease-standard, ease),
    transform var(--dur-fast, 120ms) var(--ease-standard, ease);
}

.tab-btn:hover {
  background: var(--surface-hover, #f1f5f2);
}

.tab-btn:active {
  transform: scale(0.95);
}

.tab-btn .tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-btn .tab-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.tab-btn .tab-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1;
}

.tab-btn.active {
  color: var(--accent-interactive, #2f5d3e);
  background: var(--surface-selected, #e6efe8);
}

/* On the map page, the floating bottom-left Layers button is replaced by the tab bar */
body.standalone-map #layer-control-toggle {
  display: none !important;
}

/* Compact header on map page — drop wordmark on mobile (already done globally), keep logo only */
.forayz-header-minimal .header-left {
  flex: 1;
}

/* ============================
   Tab Sheet (used by Account, Search — reuses layer-modal scrim/centered pattern)
   ============================ */
.forayz-tab-sheet {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.forayz-tab-sheet.active {
  opacity: 1;
  visibility: visible;
}

.forayz-tab-sheet[aria-hidden='true']:not(.active) {
  pointer-events: none;
}

.forayz-tab-sheet .tab-sheet-container {
  background: var(--surface-card, #ffffff);
  border-radius: 12px;
  box-shadow: var(--sh-raised, 0 20px 60px rgba(0, 0, 0, 0.3));
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body, inherit);
}

.forayz-tab-sheet .tab-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--divider, #e8e8e8);
}

.forayz-tab-sheet .tab-sheet-header h2 {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary, #1f2a23);
}

.forayz-tab-sheet .tab-sheet-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--accent-interactive, #4a5a4f);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.forayz-tab-sheet .tab-sheet-close:hover {
  background-color: var(--surface-hover, #f0f0f0);
}

.forayz-tab-sheet .tab-sheet-body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.forayz-tab-sheet .tab-sheet-placeholder {
  color: var(--accent-interactive, #4a5a4f);
  font-size: 14px;
  margin: 24px 0;
  text-align: center;
}

/* ============================
   UserMenu rendered inside the Account sheet — vertical layout overrides
   ============================ */
.user-menu-container.in-sheet {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
}

/* Site nav: stack vertically inside the sheet */
.user-menu-container.in-sheet .hdr-nav {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--divider, #e8e8e8);
  padding-top: 10px;
  margin-top: 6px;
}

.user-menu-container.in-sheet .hdr-nav a {
  padding: 10px 4px;
  border-bottom: 1px solid var(--divider, #f1f1f1);
  font-size: 15px;
}

.user-menu-container.in-sheet .hdr-nav a:last-child {
  border-bottom: none;
}

/* App-dropdown ("Get the App") becomes a stretched section */
.user-menu-container.in-sheet .get-app-container {
  display: block;
  width: 100%;
}

.user-menu-container.in-sheet .get-app-btn {
  width: 100%;
  justify-content: center;
}

.user-menu-container.in-sheet .get-app-dropdown {
  position: static !important;
  box-shadow: none;
  border: 1px solid var(--divider, #e8e8e8);
  margin-top: 8px;
  width: 100%;
}

/* Sign In button stretches full-width in the sheet */
.user-menu-container.in-sheet #login-btn,
.user-menu-container.in-sheet .modal-login-trigger {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
}

/* Profile dropdown: stack open inline (the wrapper still works, the dropdown sits below) */
.user-menu-container.in-sheet .profile-menu-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.user-menu-container.in-sheet .profile-dropdown {
  position: static !important;
  display: block !important; /* Always expanded inside the sheet — no need to tap initials */
  box-shadow: none;
  border: 1px solid var(--divider, #e8e8e8);
  width: 100%;
  margin-top: 4px;
}

.user-menu-container.in-sheet .profile-circle {
  /* hide the avatar-toggle button — the dropdown is always open inside the sheet */
  display: none;
}

/* ============================
   Bottom-offset bumps so floating UI clears the tab bar (~88px reserved)
   Stacking from bottom-right, bottom→top:
     1. Tab bar (bottom 16px, height 64px → covers 0–80px)
     2. MapLibre native controls (bottom 88px, height ~140px → covers 88–228px)
     3. View-toggle button (bottom 236px → sits above MapLibre stack)
   ============================ */
.view-toggle-btn {
  bottom: calc(236px + var(--safe-area-inset-bottom, 0px) + var(--cookie-bar-height, 0px));
  transition: bottom 0.25s ease;
}

/* MapLibre native controls (zoom, compass, locate, attribution) move up to clear the bar */
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left {
  bottom: calc(
    88px + var(--safe-area-inset-bottom, 0px) + var(--cookie-bar-height, 0px)
  ) !important;
  transition: bottom 0.25s ease;
}

@media only screen and (max-width: 768px) {
  .forayz-tab-bar {
    width: calc(100% - 24px);
    max-width: 380px;
    padding: 6px 8px;
    gap: 2px;
  }

  .tab-btn {
    width: auto;
    flex: 1;
    min-height: 48px;
    padding: 4px 2px;
  }

  .tab-btn .tab-icon svg {
    width: 18px;
    height: 18px;
  }

  .tab-btn .tab-label {
    font-size: 10px;
  }

  /* Mobile sheets slide up from bottom and fill more of the screen */
  .forayz-tab-sheet .tab-sheet-container {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    min-height: 50vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    align-self: flex-end;
    animation: modalSlideUpFromBottom 0.3s ease-out;
  }

  .forayz-tab-sheet {
    align-items: flex-end;
  }

  /* Mobile: basemap button and MapLibre controls bump higher to clear shorter tab bar */
  .view-toggle-btn {
    bottom: calc(222px + var(--safe-area-inset-bottom, 0px) + var(--cookie-bar-height, 0px));
  }

  .maplibregl-ctrl-bottom-right,
  .maplibregl-ctrl-bottom-left {
    bottom: calc(
      82px + var(--safe-area-inset-bottom, 0px) + var(--cookie-bar-height, 0px)
    ) !important;
  }
}

/* ============================
   Search Sheet (Phase C2) — wires to js/standalone/searchSheet.js
   ============================ */
.forayz-search-sheet .search-sheet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-hover, #f1f5f2);
  border: 1px solid var(--divider, #e2e8e3);
  border-radius: 10px;
  padding: 8px 12px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.search-input-wrap:focus-within {
  border-color: var(--accent-interactive, #2f5d3e);
  background: var(--surface-card, #ffffff);
}

.search-input-icon {
  display: flex;
  align-items: center;
  color: var(--accent-interactive, #4a5a4f);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  color: var(--text-primary, #1f2a23);
  font-family: var(--font-body, inherit);
  padding: 2px 0;
}

.search-input::placeholder {
  color: var(--accent-interactive, #6b7a6f);
  opacity: 0.7;
}

.search-clear-btn {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary, #333);
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.search-clear-btn:hover {
  background: rgba(0, 0, 0, 0.16);
}

.forayz-search-sheet .tab-sheet-body {
  padding: 8px 16px 16px;
}

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

.search-group + .search-group {
  margin-top: 14px;
}

.search-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-interactive, #4a5a4f);
  padding: 8px 4px 4px;
}

.search-clear-recents {
  background: none;
  border: none;
  color: var(--accent-interactive, #4a5a4f);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 2px 4px;
  text-transform: uppercase;
}

.search-clear-recents:hover {
  color: var(--text-primary, #1f2a23);
  text-decoration: underline;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 4px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--divider, #eef0ee);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body, inherit);
  transition: background 0.12s ease;
}

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

.search-result:hover,
.search-result:focus-visible {
  background: var(--surface-hover, #f5f8f5);
  outline: none;
}

.search-result-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-selected, #e6efe8);
  color: var(--accent-interactive, #2f5d3e);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary, #1f2a23);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  font-size: 13px;
  color: var(--accent-interactive, #5a6a5f);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-pro {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-interactive, #2f5d3e);
  background: var(--surface-selected, #e6efe8);
  padding: 3px 8px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.search-empty-state {
  padding: 36px 16px;
  text-align: center;
  color: var(--accent-interactive, #5a6a5f);
  font-size: 14px;
  line-height: 1.5;
}

.search-empty-state p {
  margin: 0 0 8px;
}

.search-empty-hint {
  font-size: 13px;
  opacity: 0.85;
}

.search-empty-hint em {
  font-style: normal;
  background: var(--surface-hover, #f1f5f2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
