/**
 * CampusQCM — Confetti + Score celebration overlay (post-QCM ≥ 80%)
 * Pure CSS confetti pieces (no canvas dependency).
 *
 * Usage from JS: window.CampusQCM_celebrate({ percentage: 92, points: 28 });
 *
 * @package CampusQCM
 * @version 1.0.0 — 20 avril 2026
 */

.cq-celebrate-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: var(--cq-z-overlay, 900);
}

.cq-confetti-piece {
  position: absolute;
  top: -10vh;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  will-change: transform, opacity;
  animation: cq-confetti-fall 2.6s var(--cq-ease-out, ease) forwards;
}

@keyframes cq-confetti-fall {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0deg);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--cq-confetti-x, 0), 110vh, 0) rotate(720deg);
    opacity: 0;
  }
}

/* Score badge that pops up center-screen */
.cq-celebrate-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  color: #fff;
  padding: 28px 36px;
  border-radius: 24px;
  box-shadow: 0 30px 60px -10px rgba(99, 102, 241, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  text-align: center;
  z-index: calc(var(--cq-z-overlay, 900) + 1);
  pointer-events: none;
  opacity: 0;
  animation: cq-celebrate-pop 2.4s var(--cq-ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1)) forwards;
  min-width: 240px;
}

@keyframes cq-celebrate-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  28%  { transform: translate(-50%, -50%) scale(1); }
  78%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(0.95); }
}

.cq-celebrate-card__emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 8px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
}

.cq-celebrate-card__title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  font-feature-settings: "tnum";
}

.cq-celebrate-card__subtitle {
  font-size: 14px;
  opacity: 0.92;
  margin: 0;
  font-weight: 500;
}

.cq-celebrate-card__points {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.18);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

@media (prefers-reduced-motion: reduce) {
  .cq-confetti-piece { display: none; }
  .cq-celebrate-card {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}
