/* =====================================================
   VOS ELEGÍS – Estilos con DUA (Diseño Universal para el Aprendizaje)
   ===================================================== */

:root {
  --color-primary: #1a73e8;
  --color-secondary: #f0a500;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-bg: #f5f7fa;
  --color-card: #ffffff;
  --color-text: #212529;
  --color-muted: #6c757d;
  --color-border: #dee2e6;
  --font-base: 1rem;
  --font-scale: 1;
  --radius: 0.5rem;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ── Tamaño de fuente adaptable (DUA) ── */
[data-fontsize="small"]  { --font-scale: 0.875; }
[data-fontsize="normal"] { --font-scale: 1;     }
[data-fontsize="large"]  { --font-scale: 1.2;   }
[data-fontsize="xlarge"] { --font-scale: 1.45;  }

html { font-size: calc(var(--font-base) * var(--font-scale)); }

/* ── Alto contraste (DUA) ── */
.high-contrast {
  --color-primary: #0000cc;
  --color-secondary: #cc6600;
  --color-bg: #000000;
  --color-card: #111111;
  --color-text: #ffffff;
  --color-muted: #cccccc;
  --color-border: #ffffff;
}
.high-contrast body         { background: #000 !important; color: #fff !important; }
.high-contrast .card        { background: #111 !important; color: #fff !important; border-color: #fff !important; }
.high-contrast .navbar      { background: #000033 !important; border-bottom: 2px solid #fff; }
.high-contrast .table       { --bs-table-bg: #111; --bs-table-color: #fff; border-color: #fff; }
.high-contrast .form-control,
.high-contrast .form-select { background: #222; color: #fff; border-color: #fff; }
.high-contrast a            { color: #ffff00 !important; }
.high-contrast .btn-primary { background: #0000cc; border-color: #fff; }
.high-contrast .dua-bar     { background: #000033 !important; border-bottom: 1px solid #fff; }

/* ── Estilos base ── */
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Barra de accesibilidad DUA ── */
.dua-bar {
  background: #1c3a5e;
  color: #fff;
  padding: 0.35rem 1rem;
  font-size: 0.82rem;
}
.dua-bar .btn { font-size: 0.78rem; padding: 0.2rem 0.55rem; }

/* ── Skip link (teclado) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  background: var(--color-primary);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 9999;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ── Cards ── */
.card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  background: var(--color-card);
}
.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 600;
}

/* ── Tablas ── */
.table-responsive { border-radius: var(--radius); overflow: hidden; }
.table th { background: #e8eef7; }
.table thead.table-dark th { background: #1a2a4a; color: #fff; }

/* ── Formularios ── */
.form-label { font-weight: 600; }
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,.25);
}

/* ── Footer ── */
.footer-bar {
  background: #f0f0f0;
  border-top: 1px solid var(--color-border);
}

/* ── Login page ── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a4480 0%, #2ecc71 100%);
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 440px;
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.login-logo { font-size: 2.5rem; font-weight: 800; color: var(--color-primary); }
.login-subtitle { color: var(--color-muted); font-size: .9rem; }

/* ── Dashboard stat cards ── */
.stat-card {
  border-radius: var(--radius);
  color: #fff;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card .stat-icon { font-size: 2.5rem; opacity: .8; }
.stat-card .stat-num  { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .stat-lbl  { font-size: .85rem; opacity: .9; }

/* ── Partido card (recinto electoral) ── */
.partido-card {
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color .2s, transform .1s, box-shadow .2s;
  border-radius: var(--radius);
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--color-card);
  user-select: none;
}
.partido-card:hover, .partido-card:focus {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  outline: 3px solid var(--color-primary);
}
.partido-card.selected {
  border-color: var(--color-success);
  box-shadow: 0 0 0 4px rgba(40,167,69,.35);
}
.partido-card .partido-siglas {
  font-size: 2rem;
  font-weight: 800;
}
.partido-card .partido-nombre {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: .4rem;
}
.partido-card .partido-candidato {
  font-size: .85rem;
  color: var(--color-muted);
  margin-top: .2rem;
}
.partido-color-bar {
  height: 8px;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Opciones especiales (blanco/nulo) */
.voto-especial {
  border: 2px dashed var(--color-border);
  background: #fafafa;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s;
}
.voto-especial:hover, .voto-especial:focus { border-color: var(--color-primary); outline: 2px solid var(--color-primary); }
.voto-especial.selected { border-color: var(--color-danger); background: #fff0f0; }

/* ── Padrón: indicador de votó ── */
.voto-si  { color: var(--color-success); font-weight: 700; }
.voto-no  { color: var(--color-muted); }

/* ── Badges de estado ── */
.badge-estado-pendiente { background: #6c757d; }
.badge-estado-abierta   { background: #28a745; }
.badge-estado-cerrada   { background: #343a40; }

/* ── Pantalla de voto grande (recinto) ── */
.pantalla-voto {
  max-width: 900px;
  margin: 0 auto;
}
.pantalla-voto h1 { font-size: 1.8rem; font-weight: 800; }

/* ── Actas ── */
.acta-header {
  background: #1a4480;
  color: #fff;
  padding: 1rem;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
}
.acta-table td, .acta-table th { padding: .5rem; border: 1px solid #ddd; }
.acta-table { border-collapse: collapse; width: 100%; font-size: .9rem; }

/* ── Reportes: gráficas ── */
.chart-container { position: relative; height: 320px; }

/* ── Spinner de carga ── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.loading-overlay .spinner-border { width: 3.5rem; height: 3.5rem; }

/* ── Responsive ── */
@media (max-width: 576px) {
  .partido-card { padding: 1rem .5rem; }
  .partido-card .partido-siglas { font-size: 1.5rem; }
  .stat-card { flex-direction: column; text-align: center; }
}

/* ── Impresión ── */
@media print {
  .dua-bar, .navbar, .skip-link, .btn, .footer-bar, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #000; }
}
