/* =========================================================================
   CRISPOL – Dashboard de eventos políticos
   PALETA (extraída de crispol.cl / Elementor Global Colors):
     primario  #E54164   secundario #F8DC67   acento #64A480
     texto     #283C5D   crema      #EFEDE7   negro  #0C0C0C   rojo #CC2B2B
   Para cambiar colores NO edite este archivo: use assets/theme-override.css
   ========================================================================= */

.crispol-dash {
  /* ---- Tema oscuro (por defecto) ---- */
  --cd-bg:        #0C0C0C;   /* fondo del dashboard            */
  --cd-surface:   #181818;   /* tarjetas y paneles             */
  --cd-border:    #2C2C2C;   /* bordes y líneas de grilla      */
  --cd-text:      #EFEDE7;   /* texto principal                */
  --cd-muted:     #A9A69E;   /* texto secundario               */
  --cd-accent:    #E54164;   /* botones activos, foco, enlaces */
  --cd-accent-fg: #FFFFFF;   /* texto sobre el acento          */

  /* Colores de las 4 variables */
  --cd-s1: #E54164;          /* escándalos del presidente      */
  --cd-s2: #F8DC67;          /* escándalos del círculo cercano */
  --cd-s3: #64A480;          /* manifestaciones antigobierno   */
  --cd-s4: #7C9CCB;          /* huelgas generales              */

  /* Colores al comparar países (hasta 3 líneas) */
  --cd-c1: #E54164;
  --cd-c2: #F8DC67;
  --cd-c3: #64A480;

  --cd-font:         "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cd-font-heading: "Barlow", "IBM Plex Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --cd-radius: 10px;
  --cd-max-width: 1100px;
}

.crispol-dash[data-theme="light"] {
  --cd-bg:        #FFFFFF;
  --cd-surface:   #F6F4EF;
  --cd-border:    #DDD9CF;
  --cd-text:      #283C5D;
  --cd-muted:     #5F6B80;
  --cd-accent:    #E54164;
  --cd-accent-fg: #FFFFFF;
  --cd-s1: #E54164;
  --cd-s2: #D9B72A;
  --cd-s3: #64A480;
  --cd-s4: #283C5D;
  --cd-c1: #E54164;
  --cd-c2: #283C5D;
  --cd-c3: #64A480;
}

/* ------------------------------------------------------------------ */

.crispol-dash, .crispol-dash * { box-sizing: border-box; }
.crispol-dash {
  background: var(--cd-bg);
  color: var(--cd-text);
  font-family: var(--cd-font);
  font-size: 15px;
  line-height: 1.5;
  max-width: var(--cd-max-width);
  margin: 0 auto;
  padding: 28px 24px 22px;
  border-radius: var(--cd-radius);
}
.crispol-dash h2, .crispol-dash h3 {
  font-family: var(--cd-font-heading); color: var(--cd-text); margin: 0; line-height: 1.15; letter-spacing: .01em;
}
.crispol-dash h2 { font-size: 30px; font-weight: 600; }
.crispol-dash h3 { font-size: 18px; font-weight: 600; }
.cd-sub { color: var(--cd-muted); margin: 6px 0 22px; max-width: 70ch; }

/* Controles */
.cd-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 16px; margin-bottom: 20px; }
.cd-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cd-field > label, .cd-field > .cd-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--cd-muted); }
.crispol-dash select {
  appearance: none; width: 100%; padding: 9px 34px 9px 12px; font: inherit; color: var(--cd-text);
  background: var(--cd-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--cd-border); border-radius: 8px; cursor: pointer;
}
.crispol-dash select:disabled { opacity: .5; cursor: not-allowed; }
.cd-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crispol-dash :focus-visible { outline: 2px solid var(--cd-accent); outline-offset: 2px; }

.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.cd-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; font-size: 13px;
  border: 1px solid var(--cd-border); border-radius: 999px; background: var(--cd-surface);
}
.cd-chip button { all: unset; cursor: pointer; padding: 0 5px; color: var(--cd-muted); font-size: 16px; line-height: 1; }
.cd-chip button:hover { color: var(--cd-accent); }

/* Selector de variable (botones) */
.cd-seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.cd-seg button {
  font: inherit; font-size: 14px; color: var(--cd-text); background: var(--cd-surface); cursor: pointer;
  border: 1px solid var(--cd-border); border-radius: 999px; padding: 7px 14px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s;
}
.cd-seg button:hover:not(:disabled) { border-color: var(--cd-accent); }
.cd-seg button[aria-pressed="true"] { background: var(--cd-accent); border-color: var(--cd-accent); color: var(--cd-accent-fg); }
.cd-seg button:disabled { opacity: .45; cursor: not-allowed; }
.cd-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* KPIs */
.cd-kpi-title { font-size: 15px !important; font-weight: 500 !important; color: var(--cd-muted) !important; margin: 0 0 10px !important; }
.cd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 22px; }
.cd-kpi { background: var(--cd-surface); border: 1px solid var(--cd-border); border-left-width: 4px; border-radius: var(--cd-radius); padding: 14px 16px; }
.cd-kpi .cd-k-label { font-size: 13px; color: var(--cd-muted); }
.cd-kpi .cd-k-val { font-family: var(--cd-font-heading); font-size: 38px; font-weight: 600; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.cd-kpi .cd-k-sub { font-size: 12.5px; color: var(--cd-muted); }

/* Gráfico */
.cd-chart-card { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: var(--cd-radius); padding: 18px 18px 12px; position: relative; }
.cd-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cd-chart-wrap { position: relative; height: 380px; }
.cd-note { font-size: 12.5px; color: var(--cd-muted); margin: 10px 0 0; }
.cd-msg { padding: 14px; border-radius: 8px; border: 1px dashed var(--cd-border); color: var(--cd-muted); text-align: center; margin: 14px 0; }
.cd-msg[hidden] { display: none; }
.cd-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--cd-surface) 70%, transparent); color: var(--cd-muted); border-radius: var(--cd-radius); z-index: 2; }
.cd-loading[hidden] { display: none; }

/* Pie */
.cd-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--cd-border); font-size: 12.5px; color: var(--cd-muted); }
.cd-foot details { margin-bottom: 10px; }
.cd-foot summary { cursor: pointer; color: var(--cd-text); font-weight: 500; }
.cd-foot dl { margin: 8px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
.cd-foot dt { color: var(--cd-text); }
.cd-foot dd { margin: 0; }
.cd-foot p { margin: 6px 0 0; }

@media (max-width: 640px) {
  .crispol-dash { padding: 20px 14px 16px; border-radius: 0; }
  .crispol-dash h2 { font-size: 24px; }
  .cd-chart-wrap { height: 300px; }
  .cd-kpi .cd-k-val { font-size: 30px; }
  .cd-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cd-kpi { padding: 12px; }
  .cd-foot dl { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .crispol-dash * { transition: none !important; } }

.cd-foot .cd-dl a { color: var(--cd-accent); text-decoration: underline; text-underline-offset: 2px; }
.cd-foot .cd-dl a:hover { text-decoration-thickness: 2px; }
