html, body, #map {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

#controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  max-width: 300px;
  font-size: 13px;
}

/* Logo + EN/FR share one row above the title row (2026-08-11) -- the logo
   previously lived inside #controls h1 in its own stacked row, sized for
   that standalone treatment (80px); moved back into a row alongside the
   small lang-toggle buttons, so it's sized to match that context instead. */
.controls-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.controls-top-row .lang-toggle {
  margin-bottom: 0; /* spacing below the row is controls-top-row's job now */
}

#site-logo {
  height: 24px;
  width: auto;
}

#controls h1 {
  font-size: 14px;
  color: #08306b;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-guide-link {
  margin-left: auto;
  font-size: 11px;
  color: #08306b;
  text-decoration: none;
}

.user-guide-link:hover {
  text-decoration: underline;
}

/* #map-legends sets its own `display: flex`, which as an author-stylesheet
   rule beats the `[hidden]` attribute's UA-stylesheet `display: none`
   regardless of selector specificity -- `!important` here beats that
   unconditionally, for every current and future `[hidden]` element (e.g.
   #download-report-btn), rather than patching each conflicting selector
   one at a time as they come up. */
[hidden] {
  display: none !important;
}

/* EN/FR switcher (see frontend/i18n.js's setLang) -- reused as-is in
   #controls, just right-aligned there via flex instead of this box's
   default block flow. `aria-current` (set by i18n.js's
   applyStaticTranslations) marks the active language instead of a
   separate JS-toggled class. */
.lang-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 8px;
}

.lang-btn {
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f7f7f7;
  color: #555;
}

.lang-btn[aria-current="true"] {
  background: #08306b;
  color: #fff;
  border-color: #08306b;
  cursor: default;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.layer-row label {
  flex: 1;
}

/* Source/cadence/freshness moved into the label's native `title` tooltip
   (see app.js's buildLayerRow) instead of a permanently-visible line --
   the dotted underline on just the label text (not the whole flex-grown
   label) is the only hint that there's more info on hover, since a title
   tooltip is otherwise not visually discoverable. */
.layer-label-text {
  cursor: help;
  border-bottom: 1px dotted #888;
}

#map-legends {
  position: absolute;
  /* bottom-right, not top-right: NavigationControl + the draw/trash controls
     both default to top-right and stack there, leaving no clean space. */
  bottom: 55px; /* clears the #credits bar */
  right: 10px;
  z-index: 1;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 210px;
}

.map-legend-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 8px 10px 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  font-size: 11px;
}

.map-legend-title {
  font-weight: 600;
  margin-bottom: 2px;
  color: #222;
}

.map-legend-bar {
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  margin-top: 4px;
}

.map-legend-ticks {
  position: relative;
  height: 16px;
  margin-top: 2px;
}

.map-legend-tick {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 9px;
  color: #333;
  white-space: nowrap;
  transform-origin: top left;
  transform: rotate(45deg) translateX(2px);
}

.map-legend-units {
  font-size: 11px;
  color: #555;
}

.map-legend-tick-plain {
  transform: none;
  font-size: 10px;
}

#groundwater-section {
  margin: 10px 0;
  padding-top: 8px;
  border-top: 1px solid #ddd;
}

#groundwater-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

#groundwater-country-select {
  width: 100%;
  font-size: 13px;
  padding: 3px;
}

#groundwater-status {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
}

#draw-btn {
  margin-top: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

#stats-panel {
  margin-top: 10px;
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid #ddd;
  padding-top: 8px;
}

#stats-panel table {
  width: 100%;
  border-collapse: collapse;
}

#stats-panel td {
  padding: 2px 4px;
  vertical-align: top;
}

#download-report-btn {
  margin-top: 8px;
  padding: 6px 10px;
  cursor: pointer;
  width: 100%;
}

#credits {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  background: rgba(255, 255, 255, 0.95);
  font-size: 11px;
  padding: 6px 10px;
  line-height: 1.5;
}

#credits .disclaimer {
  font-style: italic;
}

#credits .copyright {
  color: #666;
}
