/* ══════════════════════════════════════════
   Problem Map — Master Stylesheet
   All CSS vars live here. base.html links
   this file and has no inline <style> block.
   ══════════════════════════════════════════ */

/* ── Reset ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS Variables (Light Mode) ──────────── */
:root {
  --bg:        #F5F3EE;
  --surface:   #FFFFFF;
  --surface2:  #F0EDE6;
  --border:    #E2DDD5;
  --text:      #1A1714;
  --text2:     #6B635A;
  --text3:     #9E958A;
  --accent:    #C84B31;
  --accent2:   #E8773F;
  --green:     #2D6A4F;
  --blue:      #1B4F72;
  --amber:     #B7770D;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --radius:    10px;
  --nav-h:     60px;
  --post-alert-bg:    #FFF5F5;
  --post-resolved-bg: #F0FFF4;
}

/* ── Dark Mode Variables ─────────────────── */
body.dark {
  --bg:        #0F0D0B;
  --surface:   #1A1714;
  --surface2:  #242019;
  --border:    #332E28;
  --text:      #F0EDE6;
  --text2:     #A89E94;
  --text3:     #6B635A;
  --shadow:    0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.6);
  --post-alert-bg:    #2a0d0d;
  --post-resolved-bg: #0a1f12;
}

/* ── Map Dark Mode ───────────────────────── */
body.dark .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(1.05);
}

/* ── Base ────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  transition: background 0.2s, border-color 0.2s;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.nav-brand-icon {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
  flex: 1;
}

.nav-links a {
  text-decoration: none;
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--surface2);
  color: var(--text);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text2);
}

.nav-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

/* ── Dark Mode Toggle (Pill) ─────────────── */
.theme-toggle {
  position: relative;
  width: 64px;
  height: 32px;
  border-radius: 999px;
  background: #2c2c3a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  flex-shrink: 0;
  outline: none;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.15), 0 0 0 3px rgba(100,140,200,0.18);
  transition: background 0.35s ease, box-shadow 0.35s ease;
  user-select: none;
}

body:not(.dark) .theme-toggle {
  background: #7eb8e8;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.12), 0 0 0 3px rgba(126,184,232,0.35);
  animation: toggle-glow-light 3s ease-in-out infinite;
}

body.dark .theme-toggle {
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4), 0 0 0 3px rgba(80,120,200,0.22);
  animation: toggle-glow-dark 3s ease-in-out infinite;
}

@keyframes toggle-glow-light {
  0%, 100% { box-shadow: inset 0 1px 4px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.12), 0 0 0 3px rgba(126,184,232,0.35); }
  50%       { box-shadow: inset 0 1px 4px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.12), 0 0 0 4px rgba(126,184,232,0.55), 0 0 12px rgba(126,184,232,0.25); }
}

@keyframes toggle-glow-dark {
  0%, 100% { box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4), 0 0 0 3px rgba(80,120,200,0.22); }
  50%       { box-shadow: inset 0 1px 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4), 0 0 0 4px rgba(80,120,200,0.38), 0 0 14px rgba(80,120,200,0.18); }
}

.toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: opacity 0.2s ease, color 0.2s ease;
  pointer-events: none;
}

