/* map.css */
:root {
  --bg: #f3f1ec;
  --surface: #fcfbf8;
  --surface-soft: #f7f4ee;
  --surface-tint: #eaf3f1;

  --text: #243041;
  --muted: #5f6b7a;

  --border: #cfd6cf;

  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #d9ebe7;

  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.10);
}


.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 22px;
  min-height: calc(100vh - 140px);
}

.layout--map {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100dvh - 80px);
}

.park-popup {
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
    padding: 4px 4px 0 4px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.park-popup h3 {
  margin: 0 0 2px 0;
  font-size: 15px;
  line-height: 1.2;
}

.park-popup p {
  margin: 0 0 6px 0;
  color: #64748b;
  font-size: 12px;
}

.park-popup-website {
  display: block;
  font-size: 13px;
  color: var(--primary, #0f766e);
  text-decoration: none;
  margin-bottom: 12px;
  word-break: break-all;
}

.park-popup-website:hover {
  text-decoration: underline;
}

.park-popup-ratings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  /* margin: 0 0 8px; */
  padding: 6px 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.park-popup-rating-row {
  display: flex;
  flex-direction: column;
  gap: 0px;
  font-size: 12px;
}

.park-popup-rating-label {
  color: #94a3b8;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.park-popup-rating-value {
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 13px;
}

.park-popup-website {
  margin-bottom: 8px;
  font-size: 12px;
}

.popup-view-link {
    color: #0f766e;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
}

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

.popup-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    /* margin-top: 6px; */
    margin-right: 0;
    /* padding-top: 6px; */
    border-top: 1px solid #f1f5f9;
    box-sizing: border-box;
}

.popup-save-button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    box-sizing: border-box;

    background: var(--accent);
    border: 1px solid #cbd5e1;
    /* border-radius: 6px; */
    /* padding: 5px 8px; */
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    white-space: normal;
}

.popup-action-row .popup-save-button {
    flex: 1 1 0;
    padding: 0 8px !important;
    white-space: nowrap;
}

.popup-action-row .popup-directions-link {
    flex-grow: 1.25;
}

.popup-save-button:hover {
    background: var(--accent-dark);
}

.sidebar,
.map-panel {
    position: relative; /* Essential for containing absolute child elements */
    min-height: 60dvh;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--color-surface);
  overflow: hidden;
}

.sidebar-copy {
  margin-bottom: 20px;
}

.sidebar-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.sidebar h2 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.1;
}

.sidebar .muted {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
  max-width: 26ch;
}

.park-search {
  margin: 0 0 1rem;
  width: 100%;
}

.park-search input {
  width: 100%;
  height: 48px; /* Matches standard input/select sizing */
  padding: 12px 16px;
  border: 1px solid var(--border, #d1dbe5);
  border-radius: 14px; /* Unified radius matching the select dropdown */
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
}

.park-search input:focus {
  outline: none;
  background-color: #fff;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.park-list {
  display: grid;
  flex: 1 0 220px;
  overflow: auto;
  min-height: 220px;
  padding-top: 5px;
  gap: 16px;
}

.park-card {
  width: 100%;
  box-sizing: border-box; /* Ensures padding doesn't push width out */
  text-align: left;
  border: 1px solid rgba(31, 41, 55, 0.12);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  margin-bottom: 0;
}

.park-card:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: var(--shadow-md);
  background: #ffffff;
}

.park-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14);
}

.park-card.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f1fbf8;
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.08);
}

.park-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text);
}

.park-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.park-card p + p {
  margin-top: 8px;
}

.park-card-stat {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark, #0b5f59);
}

.rating-stars {
  display: inline-flex;
  gap: 2px;
  white-space: nowrap;
}

.rating-stars__star {
  color: #cbd5e1;
  line-height: 1;
}

.rating-stars__star--filled {
  color: #f59e0b;
}

.rating-stars__star--partial {
  color: transparent;
  background: linear-gradient(
    90deg,
    #f59e0b var(--star-fill),
    #cbd5e1 var(--star-fill)
  );
  background-clip: text;
}

.park-location {
  color: #374151;
}

.park-rating {
  color: var(--text);
  font-weight: 600;
}

.map-panel {
  min-height: 60dvh;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border-radius: 20px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 60dvh;
}
#park-country-select {
  width: 100%;
  height: 48px; /* Enforces identical height to the search bar */
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #d1dbe5);
  background-color: #fff;
  color: var(--text, #1f2937);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  box-sizing: border-box;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3D//www.w3.org/2000/svg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%236b7280%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 10px auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  margin-bottom: 12px;
}

