/*
  DESIGN NOTES FOR NON-PROGRAMMERS
  =================================
  This app is dark-themed on purpose: it's meant to be used outdoors,
  often at dusk, in rain, on a phone screen. A dark background with light
  text is easier on the eyes and easier to read in low light or glare
  than a bright white page.

  Exactly three colours are used to mean something specific, and nothing
  else in the app uses colour:
    --colour-rain   : rainfall information (the alert banner, rain numbers)
    --colour-hazard : anything about flood risk (zone outlines, warnings)
    --colour-clear  : a route confirmed clear of known flood zones
  If you want to change the "look", change these three values — every
  place that means "this is rain info" or "this is a hazard" pulls from
  the same variable, so the meaning stays consistent everywhere.
*/

:root {
  --bg: #0b1220;
  --panel-bg: #141d2e;
  --text: #e6e9ef;
  --text-dim: #9aa5b8;
  --border: #263248;

  --colour-rain: #4da6ff;
  --colour-hazard: #ff6b4a;
  --colour-clear: #34d399;
}

/* This rule matters more than it looks like it should.
   The HTML "hidden" attribute is only a weak default style (display:none)
   supplied by the browser. If ANY other CSS rule on the page sets
   "display" on that same element (even something generic like
   ".panel { display: flex; }"), that rule wins and the "hidden" element
   shows up anyway — including on first page load, before anything has
   happened. Marking it !important here means "hidden" always wins. */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser address bars */
  overflow: hidden;
}

/* The map fills the whole screen — it is the product, not a background
   decoration behind some panel. */
#map {
  position: absolute;
  inset: 0;
  background: #1a2436; /* shown briefly before map tiles arrive */
}

/* Top bar: app name + connection/status hint. Stays out of the map's way. */
#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(to bottom, rgba(11,18,32,0.9), rgba(11,18,32,0));
  pointer-events: none;
}

#top-bar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  pointer-events: auto;
}

/* Wrapper for the stacked banners under the top bar (rain alert, then
   the flood-data honesty notice). Positioning lives here once, instead
   of on each banner, so adding a third banner later is a one-line change. */
#top-panels {
  position: absolute;
  top: 48px;
  left: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-banner {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
}

/* The rainfall banner additionally has an icon next to its text, and a
   left accent stripe in the "rain" colour — the ONLY colour this banner
   ever uses, no matter which of the three alert states is showing. */
#rain-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid var(--colour-rain);
}

.icon-rain {
  color: var(--colour-rain);
  flex-shrink: 0;
  margin-top: 1px;
}

#rain-state-label {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.detail-text {
  color: var(--text-dim);
  font-size: 12px;
}

/* Message shown if MapLibre fails, or WebGL isn't available, or the map
   simply takes too long to draw. The zone LIST still works even here —
   that's the whole point of not coupling zone-loading to map-loading. */
#map-fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}

#map-fallback p {
  max-width: 320px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

/* Simple zone list panel for Stage 1. This will be folded into the
   draggable bottom sheet in a later stage, but for now it proves the
   "load zones independently of the map" rule and gives something real
   to look at immediately. */
#zone-list-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  padding: 12px 16px 20px;
}

#zone-list-panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 0 0 4px;
}

#zone-list-panel .guess-warning {
  font-size: 12px;
  color: var(--colour-hazard);
  margin: 0 0 10px;
  line-height: 1.4;
}

#zone-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 10px;
}

#zone-list li {
  font-size: 13px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Small dot icon marking a zone as an unverified guess — drawn as SVG
   inline in the HTML/JS, single stroke weight, no emoji. */
.zone-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--colour-hazard);
  flex-shrink: 0;
}

#status-line {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 10;
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}
