/* ===================================
   CSS Variables — Oxus Design Language
   =================================== */
:root {
  --accent: #00AA9B;
  --accent-hover: #009388;
  --text: #333;
  --text-sec: #555;
  --text-muted: #888;
  --text-faint: #999;
  --border: #e0e0e0;
  --border-light: #eee;
  --border-btn: #ccc;
  --bg: #fff;
  --radius: 10px;
  --shadow: 0 16px 48px rgba(0,0,0,0.25);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
}

/* ===================================
   Base Styles
   =================================== */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  padding-top: 0 !important;
  color: var(--text);
  background: var(--bg);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Hide Bootstrap navbar — replaced by #header */
.navbar {
  display: none !important;
}

/* ===================================
   Header
   =================================== */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 1001;
  flex-shrink: 0;
}

#title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

#logo-image {
  height: 32px;
}

#title-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.title-accent {
  color: var(--accent);
}

#header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  padding: 4px 12px;
  border: 1.5px solid var(--border-btn);
  background: var(--bg);
  color: var(--text-sec);
  font-size: 11px;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: inherit;
}

.pill-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pill-btn:active {
  background: rgba(0,170,155,0.06);
}

.info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--text-faint);
  background: none;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}

.info-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.info-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.info-btn:active {
  background: rgba(0,170,155,0.08);
}

/* ===================================
   Map Container
   =================================== */
#container {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

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

/* ===================================
   Loading Indicator
   =================================== */
#loading {
  position: fixed;
  width: 220px;
  height: 19px;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -110px;
  z-index: 20001;
}

.progress-bar-full {
  width: 100%;
}

#loading .progress-bar {
  background-color: var(--accent) !important;
}

/* ===================================
   Bootstrap Modal Overrides
   =================================== */
.modal-backdrop {
  background-color: #000;
}

.modal-backdrop.in {
  opacity: 0.45;
}

.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 16px 20px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.modal-title a {
  color: var(--accent);
  text-decoration: none;
}

.modal-title a:hover {
  text-decoration: underline;
}

.modal-header .close {
  font-size: 22px;
  color: var(--text-faint);
  opacity: 1;
  font-weight: 400;
  text-shadow: none;
  margin-top: -2px;
}

.modal-header .close:hover {
  color: var(--text);
}

.modal-body {
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-sec);
}

.modal-body a {
  color: var(--accent);
  text-decoration: none;
}

.modal-body a:hover {
  text-decoration: underline;
}

.modal-body p {
  margin-bottom: 10px;
}

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 12px 20px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.modal-footer .btn-default {
  padding: 6px 18px;
  border: 1.5px solid var(--border-btn);
  background: var(--bg);
  color: var(--text-sec);
  font-size: 12px;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}

.modal-footer .btn-default:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-footer .btn-default:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-footer .btn-default:active {
  background: rgba(0,170,155,0.06);
}

/* Feature modal title */
#featureModal .text-primary {
  color: var(--accent) !important;
}

#feature-info {
  font-size: 13px;
  line-height: 1.6;
}

/* Feature modal — table layout */
.feature-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.6;
}

.feature-table td {
  padding: 6px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--border-light);
}

.feature-table tr:last-child td {
  border-bottom: none;
}

.modal-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  white-space: nowrap;
  width: 1%;
  padding-right: 16px !important;
}

.feature-symbology {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
}

/* ===================================
   Bootstrap Tab Overrides
   =================================== */
.nav-tabs {
  border-bottom: 2px solid var(--border-light);
}

.nav-tabs > li > a {
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 0;
  padding: 10px 16px;
  transition: color 0.15s;
}

.nav-tabs > li > a:hover {
  color: var(--accent);
  background: transparent;
  border: none;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: var(--accent);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--accent);
  margin-bottom: -2px;
}

#aboutTabsContent {
  padding-top: 12px;
}

/* ===================================
   Form Elements
   =================================== */
input[type="radio"],
input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===================================
   Leaflet Controls — Layer Panel
   =================================== */
.leaflet-control-layers {
  overflow: auto;
  max-width: 300px !important;
  width: auto !important;
  transition: left 0.3s ease-in-out, transform 0.3s ease-in-out, top 0.3s ease-in-out;
  border-radius: 8px !important;
  box-shadow: var(--shadow-sm) !important;
  border: 1px solid var(--border) !important;
}

