/* ======================================
   BASE RESET & GLOBAL STYLES
====================================== */
@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:wght@400;700&display=swap');

:root {
  --color-primary: #131313;
  --color-accent: #f8f8f8;
  --color-bg: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Host Grotesk", sans-serif;
  background: var(--color-bg);
  color: var(--color-primary);
}

/* ======================================
   MAP CONTAINER STYLES
====================================== */
#map {
    width: 100%;
    height: 600px;
    margin: 1rem 0;
    z-index: 1;
    background: #fff;
    border-radius: 1rem;
}

/* Remove .map-container if not used, or ensure it does not interfere */
.map-container {
  width: 100vw;
  max-width: 100%;
  height: 600px;
  margin: 2rem 0 0 0;
  padding: 0;
  background: none;
  position: relative;
}

#toggleLegend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: #fff;
  border: none;
  padding: 0.5rem;
  z-index: 1000;
  cursor: pointer;
}

#toggleLegend svg {
  display: block;
}

/* ======================================
   LEGEND STYLES
====================================== */
.info.legend {
  background: #fff !important;
  padding: 0;
  border: 1px solid var(--color-primary);
  font-family: "Host Grotesk", sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  width: 180px;
}

.info.legend h3 {
  margin: 0;
  padding: 0.25rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  background-color: var(--color-primary);
  color: white;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.5px;
}

.info.legend .legend-item {
  padding: 0.2rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.info.legend .legend-item:last-child {
  border-bottom: none;
}

.info.legend .legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 1px solid;
}

.info.legend .legend-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}

/* ======================================
   POPUP STYLES
====================================== */
.leaflet-popup-content-wrapper {
  border-radius: 0;
  padding: 0;
  border: 1px solid var(--color-primary);
  box-shadow: none;
}

.leaflet-popup-content {
  margin: 0;
  width: auto !important;
  min-width: 300px;
  font-family: "Host Grotesk", sans-serif;
  line-height: 1.5;
  max-height: 350px;
  overflow-y: auto;
}

