/**
 * Cookie consent — premium glass panel (flat transforms = reliable clicks)
 */

.cookie-consent {
  --cc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cc-duration: 0.2s;
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
}

.cookie-consent.is-active {
  pointer-events: auto;
}

.cookie-consent[hidden] {
  display: none !important;
}

.cookie-consent__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--cc-duration) var(--cc-ease);
}

.cookie-consent.is-visible .cookie-consent__backdrop {
  opacity: 1;
}

.cookie-consent__stage {
  position: fixed;
  left: 50%;
  bottom: max(var(--space-4, 1rem), env(safe-area-inset-bottom, 0px));
  z-index: 2;
  width: min(560px, calc(100vw - var(--space-8, 2rem)));
  max-height: calc(100vh - var(--header-height, 72px) - var(--space-8, 2rem));
  transform: translateX(-50%);
  pointer-events: auto;
}

.cookie-consent__panels {
  position: relative;
  width: 100%;
}

.cookie-consent__panels > .cookie-consent__panel {
  display: none;
  width: 100%;
  min-width: 0;
}

.cookie-consent__panels > .cookie-consent__panel.is-active {
  display: block;
  animation: cc-panel-in 0.24s var(--cc-ease) both;
}

@keyframes cc-panel-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.cookie-consent__fx {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cookie-consent__aurora {
  position: absolute;
  inset: -30% -15%;
  background:
    radial-gradient(ellipse 55% 45% at 20% 30%, rgba(16, 185, 129, 0.28), transparent 65%),
    radial-gradient(ellipse 50% 40% at 80% 20%, rgba(251, 191, 36, 0.22), transparent 60%);
  filter: blur(20px);
  opacity: 0.75;
  animation: cc-aurora-drift 16s ease-in-out infinite alternate;
}

@keyframes cc-aurora-drift {
  0% { transform: translate3d(-2%, 0, 0); }
  100% { transform: translate3d(2%, -3%, 0); }
}

.cookie-consent__orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: cc-orb-float 9s ease-in-out infinite;
}

.cookie-consent__orb--1 {
  width: 90px;
  height: 90px;
  top: -20px;
  left: -12px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35), transparent 70%);
}

.cookie-consent__orb--2 {
  width: 70px;
  height: 70px;
  top: 8px;
  right: -6px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.3), transparent 70%);
  animation-delay: -2.5s;
}

.cookie-consent__orb--3 {
  width: 56px;
  height: 56px;
  bottom: 16px;
  left: 42%;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.28), transparent 70%);
  animation-delay: -4s;
}

@keyframes cc-orb-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -6px, 0); }
}

.cookie-consent__panel {
  position: relative;
  z-index: 1;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.97) 0%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(236, 253, 245, 0.94) 100%
  );
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-radius: var(--radius-xl, 1rem);
  padding: clamp(1.15rem, 3.5vw, 1.5rem);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 20px 40px -12px rgba(5, 150, 105, 0.2),
    0 28px 56px -16px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(5, 150, 105, 0.14);
}

.cookie-consent__panel--settings.is-active {
  max-height: calc(100vh - var(--header-height, 72px) - 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cookie-consent__panel-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.45) 0%,
    transparent 42%,
    rgba(16, 185, 129, 0.06) 100%
  );
  opacity: 0.6;
  pointer-events: none;
}

.cookie-consent__panel-border {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.45),
    rgba(255, 255, 255, 0.25) 45%,
    rgba(251, 191, 36, 0.35)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.cookie-consent__body {
  position: relative;
  z-index: 2;
}

.cookie-consent__header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4, 1rem);
  align-items: start;
  margin-bottom: var(--space-5, 1.25rem);
}

.cookie-consent__icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-lg, 0.75rem);
  background: linear-gradient(145deg, rgba(5, 150, 105, 0.12), rgba(251, 191, 36, 0.1));
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: var(--color-primary, #059669);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.12);
}

.cookie-consent__icon svg {
  width: 36px;
  height: 36px;
  pointer-events: none;
}

