/* ── CSS Reset & Roots ── */
:root {
  /* Default: Dark Theme */
  --bg-gradient: radial-gradient(circle at top left, #1e293b, #0f172a 70%);
  --surface: rgba(30, 41, 59, 0.7);
  --surface-hover: rgba(30, 41, 59, 0.9);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.5);
  
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --accent: #8b5cf6;
  
  /* Status / Emergency */
  --police: #0ea5e9;
  --fire: #ef4444;
  --ambulance: #10b981;
  --women: #ec4899;
  --traffic: #f59e0b;
}

[data-theme="light"] {
  --bg-gradient: radial-gradient(circle at top left, #f8fafc, #e2e8f0 70%);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-hover: rgba(255, 255, 255, 1);
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.1);
}

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

html {
  scroll-behavior: smooth;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: color 0.3s, background 0.3s;
}

/* ── Loader ── */
#loader {
  position: fixed;
  inset: 0;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.loader-ring {
  width: 50px;
  height: 50px;
  border: 4px solid var(--text-muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loader-text {
  color: var(--text-main);
  font-weight: 500;
  letter-spacing: 1px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toast {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px var(--shadow-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(120%);
  opacity: 0;
  animation: slideInToast 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast.removing {
  animation: slideOutToast 0.4s ease forwards;
}

@keyframes slideInToast {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutToast {
  to { transform: translateX(120%); opacity: 0; }
}

/* ── Back to Top ── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 900;
  background: var(--primary);
  color: #fff;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  box-shadow: 0 4px 15px var(--primary-glow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.2rem;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  transform: translateY(-5px);
  background: var(--accent);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 2rem;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand .tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0; height: 2px;
  bottom: -4px; left: 0;
  background: var(--primary);
  transition: width 0.3s;
}

.nav-links a:hover { color: var(--primary); }
.nav-links a:hover::after { width: 100%; }

/* Theme Toggle */
.theme-toggle input { display: none; }
.toggle-track {
  width: 50px; height: 26px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  position: relative;
  cursor: pointer;
}
.toggle-thumb {
  position: absolute;
  width: 20px; height: 20px;
  background: var(--text-main);
  border-radius: 50%;
  left: 3px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .toggle-thumb { transform: translateX(24px); }
.icon-dark { font-size: 12px; color: #f59e0b; }
.icon-light { font-size: 12px; color: #f1f5f9; }
[data-theme="light"] .icon-light { color: #f59e0b; }
[data-theme="light"] .icon-dark { color: #94a3b8; }

/* ── Main Layout ── */
.container {
  max-width: 1200px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* Sections Base & Glassmorphism */
.section {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 1.5rem;
  padding: 3rem;
  box-shadow: 0 15px 35px var(--shadow-color);
  position: relative;
  overflow: hidden;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ── SOS SECTION ── */
#sos {
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pulse-dot {
  width: 8px; height: 8px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.sos-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  border-radius: 1rem;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-weight: 600;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.sos-btn i { font-size: 2rem; margin-bottom: 0.5rem; }
.sos-name { font-size: 1.1rem; }
.sos-num { font-size: 1.5rem; font-weight: 800; opacity: 0.9; }

/* Buttons Hover Lift, Scale & Glow */
.sos-btn::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
}

.sos-btn:hover {
  transform: translateY(-8px) scale(1.02);
}

.police { background: var(--police); box-shadow: 0 4px 20px rgba(14, 165, 233, 0.3); }
.police:hover { box-shadow: 0 10px 30px rgba(14, 165, 233, 0.6); }

.fire { background: var(--fire); box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3); }
.fire:hover { box-shadow: 0 10px 30px rgba(239, 68, 68, 0.6); }

.ambulance { background: var(--ambulance); box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3); }
.ambulance:hover { box-shadow: 0 10px 30px rgba(16, 185, 129, 0.6); }

.women { background: var(--women); box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3); }
.women:hover { box-shadow: 0 10px 30px rgba(236, 72, 153, 0.6); }

.traffic { background: var(--traffic); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3); }
.traffic:hover { box-shadow: 0 10px 30px rgba(245, 158, 11, 0.6); }

/* ── CIVIC UTILITY CENTER ── */
.civic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.civic-card {
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  padding: 2rem;
  border-radius: 1.2rem;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.4s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .civic-card { background: rgba(255,255,255,0.5); }

.civic-icon {
  width: 60px; height: 60px;
  border-radius: 12px;
  display: flex; justify-content: center; align-items: center;
  font-size: 1.8rem; color: #fff;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.civic-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.civic-card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; flex-grow: 1; }

.civic-arrow {
  align-self: flex-start;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface-hover);
  display: flex; justify-content: center; align-items: center;
  border: 1px solid var(--border-color);
  transition: all 0.3s;
}

.civic-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary);
  background: var(--surface-hover);
  box-shadow: 0 12px 30px var(--shadow-color);
}

.civic-card:hover .civic-arrow {
  background: var(--primary);
  color: #fff;
  transform: translateX(5px);
}

/* ── SHARED CARDS GRID (E-Waste & Blood) ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  min-height: 150px;
}

.interactive-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.interactive-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary);
  opacity: 0; transition: opacity 0.3s;
}

.interactive-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px var(--shadow-color);
  border-color: rgba(59, 130, 246, 0.4);
}

.interactive-card:hover::before { opacity: 1; }

.card-title {
  font-size: 1.25rem; font-weight: 600; color: var(--text-main);
  display: flex; align-items: center; gap: 0.5rem;
}

.card-info {
  display: flex; align-items: center; gap: 0.75rem;
  color: var(--text-muted); font-size: 0.95rem;
}
.card-info i { color: var(--primary); width: 16px; text-align: center; }
.card-info a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.card-info a:hover { color: var(--primary); }

.card-btn {
  margin-top: auto;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: none;
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff; font-weight: 500;
  text-decoration: none; text-align: center;
  transition: all 0.3s; box-shadow: 0 4px 12px var(--primary-glow);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}

.card-btn.sec {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: none;
}

.card-btn:hover {
  transform: translateY(-2px); box-shadow: 0 6px 15px var(--primary-glow);
}
.card-btn.sec:hover { background: var(--surface-hover); border-color: var(--primary); }

/* ── SEARCH BAR ── */
.search-wrap {
  position: relative; margin-bottom: 2.5rem; max-width: 600px;
}

.search-wrap .search-icon {
  position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1.1rem;
}

#ewaste-search {
  width: 100%;
  padding: 1.2rem 3rem 1.2rem 3rem;
  border-radius: 3rem;
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-main); font-size: 1.05rem;
  outline: none; transition: all 0.3s;
  backdrop-filter: blur(5px);
}

[data-theme="light"] #ewaste-search { background: #fff; }

#ewaste-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

#clear-search {
  position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; padding: 0.5rem;
  display: none; transition: color 0.2s;
}
#clear-search:hover { color: var(--text-main); }

/* ── FAQ ACCORDION ── */
.faq-wrapper {
  margin-top: 4rem; padding-top: 3rem;
  border-top: 1px solid var(--border-color);
}
.faq-heading { margin-bottom: 1.5rem; font-size: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }

.accordion-item {
  border-bottom: 1px solid var(--border-color);
}
.accordion-header {
  width: 100%; text-align: left; background: transparent; border: none;
  padding: 1.25rem 0; font-size: 1.1rem; font-weight: 500; color: var(--text-main);
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  transition: color 0.3s;
}
.accordion-header:hover { color: var(--primary); }

.accordion-icon { transition: transform 0.3s; color: var(--text-muted); }
.accordion-item.active .accordion-icon { transform: rotate(180deg); color: var(--primary); }

.accordion-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
}
.accordion-content {
  padding-bottom: 1.25rem; color: var(--text-muted); line-height: 1.7;
}

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 3rem; grid-column: 1 / -1;
  color: var(--text-muted); border: 1px dashed var(--border-color);
  border-radius: 1rem;
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* ── FOOTER ── */
footer {
  text-align: center; padding: 2rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--surface); color: var(--text-muted);
  backdrop-filter: blur(10px);
}

/* ── RESPONSIVENESS ── */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; text-align: center; }
  .brand { justify-content: center; }
  .nav-links { display: none; /* Hide nav on small mobile */ }
  .section { padding: 2rem 1.5rem; }
  .section-title { font-size: 1.8rem; }
  .container { margin: 2rem auto; gap: 2.5rem; }
}
