:root {
  --bg: #f2efe8;
  --panel: #fcfbf7;
  --ink: #1f2b33;
  --muted: #52646d;
  --accent: #d0724b;
  --accent-2: #2f7a7b;
  --line: rgba(31, 43, 51, 0.12);
  --shadow: rgba(15, 23, 31, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fff4dd 0%, var(--bg) 55%, #e7efe9 100%);
}

.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  flex: 0 0 320px;
  padding: 24px 22px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 18px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: width 0.3s ease, opacity 0.3s ease, transform 0.3s ease, padding 0.3s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

.app.is-collapsed .sidebar {
  width: 0;
  flex-basis: 0;
  padding: 0;
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
  box-shadow: none;
  border-right: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.08em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-name {
  font-weight: 600;
  font-size: 16px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.panel-title {
  font-size: 22px;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-title {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.layer-list {
  display: grid;
  gap: 12px;
}

.layer-group {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.layer-group.is-collapsed {
  gap: 6px;
}

.layer-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.layer-group-title {
  flex: 1 1 auto;
}

.layer-group-toggle {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.layer-group-toggle:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.layer-group-items {
  display: grid;
  gap: 10px;
  padding-left: 6px;
}

.layer-group.is-collapsed .layer-group-items {
  display: none;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 16px rgba(31, 43, 51, 0.08);
  font-size: 14px;
  cursor: pointer;
}

.layer-item input {
  accent-color: var(--accent-2);
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent-2);
  flex: 0 0 auto;
}

.icon-swatch {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid rgba(31, 43, 51, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 12px rgba(31, 43, 51, 0.12);
}

.icon-swatch i {
  font-size: 12px;
}

.leaflet-div-icon {
  background: transparent;
  border: none;
}

.fa-marker-wrap {
  background: transparent;
  border: none;
}

.fa-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--marker-color, #fff);
  border: 2px solid var(--marker-ink, #1f2b33);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(15, 23, 31, 0.25);
}

.fa-marker::before {
  content: none;
}

.fa-marker-icon {
  font-size: 16px;
  color: var(--marker-ink, #1f2b33);
  line-height: 1;
  display: inline-block;
}

.layer-name {
  flex: 1 1 auto;
}

.status {
  font-size: 13px;
  color: var(--muted);
  margin-top: auto;
}

.status.error {
  color: #a23e2d;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1200;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

#map {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #d7ebe6, #b7d6e7);
}

.collapse-btn {
  border: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(252, 251, 247, 0.92);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(15, 23, 31, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.collapse-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 31, 0.25);
}

.collapse-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.search {
  position: relative;
  min-width: 220px;
}

.search input {
  width: 260px;
  max-width: 60vw;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(252, 251, 247, 0.95);
  font-family: inherit;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(15, 23, 31, 0.2);
}

.search input:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 28px rgba(15, 23, 31, 0.2);
  border: 1px solid var(--line);
  padding: 6px;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1250;
}

.search-results.is-open {
  display: grid;
  gap: 6px;
}

.search-result {
  text-align: left;
  border: none;
  background: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.search-result:hover,
.search-result:focus-visible {
  background: rgba(47, 122, 123, 0.12);
  outline: none;
}

.search-result-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.search-result-meta {
  font-size: 12px;
  color: var(--muted);
}

.search-result-group {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.leaflet-control-zoom {
  box-shadow: 0 8px 18px rgba(15, 23, 31, 0.18);
  border-radius: 10px;
  overflow: hidden;
}

@media (max-width: 900px) {
  .app {
    position: relative;
  }

  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    flex: 0 0 auto;
  }

  .app.is-collapsed .sidebar {
    width: 280px;
    transform: translateX(-100%);
  }

  .map-toolbar {
    top: 12px;
    left: 12px;
  }
}