#park-country-select:hover {
  background-color: #fff;
  border-color: #bcccda;
}

#park-country-select:focus {
  outline: none;
  background-color: #fff;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.wakely-map-dot {
  width: 14px;
  height: 14px;
  background-color: #0f766e; /* Your brand teal */
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(15, 118, 110, 0.8);
  cursor: pointer;
  /* transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); */
}

.wakely-map-dot:hover {
  transform: scale(1.4);
}

/* Container rounding & shadow */
.mapboxgl-map {
  border-radius: 0;
  overflow: visible;
  border: 1px solid var(--border, #e2e8f0);
}

/* Modernize Zoom/Navigation Controls */
.mapboxgl-ctrl-group {
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  overflow: hidden;
  margin: 16px !important;
}

.mapboxgl-ctrl-group button {
  width: 36px !important;
  height: 36px !important;
  border-bottom: 1px solid var(--border, #e2e8f0) !important;
}

.mapboxgl-ctrl-group button:last-child {
  border-bottom: none !important;
}

/* Style Popup Cards to match your app panels */
.mapboxgl-popup-content {
  background: var(--surface, #ffffff) !important;
  color: var(--text, #1e293b) !important;
  border-radius: 14px !important;
  padding: 16px !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid var(--border, #e2e8f0);
  font-family: 'Inter', sans-serif;
  max-height: 70vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  #map .mobile-park-popup[hidden] {
    display: none !important;
  }

  #map .mobile-park-popup {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 9;
    width: min(320px, calc(100% - 88px));
    max-height: calc(100% - 32px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 22px 12px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    font-family: 'Inter', sans-serif;
  }

  #map .mobile-park-popup-content {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
  }

  #map .mobile-park-popup-close {
    position: absolute;
    top: 2px;
    right: 6px;
    z-index: 1;
    display: flex !important;
    width: 28px !important;
    min-width: 28px;
    height: 28px;
    min-height: 28px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--muted) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    cursor: pointer;
  }

  #map .mobile-park-popup .park-popup {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #map .mobile-park-popup .popup-action-row {
    order: 2;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
  }

  #map .mobile-park-popup .popup-action-row .popup-save-button {
    flex: 1 1 100px !important;
    min-width: 100px;
    padding: 0 8px !important;
    white-space: nowrap;
  }

  #map .mobile-park-popup .park-popup-website:empty {
    display: none;
  }

  #map .mobile-park-popup .park-popup-ratings {
    order: 3;
  }
}

/* Consolidated nearby-summary popup (list of parks) */
.nearby-summary-popup {
  box-sizing: border-box;
  width: min(360px, calc(100vw - 56px));
}

.nearby-summary-header {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.nearby-summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 42vh;
  overflow-y: auto;
}

.nearby-summary-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(247, 246, 244, 0.9);
  border: 1px solid rgba(0,0,0,0.03);
}

.nearby-summary-name {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.nearby-summary-distance {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.nearby-summary-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.nearby-summary-actions .popup-save-button {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

.nearby-empty {
  padding: 6px 8px;
  color: var(--muted);
}

/* Floating nearby results panel */
.nearby-results-panel {
  position: absolute;
  top: 70px;
  right: 18px;
  width: 320px;
  max-width: calc(100% - 40px);
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  z-index: 30;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.nearby-results-panel--visible { display: flex; }

.nearby-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,246,244,0.98));
}

.nearby-results-header button.nearby-results-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.nearby-results-body { padding: 10px; max-height: 48vh; overflow-y: auto; }

.nearby-panel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.nearby-panel-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border-radius: 8px; background: var(--surface-soft); }
.nearby-panel-left { display: flex; flex-direction: column; }
.nearby-panel-name { font-weight: 700; color: var(--text); }
.nearby-panel-sub { color: var(--muted); font-size: 12px; }
body .nearby-results-panel .nearby-panel-open {
    min-height: 32px !important;
    padding: 6px 10px !important;
    border: 1px solid var(--accent) !important;
    border-radius: 8px !important;
    background: var(--accent) !important;
    color: #ffffff !important;
    font-weight: 700;
    cursor: pointer;
}

body .nearby-results-panel .nearby-panel-open:hover {
    border-color: var(--accent-dark) !important;
    background: var(--accent-dark) !important;
    color: #ffffff !important;
}
.nearby-results-footer { padding: 8px 10px; border-top: 1px solid rgba(0,0,0,0.04); display: flex; justify-content: flex-end; }
.nearby-fit-btn { background: transparent; border: 1px solid var(--border); padding: 6px 8px; border-radius: 8px; cursor: pointer; font-weight: 700; }

