/**
 * CampusQCM — Premium Popup Modals
 * 1. Signup Invitation (non-logged users, once per session)
 * 2. Daily Rewards Claim (logged-in users, once per day)
 *
 * Uses design-system.css tokens. Supports dark mode (body.qcm-dark).
 * z-index: 10001 (above correction-modal at 10000).
 *
 * @package CampusQCM
 * @version 1.0.0
 */

/* ═══════════════════════════════════════════
   SHARED — Overlay, backdrop, base card
   ═══════════════════════════════════════════ */

.cq-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--cq-space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s cubic-bezier(.4, 0, .2, 1),
              visibility .4s cubic-bezier(.4, 0, .2, 1);
}

.cq-popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Backdrop */
.cq-popup-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
  backdrop-filter: blur(8px) saturate(1.2);
}

/* Card base */
.cq-popup-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--cq-surface);
  border: 1px solid var(--cq-border);
  border-radius: var(--cq-radius-xl);
  box-shadow: var(--cq-shadow-xl),
              0 0 0 1px rgba(255, 255, 255, .04);
  overflow: hidden;
  transform: translateY(24px) scale(.97);
  opacity: 0;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1),
              opacity .4s cubic-bezier(.4, 0, .2, 1);
}

.cq-popup-overlay.is-visible .cq-popup-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Exit animation */
.cq-popup-overlay.is-closing {
  opacity: 0;
  transition: opacity .3s ease;
}

.cq-popup-overlay.is-closing .cq-popup-card {
  transform: translateY(16px) scale(.96);
  opacity: 0;
  transition: transform .3s ease, opacity .25s ease;
}

/* Close button (shared) */
.cq-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: var(--cq-radius-full);
  color: var(--cq-text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.cq-popup-close:hover {
  background: rgba(255, 255, 255, .14);
  color: var(--cq-text);
  transform: scale(1.08);
}

.cq-popup-close:active {
  transform: scale(.95);
}

/* Dark mode card overrides */
body.qcm-dark .cq-popup-card,
[data-theme="dark"] .cq-popup-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, .08);
  box-shadow: 0 24px 48px rgba(0, 0, 0, .5),
              0 0 0 1px rgba(255, 255, 255, .04),
              0 0 80px -20px rgba(99, 102, 241, .12);
}


/* ═══════════════════════════════════════════
   POPUP 1 — SIGNUP INVITATION
   ═══════════════════════════════════════════ */

/* Decorative header gradient bar */
.cq-signup-popup .cq-popup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--cq-primary), #8b5cf6, var(--cq-primary-light));
  background-size: 200% 100%;
  animation: cq-gradient-shift 3s ease infinite;
}

@keyframes cq-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Header area with subtle glow */
.cq-signup-header {
  position: relative;
  padding: 32px 28px 0;
  text-align: center;
}

/* Ambient glow behind emoji/icon */
.cq-signup-header::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(99, 102, 241, .2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.cq-signup-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--cq-primary), #8b5cf6);
  border-radius: 16px;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, .3);
  animation: cq-icon-float 3s ease-in-out infinite;
}

@keyframes cq-icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.cq-signup-title {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-xl);
  font-weight: 700;
  color: var(--cq-text);
  margin: 0 0 6px;
  line-height: 1.3;
}

.cq-signup-subtitle {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  color: var(--cq-text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Benefits list */
.cq-signup-benefits {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 28px;
  list-style: none;
  margin: 0;
}

.cq-signup-benefit {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--cq-primary-subtle, rgba(99, 102, 241, .06));
  border: 1px solid rgba(99, 102, 241, .08);
  border-radius: var(--cq-radius-lg);
  transition: background .2s ease, transform .2s ease, border-color .2s ease;
}

.cq-signup-benefit:hover {
  background: rgba(99, 102, 241, .1);
  border-color: rgba(99, 102, 241, .16);
  transform: translateX(2px);
}

.cq-signup-benefit-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(139, 92, 246, .15));
  border-radius: var(--cq-radius-md);
  font-size: 18px;
}

.cq-signup-benefit-text {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  font-weight: 500;
  color: var(--cq-text);
  line-height: 1.4;
}

.cq-signup-benefit-text span {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--cq-text-secondary);
  margin-top: 1px;
}

/* CTA area */
.cq-signup-actions {
  padding: 4px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Primary CTA — Gradient glow button */
.cq-signup-cta-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--cq-primary), #8b5cf6);
  color: #fff;
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--cq-radius-lg);
  cursor: pointer;
  transition: transform .2s cubic-bezier(.4, 0, .2, 1),
              box-shadow .2s ease;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .35),
              0 0 0 0 rgba(99, 102, 241, 0);
  text-decoration: none;
  overflow: hidden;
}

