/* Curacao Smoke Map - mobile-first styles */

:root {
  --brand: #0e7490;
  --brand-dark: #155e75;
  --fire: #dc2626;
  --smoke: #f97316;
  --odor: #6b7280;
  --dump: #16a34a;
  --bg: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --header-h: 58px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; }
a { color: var(--brand); }

/* Map page is locked to the viewport: panning the map must never
   scroll or rubber-band the page itself. */
body.page-map {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------------- header ---------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1100;
  min-height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); min-width: 0; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand strong { font-size: 0.95rem; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Compact single-row header on phones */
@media (max-width: 620px) {
  :root { --header-h: 50px; }
  .site-header { padding: 5px 8px; }
  .site-nav { flex-wrap: nowrap; }
  .nav-home { display: none; }           /* logo already links to the map */
  .brand img { width: 24px; height: 24px; }
  .brand strong { font-size: 0.85rem; }
  .brand small { font-size: 0.6rem; }
  .site-nav .btn-report { padding: 7px 10px; min-height: 38px; font-size: 0.82rem; white-space: nowrap; }
  .lang-btn { padding: 7px 8px; min-height: 38px; font-size: 0.78rem; }
}
@media (max-width: 360px) {
  .brand small { display: none; }        /* tagline goes first on tiny screens */
}
.nav-link { padding: 8px 10px; text-decoration: none; color: var(--text); border-radius: var(--radius); font-size: 0.9rem; }
.nav-link:hover { background: var(--bg); }

/* language switcher */
.lang-switcher { position: relative; }
.lang-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 40px;
}
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
  min-width: 150px;
  overflow: hidden;
  z-index: 1200;
}
.lang-menu a { padding: 10px 14px; text-decoration: none; color: var(--text); }
.lang-menu a:hover, .lang-menu a.active { background: var(--bg); }
/* The class sets display:flex, so the [hidden] attribute needs a more
   specific rule to actually hide the menu. */
