/* Estilos Modernos - Painel Apuração Eleições Brasil 2026 */

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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #0f172a;
  --bg-card: #141e33;
  --bg-card-hover: #1a2744;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(59, 130, 246, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-red: #ef4444;
  --accent-blue: #2563eb;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --accent-live: #ef4444;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(37, 99, 235, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(239, 68, 68, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Scrollbar moderno */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Pulsar AO VIVO */
.live-pulse {
  animation: pulse-dot 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

/* Mapa do Brasil SVG */
.brazil-map-container {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 800 / 820;
}

.brazil-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.6));
}

.state-path {
  fill: #1e293b;
  stroke: #0f172a;
  stroke-width: 1.2;
  cursor: pointer;
  transition: fill 0.4s ease, stroke 0.3s ease, filter 0.3s ease, transform 0.2s ease;
  vector-effect: non-scaling-stroke;
}

.state-path:hover {
  filter: brightness(1.25) drop-shadow(0 0 10px rgba(255, 255, 255, 0.25));
  stroke: #ffffff;
  stroke-width: 2.2;
}

.state-path.state-selected {
  stroke: #38bdf8 !important;
  stroke-width: 3.5 !important;
  filter: brightness(1.3) drop-shadow(0 0 15px #38bdf8);
}

/* Sem a caixa de foco retangular do navegador; teclado ganha contorno no próprio estado */
.state-path:focus {
  outline: none;
}
.state-path:focus-visible {
  stroke: #ffffff;
  stroke-width: 2.5;
}

.state-path.state-dimmed {
  fill: #111827 !important;
  opacity: 0.25;
  filter: none;
}

/* Estado selecionado fora da região filtrada não fica aceso */
.state-path.state-dimmed.state-selected {
  stroke: #0f172a !important;
  stroke-width: 1.2 !important;
  filter: none;
}

/* Textos e Labels no Mapa */
.state-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.9);
  user-select: none;
  transition: opacity 0.2s ease;
}

.state-label.dimmed {
  opacity: 0.35;
}

/* Tooltip Dinâmico */
#map-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -115%);
  transition: opacity 0.15s ease, transform 0.15s ease;
  min-width: 230px;
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8), 0 0 25px rgba(56, 189, 248, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}

#map-tooltip.visible {
  opacity: 1;
}

/* Barras de progresso com animação */
.progress-bar-fill {
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card do Líder em Destaque */
.leader-card-glow {
  position: relative;
  overflow: hidden;
}
.leader-card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ef4444, #3b82f6, #f59e0b, #10b981);
}

/* Glassmorphism Classes */
.glass-panel {
  background: rgba(20, 30, 51, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-panel-subtle {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Slider de simulação customizado */
input[type="range"].custom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 6px;
  background: #1e293b;
  outline: none;
  transition: background 0.2s;
}

input[type="range"].custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #38bdf8;
  cursor: pointer;
  border: 3px solid #0f172a;
  box-shadow: 0 0 12px #38bdf8;
  transition: transform 0.15s, background-color 0.15s;
}

input[type="range"].custom-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #7dd3fc;
}

/* Telas muito estreitas: os números grandes dos cartões cabem sem estourar */
@media (max-width: 360px) {
  /* Lista de candidatos: sem a linha do vice, que quebrava em várias linhas */
  .cand-vice {
    display: none;
  }
  .metric-val {
    /* !important: as classes do Tailwind são injetadas depois desta folha */
    font-size: 1.05rem !important;
    line-height: 1.5rem !important;
  }
}

/* Badge de Estado no Placar */
.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Canvas Confetti */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10000;
}

/* Animações de entrada */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in {
  animation: fadeInScale 0.3s ease-out forwards;
}
