/* Fire Zones Review Map — styles */

:root {
  --header-h: 56px;
  --brand: #b23a1e;       /* fire / clay red */
  --brand-dark: #7d2814;
  --ink: #1d2733;
  --panel-bg: #ffffff;
}

* { box-sizing: border-box; }

/*
 * Make the HTML `hidden` attribute authoritative. Author `display` rules
 * (e.g. .login-overlay/#app use display:flex) otherwise override the UA
 * stylesheet's `[hidden] { display: none }`, so toggling el.hidden would
 * not actually hide the element. !important guarantees hidden wins.
 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
}

/* ---- App shell ---- */
#app { height: 100%; display: flex; flex-direction: column; }

#header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

#app-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-actions { display: flex; align-items: center; gap: 8px; }

#about-btn,
#logout-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
#about-btn:hover,
#logout-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* ---- About / Methodology panel ---- */
.about-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.4);
}

.about-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1200;
  width: min(460px, 92vw);
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.about-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  line-height: 1;
  font-size: 1.5rem;
  color: #555;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.about-close:hover { background: rgba(0, 0, 0, 0.08); color: #000; }

.about-content {
  padding: 22px 26px 40px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink);
}
.about-content h2 {
  margin: 0 0 14px;
  padding-right: 28px;
  font-size: 1.2rem;
  color: var(--brand-dark);
}
.about-content h3 {
  margin: 20px 0 6px;
  font-size: 0.95rem;
  color: var(--brand);
  border-bottom: 1px solid #eee;
  padding-bottom: 3px;
}
.about-content p { margin: 6px 0; }
.about-content ul,
.about-content ol { margin: 6px 0; padding-left: 22px; }
.about-content li { margin: 5px 0; }
.about-content code {
  font-size: 0.85em;
  background: #f2f2f2;
  padding: 1px 4px;
  border-radius: 3px;
}

#map { flex: 1 1 auto; width: 100%; }

/* Small status / message line pinned bottom-left over the map. */
.status {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 900;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #444;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  max-width: 60vw;
}
.status:empty { display: none; }
.status.error { color: #a11; }

/* ---- Login overlay ---- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-dark), #2a2118);
  padding: 16px;
}

.login-box {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 28px 26px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-box h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--brand-dark);
}

.login-hint { margin: 0; font-size: 0.85rem; color: #666; }

.login-box input {
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.login-box input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(178, 58, 30, 0.15);
}

.login-box button {
  padding: 10px 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.login-box button:hover { background: var(--brand-dark); }

.login-error { margin: 0; color: #c0392b; font-size: 0.85rem; }

/* ---- Popups ---- */
.feature-popup { font-size: 0.85rem; line-height: 1.4; max-height: 260px; overflow: auto; }
.feature-popup .popup-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--brand-dark);
}
.feature-popup table { border-collapse: collapse; }
.feature-popup th,
.feature-popup td {
  text-align: left;
  vertical-align: top;
  padding: 2px 8px 2px 0;
}
.feature-popup th { color: #555; font-weight: 600; white-space: nowrap; }
.feature-popup td { word-break: break-word; }

/* Leaflet layer-control sizing for longer layer lists. */
.leaflet-control-layers { max-height: 70vh; overflow: auto; }

/* ---- Legend (categorical / unique-value colours) ---- */
.map-legend {
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  line-height: 1.4;
  color: #333;
}
.map-legend .legend-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--brand-dark);
}
.map-legend .legend-row { display: flex; align-items: center; gap: 6px; }

/* Fire-station divIcon: strip Leaflet's default white box, add a soft shadow. */
.fire-station-marker {
  background: transparent;
  border: none;
}
.fire-station-marker svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.map-legend .legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  flex: 0 0 auto;
}
