/* POURKIVOTER & GPAS2CHANCE Ecosystem Unified Stylesheet */
:root {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card: #ffffff;
  --card-hover: #ffffff;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --line: #e2e8f0;
  --line-light: #f1f5f9;
  
  /* Brand colors */
  --royal: #1d4ed8;
  --royal-light: #eff6ff;
  --royal-border: #bfdbfe;
  --emerald: #0f766e;
  --emerald-light: #f0fdfa;
  --amber: #b45309;
  --amber-light: #fffbeb;
  --gold: #d97706;
  --ruby: #dc2626;
  --ruby-light: #fef2f2;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-subtle: #111827;
  --card: #151d2f;
  --card-hover: #1a243a;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --line: #243048;
  --line-light: #1b263b;
  
  --royal-light: rgba(29, 78, 216, 0.15);
  --royal-border: rgba(59, 130, 246, 0.3);
  --emerald-light: rgba(15, 118, 110, 0.15);
  --amber-light: rgba(180, 83, 9, 0.15);
  --ruby-light: rgba(220, 38, 38, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--royal); text-decoration: none; transition: color 0.15s; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* HEADER & NAVBAR */
.site-header {
  background-color: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand-logo-clover {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.brand-titles { display: flex; flex-direction: column; }
.brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--royal) 0%, var(--emerald) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-subtitle {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
}
.theme-toggle-btn:hover { background: var(--line); }

.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.nav-bar::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s;
}
.nav-link:hover {
  background-color: var(--bg-subtle);
  color: var(--ink);
  text-decoration: none;
}
.nav-link.active {
  background-color: var(--royal-light);
  color: var(--royal);
  font-weight: 600;
  border: 1px solid var(--royal-border);
}
.nav-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #ffffff;
  text-decoration: none;
}
.nav-link-badge:hover { text-decoration: none; opacity: 0.95; }

/* HERO BANNER */
.hero-section {
  padding: 36px 0 24px;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.hero-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-badge.blue { background-color: var(--royal-light); color: var(--royal); border: 1px solid var(--royal-border); }
.tag-badge.green { background-color: var(--emerald-light); color: var(--emerald); border: 1px solid rgba(15,118,110,0.3); }
.tag-badge.amber { background-color: var(--amber-light); color: var(--amber); border: 1px solid rgba(180,83,9,0.3); }

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--ink-secondary);
  max-width: 820px;
  margin-bottom: 18px;
}

/* CARDS & CONTAINERS */
.card {
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: rgba(29, 78, 216, 0.25); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

/* AI SUMMARY BOX */
.ai-summary-card {
  background: linear-gradient(135deg, var(--card) 0%, var(--bg-subtle) 100%);
  border-left: 4px solid var(--royal);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ai-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background-color: var(--royal);
  color: #ffffff;
}
.ai-summary-text {
  font-size: 0.98rem;
  color: var(--ink);
  line-height: 1.55;
}

/* METRICS SELECTOR TABS */
.tab-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background-color: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  overflow-x: auto;
}
.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  text-align: center;
}
.tab-btn.active {
  background-color: var(--card);
  color: var(--royal);
  box-shadow: var(--shadow-sm);
}

/* RANKING BARS & LIST */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.candidate-row {
  display: grid;
  grid-template-columns: 48px 1fr 140px;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background-color: var(--card);
  border: 1px solid var(--line);
  transition: background-color 0.15s;
}
.candidate-row:hover { background-color: var(--bg-subtle); }
.candidate-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--line);
}
.candidate-info { display: flex; flex-direction: column; min-width: 0; }
.candidate-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.candidate-name { font-weight: 700; font-size: 1rem; color: var(--ink); }
.candidate-party {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 500;
}
.candidate-status-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.status-declared { background: var(--emerald-light); color: var(--emerald); border: 1px solid rgba(15,118,110,0.3); }
.status-conditional { background: var(--amber-light); color: var(--amber); border: 1px solid rgba(180,83,9,0.3); }
.status-tested { background: var(--bg-subtle); color: var(--ink-muted); border: 1px solid var(--line); }

.bar-container {
  height: 10px;
  background-color: var(--line);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 6px;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--royal) 0%, var(--emerald) 100%);
  transition: width 0.4s ease;
}

.candidate-score-block {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.candidate-score-val {
  font-size: 1.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--ink);
  line-height: 1.1;
}
.candidate-score-ci {
  font-size: 0.75rem;
  color: var(--ink-muted);
}
.candidate-not-estimable {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-muted);
}

/* SOCIAL TEMPERATURE GRID */
.temperature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.temp-card {
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.temp-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.temp-metric-pill {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}
.pill-pos { background: var(--emerald-light); color: var(--emerald); }
.pill-cont { background: var(--ruby-light); color: var(--ruby); }
.pill-neu { background: var(--bg-subtle); color: var(--ink-secondary); }

/* SIMULATOR INTERACTIVE BOX */
.simulator-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.sim-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.sim-mode-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sim-mode-card.active-mode {
  border-color: var(--royal);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.sim-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  display: inline-block;
}
.sim-badge.real { background: var(--emerald-light); color: var(--emerald); }
.sim-badge.fictif { background: var(--amber-light); color: var(--amber); }

/* ADSENSE PLACEHOLDERS */
.ad-slot {
  background-color: var(--bg-subtle);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 24px 0;
  text-align: center;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ad-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

/* FOOTER */
.site-footer {
  margin-top: auto;
  background-color: var(--card);
  border-top: 1px solid var(--line);
  padding: 36px 0 24px;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}
.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .hero-title { font-size: 1.6rem; }
  .candidate-row { grid-template-columns: 40px 1fr 90px; gap: 10px; padding: 10px 12px; }
  .candidate-avatar { width: 40px; height: 40px; }
  .candidate-score-val { font-size: 1.15rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}
