:root {
  --consent-bg: #000000;
  --consent-text: #f5f5f7;
  --consent-muted: rgba(235, 235, 239, 0.6);
  --consent-border: rgba(255, 255, 255, 0.07);
  --consent-shadow:
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ── Root pill container ──────────────────────────────── */
.consent-root {
  position: fixed;
  right: clamp(12px, 2.4vw, 24px);
  bottom: clamp(12px, 2.4vw, 24px);
  z-index: 1201;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.consent-root.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Shell (pill shape) ───────────────────────────────── */
.consent-shell {
  background: var(--consent-bg);
  border-radius: 999px;
  box-shadow: var(--consent-shadow);
  overflow: clip;
}

/* ── Pill row layout ──────────────────────────────────── */
.consent-pill-row {
  display: flex;
  align-items: center;
  min-height: 46px;
}

/* ── Trigger button (cookie icon + text) ─────────────── */
.consent-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 14px;
  border: none;
  background: transparent;
  color: var(--consent-text);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  min-height: 46px;
  transition: opacity 200ms ease;
}

.consent-trigger:hover {
  opacity: 0.72;
}

.consent-trigger:active {
  transform: scale(0.98);
}

.consent-customize-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--consent-muted);
  flex-shrink: 0;
}

.consent-customize-icon svg {
  width: 18px;
  height: 18px;
}

.consent-copy {
  color: var(--consent-muted);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* ── Quick action buttons (first visit) ──────────────── */
.consent-quick-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 2px;
}

.consent-quick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--consent-text);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 200ms ease,
    transform 200ms ease;
}

.consent-quick-btn:hover {
  background: rgba(255, 255, 255, 0.17);
}

.consent-quick-btn:active {
  transform: scale(0.97);
}

.consent-quick-btn.primary {
  background: rgba(245, 245, 247, 0.95);
  color: #141416;
}

.consent-quick-btn.primary:hover {
  background: #ffffff;
}

/* ── Backdrop (mobile only) ───────────────────────────── */
.consent-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .consent-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1201;
    background: rgba(22, 22, 22, 0.82);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .consent-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Panel container ──────────────────────────────────── */
.consent-panel-root {
  position: fixed;
  right: clamp(12px, 2.4vw, 24px);
  bottom: clamp(12px, 2.4vw, 24px);
  z-index: 1202;
  width: min(300px, calc(100vw - 24px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  transform: translateY(6px);
}

.consent-panel-root.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ── Panel shell ──────────────────────────────────────── */
.consent-panel-shell {
  background: var(--consent-bg);
  border-radius: 20px;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 16px 48px rgba(0, 0, 0, 0.4);
  overflow: clip;
}

/* ── Panel content ────────────────────────────────────── */
.consent-panel {
  padding: 18px 16px 14px;
}

.consent-panel-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--consent-border);
  margin-bottom: 4px;
}

.consent-title {
  margin: 0;
  color: var(--consent-text);
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.consent-items {
  display: flex;
  flex-direction: column;
}

.consent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--consent-border);
  gap: 12px;
}

.consent-item:last-child {
  border-bottom: none;
}

.consent-item-label {
  color: var(--consent-text);
  font-size: 0.79rem;
  font-weight: 400;
  cursor: default;
  user-select: none;
}

label.consent-item-label {
  cursor: pointer;
}

.consent-always-on {
  color: var(--consent-muted);
  font-size: 0.71rem;
  letter-spacing: 0.01em;
}

/* ── Toggle switch ────────────────────────────────────── */
.consent-switch {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.consent-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.consent-slider {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  position: relative;
  transition: background-color 220ms ease;
}

.consent-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.consent-switch input:checked + .consent-slider {
  background: rgba(255, 255, 255, 0.9);
}

.consent-switch input:checked + .consent-slider::after {
  transform: translateX(18px);
  background: #151517;
}

.consent-switch input:disabled + .consent-slider {
  opacity: 0.38;
  cursor: not-allowed;
}

/* ── Panel footer ─────────────────────────────────────── */
.consent-footer-actions {
  margin-top: 14px;
}

.consent-action {
  width: 100%;
  min-height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(245, 245, 247, 0.94);
  color: #141416;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background-color 200ms ease,
    transform 200ms ease;
}

.consent-action:hover {
  background: #ffffff;
}

.consent-action:active {
  transform: scale(0.99);
}


/* ── Footer permanent link ─────────────────────────────── */
/* #consentFooterLink vive siempre en .copyright (HTML estático).
   El consent-root ya no se mueve al footer dinámicamente.    */
.consent-footer-link {
  -webkit-appearance: none;
  appearance: none;
  display: inline;
  padding: 0;
  border: none;
  background: transparent;
  outline: none;
  box-shadow: none;
  font: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast, 150ms ease);
}

.consent-footer-link:hover,
.consent-footer-link[aria-pressed="true"] {
  color: rgba(255, 255, 255, 0.65);
}

/* ── Shake animation (panel ya abierto, se vuelve a pulsar) */
@keyframes consent-panel-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  45%       { transform: translateX(4px); }
  65%       { transform: translateX(-3px); }
  82%       { transform: translateX(2px); }
}

.consent-panel-root.is-shaking {
  animation: consent-panel-shake 320ms ease;
}

/* ── Mobile adjustments ───────────────────────────────── */
@media (max-width: 768px) {
  .consent-root {
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    width: auto;
  }

  .consent-shell {
    width: 100%;
  }

  .consent-pill-row {
    flex-wrap: wrap;
    min-height: auto;
    padding: 8px 6px;
    gap: 6px;
  }

  .consent-trigger {
    min-height: auto;
    padding: 2px 6px 2px 8px;
    flex: 1;
  }

  .consent-quick-btns {
    padding: 0;
    gap: 5px;
  }

  .consent-quick-btn {
    height: 32px;
    padding: 0 12px;
    font-size: 0.72rem;
  }

  .consent-panel-root {
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
    width: auto;
  }

}

@media (max-width: 480px) {
  .consent-footer-link {
    font-size: 0.75rem;
  }
}

@media (max-width: 320px) {
  .consent-copy {
    display: none;
  }
}


/* ── Reduce Transparency fallbacks ───────────────────────── */
/* Con "Reduce Transparency" activo los fondos translúcidos se
   camuflan. Usamos fondos sólidos (sin bordes) para mantener
   la distinción visual, igual que el dynamic island. */
@media (prefers-reduced-transparency: reduce) {
  .consent-quick-btn {
    background: #303030;
  }

  .consent-quick-btn:hover {
    background: #3a3a3a;
  }

  .consent-slider {
    background: #404040;
  }
}

@media (prefers-reduced-motion: reduce) {
  .consent-root,
  .consent-panel-root,
  .consent-trigger,
  .consent-quick-btn,
  .consent-action,
  .consent-slider,
  .consent-slider::after {
    transition: none !important;
  }
}