/* Shimmer effect on CTA */
.cq-signup-cta-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, .15),
    transparent
  );
  transition: left .6s ease;
}

.cq-signup-cta-primary:hover::after {
  left: 100%;
}

.cq-signup-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, .45),
              0 0 40px -8px rgba(99, 102, 241, .3);
}

.cq-signup-cta-primary:active {
  transform: translateY(0) scale(.98);
  box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

/* Secondary CTA — Ghost */
.cq-signup-cta-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 24px;
  background: transparent;
  color: var(--cq-text-secondary);
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  font-weight: 500;
  border: none;
  border-radius: var(--cq-radius-lg);
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

.cq-signup-cta-secondary:hover {
  color: var(--cq-text);
  background: rgba(99, 102, 241, .06);
}

.cq-signup-cta-secondary:active {
  background: rgba(99, 102, 241, .1);
}

/* Dark mode specifics for signup popup */
body.qcm-dark .cq-signup-benefit,
[data-theme="dark"] .cq-signup-benefit {
  background: rgba(99, 102, 241, .08);
  border-color: rgba(99, 102, 241, .12);
}

body.qcm-dark .cq-signup-benefit:hover,
[data-theme="dark"] .cq-signup-benefit:hover {
  background: rgba(99, 102, 241, .14);
  border-color: rgba(99, 102, 241, .2);
}

body.qcm-dark .cq-signup-benefit-icon,
[data-theme="dark"] .cq-signup-benefit-icon {
  background: linear-gradient(135deg, rgba(99, 102, 241, .2), rgba(139, 92, 246, .2));
}


/* ═══════════════════════════════════════════
   POPUP 2 — DAILY REWARDS CLAIM
   ═══════════════════════════════════════════ */

/* Card variant: celebration background */
.cq-reward-popup .cq-popup-card {
  overflow: hidden;
}

/* Decorative gradient bg behind header */
.cq-reward-header {
  position: relative;
  padding: 32px 28px 24px;
  text-align: center;
  background: linear-gradient(135deg, rgba(99, 102, 241, .08), rgba(139, 92, 246, .06));
  border-bottom: 1px solid var(--cq-border);
}

body.qcm-dark .cq-reward-header,
[data-theme="dark"] .cq-reward-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(139, 92, 246, .08));
  border-bottom-color: rgba(255, 255, 255, .06);
}

/* Ambient glow behind fire icon */
.cq-reward-header::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(245, 158, 11, .2) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}

/* Fire icon container */
.cq-reward-fire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  font-size: 36px;
  background: linear-gradient(135deg, rgba(245, 158, 11, .15), rgba(239, 68, 68, .1));
  border: 1px solid rgba(245, 158, 11, .15);
  border-radius: 20px;
  animation: cq-fire-pulse 2s ease-in-out infinite;
}

@keyframes cq-fire-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, .2);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 24px 4px rgba(245, 158, 11, .15);
  }
}

.cq-reward-streak-count {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-3xl);
  font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  line-height: 1.2;
}

.cq-reward-streak-label {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  font-weight: 500;
  color: var(--cq-text-secondary);
  margin: 2px 0 0;
}

/* Streak calendar — 7-day visualization */
.cq-reward-calendar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px 28px 4px;
}

.cq-reward-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cq-reward-day-label {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 500;
  color: var(--cq-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.cq-reward-day-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--cq-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid var(--cq-border);
  background: transparent;
  color: var(--cq-text-muted);
  transition: all .3s ease;
}

/* Active/completed day */
.cq-reward-day-dot.is-active {
  background: linear-gradient(135deg, var(--cq-primary), #8b5cf6);
  border-color: var(--cq-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

/* Today — pulsing outline */
.cq-reward-day-dot.is-today {
  border-color: var(--cq-primary);
  animation: cq-today-pulse 2s ease-in-out infinite;
}

.cq-reward-day-dot.is-today.is-active {
  animation: none;
}

@keyframes cq-today-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .3); }
  50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, .1); }
}

/* Missed day */
.cq-reward-day-dot.is-missed {
  background: rgba(239, 68, 68, .08);
  border-color: rgba(239, 68, 68, .2);
  color: var(--cq-error);
}

body.qcm-dark .cq-reward-day-dot,
[data-theme="dark"] .cq-reward-day-dot {
  border-color: rgba(255, 255, 255, .1);
}

body.qcm-dark .cq-reward-day-dot.is-missed,
[data-theme="dark"] .cq-reward-day-dot.is-missed {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .25);
}

/* Reward amount display */
.cq-reward-amount {
  text-align: center;
  padding: 16px 28px 0;
}

