/* =======================================================================
   NEXORYA — Cookie consent banner
   Loi 25 (Québec) + RGPD compliant: explicit consent, granular categories,
   reject = essentials only, re-openable preferences, version-aware.
   ======================================================================= */

.nx-consent-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.nx-consent-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.nx-consent {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 24px);
  width: min(720px, calc(100% - 32px));
  z-index: 9999;
  background:
    linear-gradient(145deg,
      rgba(139, 92, 246, 0.10) 0%,
      rgba(6, 182, 212, 0.05) 50%,
      rgba(225, 0, 255, 0.06) 100%),
    rgba(10, 10, 15, 0.92);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  padding: 24px 28px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 0 60px rgba(139, 92, 246, 0.25),
    0 30px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(.2, .9, .25, 1);
}
.nx-consent.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.nx-consent__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nx-consent__brand img {
  height: 18px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.5)) drop-shadow(0 0 20px rgba(122, 38, 251, 0.25));
  opacity: 0.92;
}
.nx-consent__brand-tag {
  margin-left: auto;
  font-family: 'Anton', sans-serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(199, 202, 255, 0.65);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(139, 92, 246, 0.30);
  background: rgba(139, 92, 246, 0.08);
}

.nx-consent__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 10px;
}
.nx-consent__icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.55) 0%, rgba(6, 182, 212, 0.28) 50%, rgba(225, 0, 255, 0.18) 100%),
    rgba(10, 10, 15, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 18px rgba(139, 92, 246, 0.4),
    0 0 32px rgba(6, 182, 212, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.nx-consent__icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 80%, rgba(225, 0, 255, 0.35) 0%, transparent 60%);
  opacity: 0.7;
}
.nx-consent__icon svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}
.nx-consent__title {
  font-family: 'Anton', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 6px 0 0;
}
.nx-consent__title .grad {
  background: linear-gradient(115deg, #ffffff 0%, #c7caff 30%, #8b5cf6 55%, #06b6d4 80%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nx-consent__body {
  font-size: 13.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 16px;
}
.nx-consent__body a {
  color: #c7b5ff;
  text-decoration: underline;
  text-decoration-color: rgba(199, 181, 255, 0.35);
  text-underline-offset: 2px;
}
.nx-consent__body a:hover { color: #ffffff; }

.nx-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
/* Paired actions = Refuser tout / Accepter tout, EQUAL visual weight
   (Loi 25 art. 14 + CNIL/CJEU "Planet49": refuse must be as easy as accept). */
.nx-consent__actions--paired {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.nx-consent__actions--secondary {
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  margin-top: 4px;
}

.nx-consent__btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 13px 22px;
  border-radius: 100px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
/* Equal-weight buttons: same size, same prominence, same hover states.
   Both use a glass/gradient surface, distinguished only by label and a
   subtle stroke difference — refusing must NOT cost more clicks or visual
   effort than accepting. */
.nx-consent__btn--equal {
  width: 100%;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(6, 182, 212, 0.10) 60%, rgba(225, 0, 255, 0.10)),
    rgba(10, 10, 15, 0.55);
  color: #ffffff;
  border: 1.5px solid rgba(139, 92, 246, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 18px rgba(139, 92, 246, 0.18),
    0 6px 14px rgba(0, 0, 0, 0.25);
}
.nx-consent__btn--equal:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 0 26px rgba(139, 92, 246, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.35);
}
.nx-consent__btn--primary {
  background: linear-gradient(120deg, #7a26fb 0%, #06b6d4 100%);
  color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.25) inset,
    0 0 20px rgba(139, 92, 246, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.3);
}
.nx-consent__btn--primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.3) inset,
    0 0 28px rgba(139, 92, 246, 0.55),
    0 10px 22px rgba(0, 0, 0, 0.4);
}
.nx-consent__btn--ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  border: none;
  padding: 8px 0;
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
  text-underline-offset: 3px;
}
.nx-consent__btn--ghost:hover { color: #ffffff; }

/* ===== Preferences expanded view ===== */
.nx-consent__prefs {
  display: none;
  margin: 14px 0 8px;
  padding: 16px 0 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nx-consent.is-prefs .nx-consent__prefs { display: block; }
.nx-consent.is-prefs .nx-consent__intro { display: none; }

.nx-consent__cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nx-consent__cat:last-child { border-bottom: 0; }
.nx-consent__cat-info { flex: 1; }
.nx-consent__cat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 4px;
}
.nx-consent__cat-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}
.nx-consent__cat-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  vertical-align: 1px;
}

