/* ---- Core page & card styling – same as before ------------------------ */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: sans-serif;
  background-color: #f8f9fa;
}

/* ---- Map container ---------------------------------------------------- */
#map {
  width: 100%;
  height: 100%;
  border: 1px solid #ccc;
  border-radius: 8px;
}

/* ---- Hover-info & legend --------------------------------------------- */
#hover-info,
#legend {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  z-index: 1000;
}

#hover-info {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 12px;
  font-size: 14px;
  pointer-events: none;
  display: none;
  transition: opacity 0.2s;
}

#legend {
  position: absolute;
  bottom: 30px;
  right: 2px;
  padding: 5px;
  font-size: 10px;
}

#legend .item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  transition: background-color 0.2s;
}

#legend .item:hover {
  background-color: #f1f1f1;
  cursor: default;
  border-radius: 4px;
}

#legend .swatch {
  width: 20px;
  height: 16px;
  border: 1px solid #999;
}

/* ---- Chart canvas: FIXED, STABLE SIZE -------------------------------- */
#chart {
  width: 100% !important;      /* stretch to card width */
  height: 40vh !important;     /* consistent height (≈40% of viewport) */
  max-height: 400px;           /* never grow taller than 400 px */
}

/* ---- Responsive tweaks ------------------------------------------------ */
@media (max-width: 768px) {
  #hover-info, #legend { font-size: 11px; padding: 6px; }
  #legend .swatch { width: 16px; height: 14px; }
  #map   { height: 50vh; }
  #chart { height: 30vh !important; }
}

#basemap-control {
  top: 80px !important; /* below zoom */
  left: 1.0em;
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  padding: 3px;
  border-radius: 3px;
  z-index: 1000;
  width: 5px;
}
