/* ============================================================
   PrismaXWeb — Estilos de la gestión de consentimiento
   ------------------------------------------------------------
   Autocontenido y con prefijo pxw- para no colisionar con
   styles.css ni con aima.css. Funciona igual sobre la home
   (fondo claro) y sobre las landings AIMA (fondo oscuro).

   Requisito de accesibilidad: los tres botones del banner
   tienen el mismo peso visual y un área táctil mínima de
   44 x 44 px CSS.
   ============================================================ */

:root {
  --pxw-cc-panel: #0F172A;
  --pxw-cc-panel-2: #16213A;
  --pxw-cc-text: #E2E8F0;
  --pxw-cc-muted: #A8B4C8;
  --pxw-cc-border: rgba(255, 255, 255, 0.14);
  --pxw-cc-accent: #38BDF8;
  --pxw-cc-accent-ink: #06263A;
}

/* ══════════════════════════════════════════════════════════
   BANNER
   ══════════════════════════════════════════════════════════ */

.pxw-cc {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  background: var(--pxw-cc-panel);
  border-top: 1px solid var(--pxw-cc-border);
  box-shadow: 0 -18px 40px -24px rgba(0, 0, 0, 0.8);
  font-family: inherit;
  animation: pxw-cc-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pxw-cc-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.pxw-cc-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.pxw-cc-copy { flex: 1 1 auto; min-width: 0; }

.pxw-cc-title {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--pxw-cc-accent);
}

.pxw-cc-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--pxw-cc-muted);
}

.pxw-cc-text a {
  color: var(--pxw-cc-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pxw-cc-text a:hover,
.pxw-cc-text a:focus-visible { color: var(--pxw-cc-accent); }

.pxw-cc-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 0.6rem;
}

/* Los tres botones comparten tamaño, tipografía y área táctil.
   Solo cambia el relleno de color, nunca la prominencia. */
.pxw-cc-btn {
  min-height: 44px;
  min-width: 112px;
  padding: 0.7rem 1.15rem;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--pxw-cc-text);
  background: transparent;
  border: 1px solid var(--pxw-cc-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pxw-cc-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.28);
}

.pxw-cc-btn:focus-visible {
  outline: 2px solid var(--pxw-cc-accent);
  outline-offset: 2px;
}

.pxw-cc-btn--primary {
  color: var(--pxw-cc-accent-ink);
  background: var(--pxw-cc-accent);
  border-color: var(--pxw-cc-accent);
  font-weight: 600;
}

.pxw-cc-btn--primary:hover {
  background: #7DD3FC;
  border-color: #7DD3FC;
}

/* Las dos decisiones vinculantes del banner (Rechazar y Aceptar)
   comparten estilo exacto: mismo color, mismo peso, mismo tamaño.
   Aceptar no recibe ningún refuerzo visual sobre Rechazar. */
.pxw-cc-btn--decide {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.34);
  font-weight: 600;
}

.pxw-cc-btn--decide:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--pxw-cc-accent);
}

/* ── Banner en móvil ──
   Se apila el texto sobre los botones y los tres botones
   reparten el ancho a partes iguales. */
@media (max-width: 860px) {
  .pxw-cc-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
  }

  /* El rótulo pasa a ir en línea con el texto para no gastar una
     línea entera del banner en móvil. */
  .pxw-cc-title {
    display: inline;
    margin: 0 0.4rem 0 0;
    font-size: 0.72rem;
  }

  .pxw-cc-text { display: inline; font-size: 0.79rem; line-height: 1.45; }

  .pxw-cc-actions { gap: 0.45rem; }

  .pxw-cc-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.6rem 0.4rem;
    font-size: 0.8rem;
  }
}

/* ══════════════════════════════════════════════════════════
   PANEL DE PREFERENCIAS
   ══════════════════════════════════════════════════════════ */

body.pxw-cm-open { overflow: hidden; }

.pxw-cm {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.pxw-cm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 9, 20, 0.72);
  backdrop-filter: blur(3px);
}

.pxw-cm-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  background: var(--pxw-cc-panel);
  border: 1px solid var(--pxw-cc-border);
  border-radius: 14px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
  animation: pxw-cc-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pxw-cm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem 1rem;
  border-bottom: 1px solid var(--pxw-cc-border);
}