@media (max-width: 900px) {
  .nearby-results-panel { right: 12px; top: 60px; width: 92%; }
  .nearby-results-panel--visible { max-height: 60vh; }
}

.nearby-panel-close {
    position: sticky;
    top: 0;
    float: right;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;
    margin: 6px 6px 0 0;
    padding: 0;

    border: none;
    border-radius: 50%;
    background: var(--surface, #fff);
    color: var(--text, #333);

    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.nearby-panel-close:hover {
    background: var(--surface-hover, #eee);
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip { border-bottom-color: var(--surface, #ffffff) !important; }
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip { border-top-color: var(--surface, #ffffff) !important; }

#map .nearby-fixed-panel {
    position: absolute;
    top: 32px;
    left: 16px;
    right: auto;
    bottom: auto;
    z-index: 9;

    width: min(320px, calc(100% - 88px));
    max-height: none;
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    font-family: 'Inter', sans-serif;

    overflow: visible;
    overscroll-behavior: contain;
}

#map .nearby-fixed-panel[hidden] {
    display: none !important;
}

/* Summary content */
#map .nearby-summary-popup {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#map .nearby-summary-header,
#map .nearby-fallback-heading {
    padding: 0 28px 10px 0;
    margin: 0 0 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

#map .nearby-summary-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: none;
    overflow: visible;
}

#map .nearby-summary-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;

    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

#map .nearby-summary-item:last-child {
    border-bottom: 0;
}

#map .nearby-summary-name {
    min-width: 0;
    color: var(--text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

#map .nearby-summary-distance {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

#map .nearby-summary-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

#map .nearby-summary-actions .popup-save-button {
    flex: 1 1 100px;
    min-width: 0;
    box-sizing: border-box;
    white-space: nowrap;
}

#map .nearby-empty {
    padding: 6px 0;
    color: var(--muted);
}

/* Close button — same treatment as the standard mobile popup */
#map .nearby-fixed-panel .nearby-panel-close {
    position: absolute;
    top: 2px;
    right: 6px;
    z-index: 10;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;

    margin: 0;
    padding: 0;

    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);

    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

#map .nearby-fixed-panel .nearby-panel-close:hover {
    background: var(--surface-hover, transparent);
}

@media (max-width: 768px) {
    #map .nearby-fixed-panel {
        top: 32px;
        left: 16px;
        right: auto;
        bottom: auto;

        width: min(320px, calc(100% - 88px));
        height: auto;
        max-height: calc(100% - 196px);

        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

.map-controls-row {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-control-btn {
    z-index: 10;
    background: #ffffff;
    border: 1px solid #ddd;
    color: #333;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.1s;
}

.map-control-btn:hover {
    background: #f8f9fa;
}

.map-control-btn:active {
    transform: scale(0.98);
}

.map-control-btn.map-location-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    box-sizing: border-box;
    justify-content: center;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 320px 1fr;
    gap: 16px;
  }
}



@media (max-width: 900px) {
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .map-panel {
    border-radius: 20px;
  }

  .sidebar {
    padding: 20px;
  }
}




@media (max-width: 768px) {
  .layout--map {
    grid-template-columns: 1fr;
  }

  .map-panel {
    order: 1;
    min-height: 0;
    height: auto;
  }

  .sidebar {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--border);
    padding: 0.875rem;
  }

  .sidebar > .nearby-parks {
    display: none;
  }

  .sidebar > .park-search,
  .sidebar > .park-filter,
  .sidebar > .park-sort {
    margin: 0 0 12px;
  }

  .sidebar > .park-sort > .wakely-select {
    margin-bottom: 0;
  }

  #map {
    height: 52dvh;
    min-height: 340px;
  }

  .sidebar-copy {
    margin-bottom: 0.75rem;
  }

  .park-list {
    max-height: 45dvh;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 0 0 auto;
  }

  .map-control-btn {
    padding: 6px 10px;
    font-size: 12px;
    }

  .map-controls-row {
    top: 10px;
    left: 10px;
    gap: 6px;
    max-width: calc(100% - 72px);
    flex-wrap: wrap;
    box-sizing: border-box;
    }

}

