/* Growth UX layer: conversion-focused + app-like mobile interactions */
:root {
  --gx-accent: var(--cq-accent, #4f46e5);
  --gx-accent-2: var(--cq-accent-alt, #0891b2);
  --gx-bg: #0b1220;
  --gx-text: #f8fafc;
  --gx-muted: #cbd5e1;
  --gx-shadow: 0 10px 30px rgba(15, 23, 42, 0.26);
}

.gx-fade-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gx-mobile-sticky-cta {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 9998;
  width: min(480px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--gx-accent) 88%, #0f172a),
    color-mix(in srgb, var(--gx-accent-2) 82%, #0f172a)
  );
  color: var(--gx-text);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--gx-shadow), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 12px 14px;
  display: none;
}

.gx-mobile-sticky-cta__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.18);
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.gx-mobile-sticky-cta__close:hover {
  background: rgba(15, 23, 42, 0.3);
}

.gx-mobile-sticky-cta__row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.gx-mobile-sticky-cta__meta {
  min-width: 0;
  padding-right: 28px;
}

.gx-mobile-sticky-cta__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  text-wrap: balance;
}

.gx-mobile-sticky-cta__ticker {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(248, 250, 252, 0.88);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gx-mobile-sticky-cta__ticker.is-live::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 999px;
  background: #86efac;
  box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.65);
  animation: gxLivePulse 1.6s infinite;
  vertical-align: middle;
}

.gx-mobile-sticky-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: stretch;
}

.gx-mobile-sticky-cta__btn,
.gx-mobile-sticky-cta__install {
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 14px;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  justify-content: center;
}

.gx-mobile-sticky-cta__btn {
  flex: 1 1 auto;
  min-width: 0;
  background: #ffffff;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

body.qcm-dark .gx-mobile-sticky-cta__btn,
html[data-theme="dark"] .gx-mobile-sticky-cta__btn {
  background: linear-gradient(135deg, var(--gx-accent), var(--gx-accent-2));
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.38);
}

.gx-mobile-sticky-cta__install {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.gx-soft-paywall {
  position: fixed;
  inset: 0;
  z-index: 10005;
  display: none;
}

.gx-soft-paywall.is-visible {
  display: block;
}

.gx-soft-paywall__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(2px);
}

.gx-soft-paywall__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 460px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  padding: 18px;
}

