/* Radar Eleitoral 2026 | ITNext — identidade visual
   Base azul-marinho profundo, destaques ciano/roxo com moderação.
   Contraste mínimo AA em ambos os temas. */

:root {
  --navy-950: #050b1a;
  --navy-900: #0a1330;
  --navy-800: #101c44;
  --navy-700: #172759;
  --navy-600: #22366f;
  --cyan-400: #3fd0e0;
  --cyan-500: #22b8cc;
  --cyan-600: #1897a8;
  --purple-400: #a685f2;
  --purple-500: #8a5cf0;
  --neutral-50: #f6f7fb;
  --neutral-100: #eceff5;
  --neutral-200: #d7dcea;

  --bg: var(--neutral-50);
  --text: var(--navy-900);
  --text-muted: #3c4a6b;
  --surface: #ffffff;
  --border: var(--neutral-200);
}

[data-theme="dark"] {
  --bg: var(--navy-950);
  --text: var(--neutral-50);
  --text-muted: #b7c0d6;
  --surface: var(--navy-800);
  --border: var(--navy-700);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

a { color: inherit; }

.skip-link {
  position: absolute;
  top: -4rem;
  left: 0.5rem;
  z-index: 50;
  background: var(--cyan-500);
  color: var(--navy-950);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  transition: top 0.15s ease-in-out;
}
.skip-link:focus { top: 0.5rem; }

:focus-visible {
  outline: 3px solid var(--cyan-500);
  outline-offset: 2px;
  border-radius: 2px;
}

.site-header {
  background: var(--navy-900);
  color: var(--neutral-50);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__top {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.brand__mark {
  display: flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan-500), var(--purple-500));
  color: var(--navy-950); font-weight: 700;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__title { font-size: 0.9rem; font-weight: 600; color: var(--neutral-100); }
.brand__sub { font-size: 0.75rem; color: var(--cyan-400); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--navy-600);
  color: var(--neutral-100);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--navy-700); }

.site-nav { background: rgba(23, 39, 89, 0.6); border-top: 1px solid rgba(255,255,255,0.08); }
.site-nav ul {
  max-width: 1100px; margin: 0 auto; padding: 0.25rem 0.5rem;
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem;
}
.site-nav a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 4px;
  text-decoration: none; color: var(--neutral-200); font-size: 0.85rem;
}
.site-nav a:hover, .site-nav a.is-active { background: var(--navy-700); color: #fff; }

main.container { padding-top: 2rem; padding-bottom: 3rem; min-height: 55vh; }

h1 { font-size: 1.75rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
.subtitle { color: var(--text-muted); max-width: 48rem; }

.notice {
  border: 1px solid var(--cyan-600);
  background: rgba(34, 184, 204, 0.06);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.notice--purple { border-color: var(--purple-500); background: rgba(138, 92, 240, 0.06); }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.9rem;
  background: rgba(23, 39, 89, 0.03);
}
[data-theme="dark"] .empty-state { background: rgba(255,255,255,0.03); }
.empty-state__title { font-weight: 600; margin: 0 0 0.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.oscilacao-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.oscilacao-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.oscilacao-card__icone {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--cyan-500), var(--purple-500));
  color: #fff;
  flex-shrink: 0;
}

.oscilacao-card h3 {
  margin: 0.2rem 0 0;
  font-size: 1.02rem;
}

.oscilacao-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.oscilacao-card__fonte {
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.82rem;
}

.oscilacao-card__fonte a {
  color: var(--cyan-600);
  text-decoration: underline;
}

[data-theme="dark"] .oscilacao-card__fonte a { color: var(--cyan-400); }


table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--border); }

.uf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.5rem;
}
.uf-cell {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
  background: var(--surface);
}
.uf-cell strong { display: block; font-size: 0.95rem; }
.uf-cell span { font-size: 0.7rem; color: var(--text-muted); }