.pxw-cm-title {
  margin: 0;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.pxw-cm-title:focus-visible {
  outline: 2px solid var(--pxw-cc-accent);
  outline-offset: 4px;
}

.pxw-cm-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--pxw-cc-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.pxw-cm-close:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }

.pxw-cm-close:focus-visible {
  outline: 2px solid var(--pxw-cc-accent);
  outline-offset: 2px;
}

.pxw-cm-body { padding: 0.4rem 1.4rem 0.2rem; }

.pxw-cm-cat {
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pxw-cm-cat:last-child { border-bottom: 0; }

.pxw-cm-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.pxw-cm-cat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

label.pxw-cm-cat-name { cursor: pointer; }

.pxw-cm-cat-fixed {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pxw-cc-muted);
  border: 1px solid var(--pxw-cc-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

.pxw-cm-cat-desc {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--pxw-cc-muted);
}

.pxw-cm-cat-desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: var(--pxw-cc-text);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}

/* Interruptor accesible: el <input> real conserva el foco y el
   nombre accesible; el deslizador es puramente decorativo. */
.pxw-cm-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 44px;
  cursor: pointer;
}

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

.pxw-cm-slider {
  pointer-events: none;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--pxw-cc-border);
  transition: background 0.22s ease, border-color 0.22s ease;
}

.pxw-cm-slider::after {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.pxw-cm-switch input:checked + .pxw-cm-slider {
  background: var(--pxw-cc-accent);
  border-color: var(--pxw-cc-accent);
}

.pxw-cm-switch input:checked + .pxw-cm-slider::after { transform: translateX(24px); }

.pxw-cm-switch input:focus-visible + .pxw-cm-slider {
  outline: 2px solid var(--pxw-cc-accent);
  outline-offset: 3px;
}

.pxw-cm-foot {
  display: flex;
  gap: 0.6rem;
  padding: 1.1rem 1.4rem 1.35rem;
  border-top: 1px solid var(--pxw-cc-border);
}

.pxw-cm-foot .pxw-cc-btn { flex: 1 1 0; min-width: 0; }

@media (max-width: 520px) {
  .pxw-cm { padding: 0.9rem; }
  .pxw-cm-head { padding: 1.1rem 1.1rem 0.9rem; }
  .pxw-cm-body { padding: 0.3rem 1.1rem 0.2rem; }
  .pxw-cm-foot { padding: 1rem 1.1rem 1.2rem; flex-direction: column; }
  .pxw-cm-foot .pxw-cc-btn { width: 100%; }
}

/* ══════════════════════════════════════════════════════════
   ENLACE "PREFERENCIAS DE COOKIES" DEL FOOTER
   Hereda el color del footer donde se inserte; solo se
   garantiza el área táctil y el foco visible.
   ══════════════════════════════════════════════════════════ */

[data-pxw-open] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

[data-pxw-open]:focus-visible {
  outline: 2px solid var(--pxw-cc-accent);
  outline-offset: 3px;
}

/* En los pies de la home y de las landings AIMA el botón vive dentro
   de una lista de enlaces: se le da el mismo aspecto que a sus vecinos
   (styles.css → .footer-col a). */
.footer-col li > [data-pxw-open] {
  font-size: 0.87rem;
  font-weight: 300;
  color: var(--muted, #94A3B8);
  transition: color 0.2s;
}

.footer-col li > [data-pxw-open]:hover { color: var(--accent, #1D4ED8); }

/* En las páginas legales el pie es una sola línea de enlaces.
   Se conserva el área táctil de 44 px: la línea crece un poco, pero el
   control sigue siendo cómodo de pulsar en móvil. */
footer p > [data-pxw-open] {
  color: var(--accent, #1D4ED8);
  vertical-align: middle;
}

footer p > [data-pxw-open]:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   MOVIMIENTO REDUCIDO
   ══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .pxw-cc,
  .pxw-cm-panel { animation: none; }

  .pxw-cc-btn,
  .pxw-cm-close,
  .pxw-cm-slider,
  .pxw-cm-slider::after { transition: none; }
}
