/* ============================================
   திருச்சி மக்கள் உதவி — Design System
   Trichy District Helper Portal
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
  /* Colors */
  --primary: #F59E0B;
  --primary-dark: #D97706;
  --primary-light: #FCD34D;
  --secondary: #3B82F6;
  --secondary-dark: #2563EB;
  --accent: #10B981;
  --accent-dark: #059669;
  --emergency: #EF4444;
  --emergency-dark: #DC2626;
  --purple: #8B5CF6;
  --pink: #EC4899;

  /* Dark Mode (default) */
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.1);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Bottom Nav Height */
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Sans Tamil', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 16px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

/* ---- Background Gradient ---- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(245, 158, 11, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: var(--space-md);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 480px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.header-logo h1 {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-logo .subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.header-btn:hover,
.header-btn:active {
  background: var(--bg-glass-hover);
  color: var(--primary);
}

/* ---- Main Content ---- */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ---- Hero Section ---- */
.hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-top: var(--space-md);
  height: 200px;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-lg);
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

.hero-overlay h2 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.hero-overlay p {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
}

/* ---- Live Info Strip ---- */
.live-strip {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  scrollbar-width: none;
}

.live-strip::-webkit-scrollbar {
  display: none;
}

.live-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: var(--space-sm) var(--space-md);
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.live-chip .live-dot {
  width: 6px;
  height: 6px;
  background: var(--emergency);
  border-radius: var(--radius-full);
  animation: pulse-dot 2s infinite;
}

.live-chip .chip-icon {
  font-size: 16px;
}

.live-chip .chip-value {
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ---- Section Title ---- */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--space-lg) 0 var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-title .title-icon {
  font-size: 22px;
}

/* ---- Quick Access Grid ---- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.quick-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-sm);
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.quick-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.quick-card:hover::before,
.quick-card:active::before {
  opacity: 1;
}

.quick-card:hover,
.quick-card:active {
  background: var(--bg-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.quick-card .card-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
  display: block;
}

.quick-card .card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Card Colors */
.quick-card.emergency::before { background: linear-gradient(90deg, var(--emergency), var(--emergency-dark)); }
.quick-card.emergency .card-icon { filter: drop-shadow(0 0 8px rgba(239,68,68,0.4)); }