/* Desktop: always expanded, no hover-to-reveal */
@media screen and (min-width: 751px) {
  .leaflet-control-layers .leaflet-control-layers-list {
    display: block !important;
  }
  .leaflet-control-layers .leaflet-control-layers-toggle {
    display: none !important;
  }
}

.leaflet-control-layers label {
  font-weight: normal;
  margin-bottom: 0;
}

.leaflet-control-layers-list input[type="radio"],
.leaflet-control-layers-list input[type="checkbox"] {
  margin: 2px;
  accent-color: var(--accent);
}

/* Group headings */
.leaflet-control-layers-group-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  font-weight: 700;
  margin-bottom: 6px;
}

.leaflet-control-layers-group {
  margin-bottom: 8px;
}

.leaflet-control-layers-group label {
  padding-left: 6px;
  font-size: 12px;
  color: var(--text-sec);
}

.leaflet-control-layers-separator {
  border-top: 1px solid var(--border-light);
  margin: 6px 0;
}

.unlock-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85em;
}
.unlock-link:hover {
  text-decoration: underline;
}

/* ===================================
   Layer Control Custom Buttons
   =================================== */
.layer-control-custom-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--border-light);
}

.layer-control-custom-buttons button {
  width: 90%;
  margin: 3px 0;
  padding: 7px 12px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  text-align: center;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  font-family: inherit;
  font-weight: 600;
}

.layer-control-custom-buttons button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===================================
   Cluster Toggle
   =================================== */
.cluster-toggle-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 6px 0;
  padding: 10px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.cluster-toggle-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cluster-toggle {
  position: relative;
  width: 48px;
  height: 24px;
  background-color: #ddd;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  border: none;
}

.cluster-toggle.active {
  background-color: rgba(0,170,155,0.2);
}

.cluster-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cluster-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: #bbb;
  border-radius: 50%;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.cluster-toggle.active .cluster-toggle-slider {
  transform: translateX(24px);
  background-color: var(--accent);
}

/* ===================================
   Cluster Toast Notification
   =================================== */
.cluster-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-width: 400px;
  text-align: center;
  white-space: nowrap;
}

.cluster-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

@media screen and (max-width: 480px) {
  .cluster-toast {
    max-width: calc(100% - 40px);
    white-space: normal;
    font-size: 11px;
    padding: 8px 16px;
  }
}

/* ===================================
   Select / Deselect / Suggest Buttons
   =================================== */
.select-all-button,
.deselect-all-button {
  width: auto;
  min-width: 120px;
  max-width: 200px;
  margin: 3px auto;
  padding: 6px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  background-color: var(--bg);
  color: var(--text-sec);
  border: 1.5px solid var(--border-btn);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
  letter-spacing: 0.2px;
}

.select-all-button:hover,
.deselect-all-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.select-all-button:active,
.deselect-all-button:active {
  background: rgba(0,170,155,0.06);
}

.suggest-locations-button {
  width: auto;
  min-width: 120px;
  max-width: 200px;
  margin: 3px auto;
  padding: 8px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  background-color: var(--accent);
  color: #fff;
  border: 1.5px solid var(--accent);
  white-space: normal;
  height: auto;
  min-height: 36px;
  line-height: 1.3;
  text-align: center;
  transition: background-color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.suggest-locations-button:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.suggest-locations-button:active {
  background-color: #00857a;
  border-color: #00857a;
}

/* View Full Project — outline style */
.view-project-button {
  width: auto;
  min-width: 120px;
  max-width: 200px;
  margin: 3px auto;
  padding: 8px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: block;
  background-color: var(--bg);
  color: var(--accent);
  border: 1.5px solid var(--accent);
  white-space: nowrap;
  text-align: center;
  transition: background-color 0.15s, color 0.15s;
  font-family: inherit;
}

.view-project-button:hover {
  background-color: var(--accent);
  color: #fff;
}

.view-project-button:active {
  background-color: var(--accent-hover);
  color: #fff;
}

/* ===================================
   Mobile Close Button (Layer Control)
   =================================== */
.leaflet-control-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  z-index: 1002;
  font-size: 18px;
  line-height: 24px;
  text-align: center;
  color: var(--text-faint);
  font-weight: 400;
  transition: color 0.15s, border-color 0.15s;
}

