/* =============================================
   CIVICPULSE — style.css
   Theme: Editorial dark with amber civic accent
   Fonts: Syne (display) + DM Sans (body)
============================================= */

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

:root {
  --bg:        #0d0f0e;
  --surface:   #161918;
  --surface2:  #1e2220;
  --border:    #2a2e2c;
  --accent:    #e8a020;
  --accent2:   #f0c060;
  --text:      #e8ebe9;
  --muted:     #7a8480;
  --green:     #3ecf8e;
  --blue:      #4a9eff;
  --red:       #ff5f5f;
  --radius:    14px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- NOISE GRAIN OVERLAY ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.5;
}

/* ---- NAVBAR ---- */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(13,15,14,0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(232,160,32,0.7);
  animation: pulse 2s infinite;
  display: inline-block;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232,160,32,0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(232,160,32,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,160,32,0); }
}

.nav-stats { color: var(--muted); font-size: 0.85rem; display: flex; gap: 0.5rem; }
.nav-sep   { opacity: 0.4; }

.btn-report {
  background: var(--accent);
  color: #0d0f0e;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.btn-report:hover { background: var(--accent2); transform: translateY(-1px); }

/* ---- HERO ---- */
.hero {
  padding: 3.5rem 2rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeUp 0.6s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}

.hero h1 em::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0.3;
  border-radius: 2px;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 460px;
  margin-bottom: 2rem;
}

.hero-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.chip {
  padding: 0.4rem 1rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
  user-select: none;
}
.chip:hover, .chip.chip-open {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,160,32,0.08);
}

/* ---- MAIN LAYOUT ---- */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  padding: 0 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
}

/* ---- MAP ---- */
.map-panel {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 540px;
  animation: fadeUp 0.7s ease both 0.1s;
}

#map { width: 100%; height: 100%; }

.map-label {
  position: absolute;
  bottom: 1rem; left: 1rem;
  background: rgba(13,15,14,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  z-index: 10;
}

/* Leaflet dark override */
.leaflet-tile { filter: brightness(0.75) saturate(0.5); }
.leaflet-container { background: #131515; }

/* ---- FEED PANEL ---- */
.feed-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeUp 0.8s ease both 0.15s;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.feed-header h2 {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

#sort-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

/* ---- ISSUE FEED ---- */
.issue-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 490px;
  overflow-y: auto;
  padding-right: 4px;
}

.issue-feed::-webkit-scrollbar { width: 4px; }
.issue-feed::-webkit-scrollbar-track { background: transparent; }
.issue-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- ISSUE CARD ---- */
.issue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  animation: cardIn 0.4s ease both;
  position: relative;
  overflow: hidden;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.issue-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.issue-card:hover { border-color: rgba(232,160,32,0.3); transform: translateX(-2px); background: var(--surface2); }
.issue-card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }

.card-title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  flex: 1;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.status-open     { background: rgba(255,95,95,0.12);  color: var(--red);   border: 1px solid rgba(255,95,95,0.2); }
.status-progress { background: rgba(74,158,255,0.12); color: var(--blue);  border: 1px solid rgba(74,158,255,0.2); }
.status-resolved { background: rgba(62,207,142,0.12); color: var(--green); border: 1px solid rgba(62,207,142,0.2); }

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.card-cat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.vote-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-btn.voted  { border-color: var(--accent); color: var(--accent); background: rgba(232,160,32,0.08); }

.status-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
  margin-left: auto;
}
.status-toggle:hover { border-color: var(--green); color: var(--green); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-family: var(--font-head); font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p  { font-size: 0.85rem; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal h2 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.modal-sub { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

.modal-close {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text); border-color: var(--muted); }

.form-group { margin-bottom: 1.1rem; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

label span { color: var(--accent); }

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}

input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }

/* ---- CATEGORY GRID ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.cat-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.55rem 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s;
  text-align: center;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(232,160,32,0.1); }

/* ---- FORM BUTTONS ---- */
.btn-use-location {
  background: none;
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}
.btn-use-location:hover { border-color: var(--accent); color: var(--accent); }

.btn-submit {
  width: 100%;
  background: var(--accent);
  color: #0d0f0e;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  padding: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
}
.btn-submit:hover { background: var(--accent2); transform: translateY(-1px); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: rgba(62,207,142,0.4); }
.toast.error   { border-color: rgba(255,95,95,0.4); }