/**
 * Kontrol Consent — estilos del banner de consentimiento
 *
 * REGLA LEGAL QUE NO SE PUEDE ROMPER AL TEMATIZAR:
 * los tres botones (Rechazar opcionales / Configurar / Aceptar todas) deben
 * tener el MISMO peso visual: mismo tamaño, mismo contraste, misma jerarquía.
 * Destacar "Aceptar todas" invalida el consentimiento. Por eso .kc-btn es una
 * sola clase y no existe una variante "primaria".
 *
 * Para adaptarlo a la marca, redefina únicamente las variables de :root.
 */

.kc {
  --kc-fondo: #ffffff;
  --kc-superficie: #f4f5f7;
  --kc-texto: #16181d;
  --kc-texto-2: #4a5160;
  --kc-borde: #d7dae2;
  --kc-acento: #1f6469;
  --kc-acento-texto: #ffffff;
  --kc-sombra: 0 -2px 24px rgba(16, 20, 28, .14);
  --kc-radio: 6px;
  --kc-fuente: inherit;
  --kc-z: 2147483000;
}

@media (prefers-color-scheme: dark) {
  .kc {
    --kc-fondo: #191d26;
    --kc-superficie: #222733;
    --kc-texto: #e8eaf1;
    --kc-texto-2: #b3bac8;
    --kc-borde: #333a48;
    --kc-acento: #5fa5aa;
    --kc-acento-texto: #0f1218;
    --kc-sombra: 0 -2px 24px rgba(0, 0, 0, .5);
  }
}

.kc,
.kc *,
.kc *::before,
.kc *::after { box-sizing: border-box; }

.kc { font-family: var(--kc-fuente); }

/* ---------- visibilidad por estado ---------- */

.kc[data-abierto="ninguno"] .kc-banner,
.kc[data-abierto="ninguno"] .kc-panel,
.kc[data-abierto="ninguno"] .kc-fondo,
.kc[data-abierto="panel"] .kc-banner,
.kc[data-abierto="banner"] .kc-panel,
.kc[data-abierto="banner"] .kc-fondo { display: none; }

/* ---------- banner ---------- */

.kc-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--kc-z);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 20px clamp(16px, 5vw, 48px);
  background: var(--kc-fondo);
  color: var(--kc-texto);
  border-top: 1px solid var(--kc-borde);
  box-shadow: var(--kc-sombra);
}

.kc-banner-texto { flex: 1 1 380px; min-width: 0; }

.kc-titulo {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--kc-texto);
}

.kc-cuerpo {
  margin: 0;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--kc-texto-2);
  max-width: 68ch;
}

.kc-enlace {
  color: var(--kc-acento);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- acciones: los tres botones son iguales ---------- */

.kc-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 0 0 auto;
}

.kc-btn {
  flex: 1 1 auto;
  min-width: 152px;
  padding: 11px 20px;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--kc-texto);
  background: var(--kc-fondo);
  border: 1.5px solid var(--kc-borde);
  border-radius: var(--kc-radio);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}

.kc-btn:hover {
  background: var(--kc-superficie);
  border-color: var(--kc-acento);
}

.kc-btn:focus-visible {
  outline: 2px solid var(--kc-acento);
  outline-offset: 2px;
}

/* ---------- panel de preferencias ---------- */

.kc-fondo {
  position: fixed;
  inset: 0;
  z-index: var(--kc-z);
  background: rgba(10, 13, 18, .55);
}

.kc-panel {
  position: fixed;
  z-index: calc(var(--kc-z) + 1);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  overflow-y: auto;
  padding: 24px clamp(20px, 4vw, 32px) 20px;
  background: var(--kc-fondo);
  color: var(--kc-texto);
  border-radius: var(--kc-radio);
  box-shadow: 0 24px 64px rgba(10, 13, 18, .4);
}

.kc-panel-cab {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.kc-panel-cab .kc-titulo { font-size: 1.15rem; }

.kc-cerrar {
  flex: none;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--kc-texto-2);
  background: transparent;
  border: 0;
  border-radius: var(--kc-radio);
  cursor: pointer;
}

.kc-cerrar:hover { background: var(--kc-superficie); color: var(--kc-texto); }
.kc-cerrar:focus-visible { outline: 2px solid var(--kc-acento); outline-offset: 2px; }

/* ---------- categorías ---------- */

.kc-cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 18px 0 20px;
  border: 1px solid var(--kc-borde);
  border-radius: var(--kc-radio);
  overflow: hidden;
}

.kc-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  background: var(--kc-superficie);
}

.kc-cat-texto { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.kc-cat-titulo { font-size: .9rem; font-weight: 600; color: var(--kc-texto); }
.kc-cat-desc { font-size: .8125rem; line-height: 1.5; color: var(--kc-texto-2); }

.kc-fijo {
  flex: none;
  align-self: center;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--kc-texto-2);
  white-space: nowrap;
}

/* ---------- interruptor ---------- */

.kc-switch {
  flex: none;
  align-self: center;
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  cursor: pointer;
}

.kc-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.kc-switch-pista {
  position: absolute;
  inset: 0;
  background: var(--kc-borde);
  border-radius: 999px;
  transition: background-color .18s ease;
  pointer-events: none;
}

.kc-switch-pista::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--kc-fondo);
  border-radius: 50%;
  transition: transform .18s ease;
}

.kc-switch input:checked + .kc-switch-pista { background: var(--kc-acento); }
.kc-switch input:checked + .kc-switch-pista::after { transform: translateX(20px); }
.kc-switch input:focus-visible + .kc-switch-pista { outline: 2px solid var(--kc-acento); outline-offset: 2px; }

.kc-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- pie del panel ---------- */

.kc-panel-pie {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kc-panel-pie .kc-btn { flex: 1 1 160px; }

/* ---------- móvil ---------- */

@media (max-width: 640px) {
  .kc-banner { padding: 18px 16px; gap: 14px; }
  .kc-acciones { width: 100%; }
  .kc-btn { flex: 1 1 100%; min-width: 0; }
  .kc-cat { flex-direction: column; align-items: stretch; gap: 12px; }
  .kc-switch, .kc-fijo { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .kc * { transition: none !important; }
}