.leaflet-control-close:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

@media screen and (max-width: 750px) {
  .leaflet-control-layers-expanded .leaflet-control-close {
    display: block !important;
  }
}

/* ===================================
   Leaflet Popup Override
   =================================== */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.18);
  padding: 6px 2px 10px;
}

.leaflet-popup-content {
  margin: 10px 14px 14px;
  font-size: 12px;
  line-height: 1.5;
}

.leaflet-popup-content strong {
  color: var(--text);
}

/* Hover tooltip — compact card */
.tooltip-popup .leaflet-popup-content-wrapper {
  max-width: 280px;
  padding: 0;
  border-top: 3px solid var(--accent);
}

.tooltip-popup .leaflet-popup-content {
  margin: 10px 14px;
  padding-bottom: 6px;
  font-size: 11px;
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.tooltip-popup .leaflet-popup-content::-webkit-scrollbar {
  width: 3px;
}

.tooltip-popup .leaflet-popup-content::-webkit-scrollbar-thumb {
  background: var(--border-btn);
  border-radius: 2px;
}

.tooltip-popup .leaflet-popup-content strong {
  color: var(--accent);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tooltip-popup .leaflet-popup-content img {
  border-radius: 4px;
  margin: 4px 0;
  max-width: 100%;
}

.tooltip-popup .leaflet-popup-tip {
  border-top-color: var(--bg);
}

/* ===================================
   Leaflet Zoom Control
   =================================== */
.leaflet-control-zoom a {
  color: var(--text-sec);
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ===================================
   Leaflet Attribution
   =================================== */
.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-control-attribution a {
  color: var(--accent);
}

/* ===================================
   Performance Optimizations
   =================================== */
.leaflet-tile {
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.leaflet-marker-icon {
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.8)) !important;
  -webkit-filter: drop-shadow(0 0 2px rgba(255,255,255,0.8)) !important;
  contain: layout style;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.leaflet-popup {
  contain: layout style;
}

.leaflet-zoom-animated {
  will-change: transform;
}

/* ===================================
   Marker Clustering — Teal Palette
   =================================== */
.marker-cluster {
  background-clip: padding-box;
  border-radius: 20px;
}

.marker-cluster div {
  text-align: center;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

/* Small clusters (< 10) */
.marker-cluster-small {
  background-color: rgba(0, 170, 155, 0.25);
}
.marker-cluster-small div {
  background-color: rgba(0, 170, 155, 0.6);
  width: 30px;
  height: 30px;
  margin: 5px;
  line-height: 30px;
}

/* Medium clusters (10-99) */
.marker-cluster-medium {
  background-color: rgba(0, 140, 128, 0.3);
}
.marker-cluster-medium div {
  background-color: rgba(0, 140, 128, 0.65);
  width: 40px;
  height: 40px;
  margin: 5px;
  line-height: 40px;
}

/* Large clusters (100+) */
.marker-cluster-large {
  background-color: rgba(0, 110, 100, 0.35);
}
.marker-cluster-large div {
  background-color: rgba(0, 110, 100, 0.7);
  width: 50px;
  height: 50px;
  margin: 5px;
  line-height: 50px;
}

.marker-cluster span {
  display: inline-block;
  width: 100%;
  text-align: center;
}

/* ===================================
   Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ===================================
   Responsive — Tablet
   =================================== */
@media screen and (max-width: 992px) {
  #title-text {
    font-size: 12px;
  }
}

/* ===================================
   Responsive — Mobile (< 768px)
   =================================== */
@media screen and (max-width: 768px) {
  .url-break {
    word-break: break-all;
    word-break: break-word;
    hyphens: auto;
  }

  .leaflet-marker-icon {
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.7)) !important;
    -webkit-filter: drop-shadow(0 0 1px rgba(255,255,255,0.7)) !important;
  }

  .marker-cluster {
    box-shadow: none !important;
  }

  .select-all-button,
  .deselect-all-button,
  .suggest-locations-button,
  .view-project-button {
    width: 100% !important;
    max-width: none !important;
    min-width: auto !important;
    font-size: 11px;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 4px !important;
    margin-bottom: 4px !important;
  }

  .layer-control-custom-buttons {
    padding: 10px !important;
  }
}

@media screen and (max-width: 480px) {
  .select-all-button,
  .deselect-all-button,
  .suggest-locations-button,
  .view-project-button {
    font-size: 10px;
  }
}

/* ===================================
   Responsive — Mobile Layer Control
   =================================== */
@media screen and (max-width: 750px) {
  #header {
    padding: 6px 10px;
  }

  #title-text {
    font-size: 12px;
  }

  #logo-image {
    height: 24px;
  }

  .pill-btn {
    padding: 3px 10px;
    font-size: 10px;
  }

  /* ---- Collapsed state: just the hamburger ---- */
  .leaflet-control-layers {
    position: fixed !important;
    left: 10px !important;
    top: 56px !important;
    z-index: 1000 !important;
    transform: none !important;
  }

  .leaflet-control-layers:not(.leaflet-control-layers-expanded) {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    overflow: visible !important;
    width: 44px !important;
    height: 44px !important;
  }

  /* Hide ALL content when collapsed */
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-list,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-base,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-overlays,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-separator,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .layer-control-custom-buttons,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .cluster-toggle-container,
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-close {
    display: none !important;
  }

  /* Ensure toggle is ALWAYS visible when collapsed */
  .leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-toggle {
    display: block !important;
  }

  /* Toggle button styling */
  .leaflet-control-layers-toggle {
    width: 44px !important;
    height: 44px !important;
    background-color: white !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36"><path fill="%23333" d="M4 7h28v3H4zM4 16.5h28v3H4zM4 26h28v3H4z"/></svg>') !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 26px 26px !important;
    border: 1.5px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: var(--shadow-sm) !important;
  }

  /* ---- Expanded state: compact panel ---- */
  .leaflet-control-layers-expanded {
    position: fixed !important;
    left: 10px !important;
    top: 56px !important;
    transform: none !important;
    width: 260px !important;
    max-width: calc(100% - 20px) !important;
    max-height: 60vh !important;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: white !important;
    padding: 10px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2) !important;
    border: 1px solid var(--border) !important;
  }

  .leaflet-control-layers-expanded .leaflet-control-layers-list,
  .leaflet-control-layers-expanded .leaflet-control-layers-base,
  .leaflet-control-layers-expanded .leaflet-control-layers-overlays,
  .leaflet-control-layers-expanded .leaflet-control-layers-separator,
  .leaflet-control-layers-expanded .layer-control-custom-buttons,
  .leaflet-control-layers-expanded .cluster-toggle-container {
    display: block !important;
  }

  .leaflet-control-layers-expanded .leaflet-control-layers-toggle {
    display: none !important;
  }

  /* Compact typography inside expanded panel */
  .leaflet-control-layers-expanded label {
    font-size: 11px;
    line-height: 1.4;
  }

  .leaflet-control-layers-expanded .leaflet-control-layers-group-name {
    font-size: 9px;
    margin-bottom: 4px;
  }

  .leaflet-control-layers-expanded .leaflet-control-layers-group label img {
    width: 22px !important;
    height: 22px !important;
  }

  .leaflet-container {
    padding-top: 0;
  }
}

/* ===================================
   Search
   =================================== */
#search-container {
  position: relative;
}

#search-input {
  padding: 4px 12px;
  border: 1.5px solid var(--border-btn);
  border-radius: 14px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  width: 180px;
  outline: none;
  transition: border-color 0.15s;
}

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

#search-input:focus {
  border-color: var(--accent);
}

#search-results {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  z-index: 1002;
  scrollbar-width: thin;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.1s;
  border-bottom: 1px solid var(--border-light);
}

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

.search-result:hover {
  background-color: #f5f5f5;
}

.search-result-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.search-result-text {
  min-width: 0;
}

.search-result-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

@media screen and (max-width: 750px) {
  #search-input {
    width: 120px;
    font-size: 10px;
    padding: 3px 10px;
  }

  #search-results {
    position: fixed;
    left: 10px;
    right: 10px;
    width: auto;
    top: 50px;
  }
}

@media screen and (max-width: 480px) {
  #search-input {
    width: 90px;
  }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
  #header {
    display: none !important;
  }
  .leaflet-control-container {
    display: none !important;
  }
}