.lang-menu[hidden] { display: none; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-report { background: var(--fire); color: #fff; }
.btn-danger { background: var(--fire); color: #fff; }
.btn-verify { background: var(--dump); color: #fff; }
.btn-lg { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: 0.8rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-whatsapp { background: #25d366; color: #fff; width: 100%; margin: 16px 0; }
.btn-validate { background: #fff; border-color: var(--border); color: var(--text); flex: 1; flex-direction: column; gap: 2px; }
.btn-validate .count { font-size: 1.1rem; color: var(--brand); }
.btn-validate.voted { border-color: var(--brand); background: #ecfeff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------------- layout helpers ---------------- */
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }
.container-wide { max-width: 1100px; }
.container-narrow { max-width: 460px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.two-col { display: grid; gap: 16px; }
@media (min-width: 800px) { .two-col { grid-template-columns: 1fr 1fr; } }

.site-footer {
  text-align: center;
  padding: 14px;
  background: #fff;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }

/* ---------------- map page ---------------- */
.page-map main { display: flex; flex-direction: column; position: relative; flex: 1; min-height: 0; }
/* Map fills the space left between header and footer, so the footer
   (with its nav links) is always visible regardless of footer height. */
#map { flex: 1 1 auto; min-height: 0; width: 100%; z-index: 1; }
.map-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.control-group { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  min-height: 38px;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip-select {
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 7px 12px;
  font-size: 0.82rem;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.big { width: 18px; height: 18px; }

/* custom markers */
.csm-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
}
.csm-marker span { transform: rotate(45deg); }
.csm-marker.sev-high { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 0 rgba(220,38,38,.5); }
  50% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 12px rgba(220,38,38,0); }
}
.popup-incident h3 { margin: 0 0 4px; font-size: 1rem; }
.popup-incident .badges { margin-bottom: 6px; }

/* ---------------- forms ---------------- */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; padding: 14px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  min-height: 44px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}
.type-option:has(input:checked) { border-color: var(--type-color); background: color-mix(in srgb, var(--type-color) 8%, #fff); }
.type-option input { position: absolute; opacity: 0; }

.seg { display: flex; gap: 6px; }
.seg-item { flex: 1; margin: 0; }
.seg-item input { position: absolute; opacity: 0; }
.seg-item span {
  display: block;
  text-align: center;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
}
.seg-item input:checked + .sev-low { border-color: var(--dump); background: #f0fdf4; }
.seg-item input:checked + .sev-medium { border-color: var(--smoke); background: #fff7ed; }
.seg-item input:checked + .sev-high { border-color: var(--fire); background: #fef2f2; }

#pick-map { height: 300px; border-radius: var(--radius); margin: 10px 0; z-index: 1; }
#mini-map { height: 220px; border-radius: var(--radius); margin: 12px 0; z-index: 1; }

.photo-previews { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.photo-previews img { width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }

.form-error { color: var(--fire); font-weight: 600; }
.success-inline { color: var(--dump); font-weight: 600; }
.success-panel { text-align: center; padding: 24px 0; }

/* ---------------- incident page ---------------- */
.incident-head h1 { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; margin-bottom: 6px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-sev-high { background: #fef2f2; border-color: var(--fire); color: var(--fire); }
.badge-sev-medium { background: #fff7ed; border-color: var(--smoke); color: #c2580c; }
.badge-sev-low { background: #f0fdf4; border-color: var(--dump); color: var(--dump); }
.badge-warn { background: #fefce8; border-color: #ca8a04; color: #854d0e; }
.badge-st-verified { background: #f0fdf4; border-color: var(--dump); color: var(--dump); }
.badge-st-rejected { background: #fef2f2; border-color: var(--fire); color: var(--fire); }
.badge-st-new { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }

.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 12px 0; }
.meta-grid dt { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.meta-grid dd { margin: 0; font-size: 0.9rem; word-break: break-word; }

.validate-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.validate-box h2 { margin: 0 0 10px; font-size: 1rem; }
.validate-buttons { display: flex; gap: 8px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius); display: block; }

.report-list { list-style: none; padding: 0; margin: 0; }
.report-list li { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.report-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-line time { color: var(--muted); font-size: 0.82rem; margin-left: auto; }

/* ---------------- admin ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.stat strong { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: 0.82rem; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filter-bar > input[type=search] { flex: 2; min-width: 200px; }
.filter-bar > select { flex: 1; min-width: 130px; width: auto; }
.filter-bar label { margin: 0; font-size: 0.8rem; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.table td.num { text-align: right; }

.pagination { display: flex; gap: 4px; margin: 16px 0; flex-wrap: wrap; }
.pagination a, .pagination .current {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  background: #fff;
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

.bar-chart { display: flex; align-items: flex-end; gap: 2px; height: 130px; }
.bar-chart .bar { flex: 1; min-height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }

.checkbox-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 16px 0; }
.checkbox-row input { width: 20px; height: 20px; min-height: 0; }

.photo-cell { display: flex; flex-direction: column; gap: 6px; }

/* ---------------- hotspots ---------------- */
.hotspot-list { list-style: none; padding: 0; margin: 0; }
.hotspot-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.hotspot-item.hot { border-color: var(--fire); background: #fef2f2; }
.hotspot-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-wrap: wrap; }
.hotspot-area { font-weight: 700; }
.hotspot-count { color: var(--brand); font-weight: 700; white-space: nowrap; }
.hotspot-types { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------------- footer nav ---------------- */
.footer-nav { display: flex; justify-content: center; gap: 18px; margin-bottom: 6px; }
.footer-nav a { color: var(--text); text-decoration: none; font-weight: 600; padding: 6px 4px; }
.footer-nav a:hover { color: var(--brand); }

/* On the map page the footer collapses to a single compact row so the
   map gets the maximum height. */
.page-map .site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 8px;
}
.page-map .footer-nav { margin: 0; gap: 14px; }
.page-map .footer-nav a { padding: 8px 2px; }
