/* ============================
   Forayz Sidebar Layout
   ============================ */

:root {
  --sm-brand-navy: #2c5d8f;
  --sm-text-primary: #1a1a1a;
}

/* ============================
   1. Layout Structure
   ============================ */

/* Ensure full-height layout */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body.standalone-map {
  display: flex;
  flex-direction: column;
}

/* ============================
   2. Header
   ============================ */
.forayz-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--surface-card, #ffffff);
  border-bottom: 1px solid var(--divider, #e8e8e8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-lg, 24px);
  z-index: 1000;
  font-family: var(
    --font-body,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    'Helvetica Neue',
    Arial,
    sans-serif
  );
}

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

.header-right {
  display: flex;
  align-items: center;
}

.hdr-logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary, var(--sm-text-primary));
}

.hdr-logo-link:hover {
  text-decoration: none;
  opacity: 0.85;
}

.hdr-logo-icon {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
}

.hdr-brand {
  font-family: var(--font-display, Georgia, serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.2px;
  line-height: 1.15;
  color: var(--text-primary, var(--sm-text-primary));
}

.forayz-header .user-menu-container {
  position: static;
  display: flex;
  align-items: center;
  gap: 22px;
}

/* Nav links */
.hdr-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hdr-nav a {
  color: var(--text-secondary, var(--sm-text-primary));
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition:
    color var(--dur-fast, 120ms) var(--ease-standard, ease),
    border-color var(--dur-fast, 120ms) var(--ease-standard, ease);
}

.hdr-nav a:hover {
  color: var(--accent-interactive, var(--sm-brand-navy));
}

.hdr-nav a.current {
  color: var(--accent-interactive, var(--sm-brand-navy));
  border-bottom-color: var(--accent-interactive, var(--sm-brand-navy));
  font-weight: 600;
}

/* Get the App dropdown */
.get-app-container {
  position: relative;
}

.get-app-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--forest-900, #1a1a1a);
  color: #ffffff;
  border: none;
  border-radius: var(--r-md, 8px);
  font-family: var(--font-body, inherit);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast, 150ms) var(--ease-standard, ease);
}

.get-app-btn:hover {
  background: var(--forest-800, #000000);
}

.get-app-caret {
  font-size: 10px;
  line-height: 1;
}

.get-app-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--divider, #e8e8e8);
  border-radius: 8px;
  box-shadow: var(--sh-card, 0 6px 20px rgba(0, 0, 0, 0.12));
  min-width: 220px;
  padding: 6px;
  z-index: 1001;
}

.get-app-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-primary, var(--sm-text-primary));
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

