:root {
  --ink: #182620;
  --muted: #6e7568;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --line: #e3e1db;
  --accent: #1c7a5b;
  --accent-deep: #145940;
  --accent-tint: #e7f3ee;
  --locate-blue: #2f80ed;

  --shadow-float: 0 8px 24px rgba(24, 38, 32, 0.12);
  --shadow-tight: 0 2px 8px rgba(24, 38, 32, 0.08);

  --radius-panel: 16px;
  --radius-pill: 999px;

  --sidebar-width: 380px;
  --font-ui: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

#app {
display: flex;
height: 100dvh;
width: 100vw;
min-height: 100svh;
overflow: hidden;
}

/* ---------- Sidebar ---------- */

#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--paper);
  box-shadow: var(--shadow-float);
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  overflow-y: auto;
}

#sidebar-handle {
  display: none; /* shown only in the mobile media query below */
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: var(--radius-pill);
  margin: 0 auto 12px;
  cursor: pointer;
  flex-shrink: 0;
}

#lang-switch {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.lang-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.lang-btn:hover {
  border-color: var(--accent);
}
.lang-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  transition: border-color 0.15s ease;
  flex-shrink: 0;
}
#search-box:focus-within {
  border-color: var(--accent);
}
#search-box svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}
#search-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  color: var(--ink);
  min-width: 0;
}
#search-input::placeholder {
  color: var(--muted);
}

#categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 2px 14px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
#categories::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 62px;
  padding: 10px 4px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.category-chip svg {
  width: 19px;
  height: 19px;
  color: var(--accent-deep);
}
.category-chip span {
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  line-height: 1.2;
}
.category-chip:hover {
  border-color: var(--accent);
}
.category-chip.active {
  background: var(--accent-tint);
  border-color: var(--accent);
}
.category-chip.active span {
  color: var(--accent-deep);
}

#results-header {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 14px 6px 6px;
}
#results-header:empty {
  display: none;
  padding: 0;
}

#results-list {
  display: flex;
  flex-direction: column;
}

.result-item {
  padding: 13px 6px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.result-item:hover .result-name {
  color: var(--accent-deep);
}
.result-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}
.result-meta {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}
.results-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 16px 6px;
}

#brand-row {
display: flex;
align-items: center;
justify-content: space-between;
margin: 2px 2px 16px;
flex-shrink: 0;
}

#brand-row #lang-switch {
margin: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.045em;
}

/* ---------- Map area ---------- */

#map-area {
position: relative;
flex: 1;
z-index: 1;
}

#map {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: var(--paper);
}

/* Fake "dark mode" basemap: invert + hue-rotate the standard OSM tiles
   instead of depending on a separate (often now key-gated) tile provider.
   Scoped to the tile pane only, so markers/popups stay normal. */
#map.dark-mode .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

#layers-control {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
}
.layers-menu {
  position: absolute;
  top: 54px;
  right: 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-float);
  padding: 6px;
  min-width: 148px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.layers-menu.hidden {
  display: none;
}
.layers-option {
  border: none;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.layers-option:hover {
  background: var(--paper);
}
.layers-option.active {
  background: var(--accent-tint);
  color: var(--accent-deep);
}

#map-controls {
  position: absolute;
  right: 16px;
  bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 500;
}

.map-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--surface);
  box-shadow: var(--shadow-tight);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
}
.map-btn:hover {
  background: var(--accent-tint);
}
.map-btn svg {
  width: 20px;
  height: 20px;
}
.map-btn--accent {
  color: var(--accent);
}

.user-location-dot {
  width: 14px;
  height: 14px;
  background: var(--locate-blue);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.28);
}

.leaflet-control-scale-line {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--ink) !important;
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 600;
}

/* ---------- Geolocation prompt modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 38, 32, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 20px;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-panel);
  padding: 26px;
  max-width: 340px;
  box-shadow: var(--shadow-float);
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
}
.modal p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-deep);
}
.btn--ghost {
  background: transparent;
  color: var(--muted);
}
.btn--ghost:hover {
  background: var(--paper);
}

/* ---------- Leaflet popup theming ---------- */

.leaflet-popup-content-wrapper {
  border-radius: 10px;
  font-family: var(--font-ui);
}
.leaflet-popup-content {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  #app {
  position: relative;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
  }

  #map-area {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  }

  #map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  }

  #sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  height: auto;
  max-height: 70vh;
  max-height: 70dvh;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  overflow-y: hidden;
  padding:
  0 16px
  max(16px, env(safe-area-inset-bottom))
  16px;
  z-index: 2000;
  isolation: isolate;
  }

  #sidebar-handle {
  display: block;
  }

  #sidebar:not(.expanded) #results-header,
  #sidebar:not(.expanded) #results-list {
  display: none;
  }

  #sidebar.expanded {
  max-height: 70vh;
  max-height: 70dvh;
  overflow-y: auto;
  }

  #layers-control {
  top: 16px;
  right: 16px;
  }

  #map-controls {
  top: 70px;
  bottom: auto;
  right: 16px;
  }

  .leaflet-control-scale {
    display: none;
  }
}
