/* Banner de preferencias de cookies (necesarias / terceros-analítica) */

.cookie-banner {
  position: fixed;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: var(--z-cookie-banner);
  max-width: 460px;
  margin-left: auto;
  background: var(--color-bg-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cookie-banner.hidden {
  display: none;
}

.cookie-banner > p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.cookie-banner > p a {
  color: var(--color-primary-text);
}

.cookie-categoria {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.cookie-categoria__cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.cookie-categoria__cabecera label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.cookie-categoria__desc {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* Interruptor accesible construido sobre un checkbox real */
.cookie-categoria__cabecera input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--color-border);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.cookie-categoria__cabecera input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-chalk-card);
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease;
}

.cookie-categoria__cabecera input[type="checkbox"]:checked {
  background: var(--color-primary);
}

.cookie-categoria__cabecera input[type="checkbox"]:checked::before {
  transform: translateX(18px);
}

.cookie-categoria__cabecera input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.cookie-categoria__cabecera input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.cookie-banner__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .cookie-categoria__cabecera input[type="checkbox"],
  .cookie-categoria__cabecera input[type="checkbox"]::before {
    transition: none;
  }
}

@media (max-width: 520px) {
  .cookie-banner {
    left: var(--space-3);
    right: var(--space-3);
    bottom: var(--space-3);
    max-width: none;
  }
}
