@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');

/* ── Design Tokens ───────────────────────────────────────── */

:root {
  /* Colors */
  --color-brand:        #F3CC05;
  --color-brand-dark:   #1A202C;
  --color-brand-subtle: #ffffff;
  --color-brand-hover:  #fffbe0;

  --color-text:         #1A202C;
  --color-text-muted:   #718096;
  --color-text-body:    #4A5568;

  --color-bg:           #EDF2F7;
  --color-bg-panel:     #ffffff;
  --color-border:       #d1d5db;

  --color-dark:         #1A202C;

  /* Typography */
  --font-family:  'Lato', 'Segoe UI', Roboto, Helvetica Neue, Arial, sans-serif;
  --font-sm:      0.75rem;
  --font-base:    0.88rem;
  --font-md:      0.9rem;
  --font-hint:    0.82rem;

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   14px;
  --space-lg:   16px;
  --space-xl:   22px;

  /* Shadows */
  --shadow-sm:    0 2px 10px rgba(0,0,0,0.12);
  --shadow-md:    0 2px 14px rgba(0,0,0,0.14);
  --shadow-lg:    0 5px 20px rgba(0,0,0,0.15);
  --shadow-focus: 0 2px 14px rgba(0,0,0,0.18);

  /* Misc */
  --radius:       0;
  --space-edge:   16px;
  --transition:   0.15s;
  --z-ui:         1000;
  --z-dropdown:   9999;
  --z-loading:    2000;
}

/* ── Reset ───────────────────────────────────────────────── */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Search ─────────────────────────────────────────────── */

#search-wrapper {
  position: absolute;
  top: var(--space-edge);
  left: var(--space-edge);
  z-index: var(--z-ui);
  display: flex;
  align-items: center;
  background: var(--color-brand-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 0 18px;
  gap: var(--space-sm);
  min-width: 360px;
  border: 2px solid var(--color-brand);
  transition: border-color var(--transition), box-shadow var(--transition);
}

#search-wrapper:focus-within {
  border-color: var(--color-brand-dark);
  box-shadow: var(--shadow-focus);
}

#search-icon {
  color: var(--color-text);
  flex-shrink: 0;
}

#search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text);
  font-family: inherit;
  font-size: var(--font-md);
  font-weight: 400;
  padding: 13px 0;
  width: 100%;
}

#search-input::placeholder {
  color: var(--color-text);
}

#search-clear {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-hint);
  padding: 0;
  display: none;
  line-height: 1;
  transition: color var(--transition);
}

#search-clear:hover {
  color: var(--color-text);
}

#search-suggestions {
  position: absolute;
  top: calc(100% + var(--space-sm));
  left: 0;
  right: 0;
  background: var(--color-bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  margin: 0;
  padding: var(--space-xs) 0;
  display: none;
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
}

#search-suggestions.open {
  display: block;
}

#search-suggestions li {
  padding: 9px var(--space-lg);
  font-size: var(--font-base);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
}

#search-suggestions li:last-child {
  border-bottom: none;
}

#search-suggestions li:hover,
#search-suggestions li.active {
  background: var(--color-brand-hover);
  color: var(--color-text);
}

#search-suggestions li .suggestion-icon {
  color: var(--color-text);
  flex-shrink: 0;
  margin-top: 1px;
}

#search-suggestions li .suggestion-text strong {
  display: block;
  font-weight: 700;
}

#search-suggestions li .suggestion-text span {
  display: none;
}

#search-suggestions .no-results {
  color: var(--color-text-muted);
  font-style: italic;
  cursor: default;
}

#search-suggestions .no-results,
#search-suggestions .no-results:hover {
  background: none;
  color: var(--color-text-muted);
  cursor: default;
  pointer-events: none;
}

/* ── Map ─────────────────────────────────────────────────── */

#map-container {
  flex: 1;
  position: relative;
}

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

/* ── Panel ───────────────────────────────────────────────── */

#layer-control {
  position: absolute;
  z-index: var(--z-ui);
  background: var(--color-bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border);
}

#layer-control {
  bottom: var(--space-edge);
  right: var(--space-edge);
  min-width: 210px;
}

/* Panel headings */

#layer-control h3 {
  font-size: var(--font-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-sm);
  margin-bottom: 10px;
}

/* ── Layer items ─────────────────────────────────────────── */

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  cursor: pointer;
}

.layer-item label {
  font-size: var(--font-base);
  font-weight: 400;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
}

.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-brand);
  border-radius: var(--radius);
  flex-shrink: 0;
}

/* ── Misc ────────────────────────────────────────────────── */

.control-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 10px 0;
}

.basemap-heading {
  margin-bottom: var(--space-sm);
}

.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-loading);
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: var(--font-base);
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
  pointer-events: none;
  display: none;
}

#zoom-hint  { bottom: var(--space-edge); }
#loading    { bottom: calc(var(--space-edge) + 48px); }

/* ── Leaflet Popup ───────────────────────────────────────── */

/* ── Leaflet Overrides ───────────────────────────────────── */

/* Pointer cursor on map canvas */
.leaflet-container {
  cursor: pointer !important;
}

/* Remove Leaflet touch double-border */
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

/* Zoom control aligned to same edge spacing */
.leaflet-bottom.leaflet-left .leaflet-control {
  margin-left: var(--space-edge);
  margin-bottom: var(--space-edge);
}

/* Popup */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
}

.leaflet-popup-content-wrapper {
  font-family: var(--font-family);
  font-size: var(--font-base);
  color: var(--color-text);
  padding: 0;
  min-width: max-content;
}

.leaflet-popup-content {
  margin: 10px 14px;
  white-space: nowrap;
}

.leaflet-popup-close-button {
  color: var(--color-text-muted) !important;
}
