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

:root {
  --p9-red: #d32f2f;
  --p9-red-dark: #b71c1c;
  --p9-blue: #1565c0;
  --p9-blue-dark: #0d47a1;
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --border-card: #e5e7eb;
  --border-light: #f1f5f9;
  --text-dark: #111827;
  --text-muted: #64748b;
  --text-sub: #475569;
  --green-lead: #16a34a;
  --gold-bg: #fffbeb;
  --gold-border: #fef3c7;
  --font-ta: 'Mukta Malar', 'Noto Sans Tamil', system-ui, sans-serif;
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-ta);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header & Branding */
.site-header {
  background: #ffffff;
  border-bottom: 2px solid var(--p9-red);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--p9-blue-dark);
  line-height: 1.2;
}

.brand-tagline {
  font-size: 13px;
  color: var(--p9-red-dark);
  font-weight: 700;
  letter-spacing: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid #fca5a5;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  background-color: #dc2626;
  border-radius: 50%;
  animation: pulse 1.4s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(0.9); opacity: 1; }
}

.lang-switch {
  text-decoration: none;
  background: var(--p9-blue);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.2s;
}

.lang-switch:hover {
  background: var(--p9-blue-dark);
}

/* Breaking Ticker */
.breaking-bar {
  background: linear-gradient(90deg, #b71c1c, #d32f2f 40%, #1565c0);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.ticker-label {
  background: #000000;
  color: #ffd700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ticker-marquee {
  display: flex;
  gap: 30px;
  white-space: nowrap;
  animation: marquee 25s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Main Container */
.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* Hero Banner */
.election-hero {
  background: linear-gradient(135deg, #ffffff 0%, #fff8f8 60%, #f0f7ff 100%);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
}

.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.hero-title h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 15px;
  color: var(--text-sub);
}

.hero-countdown {
  display: flex;
  gap: 8px;
  align-items: center;
}

.time-box {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 8px;
  padding: 6px 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.time-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--p9-red-dark);
  font-family: var(--font-en);
}

.time-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* Seat Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  background: #ffffff;
  border: 1.5px solid var(--border-card);
  color: var(--text-sub);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  border-color: var(--p9-blue);
  color: var(--p9-blue);
}

.tab-btn.active {
  background: var(--p9-blue);
  border-color: var(--p9-blue);
  color: #ffffff;
}

/* Seats Grid */
.seats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

/* Seat Card */
.seat-card {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.seat-header {
  background: linear-gradient(90deg, #f8fafc, #ffffff);
  border-bottom: 1px solid var(--border-card);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.seat-info h2 {
  font-size: 21px;
  font-weight: 800;
  color: var(--text-dark);
}

.seat-district {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.round-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #bae6fd;
}

/* Lead Status Strip */
.lead-strip {
  padding: 14px 20px;
  background: #fff8eb;
  border-bottom: 1px solid #fde68a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.lead-party-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.party-badge {
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.lead-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.lead-margin {
  text-align: right;
}

.margin-value {
  font-size: 19px;
  font-weight: 800;
  color: #92400e;
  font-family: var(--font-en);
}

.margin-label {
  font-size: 11.5px;
  color: #a16207;
  font-weight: 700;
  display: block;
}

/* Candidate List */
.candidates-list {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.candidate-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cand-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.cand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.cand-photo-thumb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--p-color, #e2e8f0);
  background: #f1f5f9;
  flex-shrink: 0;
}

.cand-photo-initial {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--p-color, #64748b);
  flex-shrink: 0;
}

.lead-photo-lg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d97706;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.cand-votes {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 15px;
}

.cand-pct {
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 6px;
  font-weight: 500;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Seat Stats Footer */
.seat-footer {
  margin-top: auto;
  background: #fafafa;
  border-top: 1px solid var(--border-light);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

.seat-footer strong {
  color: var(--text-dark);
  font-family: var(--font-en);
}

/* Calculator & Analysis Section */
.analysis-section {
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
}

.section-heading {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.calc-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
}

.calc-card h3 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--p9-blue-dark);
}

.calc-formula {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.6;
}

.calc-highlight {
  margin-top: 10px;
  padding: 8px 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
  font-weight: 700;
  font-size: 13.5px;
}

/* Footer */
.site-footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 30px 16px;
  text-align: center;
  font-size: 13.5px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a {
  color: #cbd5e1;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
  color: #ffffff;
}

/* Responsiveness */
@media (max-width: 768px) {
  .header-container {
    flex-direction: row;
    padding: 8px 12px;
  }
  .brand-logo {
    height: 38px;
  }
  .hero-title h1 {
    font-size: 22px;
  }
  .seats-grid {
    grid-template-columns: 1fr;
  }
}