.toggle-moon { color: #c8d6f0; }
.toggle-sun  { color: #fff8c0; }

.toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 2;
}

.theme-toggle.is-dark .toggle-knob {
  transform: translateX(32px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  padding: 7px 14px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #b03d27; color: white; text-decoration: none; }
.btn-outline { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #245a41; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

/* ── Page Body ───────────────────────────── */
.page-wrap { padding-top: var(--nav-h); min-height: 100vh; }

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.badge-open      { background: #EBF5FB; color: var(--blue); }
.badge-resolved  { background: #E9F5EE; color: var(--green); }
.badge-escalated { background: #FEF9E7; color: var(--amber); }
.badge-verified  { background: #F4F6F7; color: var(--text2); }
.badge-high      { background: #FDEDEC; color: var(--accent); }
.badge-medium    { background: #FEF9E7; color: var(--amber); }
.badge-low       { background: #E9F5EE; color: var(--green); }

body.dark .badge-open      { background: #0d2a3a; color: #7eb8d4; }
body.dark .badge-resolved  { background: #0d2a1a; color: #6db890; }
body.dark .badge-escalated { background: #2a1f00; color: #c9a84c; }
body.dark .badge-verified  { background: #252220; color: var(--text2); }
body.dark .badge-high      { background: #2a0d0d; color: #e07060; }
body.dark .badge-medium    { background: #2a1f00; color: #c9a84c; }
body.dark .badge-low       { background: #0d2a1a; color: #6db890; }

/* ── Tag Colors ──────────────────────────── */
.tag-pothole     { background: #FDF2E9; color: #A04000; }
.tag-water       { background: #EBF5FB; color: #1A5276; }
.tag-garbage     { background: #E9F5EE; color: #1D6A39; }
.tag-streetlight { background: #FDFEFE; color: #5D6D7E; border: 1px solid #D5D8DC; }
.tag-traffic     { background: #FDEDEC; color: #922B21; }
.tag-noise       { background: #F4ECF7; color: #7D3C98; }
.tag-sewage      { background: #FEF9E7; color: #9A7D0A; }
.tag-electricity { background: #FEF5E7; color: #935116; }
.tag-tree        { background: #EAFAF1; color: #1D6A39; }
.tag-other       { background: #F4F6F7; color: #5D6D7E; }

body.dark .tag-pothole     { background: #2a1500; color: #e09060; }
body.dark .tag-water       { background: #0a1f2e; color: #7eb8d4; }
body.dark .tag-garbage     { background: #0a1f12; color: #6db890; }
body.dark .tag-streetlight { background: #1e1c18; color: var(--text2); border-color: var(--border); }
body.dark .tag-traffic     { background: #2a0d0d; color: #e07060; }
body.dark .tag-noise       { background: #1e0f2a; color: #b07ad4; }
body.dark .tag-sewage      { background: #2a1f00; color: #c9a84c; }
body.dark .tag-electricity { background: #2a1800; color: #d4944a; }
body.dark .tag-tree        { background: #0a1f12; color: #6db890; }
body.dark .tag-other       { background: #252220; color: var(--text2); }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: background 0.2s, border-color 0.2s;
}
.card-hover { transition: box-shadow 0.15s, transform 0.15s; cursor: pointer; }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* ── Forms ───────────────────────────────── */
input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s, background 0.2s, color 0.2s;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 500; color: var(--text2); }
.form-group { margin-bottom: 14px; }

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Toast ───────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  background: var(--text);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  max-width: 300px;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ── Modal ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  padding: 24px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--surface2); border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text2);
  transition: background 0.2s, color 0.2s;
}
.modal-title { font-family: 'DM Serif Display', serif; font-size: 20px; margin-bottom: 16px; }

/* ── Spinner ─────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section Headers ─────────────────────── */
.section-header { margin-bottom: 20px; }
.section-title  { font-family: 'DM Serif Display', serif; font-size: 22px; }
.section-sub    { color: var(--text2); font-size: 13px; margin-top: 3px; }

/* ── Empty State ─────────────────────────── */
.empty-state       { text-align: center; padding: 48px 24px; color: var(--text3); }
.empty-state-icon  { font-size: 36px; margin-bottom: 12px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }

/* ── Utilities ───────────────────────────── */
.flex            { display: flex; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8           { gap: 8px; }
.gap-12          { gap: 12px; }
.gap-16          { gap: 16px; }
.text-sm         { font-size: 12.5px; }
.text-muted      { color: var(--text2); }
.mt-4            { margin-top: 4px; }
.mt-8            { margin-top: 8px; }
.mt-12           { margin-top: 12px; }
.mb-8            { margin-bottom: 8px; }
.mb-16           { margin-bottom: 16px; }
.truncate        { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full          { width: 100%; }

/* ── Global Theme Transitions ────────────── */
.nav-brand,
.nav-avatar,
.nav-user,
.btn-outline,
.btn-ghost,
.modal-overlay,
label,
::-webkit-scrollbar-thumb {
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 768px) {
  .nav-links   { display: none; }
  .hide-mobile { display: none; }
}

/* ══════════════════════════════════════════
   NGO Nearby Strip — index.html only
   Sits above the map inside .home-layout.
   Collapsed by default, auto-expands on
   report submit or issue marker click.
   ══════════════════════════════════════════ */

/* Outer wrapper — animates open/closed */
.ngo-strip-wrapper {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s, background 0.2s;
  flex-shrink: 0;
  position: relative;
}

.ngo-strip-wrapper.expanded {
  max-height: 130px;
}

/* Inner padding */
.ngo-strip {
  padding: 9px 16px 11px;
}

/* Header row */
.ngo-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ngo-strip-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
}

/* Animated live dot */
.ngo-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: ngo-pulse 2s ease-in-out infinite;
}

@keyframes ngo-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.5); }
}

/* Close button */
.ngo-strip-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text3);
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.ngo-strip-close:hover { background: var(--surface2); color: var(--text); }

/* Horizontally scrollable card row */
.ngo-strip-cards {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}
.ngo-strip-cards::-webkit-scrollbar { display: none; }

/* Individual NGO card */
.ngo-strip-card {
  flex-shrink: 0;
  min-width: 230px;
  max-width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ngo-strip-card:hover {
  border-color: var(--green);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(45,106,79,0.12);
}

/* Icon box */
.ngo-strip-icon {
  width: 32px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

/* Text block */
.ngo-strip-info { flex: 1; min-width: 0; }

.ngo-strip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ngo-strip-meta {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Action buttons (call / email) */
.ngo-strip-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.ngo-strip-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ngo-strip-btn:hover {
  background: var(--green);
  border-color: var(--green);
  color: white;
  text-decoration: none;
}

/* Collapsed pill — floats above map when NGOs available but strip is closed */
.ngo-collapsed-pill {
  display: none;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--green);
  border-radius: 20px;
  padding: 5px 14px 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  z-index: 500;
  box-shadow: var(--shadow);
  white-space: nowrap;
  align-items: center;
  gap: 6px;
  transition: box-shadow 0.15s, background 0.15s;
}
.ngo-collapsed-pill:hover {
  background: var(--surface2);
  box-shadow: var(--shadow-lg);
}
.ngo-collapsed-pill.visible { display: flex; }

/* ── NGO map marker popup ─────────────────── */
.ngo-popup {
  font-family: 'DM Sans', sans-serif;
  min-width: 190px;
}
.ngo-popup-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
}
.ngo-popup-meta {
  font-size: 11.5px;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.5;
}
.ngo-popup-actions {
  display: flex;
  gap: 6px;
}
.ngo-popup-btn {
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