/* Toggle switch */
.nx-toggle {
  flex-shrink: 0;
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.25s ease;
}
.nx-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.25s cubic-bezier(.2, .9, .25, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.nx-toggle.is-on {
  background: linear-gradient(120deg, #7a26fb, #06b6d4);
}
.nx-toggle.is-on::after { transform: translateX(18px); }
.nx-toggle.is-locked {
  background: rgba(34, 197, 94, 0.35);
  cursor: not-allowed;
  opacity: 0.85;
}
.nx-toggle.is-locked::after { transform: translateX(18px); }

/* ===== Floating preferences trigger (after consent given) ===== */
.nx-consent-trigger {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 9990;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background:
    radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.35) 0%, rgba(6, 182, 212, 0.18) 60%, rgba(10, 10, 15, 0.92) 100%),
    rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 18px rgba(139, 92, 246, 0.25),
    0 8px 22px rgba(0, 0, 0, 0.4);
  padding: 0;
}
.nx-consent-trigger.is-visible { display: flex; }
.nx-consent-trigger svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 4px rgba(199, 181, 255, 0.5));
}
.nx-consent-trigger:hover {
  border-color: rgba(139, 92, 246, 0.7);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 26px rgba(139, 92, 246, 0.45),
    0 0 50px rgba(6, 182, 212, 0.18),
    0 12px 28px rgba(0, 0, 0, 0.45);
}

/* ===== Dynamic palette alignment ===== */
.nx-consent {
  background:
    linear-gradient(145deg,
      rgba(122, 38, 251, 0.12) 0%,
      rgba(6, 182, 212, 0.07) 48%,
      rgba(200, 253, 131, 0.05) 100%),
    rgba(5, 7, 13, 0.94);
  border-color: rgba(182, 220, 254, 0.20);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 0 64px rgba(122, 38, 251, 0.22),
    0 30px 60px rgba(0, 0, 0, 0.62);
}

.nx-consent__brand-tag {
  color: rgba(182, 220, 254, 0.78);
  border-color: rgba(182, 220, 254, 0.26);
  background: rgba(6, 182, 212, 0.08);
}

.nx-consent__icon {
  background:
    linear-gradient(135deg, rgba(122, 38, 251, 0.44), rgba(6, 182, 212, 0.24), rgba(200, 253, 131, 0.16)),
    rgba(5, 7, 13, 0.76);
  border-color: rgba(182, 220, 254, 0.32);
}

.nx-consent__title .grad {
  background: linear-gradient(135deg, #c8fd83 0%, #b6dcfe 38%, #8b5cf6 70%, #f2c3d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.nx-consent__btn--equal {
  background:
    linear-gradient(135deg, rgba(122, 38, 251, 0.18), rgba(6, 182, 212, 0.10) 58%, rgba(200, 253, 131, 0.08)),
    rgba(5, 7, 13, 0.58);
  border-color: rgba(182, 220, 254, 0.30);
}

.nx-consent__btn--equal:hover {
  border-color: rgba(200, 253, 131, 0.42);
}

.nx-consent__btn--primary,
.nx-toggle.is-on {
  background: linear-gradient(135deg, #7a26fb 0%, #8b5cf6 38%, #06b6d4 76%, #c8fd83 112%);
}

.nx-consent-trigger {
  border-color: rgba(182, 220, 254, 0.30);
  background:
    linear-gradient(135deg, rgba(122, 38, 251, 0.24), rgba(6, 182, 212, 0.16), rgba(5, 7, 13, 0.92)),
    rgba(5, 7, 13, 0.92);
}

/* ===== Performance-lite ===== */
html.perf-lite .nx-consent-backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition-duration: 0.18s;
}

html.perf-lite .nx-consent {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 20px 44px rgba(0, 0, 0, 0.56);
  transition-duration: 0.2s;
}

html.perf-lite .nx-consent__brand img,
html.perf-lite .nx-consent__icon svg,
html.perf-lite .nx-consent-trigger svg {
  filter: none;
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
  .nx-consent-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nx-consent {
    bottom: 12px;
    width: calc(100% - 16px);
    padding: 20px 20px;
    border-radius: 18px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .nx-consent__actions--paired {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .nx-consent__btn { text-align: center; }
  .nx-consent-trigger.is-visible { display: none; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .nx-consent, .nx-consent-backdrop, .nx-toggle, .nx-toggle::after {
    transition: none !important;
  }
}
