/**
 * ocloc-consent.css — Estilos del CMP (banner + modal de preferencias de cookies).
 * --------------------------------------------------------------------------------
 * Móvil-first. Prefijo .ocloc-cc- en todas las clases (sin colisión con el wizard
 * .ocloc-wiz- ni con el cascarón .ocloc-).
 * Acentos con var(--ocloc-primary) (fallback teal #008C88, definido por la página).
 * Contraste AA, foco visible. Sin frameworks, sin dependencias.
 *
 * @since 2026-06-15 (oCloc headless — consentimiento de cookies AEPD/RGPD)
 */

.ocloc-cc-banner,
.ocloc-cc-modal,
.ocloc-cc-banner * ,
.ocloc-cc-modal * { box-sizing: border-box; }

:root {
  /* Defaults locales del CMP (la página puede definir --ocloc-primary con el color del tenant). */
  --ocloc-cc-primary: var(--ocloc-primary, #008C88);
  --ocloc-cc-text: #1f222b;
  --ocloc-cc-muted: #545b6e;          /* gris con contraste AA sobre blanco (>4.5:1) */
  --ocloc-cc-surface: #ffffff;
  --ocloc-cc-border: #d7dbe6;
  --ocloc-cc-radius: 12px;
  --ocloc-cc-radius-sm: 8px;
  --ocloc-cc-font: "Open Sans", -apple-system, "Segoe UI", system-ui, sans-serif;
  --ocloc-cc-shadow: 0 -6px 28px rgba(31, 34, 43, 0.16);
}

/* ─────────────────────────────────────────────────────────────────────────────
   1ª CAPA — BANNER (no es un muro: no bloquea el scroll ni cubre toda la pantalla)
───────────────────────────────────────────────────────────────────────────── */
.ocloc-cc-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483600;             /* por encima del wizard, por debajo del max absoluto */
  display: none;
  font-family: var(--ocloc-cc-font);
  color: var(--ocloc-cc-text);
  background: var(--ocloc-cc-surface);
  border-top: 1px solid var(--ocloc-cc-border);
  box-shadow: var(--ocloc-cc-shadow);
  /* Respeta la zona segura del móvil (notch / barra inferior). */
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ocloc-cc-banner--visible { display: block; }

.ocloc-cc-banner__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ocloc-cc-banner__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.ocloc-cc-banner__desc {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ocloc-cc-muted);
}
.ocloc-cc-banner__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BOTONES — las 3 acciones del banner deben tener IGUAL prominencia (AEPD):
   mismo tamaño, peso y altura. El color primario solo distingue la opción por
   defecto del producto, sin restar peso visual a "Rechazar todo"/"Configurar".
