/**
 * index.css
 * Styles specific to the overview map page (index.html).
 */

/* ── Prevent body scroll (full-screen map) ──────────────────── */
body {
  overflow: hidden;
}

/* ── Stats banner (top-center) ──────────────────────────────── */
#stats {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.75);
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  text-align: center;
}

/* ── Loading overlay ────────────────────────────────────────── */
.loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  text-align: center;
}

/* ── Chart panel (bottom-right) ─────────────────────────────── */
.chart-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.65);
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.scatter-plot-container {
  width: 300px;
  height: 300px;
  position: relative;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.75);
}

/* ── Legend (top-right) ─────────────────────────────────────── */
.legend {
  position: fixed;
  top: 20px;
  right: 20px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  z-index: 1000;
}

.legend h4 {
  margin: 3px 0 7px;
}

.legend-item {
  padding: 2px 4px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.legend-item:hover,
.legend-item:focus-visible {
  background-color: rgba(0, 0, 0, 0.05);
  outline: none;
}

.legend-color {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ── Leaflet popup overrides ────────────────────────────────── */
.leaflet-popup-content {
  width: 400px !important;
  max-height: 600px;
  overflow-y: auto;
}

.popup-chart-container {
  width: 100%;
  height: 200px;
  margin-top: 10px;
  position: relative;
}

.popup-stats-list {
  padding-left: 20px;
  margin: 5px 0;
}

/* ── "View Detailed Analysis" button ────────────────────────── */
a.view-details-btn {
  display: inline-block;
  padding: 8px 16px;
  background-color: #4CAF50;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

a.view-details-btn:hover,
a.view-details-btn:focus-visible {
  background-color: #45a049;
  color: #fff;
}

/* ── City search (top-left) ──────────────────────────────────── */
.city-search {
  position: fixed;
  top: 20px;
  left: 60px;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 6px;
  width: 320px;
}

#city-search-input {
  width: 280px;
  padding: 8px 12px;
  font-size: 14px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  outline: none;
}

#city-search-input:focus {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.city-search-reset {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #555;
}

.city-search-reset:hover,
.city-search-reset:focus-visible {
  background: rgba(255, 255, 255, 1);
  color: #000;
}

.city-search-results {
  flex-basis: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  display: none;
}

.city-search-results.visible {
  display: block;
}

.city-search-results li {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.city-search-results li.active,
.city-search-results li:hover {
  background-color: #e8f0fe;
}

.city-search-results li .search-match {
  font-weight: bold;
}

/* Add to index.css */
.legend-item.selected {
  background-color: rgba(0, 0, 0, 0.15);
  font-weight: bold;
  outline: 1px solid rgba(0, 0, 0, 0.3);
}