/*
 * charts_voto_renta_23J.css — CSS de los gráficos del 23J (voto, abstención y renta por sección censal)
 * -------------------------------------------------------------------
 *   1) BLOQUE BASE  -> copia LITERAL de shared/styles/tokens.css + shared/styles/base.css
 *                      + la botonera de shared/components/controles.css.
 *                      No se edita aquí: si cambia shared/, se vuelve a copiar entero.
 *   2) ESPECÍFICO   -> lo propio del proyecto, todo bajo .chart-voto-renta-29n
 * -------------------------------------------------------------------
 */

/* =====================================================================
   1) BLOQUE BASE — copiado de shared/
   ===================================================================== */

:root {
  /* Colores de marca */
  --ed-rojo: #D0021B;
  --ed-negro: #1a1a1a;
  --ed-amarillo: #ECDC19;
  --ed-azul: #4A90E2;
  --ed-azul-principal: #005695;

  /* Grises de UI / ejes */
  --ed-gris-900: #333333;
  --ed-gris-700: #4a4a4a;
  --ed-gris-500: #939393;
  --ed-gris-300: #c5c5c5;
  --ed-gris-200: #dedede;
  --ed-gris-100: #eaeaea;

  /* Texto */
  --ed-texto: #1a1a1a;
  --ed-texto-suave: #4a4a4a;

  /* Radio de las esquinas de los controles */
  --ed-radio: 4px;

  /* Tipografías */
  --ed-fuente: 'Encode Sans', 'Helvetica Neue', Arial, sans-serif;
  --ed-fuente-titulo: 'Sanomat-Bold', Georgia, 'Times New Roman', serif;
}

.ed-rectos { --ed-radio: 0px; }

/* Reset mínimo, SOLO dentro del gráfico */
.ed-chart,
.ed-chart *,
.ed-chart *::before,
.ed-chart *::after {
  box-sizing: border-box;
}

.ed-chart {
  font-family: var(--ed-fuente);
  color: var(--ed-texto);
  line-height: 1.4;
  margin: 24px 0;
  text-align: left;
  clear: left;
}

.ed-titulo {
  font-family: var(--ed-fuente);
  font-weight: 700;
  color: var(--ed-negro);
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 4px;
}
.ed-titulo.ed-display,
.ed-display .ed-titulo {
  font-family: var(--ed-fuente-titulo);
}
.ed-subtitulo {
  font-family: var(--ed-fuente);
  color: var(--ed-texto-suave);
  font-size: 14px;
  margin: 0 0 16px;
}
.ed-fuente {
  font-family: var(--ed-fuente);
  color: var(--ed-gris-500);
  font-size: 12px;
  margin-top: 8px;
}

.ed-chart .ed-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ed-chart .ed-svg text { font-family: var(--ed-fuente); }
.ed-chart .ed-eje text { font-size: 14px; fill: var(--ed-gris-500); }
.ed-chart .ed-eje path { stroke-width: 0; }
.ed-chart .ed-eje line { stroke: var(--ed-gris-500); stroke-width: 1; }
.ed-chart .ed-eje-grid line { stroke: var(--ed-gris-300); stroke-width: 0.5; stroke-dasharray: 3; }