.leaflet-popup-content h3 {
  margin: 0;
  padding: 0.5rem 1rem; /* reduced vertical padding */
  font-size: 1rem;
  font-weight: 700;
  background-color: var(--color-primary);
  color: white;
  text-transform: uppercase;
  letter-spacing: .5px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.leaflet-popup-content .section {
  padding: 0.35rem 8px 0.35rem 1rem; /* top, right, bottom, left */
  border-bottom: 1px solid #eee;
}

.leaflet-popup-content .section:last-child {
  border-bottom: none;
}

.leaflet-popup-content .section-title {
  display: block;
  font-weight: 700;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 0.15rem; /* reduced margin */
}

.leaflet-popup-content .section-value {
  display: block;
  font-size: 1.1rem; /* slightly reduced font size */
  line-height: 1.3;   /* tighter line height */
  font-weight: normal;
}

.leaflet-popup-tip {
  background: #fff;
}

.leaflet-popup-close-button {
  color: #fff !important;
  font-size: 1rem !important;
  padding: 0 4px 0 0 !important;
  right: 0 !important;
  top: 0 !important;
  margin: 0 !important;
}

/* Add these to your existing CSS file */
.leaflet-popup-content::-webkit-scrollbar {
    width: 6px;
}

.leaflet-popup-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.leaflet-popup-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

.leaflet-popup-content a:hover {
    color: #3498db;
}

/* Add this to remove the close button */
.leaflet-popup-close-button {
    display: none !important;
}

.leaflet-pane .tract-layer {
  pointer-events: none;
}

/* Prevent polygon fill from blocking point interactions */
.leaflet-pane path {
  pointer-events: visiblePainted;
}

/* MapLibre popup styling (adapted from Leaflet popup styles) */
.ml-popup-content-wrapper {
  max-width: 350px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 0;
  border: 2px solid #131313;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.ml-popup-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  max-height: 350px;
  padding: 0;
  margin: 0;
  font-family: "Host Grotesk", sans-serif;
  line-height: 1.5;
  background: #fff;
  border-radius: 0;
}

.ml-popup-content *,
.ml-popup-content *::before,
.ml-popup-content *::after {
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  border-radius: 0;
}

.ml-popup-content h3 {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  background-color: #131313;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-bottom: none;
}

.ml-section {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #eaeaea;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

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

.ml-section-title {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 0.15rem;
}

.ml-section-value {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 400;
  color: #131313;
}

.ml-popup-content::-webkit-scrollbar {
  width: 6px;
}

.ml-popup-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.ml-popup-content a {
  color: #131313;
  text-decoration: underline;
}

.ml-popup-content a:hover {
  color: #3498db;
}

/* Switch style toggle buttons for map controls */
.switch-label {
  display: flex;
  align-items: center;
  gap: 0rem;
  font-family: "Host Grotesk", sans-serif;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
}

.switch-label input[type="checkbox"] {
  display: none;
}

.switch-slider {
  width: 44px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  margin-right: 0.5rem;
  box-sizing: border-box;
}

.switch-label input[type="checkbox"]:checked + .switch-slider {
  background: #131313;
}

.switch-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.switch-label input[type="checkbox"]:checked + .switch-slider::before {
  left: 23px;
}

.switch-text {
  font-size: 1rem;
  color: #131313;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Custom Neumorphic Dual-handle Slider */
.custom-slider-wrapper {
  display: flex;
  flex-direction: column;
  row-gap: 0.75rem;
  margin-bottom: 3rem;
}

.custom-slider-wrapper:last-child {
  margin-bottom: 0;
}

.slider-label {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}

.custom-slider {
  position: relative;
  height: 13px;
  background: #eee;
  border-radius: 999px;
  width: 100%;
  /* ...existing code... */
}

.custom-slider .track {
  position: absolute;
  top: 50%;
  left: 0;
  height: 1px;
  width: 100%;
  background: #eee;
  transform: translateY(-50%);
  border-radius: 0px;
  z-index: 1;
  
}

.custom-slider .range {
  position: absolute;
  top: 50%;
  height: 12px;
  background: #131313;
  border-radius: 2px;
  transform: translateY(-50%);
  z-index: 2;
}

.custom-slider-wrapper:last-child {
  margin-bottom: 3rem;
}


.handle {
  position: absolute;
  top: 50%;
  width: 25px;
  height: 25px;
  background: #131313;
  border-radius: 50%;
  border: solid 3px #eee;
  box-shadow: 0 0px 10px 0 rgba(0, 0, 0, 0.2), 0 0px 20px 0 rgba(0, 0, 0, 0.19);
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 3;
}

.tooltip {
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
  background: #131313;
  color: #fff;
  padding: 3px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  font-weight: bold;
}


.slider-group-wrapper {
  padding-left:3rem;
  padding-right: 3rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  background:#eee;
  border-radius:1rem;
  box-shadow:0 2px 8px rgba(0,0,0,0.04);
  border:1px solid #e6e6e6;
}

.toggle-controls {
  display: flex;
  justify-content: left;
  gap: 1rem;
  flex-wrap: wrap;
}

.map-controls {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto 1rem auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: stretch;
}

.slider-group-wrapper {
  flex: 1 1 320px;
  max-width: auto;
  display: flex;
  flex-direction: column;
  padding: 1rem 1rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #eee;
  box-sizing: border-box;
  gap: 1rem;
}

.slider-group-wrapper h3 {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: normal;
}

/* Responsive: stack vertically on small screens */
@media (max-width: 1100px) {
  .map-controls {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  .slider-group-wrapper {
    max-width: 100%;
    min-width: 0;
    width: 100%;
  }
}

.filter-toggle {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  padding: 0.75rem 1.25rem;
  background: #fff;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  font-weight: bold;
  cursor: pointer;
}

.filter-panel {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.15);
  padding: 1.5rem 1rem;
  transition: transform 0.3s ease;
}



.filter-card {
  background: #fafafa;
  border-radius: 12px;
  padding-top: 1rem;
  padding-bottom: 1rem;
  padding-left: 3rem;
  padding-right: 3rem;
  border: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group-title {
  font-weight: 700;
  font-size: 1.25rem;
  text-transform: uppercase;
  margin-bottom: -1rem;
}

.filter-group-desc {
  font-size: 0.9rem;
  font-style: italic;
  color: #444;
  margin: 0;
  line-height: 1.4;
}

.toggle-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}


@media (max-width: 900px) {
  #map {
    height: 400px !important; /* or whatever height you want on mobile */
  }

  .map-container {
    height: 400px !important;
  }
}