.cq-reward-points {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, .1), rgba(139, 92, 246, .08));
  border: 1px solid rgba(99, 102, 241, .12);
  border-radius: var(--cq-radius-full);
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-lg);
  font-weight: 700;
  color: var(--cq-primary);
}

body.qcm-dark .cq-reward-points,
[data-theme="dark"] .cq-reward-points {
  background: linear-gradient(135deg, rgba(99, 102, 241, .15), rgba(139, 92, 246, .12));
  border-color: rgba(99, 102, 241, .2);
  color: var(--cq-primary-light);
}

.cq-reward-points-icon {
  font-size: 20px;
}

.cq-reward-motivation {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  color: var(--cq-text-secondary);
  text-align: center;
  margin: 10px 0 0;
  padding: 0 28px;
  line-height: 1.5;
}

/* CTA area */
.cq-reward-actions {
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Claim CTA — Animated glow button */
.cq-reward-cta-claim {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--cq-primary), #8b5cf6);
  color: #fff;
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--cq-radius-lg);
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.4, 0, .2, 1),
              box-shadow .2s ease;
  box-shadow: 0 4px 20px rgba(99, 102, 241, .4);
  animation: cq-claim-glow 2.5s ease-in-out infinite;
}

@keyframes cq-claim-glow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(99, 102, 241, .4),
                0 0 0 0 rgba(99, 102, 241, 0);
  }
  50% {
    box-shadow: 0 4px 24px rgba(99, 102, 241, .5),
                0 0 40px -4px rgba(99, 102, 241, .2);
  }
}

/* Shimmer sweep */
.cq-reward-cta-claim::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, .18),
    transparent
  );
  animation: cq-shimmer-sweep 3s ease-in-out infinite;
}

@keyframes cq-shimmer-sweep {
  0% { left: -100%; }
  40%, 100% { left: 100%; }
}

.cq-reward-cta-claim:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, .5),
              0 0 48px -8px rgba(99, 102, 241, .3);
  animation: none;
}

.cq-reward-cta-claim:active {
  transform: translateY(0) scale(.98);
  box-shadow: 0 2px 12px rgba(99, 102, 241, .3);
}

/* Disabled state — waiting for QCM completion */
.cq-reward-cta-claim.is-locked {
  background: var(--cq-border);
  box-shadow: none;
  cursor: not-allowed;
  animation: none;
  color: var(--cq-text-muted);
}

.cq-reward-cta-claim.is-locked::after {
  display: none;
}

body.qcm-dark .cq-reward-cta-claim.is-locked,
[data-theme="dark"] .cq-reward-cta-claim.is-locked {
  background: rgba(255, 255, 255, .08);
  color: var(--cq-text-muted);
}

/* QCM redirect CTA */
.cq-reward-cta-qcm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px 24px;
  background: rgba(99, 102, 241, .08);
  color: var(--cq-primary);
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, .15);
  border-radius: var(--cq-radius-lg);
  cursor: pointer;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.cq-reward-cta-qcm:hover {
  background: rgba(99, 102, 241, .14);
  border-color: rgba(99, 102, 241, .25);
  transform: translateY(-1px);
}

.cq-reward-cta-qcm:active {
  transform: translateY(0) scale(.98);
}

body.qcm-dark .cq-reward-cta-qcm,
[data-theme="dark"] .cq-reward-cta-qcm {
  background: rgba(99, 102, 241, .12);
  border-color: rgba(99, 102, 241, .2);
  color: var(--cq-primary-light);
}

/* Lock message */
.cq-reward-lock-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .12);
  border-radius: var(--cq-radius-lg);
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  font-weight: 500;
  color: var(--cq-warning-dark, #d97706);
  text-align: center;
  margin: 0 28px;
}

body.qcm-dark .cq-reward-lock-msg,
[data-theme="dark"] .cq-reward-lock-msg {
  background: rgba(245, 158, 11, .1);
  border-color: rgba(245, 158, 11, .18);
  color: var(--cq-warning, #f59e0b);
}


/* ═══════════════════════════════════════════
   SUCCESS STATE — After claiming reward
   ═══════════════════════════════════════════ */

.cq-reward-success {
  text-align: center;
  padding: 40px 28px;
}

.cq-reward-success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  font-size: 40px;
  background: linear-gradient(135deg, rgba(16, 185, 129, .12), rgba(99, 102, 241, .08));
  border-radius: 22px;
  animation: cq-success-pop .5s cubic-bezier(.22, 1, .36, 1);
}

@keyframes cq-success-pop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.cq-reward-success-title {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-xl);
  font-weight: 700;
  color: var(--cq-text);
  margin: 0 0 6px;
}

.cq-reward-success-points {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-2xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--cq-primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 8px 0;
}

