:root {
  --app-bg: #f0f4f8;
  --card-bg: #ffffff;
  --primary: #059669;
  --primary-light: #d1fae5;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif; }
body { background-color: var(--app-bg); color: var(--text-main); line-height: 1.5; padding-bottom: 80px; -webkit-font-smoothing: antialiased; }

/* NORMAL STICKY HEADER & NAV */
.main-header {
  background: var(--card-bg);
  padding: 15px 20px;
  box-shadow: 0 2px 15px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-title h1 { color: var(--primary); font-size: 1.5rem; font-weight: 800; margin: 0; line-height: 1.2; }
.header-title p { font-size: 0.75rem; color: var(--text-muted); margin: 0; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* PWA Install Button */
.btn-install {
  background: linear-gradient(135deg, var(--accent-orange), #d97706);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  display: none; /* Hidden by default, JS turns it to 'flex' */
  align-items: center;
  gap: 5px;
}
.btn-install:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(245, 158, 11, 0.4); }

.top-nav { display: none; } /* Hidden on mobile by default */

/* Main Container */
.container { max-width: 1100px; margin: 25px auto; padding: 0 15px; position: relative; z-index: 10; }

/* SCROLLING IMAGE GALLERY */
.marquee-wrapper { overflow: hidden; width: 100%; background: transparent; margin-bottom: 25px; padding: 5px 0; }
.marquee-track { display: flex; width: max-content; animation: scrollLeft 25s linear infinite; gap: 15px; }
.marquee-track:hover { animation-play-state: paused; }
.marquee-track img { width: 280px; height: 160px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow-soft); }
@keyframes scrollLeft { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* PREMIUM CARDS & COMPONENTS */
.card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-soft); border: 1px solid rgba(255,255,255,0.8); }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }

/* Quick Stats Grid */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-box { background: var(--card-bg); padding: 15px; border-radius: var(--radius); text-align: center; box-shadow: var(--shadow-soft); }
.stat-box.blue .icon { color: var(--accent-blue); background: #eff6ff; }
.stat-box.orange .icon { color: var(--accent-orange); background: #fffbeb; }
.stat-box.green .icon { color: var(--primary); background: var(--primary-light); }
.stat-box.purple .icon { color: #8b5cf6; background: #f5f3ff; }
.stat-box .icon { width: 40px; height: 40px; margin: 0 auto 8px auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.stat-box h3 { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.stat-box p { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }

/* Explore Buttons */
.explore-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 10px; border-radius: 12px; color: white; text-decoration: none; font-weight: bold; transition: transform 0.2s, box-shadow 0.2s; text-align: center; }
.explore-btn:hover { transform: translateY(-3px); }
.explore-btn .icon { font-size: 2rem; margin-bottom: 8px; }
.bg-purple { background: linear-gradient(135deg, #a855f7, #7e22ce); box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3); }
.bg-teal { background: linear-gradient(135deg, #14b8a6, #0f766e); box-shadow: 0 4px 15px rgba(20, 184, 166, 0.3); }

/* Ward Member / Contact List */
.list-group { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; padding: 12px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; }
.list-avatar { width: 45px; height: 45px; background: var(--primary-light); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; margin-right: 15px; flex-shrink: 0; }
.list-info h4 { font-size: 1rem; color: var(--text-main); margin-bottom: 2px; }
.list-info p { font-size: 0.8rem; color: var(--text-muted); }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 600; background: #e2e8f0; color: #475569; margin-right: 5px; }

/* Weather / AQI */
.weather-card { background: linear-gradient(to right, #38bdf8, #0ea5e9); color: white; }
.weather-card .aqi-bad { background: #ef4444; padding: 4px 8px; border-radius: 6px; font-size: 0.8rem; font-weight: bold; display: inline-block; margin-top: 5px; }

/* Emergency Buttons */
.btn-emergency { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-radius: 12px; text-decoration: none; color: white; font-weight: bold; margin-bottom: 12px; transition: transform 0.2s, box-shadow 0.2s; }
.btn-emergency:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.15); }
.btn-emergency .icon { font-size: 1.5rem; margin-right: 15px; background: transparent; }
.bg-red { background: linear-gradient(135deg, #ef4444, #dc2626); }
.bg-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.bg-green { background: linear-gradient(135deg, #10b981, #059669); }

/* Bottom App Bar */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--card-bg); display: flex; justify-content: space-around; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(0,0,0,0.06); border-top-left-radius: 20px; border-top-right-radius: 20px; z-index: 1000; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted); font-size: 0.7rem; font-weight: 600; gap: 4px; transition: 0.2s; }
.bottom-nav a.active { color: var(--primary); transform: translateY(-2px); }
.bottom-nav svg { width: 22px; height: 22px; fill: currentColor; }

/* DESKTOP GRID & RESPONSIVENESS */
@media (min-width: 769px) {
  .top-nav { display: flex; gap: 5px; }
  .top-nav a { text-decoration: none; color: var(--text-main); font-weight: 600; padding: 8px 16px; border-radius: 8px; transition: all 0.2s ease; font-size: 0.95rem; }
  .top-nav a:hover, .top-nav a.active { background: var(--primary-light); color: var(--primary); }
  
  .desktop-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
  .bottom-nav { display: none; }
  body { padding-bottom: 40px; }
  
  /* Hide the manual install button on desktop monitors since PWAs are mainly for mobile */
  .btn-install { display: none !important; }
}
@media (max-width: 768px) {
  .desktop-grid { display: flex; flex-direction: column; }
}