/* ============================================================
   Guwahati Flood Watch — mobile-first stylesheet
   ============================================================ */

:root {
  --blue-900: #0b3c5d;
  --blue-800: #12557e;
  --blue-700: #1769aa;
  --blue-600: #1f7fce;
  --blue-100: #e3f1fb;
  --blue-50:  #f2f9fe;
  --ink: #16232e;
  --ink-soft: #4c5f70;
  --line: #dbe6ef;
  --bg: #f5f9fc;
  --card: #ffffff;
  --danger: #d92d20;
  --low: #16a34a;
  --moderate: #eab308;
  --high: #f97316;
  --critical: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(11, 60, 93, .10), 0 6px 18px rgba(11, 60, 93, .07);
  --tap: 48px; /* min touch target */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; display: block; }
a { color: var(--blue-700); }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header / hamburger nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--blue-900);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: .2px;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--blue-600), #38bdf8);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-size: .62rem; font-weight: 500; opacity: .75; letter-spacing: .6px; text-transform: uppercase; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
}

.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  content: "";
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: relative;
  transition: transform .18s ease, opacity .18s ease;
}
.nav-toggle .bars::before { position: absolute; top: -6px; }
.nav-toggle .bars::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--blue-900);
  border-top: 1px solid rgba(255, 255, 255, .12);
  display: none;
  flex-direction: column;
  padding: 8px 16px 16px;
  box-shadow: 0 12px 20px rgba(0, 0, 0, .22);
}

.site-nav.open { display: flex; }

.site-nav a {
  color: #eaf4fb;
  text-decoration: none;
  padding: 13px 10px;
  border-radius: 9px;
  font-weight: 600;
  font-size: .98rem;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}

.site-nav a:hover, .site-nav a:focus { background: rgba(255, 255, 255, .10); }
.site-nav a.active { background: var(--blue-700); color: #fff; }
.site-nav .nav-report {
  background: var(--critical);
  color: #fff;
  justify-content: center;
  margin-top: 8px;
}
.site-nav .nav-report:hover { background: #b91c1c; }

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .site-nav a { padding: 8px 13px; min-height: 40px; font-size: .92rem; }
  .site-nav .nav-report { margin-top: 0; padding: 9px 16px; }
}

/* ---------- Hero ---------- */

.hero {
  background:
    radial-gradient(1000px 320px at 85% -40%, rgba(56, 189, 248, .35), transparent 60%),
    linear-gradient(165deg, var(--blue-900) 0%, var(--blue-800) 55%, var(--blue-700) 100%);
  color: #fff;
  padding: 30px 0 34px;
}

.hero h1 { margin: 0 0 8px; font-size: 1.65rem; line-height: 1.25; }
.hero p { margin: 0 0 20px; color: #d7ecfa; font-size: .98rem; max-width: 56ch; }

.hero-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }

.btn-report {
  background: var(--critical);
  color: #fff;
  font-size: 1.12rem;
  min-height: 56px;
  box-shadow: 0 8px 20px rgba(220, 38, 38, .35);
}
.btn-report:hover { background: #b91c1c; }

.btn-secondary {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-color: rgba(255, 255, 255, .45);
}
.btn-secondary:hover { background: rgba(255, 255, 255, .2); }

.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-800); }

.btn-outline {
  background: var(--card);
  color: var(--blue-800);
  border-color: var(--line);
}
.btn-outline:hover { background: var(--blue-50); }

.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: .88rem; border-radius: 9px; }

@media (min-width: 620px) {
  .hero-actions { flex-direction: row; }
  .hero-actions .btn { width: auto; }
}

/* ---------- Stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--ink-soft);
  font-weight: 700;
}

.stat-card .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--blue-900);
  line-height: 1.15;
  margin-top: 2px;
}

.stat-card .stat-sub { font-size: .8rem; color: var(--ink-soft); }
.stat-card.is-critical .stat-value { color: var(--critical); }
.stat-card.is-high .stat-value { color: var(--high); }

@media (min-width: 720px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Sections / cards ---------- */

.section { padding: 22px 0; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1.12rem;
  color: var(--blue-900);
}

.section-title a { font-size: .85rem; font-weight: 600; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.notice {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  color: var(--blue-900);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: .9rem;
}

/* ---------- Severity badges ---------- */

.sev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
}