.map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--surface, #fcfbf8);
    color: var(--muted, #5f6b7a);
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.map-loading-overlay--hidden {
    opacity: 0;
    pointer-events: none;
}

.map-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border, #cfd6cf);
    border-top-color: var(--accent, #0f766e);
    border-radius: 50%;
    animation: map-spin 0.8s linear infinite;
}

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

.map-style-toggle-btn,
.map-view-toggle-btn {
    z-index: 10;
    background: #ffffff;
    border: 1px solid #ddd;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: background 0.2s, transform 0.1s;
}

.map-style-toggle-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mapboxgl-ctrl-group .map-location-btn,
.mapboxgl-ctrl-group .map-style-toggle-btn,
.mapboxgl-ctrl-group .map-view-toggle-btn {
    position: static;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background-color: #ffffff !important;
    color: #333333 !important;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mapboxgl-ctrl-group .map-location-btn:hover {
    background-color: #f8f9fa !important;
}

.mapboxgl-ctrl-group .map-location-btn.is-active {
    background-color: var(--accent) !important;
    color: #ffffff !important;
}

.mapboxgl-ctrl-group .map-location-btn.is-active:hover {
    background-color: var(--accent-dark) !important;
}

.map-view-toggle-btn {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
}

.map-style-toggle-btn:hover,
.map-view-toggle-btn:hover {
    background: #f8f9fa;
}

.map-style-toggle-btn:active,
.map-view-toggle-btn:active {
    transform: scale(0.96);
}

.map-style-toggle-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.map-controls-row {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-controls-row .map-control-btn,
.map-controls-row .map-style-toggle-btn,
.map-controls-row .map-view-toggle-btn {
    position: static;
}


/* Mobile nearby-parks overlay */
.map-nearby-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 12;
    width: min(22rem, calc(100% - 24px));
    max-height: 35%;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
}


.map-nearby-overlay .nearby-parks {
    margin: 0;
    padding: 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #ddd);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
}

/* Simplified proximity controls when displayed over the map */
.map-nearby-overlay.is-open .nearby-parks {
    padding: 10px 12px;
}

.map-nearby-overlay.is-open .nearby-parks-header {
    margin-bottom: 0;
}

.map-nearby-overlay.is-open .nearby-parks-header > .park-filter-label {
    display: none;
}

.map-nearby-overlay.is-open .nearby-location-toggle,
.map-nearby-overlay.is-open .nearby-status {
    display: none;
}

.map-nearby-overlay.is-open .nearby-slider-container {
    margin: 0;
}

.map-nearby-overlay.is-open .nearby-slider-labels {
    font-size: 11px;
}

/* The overlay is only used on mobile */
@media (min-width: 769px) {
    .map-nearby-overlay {
        display: none;
    }
}


/* Nearby results popups: fixed position within the map */
.mapboxgl-popup.nearby-fixed-popup {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;

    width: min(360px, calc(100% - 100px));
    max-width: none !important;
    max-height: calc(100% - 24px);

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    z-index: 10;
}

.mapboxgl-popup.nearby-fixed-popup .mapboxgl-popup-content {
    box-sizing: border-box;
    max-width: 100%;
}

/* Remove the pointer because the popup is now a fixed panel */
.mapboxgl-popup.nearby-fixed-popup .mapboxgl-popup-tip {
    display: none;
}

@media (max-width: 768px) {
    .mapboxgl-popup.nearby-fixed-popup {
        top: 10px !important;
        left: 10px !important;
        width: min(340px, calc(100% - 90px));
        max-height: calc(100% - 20px);
    }
}


.nearby-fixed-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 90px;
    z-index: 5;

    width: auto;
    max-width: 360px;
    max-height: calc(100% - 24px);

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;

    background: var(--surface, #fff);
    border: 1px solid var(--border, #ddd);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.nearby-fixed-panel[hidden] {
    display: none;
}

.nearby-fixed-panel > * {
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    #map .nearby-fixed-panel {
        top: 16px;
        left: 16px;
        right: auto;
        bottom: auto;

        width: min(320px, calc(100% - 88px));
        height: auto;
        max-height: calc(100% - 180px);
        padding: 12px;

        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* Compact nearby parks slider panel */
.map-nearby-overlay .nearby-parks {
    padding: 10px 12px;
    gap: 6px;
}

/* Header: radius label, value and reset button */
.map-nearby-overlay .nearby-parks-header {
    margin-bottom: 4px;
}

/* Location toggle */
.map-nearby-overlay .nearby-location-toggle {
    margin: 0;
    min-height: 24px;
}

/* Slider and its labels */
.map-nearby-overlay .nearby-slider-container {
    margin: 0;
    padding: 0;
}

.map-nearby-overlay #nearby-radius-slider {
    display: block;
    margin: 4px 0;
}

.map-nearby-overlay .nearby-slider-labels {
    margin-top: 2px;
    line-height: 1.2;
}

/* Status text beneath the slider */
.map-nearby-overlay .nearby-status {
    margin: 2px 0 0;
    line-height: 1.3;
}

/* Collapsible nearby parks header */
#map .nearby-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 0 0 10px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

#map .nearby-summary-header:focus-visible {
    outline: 2px solid var(--primary, #207c72);
    outline-offset: 3px;
    border-radius: 4px;
}

#map .nearby-summary-chevron {
    flex: 0 0 auto;
    font-size: 22px;
    line-height: 1;
    transition: transform 160ms ease;
}

#map .nearby-summary-header[aria-expanded="true"]
.nearby-summary-chevron {
    transform: rotate(180deg);
}

/* Hide the list completely when collapsed */
#map .nearby-summary-list[hidden] {
    display: none !important;
}