.cq-reward-success-sub {
  font-family: var(--cq-font-sans, 'Inter', sans-serif);
  font-size: var(--cq-text-sm);
  color: var(--cq-text-secondary);
  margin: 0;
}


/* ═══════════════════════════════════════════
   SPARKLE / CONFETTI CELEBRATION
   ═══════════════════════════════════════════ */

.cq-sparkle-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}

.cq-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: cq-sparkle-burst 1s cubic-bezier(.22, 1, .36, 1) forwards;
  opacity: 0;
}

@keyframes cq-sparkle-burst {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--sx, 30px), var(--sy, -60px)) scale(0);
    opacity: 0;
  }
}

/* Confetti pieces */
.cq-confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  animation: cq-confetti-fall 1.5s cubic-bezier(.22, 1, .36, 1) forwards;
  opacity: 0;
}

.cq-confetti--circle { border-radius: 50%; }
.cq-confetti--square { border-radius: 2px; }
.cq-confetti--rect {
  width: 4px;
  height: 10px;
  border-radius: 2px;
}

@keyframes cq-confetti-fall {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(0);
    opacity: 1;
  }
  20% {
    opacity: 1;
    transform: translate(var(--cx, 20px), var(--cy, -40px)) rotate(180deg) scale(1);
  }
  100% {
    transform: translate(var(--cx2, 30px), 120px) rotate(720deg) scale(.5);
    opacity: 0;
  }
}


/* ═══════════════════════════════════════════
   RESPONSIVE — Mobile adaptations
   ═══════════════════════════════════════════ */

@media (max-width: 480px) {
  .cq-popup-overlay {
    padding: var(--cq-space-3);
    align-items: flex-end;
  }

  .cq-popup-card {
    max-width: 100%;
    border-radius: var(--cq-radius-xl) var(--cq-radius-xl) 0 0;
    transform: translateY(100%);
  }

  .cq-popup-overlay.is-visible .cq-popup-card {
    transform: translateY(0);
  }

  .cq-popup-overlay.is-closing .cq-popup-card {
    transform: translateY(100%);
  }

  .cq-signup-header {
    padding: 24px 20px 0;
  }

  .cq-signup-benefits {
    padding: 16px 20px;
  }

  .cq-signup-actions {
    padding: 4px 20px 24px;
  }

  .cq-reward-header {
    padding: 24px 20px 20px;
  }

  .cq-reward-calendar {
    gap: 6px;
    padding: 16px 16px 4px;
  }

  .cq-reward-day-dot {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .cq-reward-actions {
    padding: 16px 20px 24px;
  }

  .cq-reward-lock-msg {
    margin: 0 20px;
  }

  /* Draggable handle for bottom-sheet feel */
  .cq-popup-card::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, .15);
    border-radius: var(--cq-radius-full);
    z-index: 5;
  }

  .cq-signup-popup .cq-popup-card::after {
    top: 12px;
  }
}

@media (max-width: 360px) {
  .cq-reward-calendar {
    gap: 4px;
    padding: 12px 12px 4px;
  }

  .cq-reward-day-dot {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  .cq-reward-day-label {
    font-size: 10px;
  }
}

/* Large screens — wider card */
@media (min-width: 640px) {
  .cq-popup-card {
    max-width: 440px;
  }
}


/* ═══════════════════════════════════════════
   ACCESSIBILITY — Reduced motion
   ═══════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .cq-popup-card,
  .cq-popup-overlay,
  .cq-signup-icon,
  .cq-reward-fire,
  .cq-reward-cta-claim,
  .cq-reward-day-dot.is-today,
  .cq-signup-cta-primary::after,
  .cq-reward-cta-claim::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }

  .cq-sparkle,
  .cq-confetti {
    display: none !important;
  }
}


/* ═══════════════════════════════════════════
   LIGHT MODE — Explicit overrides
   (Design tokens handle most of it, but
    some glass/glow effects need refinement)
   ═══════════════════════════════════════════ */

body:not(.qcm-dark):not([data-theme="dark"]) .cq-popup-overlay::before {
  background: rgba(15, 23, 42, .4);
}

body:not(.qcm-dark):not([data-theme="dark"]) .cq-popup-card {
  box-shadow: 0 24px 48px rgba(0, 0, 0, .12),
              0 0 0 1px rgba(0, 0, 0, .04);
}

body:not(.qcm-dark):not([data-theme="dark"]) .cq-popup-close {
  background: rgba(0, 0, 0, .05);
  border-color: rgba(0, 0, 0, .06);
  color: var(--cq-text-secondary);
}

body:not(.qcm-dark):not([data-theme="dark"]) .cq-popup-close:hover {
  background: rgba(0, 0, 0, .1);
  color: var(--cq-text);
}