.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sev-low      { color: #15803d; background: #dcfce7; }
.sev-moderate { color: #a16207; background: #fef9c3; }
.sev-high     { color: #c2410c; background: #ffedd5; }
.sev-critical { color: #b91c1c; background: #fee2e2; }

/* ---------- Report cards ---------- */

.report-list { display: grid; gap: 12px; }

.report-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}

.report-card:hover { border-color: var(--blue-600); }
.report-card.sev-low      { border-left-color: var(--low); }
.report-card.sev-moderate { border-left-color: var(--moderate); }
.report-card.sev-high     { border-left-color: var(--high); }
.report-card.sev-critical { border-left-color: var(--critical); }

.report-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--blue-100);
  display: grid;
  place-items: center;
  font-size: 1.6rem;
}

.report-thumb.placeholder { color: var(--blue-700); }

.report-body { min-width: 0; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.report-area { font-weight: 800; color: var(--blue-900); font-size: 1rem; }
.report-meta { font-size: .78rem; color: var(--ink-soft); margin-top: 1px; }
.report-desc {
  margin: 6px 0 0;
  font-size: .9rem;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-foot { margin-top: 7px; display: flex; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-soft); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 28px 16px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  font-size: .92rem;
}

/* ---------- Search / filters ---------- */

.search-bar { position: relative; }

.search-bar input {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card);
  color: var(--ink);
}

.search-bar input:focus { outline: 2px solid var(--blue-600); border-color: var(--blue-600); }

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.chip {
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
}

.chip:hover { border-color: var(--blue-600); color: var(--blue-700); }
.chip.active { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.chip.chip-low.active      { background: var(--low); border-color: var(--low); }
.chip.chip-moderate.active { background: var(--moderate); border-color: var(--moderate); color: #422006; }
.chip.chip-high.active     { background: var(--high); border-color: var(--high); }
.chip.chip-critical.active { background: var(--critical); border-color: var(--critical); }


/* ---------- Forms ---------- */

.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
}

.field { margin-bottom: 18px; }

.field label, .field .field-label {
  display: block;
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 7px;
  color: var(--ink);
}

.field .hint { font-size: .8rem; color: var(--ink-soft); margin-top: 5px; }

.field input[type="text"],
.field input[type="datetime-local"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 1.02rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

.field textarea { min-height: 104px; resize: vertical; }

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(31, 127, 206, .18);
}

.field .error-msg { color: var(--danger); font-size: .82rem; font-weight: 600; margin-top: 5px; display: none; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field.invalid .error-msg { display: block; }

/* severity radio buttons as big touch targets */
.severity-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.severity-option { position: relative; }
.severity-option input { position: absolute; opacity: 0; pointer-events: none; }

.severity-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font-weight: 800;
  font-size: .92rem;
  cursor: pointer;
  background: #fff;
  user-select: none;
}

.severity-option input:checked + span { color: #fff; border-color: transparent; }
.severity-option.low input:checked + span      { background: var(--low); }
.severity-option.moderate input:checked + span { background: var(--moderate); color: #422006; }
.severity-option.high input:checked + span     { background: var(--high); }
.severity-option.critical input:checked + span { background: var(--critical); }
.severity-option input:focus-visible + span { outline: 3px solid #7dd3fc; outline-offset: 2px; }

@media (min-width: 560px) {
  .severity-group { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* location block */
.loc-actions { display: grid; gap: 9px; grid-template-columns: 1fr; }

@media (min-width: 560px) {
  .loc-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.loc-status {
  margin-top: 10px;
  font-size: .88rem;
  background: var(--blue-50);
  border: 1px dashed var(--blue-600);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--blue-900);
  display: none;
}
.loc-status.show { display: block; }
.loc-status strong { font-weight: 800; }

#locationMap {
  height: 240px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 10px;
  display: none;
  z-index: 1;
}
#locationMap.show { display: block; }

/* photo upload */
.photo-input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 13px;
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--blue-800);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
}

.photo-preview { margin-top: 10px; position: relative; display: none; }
.photo-preview.show { display: block; }
.photo-preview img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; }

.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9px;
  border: 0;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.form-actions { display: grid; gap: 10px; margin-top: 4px; }

/* success panel */
.success-panel { display: none; text-align: center; padding: 30px 18px; }
.success-panel.show { display: block; }
.success-panel .big { font-size: 3rem; }
.success-panel h2 { margin: 8px 0 6px; color: var(--blue-900); }
.success-panel p { color: var(--ink-soft); margin: 0 0 18px; }
.success-panel .btn { margin-bottom: 10px; }


/* ---------- Map page ---------- */

.map-toolbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

#floodMap {
  height: calc(100vh - 330px);
  min-height: 340px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 1;
}

.map-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: .8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.map-layout { display: grid; gap: 14px; }

@media (min-width: 900px) {
  .map-layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
  #floodMap { height: calc(100vh - 240px); }
  .map-side { max-height: calc(100vh - 200px); overflow-y: auto; }
}

/* Leaflet popup tuning */
.leaflet-popup-content { margin: 12px 14px; min-width: 210px; }
.popup-area { font-weight: 800; color: var(--blue-900); font-size: 1rem; margin-bottom: 3px; }
.popup-row { font-size: .84rem; color: var(--ink); margin-top: 4px; }
.popup-time { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }
.popup-photo { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; margin-top: 8px; }

.marker-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

/* ---------- Dashboard ---------- */

.dash-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 720px) {
  .dash-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.breakdown { display: grid; gap: 10px; }

.breakdown-row {
  display: grid;
  grid-template-columns: 86px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: .86rem;
  font-weight: 700;
}

.breakdown-bar { height: 12px; border-radius: 999px; background: var(--blue-100); overflow: hidden; }
.breakdown-bar i { display: block; height: 100%; border-radius: 999px; }

/* ---------- Misc ---------- */

.page-title { margin: 22px 0 4px; font-size: 1.4rem; color: var(--blue-900); }
.page-sub { margin: 0 0 16px; color: var(--ink-soft); font-size: .92rem; }

.site-footer {
  background: var(--blue-900);
  color: #bcd9ec;
  padding: 22px 0 26px;
  margin-top: 26px;
  font-size: .85rem;
}

.site-footer strong { color: #fff; }
.site-footer p { margin: 4px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 2000;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

