/* Cookie consent — floating corner card. Uses landing/auth tokens. */

.cookie-banner {
  position: fixed;
  z-index: 190;
  inset-inline-end: 1.25rem;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  width: min(22rem, calc(100vw - 2rem));
  color: var(--on-background);
  font-family: var(--font);
  pointer-events: none;
}

.cookie-banner[hidden] {
  display: none;
}

/* Keep the last screen of content reachable above the fixed card. */
body:has(#cookie-banner:not([hidden])):not(:has(.auth-page)) {
  padding-bottom: var(--cookie-banner-space, 15rem);
}

body:has(#cookie-banner:not([hidden])) .auth-page {
  padding-bottom: calc(var(--cookie-banner-space, 15rem) + 0.75rem);
}

.cookie-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.15rem 0.85rem;
  border-radius: 12px;
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--primary-start) 12%, transparent), transparent 42%),
    var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 var(--glass-highlight);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
  animation: cookie-in 180ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.cookie-card[hidden] {
  display: none;
}

.cookie-card::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-start), var(--primary-end));
}

html[dir="rtl"] .cookie-card::before {
  background: linear-gradient(to left, var(--primary-start), var(--primary-end));
}

[data-theme="light"] .cookie-card {
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 var(--glass-highlight);
}

.cookie-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary-start);
}

.cookie-text,
.cookie-note {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--on-surface);
}

.cookie-note {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted, var(--on-surface-variant));
}

.cookie-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.cookie-btn {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 160ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    border-color 160ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    box-shadow 160ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    transform 160ms var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
}

.cookie-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-start), var(--primary-end));
  box-shadow: 0 4px 18px rgba(255, 61, 154, 0.28);
}

.cookie-btn-primary:hover {
  box-shadow: 0 8px 22px rgba(123, 97, 255, 0.38);
}

.cookie-btn-ghost {
  color: var(--on-background);
  background: var(--btn-ghost-bg);
  border-color: var(--outline);
}

.cookie-btn-ghost:hover {
  background: var(--btn-ghost-hover);
  border-color: color-mix(in srgb, var(--primary-start) 25%, var(--outline));
}

.cookie-btn:active {
  transform: scale(0.98);
}

.cookie-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.cookie-btn:focus-visible,
.cookie-link:focus-visible {
  outline: 2px solid var(--primary-start);
  outline-offset: 2px;
}

.cookie-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 0.15rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-start);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.cookie-link:hover {
  color: var(--primary-end);
}

.cookie-link:active {
  opacity: 0.8;
}

.cookie-pref {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  row-gap: 0.25rem;
  align-items: baseline;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--glass-border);
}

.cookie-pref-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.cookie-pref-state {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-muted, var(--on-surface-variant));
  white-space: nowrap;
}

.cookie-pref-desc {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted, var(--on-surface-variant));
}

.cookie-actions-single .cookie-btn {
  flex: 0 1 auto;
  min-width: 7.5rem;
}

@media (max-width: 480px) {
  .cookie-banner {
    inset-inline-end: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    width: min(22rem, calc(100vw - 1.5rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-card {
    animation: none;
  }

  .cookie-btn {
    transition: none;
  }
}

@keyframes cookie-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