.cookie-consent__title {
  font-size: clamp(1.125rem, 2.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  color: var(--color-text, #0f172a);
}

.cookie-consent__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text-secondary, #475569);
}

.cookie-consent__link {
  color: var(--color-primary, #059669);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
  z-index: 10;
}

.cookie-consent__panel .btn,
.cookie-consent__back,
.cookie-consent__switch {
  position: relative;
  z-index: 11;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

/* Override bundled legacy rules on production */
#cookie-consent-root.is-active .cookie-consent__stage,
#cookie-consent-root.is-active .cookie-consent__panels,
#cookie-consent-root.is-active .cookie-consent__panel.is-active,
#cookie-consent-root.is-active .cookie-consent__body,
#cookie-consent-root.is-active .cookie-consent__actions,
#cookie-consent-root.is-active .btn,
#cookie-consent-root.is-active [data-cookie-action],
#cookie-consent-root.is-active [data-cookie-open-settings],
#cookie-consent-root.is-active [data-cookie-back] {
  pointer-events: auto !important;
}

#cookie-consent-root.is-active .cookie-consent__panel {
  transform: none !important;
  perspective: none !important;
}

.cookie-consent__actions--settings {
  margin-top: var(--space-4, 1rem);
  padding-top: var(--space-3, 0.75rem);
  border-top: 1px solid rgba(5, 150, 105, 0.12);
}

.cookie-consent__btn {
  flex: 1 1 auto;
  min-width: 7.5rem;
  font-weight: 600;
}

.cookie-consent__btn--glass {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(5, 150, 105, 0.22);
  color: var(--color-text, #0f172a);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.cookie-consent__btn--glass:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(5, 150, 105, 0.35);
}

.cookie-consent__btn--text {
  flex: 1 1 100%;
  background: transparent;
  border: none;
  color: var(--color-text-secondary, #64748b);
  box-shadow: none;
  min-width: auto;
}

.cookie-consent__btn--text:hover {
  color: var(--color-primary, #059669);
  background: rgba(5, 150, 105, 0.06);
}

.cookie-consent__settings-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: var(--space-4, 1rem);
}

.cookie-consent__settings-intro {
  flex: 1;
  min-width: 0;
}

.cookie-consent__settings-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary, #059669);
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.cookie-consent__settings-sub {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-secondary, #64748b);
}

.cookie-consent__settings-note {
  margin: 0 0 var(--space-3, 0.75rem);
  font-size: 0.75rem;
  color: var(--color-text-muted, #94a3b8);
  text-align: center;
}

.cookie-consent__back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-md, 0.5rem);
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text, #0f172a);
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

.cookie-consent__back:hover {
  background: #fff;
  transform: translateX(-2px);
}

.cookie-consent__categories {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cookie-consent__category {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg, 0.75rem);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cookie-consent__category:hover {
  border-color: rgba(5, 150, 105, 0.2);
}

.cookie-consent__category.is-enabled {
  border-color: rgba(5, 150, 105, 0.32);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.92), rgba(255, 255, 255, 0.9));
}

.cookie-consent__category--essential {
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.95), rgba(255, 255, 255, 0.88));
  border-color: rgba(5, 150, 105, 0.18);
}

.cookie-consent__category-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md, 0.5rem);
  background: rgba(5, 150, 105, 0.1);
  color: var(--color-primary, #059669);
  flex-shrink: 0;
}

.cookie-consent__category-icon svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.cookie-consent__category-icon--functional {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.cookie-consent__category-icon--analytics {
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
}

.cookie-consent__category-info h3 {
  margin: 0 0 0.2rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text, #0f172a);
}

.cookie-consent__category-info p {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--color-text-secondary, #64748b);
}

.cookie-consent__always {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-primary, #059669);
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  background: rgba(5, 150, 105, 0.1);
  border-radius: 999px;
}

.cookie-consent__switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
}

.cookie-consent__switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.cookie-consent__switch-track {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
  border: 1px solid rgba(15, 23, 42, 0.1);
  transition: background 0.2s ease;
  position: relative;
  pointer-events: none;
}

.cookie-consent__switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.cookie-consent__switch input:checked + .cookie-consent__switch-track {
  background: var(--gradient-primary, linear-gradient(135deg, #059669, #10b981));
}

.cookie-consent__switch input:checked + .cookie-consent__switch-track::after {
  transform: translateX(20px);
}

.cookie-consent__switch input:focus-visible + .cookie-consent__switch-track {
  outline: 2px solid var(--color-primary, #059669);
  outline-offset: 2px;
}

body.cookie-consent-open {
  overflow: hidden;
}

.footer--premium .footer__legal-btn {
  font-size: var(--text-sm);
  color: rgba(148, 163, 184, 0.95);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
  touch-action: manipulation;
}

.footer--premium .footer__legal-btn:hover {
  color: #6ee7b7;
}

@media (max-width: 520px) {
  .cookie-consent__stage {
    width: calc(100vw - var(--space-4, 1rem));
    bottom: max(var(--space-3, 0.75rem), env(safe-area-inset-bottom, 0px));
  }

  .cookie-consent__btn {
    min-width: 100%;
  }

  .cookie-consent__actions--settings .cookie-consent__btn {
    min-width: 100%;
  }

  .cookie-consent__category {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .cookie-consent__category .cookie-consent__switch,
  .cookie-consent__category .cookie-consent__always {
    grid-column: 2;
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-consent__aurora,
  .cookie-consent__orb,
  .cookie-consent__icon {
    animation: none !important;
  }

  .cookie-consent__panels > .cookie-consent__panel.is-active {
    animation: none;
  }
}
