/* Faro — mobile-first, no framework. Kept small for the 3G / <500KB budget. */

:root {
  --banner-bg: #b00020;
  --banner-fg: #ffffff;
  --fg: #1a1a1a;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  /* Explicit, not inherited. The UI is built around a light basemap, so without this the
     browser's dark-mode canvas shows through anywhere we haven't painted — which made the
     boot-failure screen dark-grey-on-black: unreadable, on the one screen whose whole job
     is to show the emergency number when everything else has failed. */
  background: #ffffff;
}

/* Permanent disclaimer banner — always visible, above the map. */
.banner {
  background: var(--banner-bg);
  color: var(--banner-fg);
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.3;
  text-align: center;
  z-index: 1000;
}

/* Plain-language privacy note, just under the banner. Muted, always visible. */
.privacy {
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: #f4f4f4;
  color: #555;
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  border-bottom: 1px solid #e2e2e2;
}

/* Map fills the rest of the viewport. min-height:0 lets it shrink inside the flex column. */
.map {
  flex: 1 1 auto;
  min-height: 0;
}

.hidden { display: none !important; }

/* Floating "report a problem" button. */
.fab {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 1000;
  background: #1565c0;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.8rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

/* Bottom-sheet panel for the report steps. */
.panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  background: #fff;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.25);
  max-height: 75vh;
  overflow-y: auto;
}

.panel-body { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }

.panel-title { margin: 0 0 0.75rem; font-size: 1.1rem; }
.panel-title.danger { color: var(--banner-bg); }

.prompt { margin: 0 0 1rem; font-size: 0.98rem; line-height: 1.4; }

.row { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.btn {
  flex: 1 1 auto;
  min-width: 8rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #f4f4f4;
  color: var(--fg);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: #1565c0; color: #fff; border-color: #1565c0; }
.btn-danger { background: var(--banner-bg); color: #fff; border-color: var(--banner-bg); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Category chooser grid. */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.cat {
  padding: 0.85rem 0.6rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.desc-label { display: block; margin-bottom: 0.4rem; font-size: 0.95rem; }
.desc {
  width: 100%;
  padding: 0.6rem;
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 1rem;
  resize: vertical;
}

/* Toast notifications. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 5rem;
  transform: translateX(-50%);
  z-index: 1002;
  max-width: 90vw;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.toast-ok { background: #2e7d32; }
.toast-error { background: var(--banner-bg); }

/* Shown when the app cannot boot (old browser, offline, bad config). Removed by app.js on
   success, so it must look deliberate rather than like a broken page. */
.boot-fallback {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 1.5rem;
  text-align: center;
  /* Both colours pinned: this must stay legible regardless of the device's colour scheme. */
  background: #ffffff;
  color: #1a1a1a;
  font-size: 0.95rem;
  line-height: 1.5;
}
.boot-fallback p { margin: 0 0 0.6rem; }
.boot-fallback-title { font-size: 1.1rem; font-weight: 600; }
.boot-fallback-hint { font-size: 0.85rem; color: #666; }
.boot-fallback a { color: var(--banner-bg); }

/* Official announcements bar, between the privacy note and the map. */
.announcement-bar {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: #1f3a5f;
  color: #fff;
  border: none;
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  z-index: 900;
}

.announcement-public { border: none; background: #f2f5f9; }

/* Map pin for an anchored announcement — distinct from citizen report dots. */
.announcement-pin {
  display: grid;
  place-items: center;
  font-size: 18px;
  background: #fff;
  border: 2px solid #1f3a5f;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---- Officials console (official.html only) ---- */
.official-page { background: #fafafa; }
.banner-official { background: #1f3a5f; }

.console {
  flex: 1 1 auto;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  overflow-y: auto;
}

.console-head { margin-bottom: 1rem; }
.composer { margin-bottom: 1.5rem; }
.composer .desc { margin-bottom: 0.6rem; }

.anchor-label {
  display: block;
  margin: 0.2rem 0 0.6rem;
  font-size: 0.9rem;
}

.picker-map {
  height: 220px;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 0.4rem;
}

.error-text { margin: 0.5rem 0 0; font-size: 0.85rem; color: var(--banner-bg); }

/* Sign-in failures must not look like a dead button — give them real presence. */
.error-box {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--banner-bg);
  border-left-width: 4px;
  border-radius: 6px;
  background: #fdf2f4;
  color: #7a0016;
  font-size: 0.88rem;
  line-height: 1.4;
}

.announcement {
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
}
.announcement.is-expired { opacity: 0.55; }
.announcement-title { margin: 0 0 0.3rem; font-size: 1rem; }
.announcement-body { margin: 0 0 0.4rem; font-size: 0.92rem; line-height: 1.4; }

/* ---- Report detail sheet ---- */
.detail-head { margin-bottom: 0.5rem; }
.detail-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: -0.4rem;
}
.detail-time { font-size: 0.8rem; color: #666; }
.detail-desc { margin: 0.5rem 0 1rem; font-size: 0.95rem; line-height: 1.4; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active { background: #e3f0fc; color: #10457f; }
.badge-disputed { background: #eee; color: #666; }
.badge-resolved { background: #e6f4e7; color: #1f5c23; }
.badge-stale { background: #fdf0d5; color: #8a5a00; }
.badge-flagged { background: #f3e8fd; color: #5b2a86; }

.vote-btn { font-size: 0.95rem; }
.hint { margin: 0.5rem 0 0; font-size: 0.82rem; color: #666; }

.section-title { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; }
.comment-list { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.comment {
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  background: #f6f6f6;
  border-radius: 8px;
}
.comment-body { margin: 0 0 0.2rem; font-size: 0.9rem; line-height: 1.35; word-break: break-word; }
.comment-time { font-size: 0.75rem; color: #777; }