───────────────────────────────────────────────────────────────────────────── */
.ocloc-cc-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;                /* touch-friendly */
  padding: 12px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;                /* mismo peso en las 3 → igual prominencia */
  line-height: 1.2;
  border-radius: var(--ocloc-cc-radius-sm);
  border: 2px solid var(--ocloc-cc-primary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.ocloc-cc-btn--primary {
  background: var(--ocloc-cc-primary);
  color: #ffffff;
}
.ocloc-cc-btn--primary:hover {
  background: color-mix(in srgb, var(--ocloc-cc-primary) 88%, #000 12%);
  border-color: color-mix(in srgb, var(--ocloc-cc-primary) 88%, #000 12%);
}
.ocloc-cc-btn--ghost {
  background: var(--ocloc-cc-surface);
  color: var(--ocloc-cc-primary);
}
.ocloc-cc-btn--ghost:hover {
  background: color-mix(in srgb, var(--ocloc-cc-primary) 8%, #fff 92%);
}
.ocloc-cc-btn:focus-visible,
.ocloc-cc-link:focus-visible,
.ocloc-cc-modal__close:focus-visible,
.ocloc-cc-switch__input:focus-visible + .ocloc-cc-switch__track {
  outline: 3px solid color-mix(in srgb, var(--ocloc-cc-primary) 55%, #000 0%);
  outline-offset: 2px;
}

.ocloc-cc-link {
  color: var(--ocloc-cc-primary);
  text-decoration: underline;
  font-weight: 600;
}
.ocloc-cc-link:hover { text-decoration: none; }

/* ─────────────────────────────────────────────────────────────────────────────
   2ª CAPA — MODAL DE PREFERENCIAS
───────────────────────────────────────────────────────────────────────────── */
.ocloc-cc-noscroll { overflow: hidden; }

.ocloc-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483601;
  display: none;
  align-items: flex-end;           /* hoja inferior en móvil */
  justify-content: center;
  background: rgba(20, 23, 31, 0.55);
  font-family: var(--ocloc-cc-font);
  color: var(--ocloc-cc-text);
  padding: 0;
}
.ocloc-cc-modal--visible { display: flex; }

.ocloc-cc-modal__dialog {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--ocloc-cc-surface);
  border-radius: var(--ocloc-cc-radius) var(--ocloc-cc-radius) 0 0;
  box-shadow: 0 -10px 40px rgba(31, 34, 43, 0.25);
  overflow: hidden;
  animation: ocloc-cc-slide-up 0.22s ease;
}
@keyframes ocloc-cc-slide-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to   { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ocloc-cc-modal__dialog { animation: none; }
  .ocloc-cc-btn { transition: none; }
}

.ocloc-cc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--ocloc-cc-border);
}
.ocloc-cc-modal__title { margin: 0; font-size: 1.15rem; font-weight: 700; }
.ocloc-cc-modal__close {
  appearance: none;
  -webkit-appearance: none;
  width: 40px; height: 40px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 1.6rem; line-height: 1;
  color: var(--ocloc-cc-muted);
  background: transparent;
  border: 0;
  border-radius: var(--ocloc-cc-radius-sm);
  cursor: pointer;
}
.ocloc-cc-modal__close:hover { background: rgba(31, 34, 43, 0.06); color: var(--ocloc-cc-text); }

.ocloc-cc-modal__body {
  padding: 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ocloc-cc-modal__intro {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ocloc-cc-muted);
}

.ocloc-cc-row {
  padding: 14px 0;
  border-top: 1px solid var(--ocloc-cc-border);
}
.ocloc-cc-row:first-of-type { border-top: 0; }
.ocloc-cc-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.ocloc-cc-row__title { margin: 0; font-size: 0.98rem; font-weight: 700; }
.ocloc-cc-row__desc { margin: 0; font-size: 0.85rem; line-height: 1.5; color: var(--ocloc-cc-muted); }
.ocloc-cc-row__always {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ocloc-cc-primary);
  background: color-mix(in srgb, var(--ocloc-cc-primary) 10%, #fff 90%);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* Toggle accesible (checkbox real visualmente oculto pero enfocable). */
.ocloc-cc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}
.ocloc-cc-switch__input {
  position: absolute;
  width: 44px; height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.ocloc-cc-switch__track {
  position: relative;
  width: 44px; height: 26px;
  border-radius: 999px;
  background: #b8bfd0;
  transition: background-color 0.18s ease;
  flex: 0 0 auto;
}
.ocloc-cc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease;
}
.ocloc-cc-switch__input:checked + .ocloc-cc-switch__track { background: var(--ocloc-cc-primary); }
.ocloc-cc-switch__input:checked + .ocloc-cc-switch__track::after { transform: translateX(18px); }
.ocloc-cc-switch__label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ocloc-cc-modal__foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--ocloc-cc-border);
  background: var(--ocloc-cc-surface);
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ─────────────────────────────────────────────────────────────────────────────
   ESCRITORIO / TABLET — fila horizontal, modal centrado.
───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 720px) {
  .ocloc-cc-banner__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 20px;
  }
  .ocloc-cc-banner__text { flex: 1 1 auto; }
  .ocloc-cc-banner__actions {
    flex-direction: row;
    flex: 0 0 auto;
    align-items: center;
  }
  .ocloc-cc-btn { width: auto; min-width: 130px; }

  .ocloc-cc-modal { align-items: center; padding: 24px; }
  .ocloc-cc-modal__dialog { border-radius: var(--ocloc-cc-radius); }
  .ocloc-cc-modal__foot { flex-direction: row; justify-content: flex-end; }
  .ocloc-cc-modal__foot .ocloc-cc-btn { width: auto; min-width: 150px; }
}

/* Modo alto contraste (forzado por el SO). */
@media (forced-colors: active) {
  .ocloc-cc-btn { border: 2px solid ButtonText; }
  .ocloc-cc-switch__track { border: 1px solid ButtonText; }
}

/* Vista previa de quien lleva el negocio (tenant-page.php marca el <body> solo con un código de
   handoff válido): el aviso tapaba la vista previa de la app. No da consentimiento. */
body[data-otp-preview] .ocloc-cc-banner { display: none !important; }