.quick-card.schemes::before { background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.quick-card.schemes .card-icon { filter: drop-shadow(0 0 8px rgba(245,158,11,0.4)); }

.quick-card.jobs::before { background: linear-gradient(90deg, var(--secondary), var(--secondary-dark)); }
.quick-card.jobs .card-icon { filter: drop-shadow(0 0 8px rgba(59,130,246,0.4)); }

.quick-card.education::before { background: linear-gradient(90deg, var(--purple), #7C3AED); }
.quick-card.education .card-icon { filter: drop-shadow(0 0 8px rgba(139,92,246,0.4)); }

.quick-card.agriculture::before { background: linear-gradient(90deg, var(--accent), var(--accent-dark)); }
.quick-card.agriculture .card-icon { filter: drop-shadow(0 0 8px rgba(16,185,129,0.4)); }

.quick-card.women::before { background: linear-gradient(90deg, var(--pink), #DB2777); }
.quick-card.women .card-icon { filter: drop-shadow(0 0 8px rgba(236,72,153,0.4)); }

.quick-card.seniors::before { background: linear-gradient(90deg, #F97316, #EA580C); }
.quick-card.seniors .card-icon { filter: drop-shadow(0 0 8px rgba(249,115,22,0.4)); }

.quick-card.news::before { background: linear-gradient(90deg, #06B6D4, #0891B2); }
.quick-card.news .card-icon { filter: drop-shadow(0 0 8px rgba(6,182,212,0.4)); }

.quick-card.contacts::before { background: linear-gradient(90deg, #8B5CF6, #7C3AED); }
.quick-card.contacts .card-icon { filter: drop-shadow(0 0 8px rgba(139,92,246,0.4)); }

.quick-card.blood::before { background: linear-gradient(90deg, var(--emergency), #B91C1C); }

/* ---- Info Cards ---- */
.info-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--transition-normal);
}

.info-card:hover {
  background: var(--bg-glass-hover);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.info-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.info-card-title {
  font-size: 16px;
  font-weight: 700;
}

.info-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.info-card-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---- Emergency Call Button ---- */
.emergency-call {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  width: 100%;
}

.emergency-call:hover,
.emergency-call:active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(239, 68, 68, 0.1));
  transform: scale(1.01);
}

.emergency-call .call-icon {
  width: 44px;
  height: 44px;
  background: var(--emergency);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  animation: ring 3s infinite;
  flex-shrink: 0;
}

@keyframes ring {
  0%, 100% { transform: rotate(0deg); }
  5% { transform: rotate(15deg); }
  10% { transform: rotate(-15deg); }
  15% { transform: rotate(10deg); }
  20% { transform: rotate(-10deg); }
  25% { transform: rotate(0deg); }
}

.emergency-call .call-info {
  flex: 1;
}

.emergency-call .call-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.emergency-call .call-number {
  font-size: 20px;
  font-weight: 800;
  color: var(--emergency);
}

.emergency-call .call-action {
  color: var(--emergency);
  font-size: 24px;
}

/* ---- Search Bar ---- */
.search-container {
  margin-top: var(--space-md);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: var(--space-sm) var(--space-md);
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.search-bar .search-icon {
  font-size: 18px;
  color: var(--text-muted);
}

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: var(--space-sm) 0;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: var(--space-sm) 0 max(var(--space-sm), env(safe-area-inset-bottom));
}

.nav-items {
  display: flex;
  justify-content: space-around;
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  min-width: 56px;
}

.nav-item .nav-icon {
  font-size: 22px;
  transition: all var(--transition-fast);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item:hover {
  color: var(--primary);
}

/* ---- WhatsApp Share Button ---- */
.whatsapp-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-xl);
  margin: var(--space-lg) 0;
  transition: all var(--transition-fast);
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
}

.whatsapp-share:hover,
.whatsapp-share:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.4);
}

.whatsapp-share .wa-icon {
  font-size: 20px;
}

/* ---- Page Header (for sub-pages) ---- */
.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
}

.back-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--bg-glass-hover);
}

.page-title {
  font-size: 20px;
  font-weight: 700;
}

/* ---- Filter Pills ---- */
.filter-pills {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-xl);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  font-weight: 600;
}

.filter-pill:hover {
  background: var(--bg-glass-hover);
}

.filter-pill.active:hover {
  background: var(--primary-dark);
}

/* ---- Scheme Card ---- */
.scheme-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--transition-normal);
}

.scheme-card:hover {
  background: var(--bg-glass-hover);
  transform: translateY(-1px);
}

.scheme-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-xl);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.scheme-badge.central {
  background: rgba(59, 130, 246, 0.2);
  color: var(--secondary);
}

.scheme-badge.state {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent);
}

.scheme-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.scheme-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.scheme-details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.scheme-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.scheme-detail .detail-icon {
  font-size: 14px;
}

/* ---- Contact List ---- */
.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.contact-item:hover,
.contact-item:active {
  background: var(--bg-glass-hover);
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
}

.contact-name {
  font-size: 14px;
  font-weight: 600;
}

.contact-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.contact-action {
  font-size: 20px;
  color: var(--accent);
}

/* ---- Weather Widget ---- */
.weather-widget {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.weather-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.weather-temp {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, #60A5FA, #34D399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.weather-icon {
  font-size: 56px;
}

.weather-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.weather-details {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-glass);
}

.weather-detail {
  text-align: center;
}

.weather-detail .wd-label {
  font-size: 11px;
  color: var(--text-muted);
}

.weather-detail .wd-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ---- News Card ---- */
.news-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--transition-normal);
}

.news-card:hover {
  background: var(--bg-glass-hover);
}

.news-time {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.news-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.news-source {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-glass) 25%, var(--bg-glass-hover) 50%, var(--bg-glass) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Toast Notification ---- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-md) var(--space-lg);
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: all var(--transition-normal);
  pointer-events: none;
}

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

/* ---- Fade In Animation ---- */
.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

.fade-in-delay-1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.2s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.3s; opacity: 0; }
.fade-in-delay-4 { animation-delay: 0.4s; opacity: 0; }

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .main-content {
    max-width: 520px;
  }
  .quick-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .hero {
    height: 260px;
  }
}
