/* Styles for the map-tools.js overlay controls (search box, 3D/PNG/draw/
   fullscreen buttons, draw hint, area-stats panel) - all positioned
   absolute within #map-wrap (Explore's map panel), not the viewport, so
   they work identically whether the panel is docked at 400px or expanded
   to fullscreen (see .is-fullscreen below). */

#map-wrap { position: relative; flex: 1; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
#map-wrap #map { position: absolute; inset: 0; }

/* Real bug found and fixed: a fixed 280px search box plus a fixed 220px
   tool cluster both anchored to the top row overlapped whenever the map
   panel itself was narrower than ~500px combined - which is the normal
   case here, not an edge case, since the panel shares width with the
   results list/card grid next to it (confirmed directly: 380px wide panel,
   ~177px of real overlap between the two elements). Fixed by moving the
   tool cluster to the bottom-right corner instead of fighting the search
   box for the same row, and capping the search box's own width to the
   container's actual width so it can never overflow a narrow panel on its
   own either. */
#map-wrap #search-box { position: absolute; top: 10px; left: 10px; z-index: 2; width: min(280px, calc(100% - 20px)); }
#map-wrap #search-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border: none; border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3); font-size: 13px; font-family: inherit;
}
#map-wrap #search-results {
  background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3);
  margin-top: 4px; max-height: 280px; overflow-y: auto; display: none;
}
#map-wrap #search-results .result { padding: 8px 12px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 12.5px; }
#map-wrap #search-results .result:hover { background: #f4f6f8; }
#map-wrap #search-results .result .addr { font-weight: 500; }
#map-wrap #search-results .result .meta { color: #666; font-size: 11.5px; }

#map-extra-tools {
  position: absolute; bottom: 16px; right: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap;
  justify-content: flex-end; max-width: calc(100% - 20px);
}
#map-extra-tools button {
  background: #fff; border: none; border-radius: 6px; padding: 7px 10px; font-size: 12px; font-weight: 600;
  color: #333; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; font-family: inherit; white-space: nowrap;
}
#map-extra-tools button:hover { background: #f4f6f8; }
#map-extra-tools button.active { background: var(--brand); color: #fff; }

#area-draw-hint {
  display: none; position: absolute; top: 52px; right: 10px; z-index: 2; background: #16202c; color: #fff;
  padding: 8px 12px; border-radius: 6px; font-size: 12px; max-width: 200px; text-align: right;
}
#area-stats-panel {
  display: none; position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: #fff; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.25); padding: 14px 18px;
  min-width: 240px; max-width: 90%; font-size: 13px;
}
#area-stats-panel h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #8a94a3; }
#area-stats-close { position: absolute; top: 8px; right: 10px; background: none; border: none; font-size: 18px; cursor: pointer; color: #8a94a3; }
.area-stat-row { padding: 3px 0; color: #333; }
.area-stats-loading, .area-stats-empty { color: #8a94a3; font-style: italic; }

/* Fullscreen mode: the whole map panel lifts out of the flex layout and
   covers the viewport - toggled by map-tools.js, which also calls
   map.resize() so MapLibre's canvas actually fills the new size. */
#map-wrap.is-fullscreen {
  position: fixed; inset: 0; z-index: 60; border-radius: 0; border: none; box-shadow: none;
}