.ed-chart .ed-halo { stroke: #fff; stroke-width: 3px; stroke-opacity: 0.9; paint-order: stroke; }

.ed-chart .ed-highlight-layer rect,
.ed-chart .ed-highlight-layer circle,
.ed-chart .ed-highlight-layer path { fill: none; stroke: var(--ed-negro); stroke-width: 2px; }

/* Botonera segmentada (shared/components/controles.css) */
.ed-botonera { display: inline-flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ed-botonera .ed-boton {
  font-family: var(--ed-fuente); font-size: 13px; padding: 6px 12px; height: 34px;
  background: #fff; color: var(--ed-texto); border: 1px solid #cecece; border-radius: var(--ed-radio);
  cursor: pointer; transition: all 0.15s;
}
.ed-botonera .ed-boton:hover { background: var(--ed-gris-100); }
.ed-botonera .ed-boton.activo { background: var(--ed-negro); color: #fff; border-color: var(--ed-negro); }

/* Desplegable (shared/components/controles.css) */
.ed-dropdown { position: relative; display: inline-block; font-family: var(--ed-fuente); }
.ed-dropdown-trigger {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: #fff; border: 1px solid #cecece; border-radius: var(--ed-radio);
  padding: 6px 11px; font-size: 13px; color: var(--ed-negro);
}
.ed-dropdown-trigger:hover { border-color: #bbb; }
.ed-dropdown-lbl { color: #888; font-weight: 600; }
.ed-dropdown-cur { font-weight: 700; }
.ed-dropdown-caret { color: #888; transition: transform 0.15s; }
.ed-dropdown.abierto .ed-dropdown-caret { transform: rotate(180deg); }
.ed-dropdown-menu {
  display: none; position: absolute; left: 0; top: calc(100% + 5px); z-index: 1000; min-width: 210px;
  list-style: none; margin: 0; padding: 4px 0; background: #fff; border: 1px solid #ececec; border-radius: var(--ed-radio);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); text-align: left;
}
.ed-dropdown.abierto .ed-dropdown-menu { display: block; }
.ed-dropdown-menu li { padding: 7px 13px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; border-bottom: 1px solid #eee; }
.ed-dropdown-menu li:last-child { border-bottom: none; }
.ed-dropdown-menu li:hover, .ed-dropdown-menu li.sel { background: var(--ed-gris-100); }
.ed-dropdown-menu .ed-dropdown-n { font-weight: 600; color: var(--ed-negro); font-size: 13.5px; }
.ed-dropdown-menu .ed-dropdown-d { color: #999; font-size: 12px; }


/* =====================================================================
   2) ESPECÍFICO DEL PROYECTO (.chart-voto-renta-29n)
   ===================================================================== */

.chart-voto-renta-29n {
  /* Colores de partido: los mismos que en encuestas y listas del 29N */
  --vr-pp: #02A2DD;
  --vr-psoe: #E02020;
  --vr-vox: #AAD656;
  --vr-izquierda: #ff7090;
  --vr-otros: var(--ed-gris-300);
}

/* Controles: botoneras y desplegable en fila */
.chart-voto-renta-29n .vr-controles { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin-bottom: 4px; }
.chart-voto-renta-29n .vr-controles .ed-botonera { margin: 4px 0; }
.chart-voto-renta-29n .vr-controles .ed-dropdown { margin: 4px 0; }
/* 52 provincias: la lista se desplaza */
.chart-voto-renta-29n .ed-dropdown-menu { max-height: 320px; overflow-y: auto; }

/* --- Minigráficos por partido --- */
.chart-voto-renta-29n .vr-minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; }
.chart-voto-renta-29n .vr-mini { min-width: 0; }
.chart-voto-renta-29n .vr-mini-titulo { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.chart-voto-renta-29n .vr-mini .ed-eje-x text { font-size: 12px; }

.chart-voto-renta-29n .vr-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; margin: 6px 0; }
.chart-voto-renta-29n .vr-leyenda span { display: inline-flex; align-items: center; gap: 5px; }
.chart-voto-renta-29n .vr-leyenda i { display: inline-block; width: 14px; height: 3px; }
.chart-voto-renta-29n .vr-leyenda i.vr-cuadro { width: 11px; height: 11px; }
.chart-voto-renta-29n .vr-leyenda i.vr-discontinua { background: none !important; border-top: 2px dashed var(--ed-gris-500); height: 0; }

/* --- Líneas por grupo de renta --- */
.chart-voto-renta-29n .vr-linea { fill: none; stroke-width: 2.5; }
.chart-voto-renta-29n .vr-linea--discontinua { stroke-dasharray: 5 4; stroke-width: 2; }
.chart-voto-renta-29n .vr-punto { stroke: #fff; stroke-width: 1.5; }
.chart-voto-renta-29n .vr-etiqueta { font-size: 13px; font-weight: 700; }
.chart-voto-renta-29n .vr-extremos { font-size: 12px; fill: var(--ed-gris-700); }
.chart-voto-renta-29n .vr-guia { stroke: var(--ed-gris-500); stroke-width: 1; }
.chart-voto-renta-29n .vr-captura { fill: transparent; cursor: pointer; }

/* --- Brecha entre el grupo más pobre y el más rico, elección a elección --- */
.chart-voto-renta-29n .vr-brecha-area { fill: var(--ed-gris-200); opacity: 0.6; }
.chart-voto-renta-29n .vr-brecha-valor { font-size: 12px; fill: var(--ed-gris-700); font-variant-numeric: tabular-nums; }
.chart-voto-renta-29n .vr-brecha-dif { font-size: 13px; font-weight: 700; fill: var(--ed-negro); }

/* --- Bloques: una barra 100% por grupo (como la de paridad) --- */
.chart-voto-renta-29n .vr-bfila {
  display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 0 8px;
  height: 28px; font-size: 13px; max-width: 680px;
}
.chart-voto-renta-29n .vr-bfila--ejes { height: 20px; font-size: 12px; color: var(--ed-gris-500); }
.chart-voto-renta-29n .vr-bfila--total { margin-top: 6px; border-top: 1px solid var(--ed-gris-200); padding-top: 6px; height: 34px; }
.chart-voto-renta-29n .vr-bnom { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-voto-renta-29n .vr-bejes { position: relative; height: 100%; }
.chart-voto-renta-29n .vr-bejes span { position: absolute; top: 2px; transform: translateX(-50%); }
.chart-voto-renta-29n .vr-bejes span:first-child { transform: none; }
.chart-voto-renta-29n .vr-bejes span:last-child { transform: translateX(-100%); }
.chart-voto-renta-29n .vr-bbarra { position: relative; display: flex; height: 22px; }
.chart-voto-renta-29n .vr-bseg {
  display: flex; align-items: center; justify-content: center; height: 100%;
  color: #fff; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.chart-voto-renta-29n .vr-bseg--otros { color: var(--ed-negro); }
.chart-voto-renta-29n .vr-bseg + .vr-bseg { border-left: 2px solid #fff; }
.chart-voto-renta-29n .vr-mitad { position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 1.5px dashed var(--ed-negro); }
.chart-voto-renta-29n .vr-bfila.vr-mayoria .vr-bnom::after { content: ' ●'; color: var(--vr-pp); }

/* --- Cambio entre elecciones: rejilla de barras divergentes --- */
.chart-voto-renta-29n .vr-ctabla { display: grid; gap: 2px 10px; align-items: center; font-size: 13px; max-width: 760px; }
.chart-voto-renta-29n .vr-ccab { font-size: 12px; font-weight: 700; text-align: center; padding-bottom: 4px; }
.chart-voto-renta-29n .vr-cnom { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-voto-renta-29n .vr-ctotal { border-top: 1px solid var(--ed-gris-200); padding-top: 4px; }
.chart-voto-renta-29n .vr-ccelda { position: relative; height: 22px; }
.chart-voto-renta-29n .vr-ccero { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--ed-gris-500); }
.chart-voto-renta-29n .vr-cbarra { position: absolute; top: 4px; height: 14px; }
.chart-voto-renta-29n .vr-cvalor {
  position: absolute; top: 3px; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}

@media (max-width: 600px) {
  .chart-voto-renta-29n .vr-bfila { grid-template-columns: 96px 1fr; }
  .chart-voto-renta-29n .vr-ctabla { gap: 2px 4px; font-size: 12px; }
}

/* =====================================================================
   3) AJUSTES DE LOS GRÁFICOS DEL 23J (.vr-23j, los pone charts_voto_renta_23J.js)
      Venían en el <style> de graficos_voto_renta_23J.html
   ===================================================================== */
.chart-voto-renta-29n.vr-23j .vr-leyenda i.vr-discontinua { border-top-color: var(--ed-negro); }
.chart-voto-renta-29n.vr-23j .vr-minis { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 20px; }
.chart-voto-renta-29n.vr-23j .ed-botonera { margin: 0 0 8px; }
.chart-voto-renta-29n.vr-23j .vr-minis--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .chart-voto-renta-29n.vr-23j .vr-minis--3 { grid-template-columns: repeat(2, 1fr); } }
.chart-voto-renta-29n.vr-23j .vr-mini-titulo span.vr-dif { font-weight: 400; color: #4a4a4a; }
.chart-voto-renta-29n.vr-23j .vr-minis--ccaa { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 20px 20px; }
/* Nombre pegado a su gráfico: hueco de dos líneas (por los nombres largos) y el texto abajo del todo */
.chart-voto-renta-29n.vr-23j .vr-minis--ccaa .vr-mini-titulo { font-size: 13.5px; line-height: 1.3; min-height: 2.6em; display: flex; align-items: flex-end; margin-bottom: 0; }
.chart-voto-renta-29n.vr-23j .vr-minis--ccaa .vr-abst { display: block; font-weight: 400; font-size: 12px; color: #4a4a4a; }
/* Gráfico 4 (comunidades): 4 minis por fila; 2 en móvil. El título lleva debajo la abstención (más alto) */
.chart-voto-renta-29n.vr-23j .vr-minis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
.chart-voto-renta-29n.vr-23j .vr-minis--abst .vr-mini-titulo { min-height: 4.2em; }
@media (max-width: 600px) { .chart-voto-renta-29n.vr-23j .vr-minis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Botón «ver más» de las listas plegadas (gráfico 5): el de los minicharts de publicidad de la CAM
   (que a su vez es el de 2409 alquileres de temporada): texto gris sin caja, centrado y separado */
.chart-voto-renta-29n .btn-vermas {
  display: block;
  margin: 18px auto 4px auto;
  font-family: var(--ed-fuente);
  font-size: 13px;
  font-weight: 600;
  color: #777;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
}
.chart-voto-renta-29n .btn-vermas:hover { color: #333; text-decoration: underline; }