.get-app-dropdown a:hover {
  background: var(--surface-sunken, #f4f4f4);
}

.get-app-dropdown .svg-icon {
  font-size: 18px;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: #333;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  transition:
    background 0.2s,
    transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: #f5f5f5;
}

.sidebar-toggle i {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rotate icon when sidebar is collapsed */
body.sidebar-collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

/* ============================
   3. Left Sidebar
   ============================ */
.forayz-sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  width: 220px;
  height: calc(100vh - 60px);
  background: #ffffff;
  border-right: 1px solid #e0e0e0;
  z-index: 999;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
  -webkit-overflow-scrolling: touch;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* ============================
   4. Sidebar Sections
   ============================ */
.sidebar-section {
  border-bottom: 1px solid #f0f0f0;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #333;
  background: #fafafa;
  border-bottom: 1px solid #e8e8e8;
}

.sidebar-section-title.clickable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.sidebar-section-title.clickable:hover {
  background: #f0f0f0;
}

.sidebar-section-title i:first-child {
  width: 20px;
  min-width: 20px;
  text-align: center;
  color: #007cba;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-section-title .collapse-icon {
  margin-left: auto;
  font-size: 12px;
  color: #999;
  transition: transform 0.3s;
}

.sidebar-section-title.expanded .collapse-icon {
  transform: rotate(180deg);
}

.sidebar-section-content {
  padding: 16px 20px;
  overflow: visible;
  transition:
    max-height 0.3s ease,
    padding 0.3s ease,
    opacity 0.3s ease;
  max-height: 2000px;
  opacity: 1;
}

.sidebar-section-content.collapsed {
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
  opacity: 0;
}

/* ============================
   5. Basemap Selector (Compact Segmented Control)
   ============================ */
.basemap-selector-compact {
  display: flex;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 3px;
  gap: 0;
}

.basemap-option-compact {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
}

.basemap-option-compact:hover {
  background: rgba(0, 124, 186, 0.1);
}

.basemap-option-compact input {
  display: none;
}

/* Selected state - white background with shadow */
.basemap-option-compact:has(input:checked) {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.basemap-option-compact .basemap-icon {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: none;
  flex-shrink: 0;
}

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

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

.basemap-label {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  white-space: nowrap;
}

.basemap-option-compact:has(input:checked) .basemap-label {
  color: #007cba;
  font-weight: 600;
}

/* ============================
   6. Layers Container
   ============================ */
.sidebar-layers-container {
  max-height: none;
  overflow-y: visible;
}

.loading-text {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 20px;
  font-style: italic;
}

.layer-subsection {
  margin-bottom: 20px;
}

.layer-subsection:last-child {
  margin-bottom: 0;
}

.layer-subsection-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6c757d;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e9ecef;
}

/* Sidebar Layer Items */
.sidebar-layer-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  margin-bottom: 8px;
  position: relative;
  min-height: 40px;
}

.sidebar-layer-item:hover {
  border-color: #007cba;
  background: #f8fbff;
  box-shadow: 0 1px 3px rgba(0, 124, 186, 0.1);
}

.sidebar-layer-item.selected {
  border-color: #007cba;
  background: #f0f8ff;
  box-shadow: 0 2px 6px rgba(0, 124, 186, 0.15);
}

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

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

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

.layer-icon {
  width: 16px;
  color: #495057;
  font-size: 14px;
  flex-shrink: 0;
  text-align: center;
}

.sidebar-layer-item.selected .layer-icon {
  color: #007cba;
}

.layer-name {
  font-weight: 500;
  font-size: 14px;
  /* Use the token so the layer-panel title flips to light in dark mode.
     A hardcoded #212529 here was overriding map-custom.css (later load order,
     equal specificity) and staying dark on the dark panel. */
  color: var(--text-primary, #212529);
  word-wrap: break-word;
}

.sidebar-layer-item.selected .layer-name {
  font-weight: 600;
  color: #007cba;
}

/* Checkbox visual indicator */
.checkbox-item .checkbox-visual {
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.checkbox-item input:checked ~ .layer-item-content .checkbox-visual {
  background: #007cba;
  border-color: #007cba;
}

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

.checkbox-item:hover .checkbox-visual {
  border-color: #007cba;
}

/* Pro indicator */
.pro-indicator {
  color: #ffd700;
  font-size: 12px;
  margin-left: 4px;
}

/* Experimental ("Beta") badge — flags habitat/forecast layers users should treat with skepticism */
.experimental-indicator {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #8a5a00;
  background-color: #fff4d6;
  border: 1px solid #e8c97a;
  border-radius: 3px;
  vertical-align: middle;
}

.pro-lock-icon {
  position: absolute;
  right: 12px;
  color: #999;
  font-size: 14px;
}

/* ============================
   7. Saved Items & Preferences
   ============================ */
.sidebar-placeholder {
  text-align: center;
  color: #999;
  font-size: 14px;
  font-style: italic;
}

/* ============================
   8. Sidebar Footer
   ============================ */
.sidebar-footer {
  padding: 16px 20px;
  /* Safe area inset for bottom - covers notches and home indicators */
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
  /* Prevent footer from shrinking in flexbox layout */
  flex-shrink: 0;
}

.btn-upgrade {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #333;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn-upgrade i {
  font-size: 14px;
}

/* ============================
   9. Map Container
   ============================ */
#map {
  position: fixed;
  top: 60px;
  left: 0; /* Full width - no sidebar */
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
}

/* ============================
   10. Sidebar Collapsed State (Mini Mode)
   COMMENTED OUT - Sidebar removed in favor of floating button + modal
   ============================ */
/*
body.sidebar-collapsed .forayz-sidebar {
    width: 60px;
}

body.sidebar-collapsed #map {
    left: 60px;
}
*/

/* Hide text labels in collapsed state - but NOT the icons */
body.sidebar-collapsed .sidebar-section-title > span,
body.sidebar-collapsed .basemap-label,
body.sidebar-collapsed .sidebar-placeholder,
body.sidebar-collapsed .layer-name,
body.sidebar-collapsed .collapse-icon,
body.sidebar-collapsed .btn-upgrade > span {
  display: none !important;
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
}

/* Center icons when collapsed */
body.sidebar-collapsed .sidebar-section-title {
  justify-content: center;
  align-items: center;
  padding: 16px 8px;
  display: flex;
  cursor: pointer;
  position: relative;
  gap: 0 !important;
}

body.sidebar-collapsed .sidebar-section-title i:first-child {
  margin: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  width: auto !important;
  min-width: auto !important;
  display: block !important;
  color: #007cba;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

/* Hide section content when collapsed */
body.sidebar-collapsed .sidebar-section-content {
  display: none;
}

/* Hide footer text, show only icon */
body.sidebar-collapsed .sidebar-footer {
  padding: 16px 8px;
  display: flex;
  justify-content: center;
}

body.sidebar-collapsed .btn-upgrade {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  align-items: center;
  display: flex;
}

body.sidebar-collapsed .btn-upgrade i {
  margin: 0;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  font-size: 16px;
  line-height: 1;
}

/* Hover effect for collapsed sidebar items - merged with centering above */
body.sidebar-collapsed .sidebar-section-title:hover {
  background: #f0f0f0;
}

/* Tooltips for collapsed state */
body.sidebar-collapsed .sidebar-section-title::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 65px;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s,
    visibility 0.2s;
  pointer-events: none;
  z-index: 10000;
}

body.sidebar-collapsed .sidebar-section-title:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================
   11. Mobile Responsiveness
   ============================ */

/* Mobile Overlay - Only active on mobile, not when details sidebar is open */
.sidebar-overlay {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none; /* Allow clicks to pass through by default */
  transition:
    opacity 0.3s,
    visibility 0.3s;
}

/* Only show overlay on mobile when left sidebar is open */
@media only screen and (max-width: 768px) {
  body.sidebar-open:not(.details-sidebar-open) .sidebar-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Block clicks only on mobile for left sidebar */
  }
}

/* Mobile styles */
@media only screen and (max-width: 768px) {
  .forayz-header {
    height: 50px;
    padding: 0 12px;
  }

  .hdr-brand {
    display: none;
  }

  .forayz-header .user-menu-container {
    gap: 10px;
  }

  /* Hide the desktop nav; a hamburger will take its place (added in a follow-up step below) */
  .hdr-nav {
    display: none;
  }

  .get-app-btn {
    padding: 7px 12px;
    font-size: 13px;
  }

  /* Sidebar on mobile - DEFAULT to collapsed (60px mini mode) until JS loads */
  /* This prevents the sidebar from covering the screen before JavaScript runs */
  .forayz-sidebar {
    top: 50px;
    /* Use dvh (dynamic viewport height) for mobile Safari - respects browser chrome */
    /* Fallback to vh for older browsers, then override with dvh if supported */
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    width: 60px; /* Start collapsed by default on mobile */
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
    transform: translateX(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* When sidebar is collapsed on mobile, show mini mode (60px width with icons) */
  body.sidebar-collapsed .forayz-sidebar {
    width: 60px;
    transform: translateX(0);
    visibility: visible;
  }

  /* When sidebar is open on mobile, show narrower width so map is visible */
  body.sidebar-open .forayz-sidebar {
    width: 50%;
    max-width: 200px;
    transform: translateX(0);
  }

  /* Default: Hide section content on mobile until sidebar is opened */
  .sidebar-section-content {
    display: none;
  }

  /* Show content only when sidebar is explicitly opened */
  body.sidebar-open .sidebar-section-content {
    display: block;
  }

  /* Map takes full width on mobile - no sidebar */
  #map {
    top: 50px;
    left: 0; /* Full width */
    right: 0;
    bottom: 0;
  }

  /* Keep mini-sidebar styles on mobile when collapsed - but show icons */
  body.sidebar-collapsed .sidebar-section-title > span,
  body.sidebar-collapsed .basemap-label,
  body.sidebar-collapsed .layer-name,
  body.sidebar-collapsed .collapse-icon,
  body.sidebar-collapsed .btn-upgrade > span {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
  }

  /* Center icons when collapsed on mobile */
  body.sidebar-collapsed .sidebar-section-title {
    justify-content: center;
    align-items: center;
    padding: 14px 8px;
    background: #fafafa;
    display: flex;
    gap: 0 !important;
  }

  body.sidebar-collapsed .sidebar-section-title i:first-child {
    margin: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    min-width: auto !important;
    display: block !important;
    color: #007cba;
    font-size: 18px;
    line-height: 1;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Hide section content when collapsed on mobile */
  body.sidebar-collapsed .sidebar-section-content {
    display: none;
  }

  /* Footer icon-only when collapsed */
  body.sidebar-collapsed .sidebar-footer {
    padding: 14px 8px;
    display: flex;
    justify-content: center;
  }

  body.sidebar-collapsed .btn-upgrade {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    align-items: center;
    display: flex;
  }

  body.sidebar-collapsed .btn-upgrade i {
    margin: 0;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    font-size: 16px;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* When sidebar is open (full), show all content normally */
  body.sidebar-open .sidebar-section-title,
  body.sidebar-open .sidebar-section-content,
  body.sidebar-open .sidebar-section-title span,
  body.sidebar-open .basemap-label,
  body.sidebar-open .btn-upgrade span {
    opacity: 1;
    visibility: visible;
    width: auto;
    display: block;
  }

  body.sidebar-open .sidebar-section-title {
    justify-content: flex-start;
    padding: 14px 16px;
  }

  body.sidebar-open .sidebar-section-content {
    display: block;
  }

  body.sidebar-open .sidebar-footer {
    padding: 14px 16px;
  }

  body.sidebar-open .btn-upgrade {
    width: 100%;
    height: auto;
    padding: 12px 16px;
  }

  /* No tooltips on mobile */
  body.sidebar-collapsed .sidebar-section-title::after {
    display: none;
  }

  /* Sidebar sections more compact when open */
  .sidebar-section-title {
    padding: 14px 16px;
    font-size: 14px;
  }

  .sidebar-section-content {
    padding: 14px 16px;
  }

  /* Stack basemap buttons vertically on mobile to save horizontal space */
  .basemap-selector-compact {
    flex-direction: column;
    gap: 6px;
  }

  .basemap-option-compact {
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .sidebar-footer {
    padding: 14px 16px;
    /* Extra bottom padding for Safari navigation bar - needs ~100px to clear nav bar */
    padding-bottom: calc(14px + max(100px, env(safe-area-inset-bottom, 100px)));
  }
}

/* Tablet - REMOVED: Left sidebar was removed in favor of floating button + modal
   The forayz-sidebar element no longer exists, so these rules were causing
   a blank left gap on the map at tablet widths (769-1024px). */

/* ============================
   12. Details Sidebar Adjustments
   ============================ */
/* Ensure details sidebar appears above map */
#details-sidebar {
  top: 60px;
  max-height: calc(100vh - 60px);
  z-index: 1001;
}

@media only screen and (max-width: 768px) {
  #details-sidebar {
    top: 50px;
    max-height: calc(100vh - 50px);
  }
}

/* Morel prediction card in AOI sidebar */
.morel-prediction-content {
  background: #f0f7f0;
  border-left: 3px solid #4caf50;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.4;
}

.morel-prediction-content strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.morel-prediction-date {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #888;
}

/* Summary text preserves line breaks from \n in data */
.summary-text {
  white-space: pre-line;
}

/* ============================
   13. Animation & Transitions
   ============================ */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.forayz-sidebar.animating {
  animation: slideInFromLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================
   14. Accessibility
   ============================ */
.sidebar-toggle:focus,
.sidebar-section-title.clickable:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.hdr-nav a:focus-visible,
.get-app-btn:focus-visible,
.get-app-dropdown a:focus-visible {
  outline: 2px solid var(--sm-brand-navy);
  outline-offset: 2px;
  border-radius: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .forayz-header,
  .forayz-sidebar {
    border-color: #000;
  }

  .sidebar-section-title {
    border-color: #000;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .forayz-sidebar,
  #map,
  .sidebar-overlay,
  .sidebar-section-content {
    transition: none;
  }

  .hdr-nav a,
  .get-app-btn {
    transition: none;
  }
}

/* ============================================
   Burn Flag System Styles
   ============================================ */

/* Flag Banner */
.flag-banner {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}
.flag-banner-icon {
  fill: currentColor;
  flex-shrink: 0;
}
.flag-banner.category-access_issue {
  background: var(--danger, #c0392b);
}
.flag-banner.category-safety_hazard {
  background: var(--warning, #d4852a);
}
.flag-banner.category-inaccurate_data {
  background: var(--forest-600, #4a7c59);
}
.flag-banner.category-poor_conditions {
  background: var(--bark-700, #6b4a2e);
}

/* Approved Comments */
.flag-comments-section {
  padding: 0 16px 12px;
}
.flag-comment-card {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.flag-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.flag-category-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  color: #fff;
}
.flag-category-pill.pill-access_issue {
  background: var(--danger, #c0392b);
}
.flag-category-pill.pill-safety_hazard {
  background: var(--warning, #d4852a);
}
.flag-category-pill.pill-inaccurate_data {
  background: var(--forest-600, #4a7c59);
}
.flag-category-pill.pill-poor_conditions {
  background: var(--bark-700, #6b4a2e);
}
.flag-comment-time {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.5);
}
.flag-comment-text {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.85);
  line-height: 1.4;
}

/* Flag Form Area */
.flag-form-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.flag-btn {
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: transparent;
  color: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.flag-btn:hover {
  border-color: rgba(0, 0, 0, 0.5);
  color: rgba(0, 0, 0, 0.9);
}

/* Flag Form */
.flag-form {
  margin-top: 10px;
}
.flag-radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.flag-radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 2px solid transparent;
  color: rgba(0, 0, 0, 0.85);
}
.flag-radio-option:hover {
  background: rgba(0, 0, 0, 0.1);
}
.flag-radio-option input[type='radio'] {
  display: none;
}
.flag-radio-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
  position: relative;
}
.flag-radio-option input[type='radio']:checked ~ .flag-radio-dot {
  border-color: var(--forest-600, #5b9bd5);
}
.flag-radio-option input[type='radio']:checked ~ .flag-radio-dot::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest-600, #5b9bd5);
}
.flag-radio-option:has(input:checked) {
  border-color: var(--forest-600, #5b9bd5);
  background: var(--forest-50, rgba(91, 155, 213, 0.1));
}

.flag-comment-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
  color: rgba(0, 0, 0, 0.85);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 52px;
  margin-bottom: 10px;
}
.flag-comment-input::placeholder {
  color: rgba(0, 0, 0, 0.35);
}
.flag-comment-input:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.3);
}

/* Form Action Buttons */
.flag-form-actions {
  display: flex;
  gap: 8px;
}
.flag-submit-btn {
  flex: 1;
  padding: 9px;
  background: var(--forest-700, #5b9bd5);
  color: #fff;
  border: none;
  border-radius: var(--r-md, 8px);
  font-family: var(--font-body, inherit);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast, 120ms) var(--ease-standard, ease);
}
.flag-submit-btn:hover {
  background: var(--forest-800, #4a8ac4);
}
.flag-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.flag-remove-btn {
  padding: 9px 14px;
  background: var(--danger, #c0392b);
  color: #fff;
  border: none;
  border-radius: var(--r-md, 8px);
  font-family: var(--font-body, inherit);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast, 120ms) var(--ease-standard, ease);
}
.flag-remove-btn:hover {
  background: #a93226;
}
.flag-cancel-btn {
  padding: 9px 14px;
  background: transparent;
  color: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.flag-cancel-btn:hover {
  color: rgba(0, 0, 0, 0.8);
  border-color: rgba(0, 0, 0, 0.35);
}

/* Confirmation Message */
.flag-message {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.flag-message.success {
  background: rgba(76, 175, 80, 0.15);
  color: #8fc9a9;
}
.flag-message.error {
  background: rgba(192, 57, 43, 0.15);
  color: #e88;
}
