* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #f0f0f0; }
body { max-width: 3600px; margin: 0 auto; }
#map { height: 100vh; width: 100%; background: #f0f0f0; }

/* ── Geocoder ─────────────────────────────────────────────────────────────── */
#geocoder {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  gap: 4px;
  font-family: sans-serif;
  font-size: 13px;
}
#geocoder input {
  width: 220px;
  padding: 5px 8px;
  border: 1px solid #333;
  border-radius: 3px;
  outline: none;
  background: #000;
  color: #fff;
}
#geocoder input::placeholder { color: #fff; opacity: 0.6; }
#geocoder button {
  padding: 5px 10px;
  background: #000;
  border: 1px solid #333;
  border-radius: 3px;
  cursor: pointer;
  color: #fff;
}
#geocoder button:hover { background: #222; }
#geocoder-error {
  position: absolute;
  top: 38px;
  right: 0;
  background: #fff;
  border: 1px solid #f99;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  color: #c00;
  display: none;
  white-space: nowrap;
}

/* ── Leaflet zoom override ────────────────────────────────────────────────── */
.leaflet-bar a {
  background-color: #000 !important;
  color: #fff !important;
  border-bottom: 1px solid #333 !important;
}
.leaflet-bar a:hover {
  background-color: #222 !important;
  color: #fff !important;
}
.leaflet-bar {
  border: 2px solid #333 !important;
  box-shadow: none !important;
}
.leaflet-touch .leaflet-bar a {
  background-color: #000 !important;
  color: #fff !important;
}

/* ── Geolocate button ─────────────────────────────────────────────────────── */
#geolocate-btn {
  position: absolute;
  top: 104px;
  left: 10px;
  z-index: 1000;
  width: 35px;
  height: 35px;
  background: #000;
  border: 2px solid #333;
  border-radius: 4px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  background-clip: padding-box;
}
#geolocate-btn:hover { background: #222; }

/* ── Palette toggle ───────────────────────────────────────────────────────── */
#palette-toggle {
  position: absolute;
  top: 150px;
  left: 10px;
  z-index: 1000;
  display: flex;
  border: 2px solid #333;
  border-radius: 4px;
  overflow: hidden;
}
#palette-toggle button {
  padding: 5px 10px;
  background: #000;
  border: none;
  border-right: 1px solid #333;
  color: rgba(255,255,255,0.5);
  font-family: sans-serif;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
#palette-toggle button:last-child { border-right: none; }
#palette-toggle button:hover { color: rgba(255,255,255,0.8); }
#palette-toggle button.active { color: #fff; background: #222; }

/* ── Custom palette panel ─────────────────────────────────────────────────── */
#custom-palette-panel {
  position: absolute;
  top: 184px;
  left: 10px;
  z-index: 1000;
  background: #000;
  border: 2px solid #333;
  border-radius: 4px;
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 7px;
  font-family: sans-serif;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
#custom-palette-panel.open { display: flex; }
#custom-palette-panel label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#custom-palette-panel input[type="color"] {
  width: 36px;
  height: 22px;
  border: 1px solid #444;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  padding: 1px 2px;
}

/* ── Logo ─────────────────────────────────────────────────────────────────── */
#logo {
  position: absolute;
  bottom: 24px;
  left: 10px;
  z-index: 1000;
  width: 100px;
  height: auto;
  pointer-events: none;
}

/* ── Bottom button bar ────────────────────────────────────────────────────── */
#btn-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 8px;
}
#btn-bar button {
  padding: 7px 18px;
  background: #000;
  border: 1px solid #333;
  border-radius: 3px;
  font-family: sans-serif;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
#btn-bar button:hover { background: #222; }
#btn-bar button:disabled { opacity: 0.7; cursor: default; }

/* ── Preview modal ────────────────────────────────────────────────────────── */
#preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.85);
  align-items: center;
  justify-content: center;
}
#preview-modal.open { display: flex; }
#preview-modal-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}
#preview-modal img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  border: 1px solid #333;
}
#preview-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  background: #000;
  border: 1px solid #444;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#preview-modal-close:hover { background: #222; }