.site-footer {
  background: var(--navy-900);
  color: var(--neutral-200);
  padding: 2rem 0;
  margin-top: 3rem;
  font-size: 0.85rem;
}
.site-footer__title { color: #fff; font-weight: 600; margin-bottom: 0.5rem; }
.site-footer__small { color: #9fabc7; font-size: 0.75rem; }

form label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; }
form input[type="text"], form input[type="email"], form input[type="password"],
form input[type="number"], form input[type="date"], form input[type="file"], form select, form textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.btn-primary {
  background: var(--navy-900);
  color: #fff;
  border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
[data-theme="dark"] .btn-primary { background: var(--cyan-500); color: var(--navy-950); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.alert-error {
  border: 1px solid #d33; background: #fdeaea; color: #7a1414;
  border-radius: 6px; padding: 0.75rem 1rem; font-size: 0.85rem; margin-bottom: 1rem;
}
[data-theme="dark"] .alert-error { background: #3a1414; color: #ffb3b3; border-color: #7a1414; }

.tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tab-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}
.tab-btn[aria-selected="true"] { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
[data-theme="dark"] .tab-btn[aria-selected="true"] { background: var(--cyan-500); color: var(--navy-950); border-color: var(--cyan-500); }
.tab-panel[hidden] { display: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Página Governadores — cards de pesquisa por UF */
.uf-jump {
  position: sticky;
  top: calc(var(--header-h, 108px) + var(--instituto-jump-h, 0px));
  z-index: 20;
  background: var(--bg);
  padding: 0.5rem 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 1rem 0 1.5rem;
}
.uf-jump__item {
  display: inline-block;
  min-width: 2.4rem;
  text-align: center;
  padding: 0.3rem 0.5rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}
.uf-jump__item.is-disponivel { background: var(--surface); color: var(--text); }
.uf-jump__item.is-vazio { color: var(--text-muted); opacity: 0.45; pointer-events: none; }
.uf-jump__item.is-disponivel:hover { border-color: var(--cyan-500); color: var(--cyan-600); }
[data-theme="dark"] .uf-jump__item.is-disponivel:hover { color: var(--cyan-400); }

.instituto-jump {
  position: sticky;
  top: var(--header-h, 108px);
  z-index: 21;
  background: var(--bg);
  padding: 0.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.5rem;
}
.instituto-jump__item {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
}
.instituto-jump__item:hover { border-color: var(--cyan-500); color: var(--cyan-600); }
[data-theme="dark"] .instituto-jump__item:hover { color: var(--cyan-400); }
.instituto-jump__item.is-ativo { background: var(--cyan-500); border-color: var(--cyan-500); color: #fff; }

.badge--instituto {
  color: var(--text-muted);
  background: var(--surface);
  border-color: var(--border);
  font-weight: 500;
}

.poll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  scroll-margin-top: 5rem;
}
.poll-card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.poll-card__sigla {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}
.poll-card__turno { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.poll-card__turno:first-of-type { border-top: none; padding-top: 0; }
.poll-card__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.badge--single { color: #92600a; background: #fff3d6; border-color: #f0cd7c; }
[data-theme="dark"] .badge--single { color: #ffd98a; background: #3a2c0c; border-color: #6b5220; }
.badge--multi { color: #0b6e4f; background: #dff5ec; border-color: #a9e2cb; }
[data-theme="dark"] .badge--multi { color: #8be3bd; background: #0d2d22; border-color: #1f5a44; }

.poll-bars { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.poll-bar {
  display: grid;
  grid-template-columns: minmax(7rem, 13rem) 1fr 3.2rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}
.poll-bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll-bar__logo { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-right: 4px; border-radius: 3px; display: inline-block; }
.poll-bar__logo-wrap { position: relative; display: inline-flex; width: 20px; height: 20px; vertical-align: middle; margin-right: 4px; }
.poll-bar__logo-wrap .poll-bar__logo { margin-right: 0; }
.poll-bar__logo--fallback { align-items: center; justify-content: center; color: #fff; font-size: 8px; font-weight: 700; line-height: 1; }

.poll-bar__track {
  background: var(--border);
  border-radius: 4px;
  height: 0.9rem;
  overflow: hidden;
}
.poll-bar__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-500), var(--purple-500));
  border-radius: 4px;
}
.poll-bar__fill.poll-bar--neutro { background: var(--text-muted); opacity: 0.55; }
.poll-bar__valor { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.poll-card__fonte {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}
.poll-card__fonte a { color: var(--cyan-600); }
[data-theme="dark"] .poll-card__fonte a { color: var(--cyan-400); }

@media (max-width: 640px) {
  .poll-bar { grid-template-columns: 6rem 1fr 2.6rem; }
}

.regiao-titulo {
  margin: 2.2rem 0 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border);
  font-size: 1.1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.regiao-titulo:first-of-type { margin-top: 1rem; }

.poll-bar__partido {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  margin-left: 0.3rem;
  white-space: nowrap;
}
[data-theme="dark"] .poll-bar__partido { color: var(--text-muted); }

.poll-bar-group {
padding: 0.4rem 0 0.4rem 0.6rem;
margin-bottom: 0.15rem;
border-left: 3px solid transparent;
}
.poll-bar-group--alta { border-left-color: #0b6e4f; }
[data-theme="dark"] .poll-bar-group--alta { border-left-color: #8be3bd; }
.poll-bar-group--baixa { border-left-color: #a4262c; }
[data-theme="dark"] .poll-bar-group--baixa { border-left-color: #ffb4b8; }
.poll-bar { margin-bottom: 0.2rem; }
.poll-bar__trend-line {
margin: 0;
font-size: 0.76rem;
color: var(--text-muted);
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.35rem;
}
.poll-bar__trend-line strong { color: var(--text); font-variant-numeric: tabular-nums; }
.poll-bar__trend {
font-size: 0.72rem;
font-weight: 700;
border-radius: 4px;
padding: 0.1rem 0.5rem;
white-space: nowrap;
display: inline-block;
}
.poll-bar__trend--alta { color: #0b6e4f; background: #dff5ec; }
[data-theme="dark"] .poll-bar__trend--alta { color: #8be3bd; background: #0d2d22; }
.poll-bar__trend--baixa { color: #a4262c; background: #fbe1e2; }
[data-theme="dark"] .poll-bar__trend--baixa { color: #ffb4b8; background: #3a1414; }
.poll-bar__trend-line--novo { font-style: italic; }
.poll-card__comparativo {
font-size: 0.78rem;
color: var(--text-muted);
margin: 0.2rem 0 0.9rem;
padding-bottom: 0.5rem;
border-bottom: 1px dashed var(--border);
}

/* Favoritos (Fase 3 do roadmap de recorrencia) */
.favorito-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  line-height: 1;
  vertical-align: middle;
  color: #999;
  padding: 0 0.2em;
}
.favorito-btn:hover { color: #c9a227; }
.favorito-btn--ativo { color: #c9a227; }
.lista-novidades__item--novo::before {
  content: "novo";
  display: inline-block;
  font-size: 0.7em;
  text-transform: uppercase;
  background: #2a6df4;
  color: #fff;
  border-radius: 3px;
  padding: 0.1em 0.4em;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Favoritos (Fase 3 do roadmap de recorrencia) */
.favorito-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  line-height: 1;
  vertical-align: middle;
  color: #999;
  padding: 0 0.2em;
}
.favorito-btn:hover { color: #c9a227; }
.favorito-btn--ativo { color: #c9a227; }
.lista-novidades__item--novo::before {
  content: "novo";
  display: inline-block;
  font-size: 0.7em;
  text-transform: uppercase;
  background: #2a6df4;
  color: #fff;
  border-radius: 3px;
  padding: 0.1em 0.4em;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Filtro local de instituto por UF (dentro do card) */
.instituto-jump--local {
  position: static;
  z-index: auto;
  background: transparent;
  padding: 0;
  margin: 0.5rem 0 0.75rem;
  gap: 0.3rem;
}
.instituto-jump__item--sm {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  font-weight: 500;
}

/* Mobile: evitar que os paineis fixos (instituto-jump + uf-jump) ocupem a tela toda */
@media (max-width: 768px) {
  .instituto-jump, .uf-jump {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: 100vw;
  }
  .instituto-jump__item, .uf-jump__item {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .instituto-jump--local {
    flex-wrap: wrap;
    overflow-x: visible;
    position: static;
  }
}

/* Graficos: mais altura no mobile para caber legenda + eixo com varios candidatos */
@media (max-width: 640px) {
  .poll-chart {
    height: 290px;
  }
}

/* Correcao de altura para graficos Chart.js em mobile */
.poll-chart {
  position: relative;
  width: 100%;
  height: 220px;
}
.poll-chart canvas {
  width: 100% !important;
  height: 100% !important;
}


/* Link "ver analise" em destaque (botao/chip), separado da citacao da fonte */
.poll-card__analise {
  margin-top: .6rem;
}
a.poll-card__analise-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .9rem;
  border-radius: 999px;
  background: rgba(24, 151, 168, 0.09);
  border: 1px solid rgba(24, 151, 168, 0.4);
  color: #1897a8;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
a.poll-card__analise-btn:hover,
a.poll-card__analise-btn:focus-visible {
  background: rgba(24, 151, 168, 0.18);
  border-color: rgba(24, 151, 168, 0.65);
  text-decoration: none;
}
a.poll-card__analise-btn:active {
  transform: scale(0.98);
}
a.poll-card__analise-btn span {
  transition: transform .15s ease;
}
a.poll-card__analise-btn:hover span {
  transform: translateX(2px);
}
