/*! =============================================================================
 *  © 2026 Renzo Núñez · RonBStudio — "Perú Elige 2026 · Segunda Vuelta".
 *  Todos los derechos reservados. Código propietario.
 *  https://www.ronbstudio.com
 * ============================================================================= */
/* =============================================================================
 *  Archivo: proy-departamentos.css
 *  Tarjeta del desagregado por departamento (barra divergente). Espejo visual
 *  de evolution.css para verse como una sección hermana.
 * ===========================================================================*/

.pdept-section {
  max-width: var(--container-max, 1100px);
  margin: 0 auto;
  padding: var(--sp-3, 0.75rem) var(--container-padding, 1rem) var(--sp-5, 1.5rem);
}

.pdept {
  max-width: 980px;
  margin: 0 auto;
  background:
    radial-gradient(
      ellipse at top left,
      var(--c-mv-mapa-radial-from) 0%,
      var(--c-mv-mapa-radial-mid)  60%,
      transparent 100%
    ),
    var(--c-mv-bg-card, #ffffff);
  border: 1px solid var(--c-mv-card-border, #e2e8f0);
  border-radius: var(--c-card-radius, 16px);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--c-card-shadow, 0 1px 3px rgba(15, 23, 42, 0.06));
}

.pdept__head { text-align: center; margin-bottom: 0.85rem; }

.pdept__title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--c-mv-card-title, #2c5599);
  margin: 0 0 0.3rem;
  line-height: 1.25;
}

.pdept__sub {
  font-size: 0.85rem;
  color: var(--c-mv-ink-muted, #64748b);
  margin: 0;
}

/* --- Leyenda propia --- */
.pdept__legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.pdept__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-mv-ink, #1e293b);
}
.pdept__legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* --- Canvas (alto fijado por JS según nº de departamentos) --- */
.pdept__canvas-wrap {
  position: relative;
  width: 100%;
  height: 620px;
}
.pdept__canvas { width: 100%; height: 100%; }

/* --- Nota al pie --- */
.pdept__note {
  text-align: center;
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
  color: var(--c-mv-ink-muted, #64748b);
  min-height: 1.2em;
}
.pdept__note--preview { font-style: italic; }
.pdept__note--error { color: var(--c-party-ap, #c8302a); }

/* --- Totales: doughnut de netos (mismo lenguaje visual que el del cuadro JEE)
       con el Δ al centro y leyenda con los ~montos por candidato --- */
.pdept__totals {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.1rem 2rem;
  margin: 1.25rem 0 0;
}
.pdept__pie {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 9px rgba(15, 23, 42, 0.13);
}
.pdept__pie-hole {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66%;
  height: 66%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--c-mv-bg-card, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.pdept__pie-delta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pdept__pie-dcap {
  font-size: 0.52rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--c-mv-ink-muted, #64748b);
  margin-top: 0.18rem;
  text-align: center;
  max-width: 80%;
}
.pdept__pielegend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 170px;
}
.pdept__pielegrow { display: flex; align-items: center; gap: 0.6rem; }
.pdept__piedot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
.pdept__piedot--k { background: #f37021; }
.pdept__piedot--s { background: #c8302a; }
.pdept__pielegtxt { display: flex; flex-direction: column; line-height: 1.05; }
.pdept__pieleg-val {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pdept__pct--k { color: #f37021; }
.pdept__pct--s { color: #c8302a; }
.pdept__pieleg-cap {
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--c-mv-ink, #334155);
  margin-top: 0.2rem;
}

/* --- Responsive --- */
@media (max-width: 560px) {
  .pdept { padding: 1.5rem 0.9rem 1.25rem; }
  .pdept__title { font-size: 1.1rem; }
  .pdept__legend { gap: 1rem; }
  .pdept__totals { gap: 0.9rem 1.4rem; }
  .pdept__pie { width: 120px; height: 120px; }
  .pdept__pielegend { min-width: 140px; }
  .pdept__pieleg-val { font-size: 1.25rem; }
}
