.cookie-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(17, 12, 8, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.cookie-consent-overlay.is-visible {
  z-index: 28;
  opacity: 1;
  pointer-events: auto;
}

.cookie-consent {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 0;
  width: min(34rem, calc(100vw - 2rem));
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(222, 82, 21, 0.08), transparent 38%),
    rgba(255, 253, 249, 0.98);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translate(-50%, 1rem);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 0s linear 220ms;
}

.cookie-consent.is-visible {
  z-index: 29;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translate(-50%, 0);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 0s linear 0s;
}

.cookie-consent__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cookie-consent__title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
}

.cookie-consent__description {
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
}

.cookie-consent__description a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

/* ── COOKIE CATEGORIES ── */

.cookie-consent__categories {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cookie-consent__category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
}

.cookie-consent__category + .cookie-consent__category {
  border-top: 1px solid var(--line);
}

.cookie-consent__category-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cookie-consent__category-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.cookie-consent__category-desc {
  font-size: 0.78rem;
  color: var(--text-muted, color-mix(in srgb, var(--text) 55%, transparent));
}

/* ── TOGGLE SWITCH ── */

.cookie-consent__toggle {
  position: relative;
  display: inline-block;
  width: 2.5rem;
  height: 1.4rem;
  flex-shrink: 0;
  cursor: pointer;
}

.cookie-consent__toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-consent__toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--line);
  transition: background 160ms ease;
}

.cookie-consent__toggle-track::after {
  content: '';
  position: absolute;
  top: 0.22rem;
  left: 0.22rem;
  width: 0.96rem;
  height: 0.96rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.cookie-consent__toggle input:checked + .cookie-consent__toggle-track {
  background: var(--accent);
}

.cookie-consent__toggle input:checked + .cookie-consent__toggle-track::after {
  transform: translateX(1.1rem);
}

.cookie-consent__toggle input:focus-visible + .cookie-consent__toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cookie-consent__toggle--locked {
  cursor: default;
  opacity: 0.45;
}

/* ── ACTIONS ── */

.cookie-consent__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.cookie-consent__button--full {
  grid-column: 1 / -1;
}

.cookie-consent__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-weight: 600;
  line-height: 1;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.cookie-consent__button:hover,
.cookie-consent__button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(222, 82, 21, 0.35);
}

.cookie-consent__button--primary {
  border-color: transparent;
  background: var(--accent);
  color: #ffffff;
}

.cookie-consent__button--primary:hover,
.cookie-consent__button--primary:focus-visible {
  background: var(--accent-dark);
}

.cookie-settings-button {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 27;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(222, 82, 21, 0.08), transparent 36%),
    rgba(255, 253, 249, 0.94);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.cookie-settings-button[hidden] {
  display: none;
}

.cookie-settings-button:hover,
.cookie-settings-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(222, 82, 21, 0.35);
}

.cookie-settings-button:focus-visible,
.cookie-consent__button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.cookie-settings-button__icon {
  width: 1.4rem;
  height: 1.4rem;
}

.cookie-consent-open {
  overflow: hidden;
}

[data-theme="dark"] .cookie-consent {
  background:
    linear-gradient(180deg, rgba(232, 67, 10, 0.08), transparent 38%),
    var(--su);
  border-color: var(--bd2);
  color: var(--tx);
}

[data-theme="dark"] .cookie-consent__description {
  color: var(--tx2);
}

[data-theme="dark"] .cookie-consent__description a {
  color: var(--tx);
}

[data-theme="dark"] .cookie-consent__button {
  background: var(--su2);
  border-color: var(--bd2);
  color: var(--tx);
}

[data-theme="dark"] .cookie-consent__button:hover,
[data-theme="dark"] .cookie-consent__button:focus-visible {
  border-color: var(--ac);
  background: var(--bg2);
}

[data-theme="dark"] .cookie-consent__button--primary {
  background: var(--ac);
  border-color: var(--ac);
  color: #fff;
}

[data-theme="dark"] .cookie-consent__button--primary:hover,
[data-theme="dark"] .cookie-consent__button--primary:focus-visible {
  background: var(--ac3);
  border-color: var(--ac3);
}

[data-theme="dark"] .cookie-consent__categories {
  border-color: var(--bd2);
}

[data-theme="dark"] .cookie-consent__category + .cookie-consent__category {
  border-color: var(--bd2);
}

[data-theme="dark"] .cookie-consent__category-name {
  color: var(--tx);
}

[data-theme="dark"] .cookie-consent__category-desc {
  color: var(--tx2);
}

[data-theme="dark"] .cookie-consent__toggle-track {
  background: var(--bd2);
}

[data-theme="dark"] .cookie-consent__toggle-track::after {
  background: var(--tx2);
}

[data-theme="dark"] .cookie-consent__toggle input:checked + .cookie-consent__toggle-track {
  background: var(--ac);
}

[data-theme="dark"] .cookie-consent__toggle input:checked + .cookie-consent__toggle-track::after {
  background: #fff;
}

[data-theme="dark"] .cookie-settings-button {
  background: var(--su);
  border-color: transparent;
  color: var(--tx);
}

[data-theme="dark"] .cookie-settings-button:hover,
[data-theme="dark"] .cookie-settings-button:focus-visible {
  border-color: var(--ac);
  background: var(--su2);
}

@media (max-width: 640px) {
  .cookie-consent {
    width: calc(100vw - 1rem);
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    transform: translate(0, 1rem);
  }

  .cookie-consent.is-visible {
    transform: translate(0, 0);
  }

  .cookie-consent__actions {
    grid-template-columns: 1fr;
  }

  .cookie-settings-button {
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-consent-overlay,
  .cookie-consent,
  .cookie-consent__button,
  .cookie-settings-button {
    transition: none;
  }
}