body.qcm-dark .gx-soft-paywall__panel,
html[data-theme="dark"] .gx-soft-paywall__panel {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.gx-soft-paywall__title {
  margin: 0 0 8px;
  font-size: 20px;
  color: #0f172a;
}

body.qcm-dark .gx-soft-paywall__title,
html[data-theme="dark"] .gx-soft-paywall__title {
  color: #f8fafc;
}

.gx-soft-paywall__desc {
  margin: 0 0 12px;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
}

body.qcm-dark .gx-soft-paywall__desc,
html[data-theme="dark"] .gx-soft-paywall__desc {
  color: #cbd5e1;
}

.gx-soft-paywall__list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.gx-soft-paywall__item {
  font-size: 13px;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
}

body.qcm-dark .gx-soft-paywall__item,
html[data-theme="dark"] .gx-soft-paywall__item {
  color: #e2e8f0;
  background: #111c31;
  border-color: rgba(148, 163, 184, 0.25);
}

.gx-soft-paywall__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.gx-soft-paywall__cta {
  text-align: center;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
}

.gx-soft-paywall__cta--primary {
  background: linear-gradient(135deg, var(--gx-accent), #6d28d9);
  color: #fff !important;
}

.gx-soft-paywall__cta--secondary {
  background: #eef2ff;
  color: #3730a3;
}

body.qcm-dark .gx-soft-paywall__cta--secondary,
html[data-theme="dark"] .gx-soft-paywall__cta--secondary {
  background: #1e293b;
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.gx-soft-paywall__close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

body.qcm-dark .gx-soft-paywall__close,
html[data-theme="dark"] .gx-soft-paywall__close {
  color: #94a3b8;
}

.gx-bottom-nav {
  display: none;
}

.gx-install-prompt {
  position: fixed;
  right: 12px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 9997;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: var(--gx-shadow);
  padding: 10px 12px;
  width: min(90vw, 320px);
  display: none;
}

.gx-install-prompt.is-visible {
  display: block;
}

.gx-install-prompt__title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.gx-install-prompt__desc {
  margin: 0 0 10px;
  font-size: 12px;
  color: #334155;
}

.gx-install-prompt__actions {
  display: flex;
  gap: 8px;
}

.gx-install-prompt__btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.gx-install-prompt__btn--primary {
  background: #3730a3;
  color: #fff;
}

.gx-install-prompt__btn--ghost {
  background: #f1f5f9;
  color: #334155;
}

.gx-home-live {
  margin-top: 16px;
  background: linear-gradient(120deg, #0f172a, #1e293b 70%, #164e63);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
  padding: 14px;
}

.gx-home-live__title {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #93c5fd;
}

.gx-home-live__q {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.gx-home-live__opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Premium QCM preview option style */
.gx-home-live__opt {
  background: rgba(79, 70, 229, 0.10); /* indigo accent */
  border: 1.5px solid rgba(79, 70, 229, 0.22);
  color: #f8fafc;
  border-radius: 12px;
  font-size: 13px;
  padding: 11px 13px;
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.18s, border-color 0.18s, background 0.18s;
  box-shadow: none;
}
.gx-home-live__opt:hover, .gx-home-live__opt:focus {
  border-color: #6366f1;
  background: rgba(79, 70, 229, 0.18);
  box-shadow: 0 0 0 2px #6366f1, 0 2px 8px 0 rgba(79,70,229,0.10);
  outline: none;
}
.gx-home-live__opt:active {
  background: rgba(79, 70, 229, 0.28);
}

.gx-home-live__opt.is-right {
  border-color: #22d3ee;
  background: linear-gradient(90deg, #6366f1 60%, #22d3ee 100%);
  color: #0f172a;
  box-shadow: 0 0 0 2px #22d3ee, 0 2px 12px 0 rgba(34,211,238,0.13);
}

.gx-home-live__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.gx-home-live__cta {
  border-radius: 9px;
  font-size: 12px;
  padding: 8px 10px;
  text-decoration: none;
  font-weight: 700;
}

.gx-home-live__cta--primary {
  background: linear-gradient(90deg, #6366f1 60%, #22d3ee 100%);
  color: #fff;
  box-shadow: 0 2px 12px 0 rgba(79,70,229,0.13);
  border: none;
  transition: background 0.18s, box-shadow 0.18s;
}
.gx-home-live__cta--primary:hover, .gx-home-live__cta--primary:focus {
  background: linear-gradient(90deg, #4f46e5 60%, #0891b2 100%);
  box-shadow: 0 4px 18px 0 rgba(79,70,229,0.18);
  color: #fff;
}

.gx-home-live__cta--ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.gx-onboarding-focus {
  animation: gxPulseFocus 1.8s ease;
}

@keyframes gxPulseFocus {
  0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.36); }
  70% { box-shadow: 0 0 0 12px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

@keyframes gxLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(134, 239, 172, 0); }
  100% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0); }
}

@media (max-width: 900px) {
  .gx-mobile-sticky-cta {
    display: block;
  }

  .gx-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9996;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #0f172a;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .gx-bottom-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    padding: 4px 2px;
    border-radius: 8px;
    display: grid;
    gap: 4px;
  }

  .gx-bottom-nav a > span:first-child {
    font-size: 22px;
    line-height: 1;
  }

  .gx-bottom-nav a.is-active {
    color: #fff;
    background: rgba(99, 102, 241, 0.35);
  }

  body.gx-has-bottom-nav {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  body.gx-has-sticky-cta {
    padding-bottom: calc(126px + env(safe-area-inset-bottom));
  }

  body.gx-has-bottom-nav.gx-has-sticky-cta {
    padding-bottom: calc(176px + env(safe-area-inset-bottom));
  }

  /* Bulle messagerie : au-dessus de la barre d’onglets (évite de masquer QCM / Stats) */
  body.gx-has-bottom-nav .cq-chat-widget {
    bottom: calc(72px + env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
  }

  body.gx-has-bottom-nav.gx-has-sticky-cta .cq-chat-widget {
    bottom: calc(132px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .gx-fade-out,
  .gx-mobile-sticky-cta,
  .gx-soft-paywall,
  .gx-install-prompt {
    transition: none !important;
  }
}
