:root {
  color-scheme: light dark;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

#map {
  height: 100%;
  width: 100%;
}

/* --- Marker styles --- */

/* Zoomed-out: tiny dot */
.poi-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.poi-dot--hut {
  background: #2da44e; /* green for huts */
}

.poi-dot--peak {
  background: #8250df; /* purple for peaks */
}

/* Middle zoom: Google Maps-ish pin */
.poi-pin {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff3b30;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.poi-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -7px) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #ff3b30;
  border-right: 2px solid rgba(255,255,255,0.9);
  border-bottom: 2px solid rgba(255,255,255,0.9);
  border-top-left-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: -1
}
.poi-pin__center {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
}

/* Zoomed-in: pin + name label */
.poi-labeled {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transform: translateY(-2px);
}

.poi-label {
  white-space: nowrap;
  padding: 4px 6px 4px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  color: #111;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  margin-left: -18px;
  display: none; /* Hidden by default */
}

/* Show label in high zoom mode */
.show-label .poi-label {
  display: block;
}

/* Show label on hover even when hidden */
.poi-labeled:hover .poi-label {
  display: block;
}

/* Leaflet's DivIcon defaults include a 12px drop shadow space; removing it keeps alignment crisp */
.leaflet-div-icon {
  background: transparent;
  border: none;
}

/* Tooltip styling for hover labels */
.leaflet-tooltip {
  background: rgba(255,255,255,0.95);
  color: #111;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.leaflet-tooltip-right:before {
  border-right-color: rgba(255,255,255,0.95);
}

/* Too many POIs message */
.too-many-pois-overlay {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  font-size: 14px;
  max-width: 300px;
  display: none;
}

.too-many-pois-overlay.visible {
  display: block;
}

.too-many-pois-overlay .message-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 15px;
}

.too-many-pois-overlay .message-text {
  opacity: 0.85;
  font-size: 13px;
}

/* Search bar container */
.search-container {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 300px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  color: #111;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  font-size: 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-input:focus {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}

.search-results {
  margin-top: 8px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  border-radius: 12px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}

.search-results.has-results {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background 0.15s ease;
}

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

.search-result-item:hover {
  background: rgba(0,0,0,0.05);
}

.search-result-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
  color: #111;
}

.search-result-details {
  font-size: 11px;
  opacity: 0.7;
  color: #111;
}

.search-no-results {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  opacity: 0.6;
  color: #111;
}

/* Simple control panel */
.control {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  color: #111;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  max-width: 360px;
}
.control h1 {
  font-size: 13px;
  margin: 0 0 8px 0;
  font-weight: 700;
}
.control .row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.control code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 8px;
}
.control #zoomValue {
  transition: color 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  .search-input {
    background: rgba(20,20,20,0.92);
    color: #eee;
    border-color: rgba(255,255,255,0.14);
  }
  .search-input:focus {
    background: rgba(20,20,20,0.98);
  }
  .search-results {
    background: rgba(20,20,20,0.92);
    border-color: rgba(255,255,255,0.14);
  }
  .search-result-item {
    border-bottom-color: rgba(255,255,255,0.06);
  }
  .search-result-item:hover {
    background: rgba(255,255,255,0.08);
  }
  .search-result-name,
  .search-result-details,
  .search-no-results {
    color: #eee;
  }
  .too-many-pois-overlay {
    background: rgba(20,20,20,0.92);
    color: #eee;
    border-color: rgba(255,255,255,0.14);
  }
  .control {
    background: rgba(20,20,20,0.92);
    color: #eee;
    border-color: rgba(255,255,255,0.14);
  }
  .control code {
    background: rgba(255,255,255,0.10);
  }
  .control div[style*="border-top"] {
    border-top-color: rgba(255,255,255,0.14) !important;
  }
  .poi-label {
    background: rgba(24,24,24,0.85);
    color: #f6f6f6;
    border-color: rgba(255,255,255,0.14);
  }
  .leaflet-tooltip {
    background: rgba(24,24,24,0.95);
    color: #f6f6f6;
    border-color: rgba(255,255,255,0.14);
  }
  .leaflet-tooltip-right:before {
    border-right-color: rgba(24,24,24,0.95);
  }
}