/* Space between the expanded header and park cards */
#map .nearby-summary-header:not([aria-expanded="false"]) {
    margin-bottom: 8px;
}


.popup-directions-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #ffffff;
}

.popup-directions-link:hover {
    text-decoration: none;
}

.park-select {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border, #d1dbe5);
  background-color: var(--surface-subtle, #f4f6f8);
  color: var(--text, #1f2937);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  box-sizing: border-box;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3D//www.w3.org/2000/svg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%236b7280%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%27/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 10px auto;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  margin-bottom: 12px;
}

.park-select:hover {
  background-color: #ebedf0;
  border-color: #bcccda;
}

.park-select:focus {
  outline: none;
  background-color: #fff;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.park-sort > .wakely-select {
  margin-bottom: 12px;
}

.park-filter-label {
  display: block;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}

.park-results-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.park-results-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.park-load-error {
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}

.park-load-error p {
  margin: 0 0 10px;
}

.park-load-retry {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.park-load-retry:disabled {
  opacity: 0.65;
  cursor: wait;
}

.clear-filters-btn {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

#clear-park-filters[hidden] {
  display: none !important;
}

.park-empty-state {
  margin: 12px 0;
  color: var(--muted);
  text-align: center;
}

.nearby-parks {
    position: relative;
    margin: 12px 0 1rem;
    padding: 14px 0;
    box-sizing: border-box;
}

.nearby-parks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.nearby-parks-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nearby-parks-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.nearby-parks > .wakely-select {
    margin-bottom: 8px;
}

.nearby-radius-value {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.nearby-slider-container {
    margin-top: 14px;
}

#nearby-radius-slider {
    width: 100%;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

#nearby-radius-slider:disabled {
    opacity: 0.45;
    cursor: default;
}

.nearby-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.nearby-status {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.nearby-park-select {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
}

.nearby-park-select:disabled {
    display: none;
}

.nearby-park-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.nearby-location-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.nearby-location-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.nearby-switch {
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 38px;
    border-radius: 999px;
    background: #aab4b1;
    transition: background-color 160ms ease;
}

.nearby-switch::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
    content: "";
    transition: transform 160ms ease;
}

.nearby-location-toggle input:checked + .nearby-switch {
    background: var(--accent);
}

.nearby-location-toggle input:checked + .nearby-switch::after {
    transform: translateX(16px);
}

.nearby-location-toggle input:focus-visible + .nearby-switch {
    outline: 3px solid rgba(15, 118, 110, 0.25);
    outline-offset: 2px;
}

.nearby-choose-park {
    min-height: 0 !important;
    margin: 0 0 8px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--accent-dark) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
    cursor: pointer;
}

.nearby-close-btn {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border: 0;
    border-radius: 50%;

    background: transparent;
    color: var(--muted);

    font-family: inherit;
    font-size: 22px;
    line-height: 1;

    cursor: pointer;
}

.nearby-close-btn:hover {
    background: rgba(15, 118, 110, 0.1);
    color: var(--text);
}

.nearby-close-btn svg {
    width: 17px;
    height: 17px;
}

.nearby-parks-header {
    padding-right: 0;
}

/* Ensure the nearby parks list stays hidden when collapsed */
#map .nearby-summary-list[hidden] {
    display: none !important;
}
#map .nearby-summary-header {
    padding-right: 12px;
}

#map .nearby-summary-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 28px;
    margin-right: 8px;
    color: var(--text);
}

#map .nearby-summary-toggle-icon svg {
    display: none;
    width: 20px;
    height: 20px;
}

#map .nearby-summary-header[aria-expanded="false"]
.nearby-summary-toggle-icon .icon-expand {
    display: block;
}

#map .nearby-summary-header[aria-expanded="true"]
.nearby-summary-toggle-icon .icon-collapse {
    display: block;
}

@media (max-width: 768px) {
    #map .nearby-summary-actions button.popup-save-button {
        display: none !important;
    }
}

/* Hide nearby parks list on desktop */
@media (min-width: 769px) {
    #map .nearby-fixed-panel {
        display: none !important;
    }
}