* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none; 
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

/* Legend container */
.legend-container {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  max-width: 280px;
}

/* Toggle button */
.legend-toggle {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 11px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 20px;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.legend-toggle:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.legend-toggle::before {
  font-family: 'FontAwesome';
  content: "\f0c9";
  margin-right: 8px;
}

/* Legend panel */
.legend-panel {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  display: none;  /* Hidden by default */
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.legend-panel.show {
  display: block;  /* Show when .show class added */
}

/* Close button */
.legend-close {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 11px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  float: right;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 20px;
  display: block;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.legend-close:hover {
  background-color: rgba(0, 0, 0, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.legend-close::before {
  font-family: 'FontAwesome';
  content: "\f00d";
}

.clearfix::after {
  content: '';
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

/* Legend content */
.legend-content {
  padding: 0;
}

.legend-title {
  background-color: rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, .9);
  padding: 11px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  font-size: 13px;
  line-height: 20px;
  width: 100%;
  display: block;
  border-radius: 6px;
  margin: 0;
  letter-spacing: -0.01em;
}

.legend-item {
  position: relative;
  width: 100%;
  display: block;
}

.legend-item input[type=checkbox] {
  display: none;
}

.legend-item label {
  background-color: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, .95);
  padding: 11px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 20px;
  width: 100%;
  display: block;
  cursor: pointer;
  border-radius: 6px;
  margin: 0;
  position: relative;
  transition: all 0.2s ease;
}

.legend-item label:hover {
  background-color: rgba(0, 0, 0, .7);
  transform: translateX(2px);
}

.legend-item label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  margin-right: 10px;
  vertical-align: middle;
  margin-top: -2px;
  transition: all 0.2s ease;
}

.legend-item input[type=checkbox]:checked + label {
  background-color: rgba(0, 0, 0, .65);
}

.legend-item input[type=checkbox]:checked + label::before {
  background-color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.9);
  font-family: 'FontAwesome';
  content: "\f00c";
  color: #000;
  font-size: 12px;
  text-align: center;
  line-height: 20px;
  font-weight: 900;
}

.legend-color {
  display: inline-block;
  width: 50px;
  height: 12px;
  margin-right: 10px;
  vertical-align: middle;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.legend-footer {
  background-color: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, .7);
  padding: 11px 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 20px;
  width: 100%;
  display: block;
  border-radius: 6px;
  margin: 0;
}

@media (min-width: 769px) {
  .legend-panel {
    display: block;  /* Desktop: visible by default */
  }
  
  .legend-panel.hide {
    display: none;  /* Hide when .hide class added */
  }
  
  .legend-toggle {
    display: none;  /* Toggle hidden initially */
  }
  
  .legend-toggle.show {
    display: block;  /* Show toggle when legend closed */
  }

  .legend-toggle.hide {
    display: none;  /* Force hide when legend open */
  }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .legend-container {
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
  }
  
  .legend-toggle {
    display: block;
    width: 100%;
  }
  
  .legend-panel {
    display: none;
  }
  
  .legend-panel.show {
    display: block;
  }
  
  .legend-toggle.hide {
    display: none;
  }

/*  .maplibregl-ctrl-bottom-right {
    bottom: 10px;
    right: 10px;
  }*/
  
  /* Add space between geolocate and attribution */
/*  .maplibregl-ctrl-bottom-right .maplibregl-ctrl {
    margin-bottom: 10px;
  }*/
}

/* Custom popup styling */
.maplibregl-popup-content {
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.maplibregl-popup-content strong {
  color: #fff;
  font-weight: 600;
}

.maplibregl-popup-close-button {
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  padding: 4px 8px;
  transition: all 0.2s ease;
}

.maplibregl-popup-close-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.maplibregl-popup-content a {
  color: #4db8ff;
  text-decoration: none;
}

.maplibregl-popup-content a:hover {
  color: #80d4ff;
  text-decoration: underline;
}

.maplibregl-popup-content a:visited {
  color: #66c2ff;
}

/* Tooltip styling (lighter than full popup) */
.tooltip-popup .maplibregl-popup-content {
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  pointer-events: none;  /* Don't block mouse events */
}

.tooltip-popup .maplibregl-popup-tip {
  border-top-color: rgba(0, 0, 0, 0.85);
}

/* No close button on tooltip */
.tooltip-popup .maplibregl-popup-close-button {
  display: none;
}

.map-logo {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 1;
}

.map-logo img {
  display: block;
  height: 40px;
  width: auto;
  /* Add shadow for visibility */
/*  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));*/
}

.map-logo a {
  display: block;
  text-decoration: none;
}

.map-logo a:hover {
  opacity: 0.8;  /* Slight fade on hover to show it's clickable */
  transition: opacity 0.2s ease;
}


