/* ================================================================
   QUIZ ARENA — Hi-Tech Mesmerizing Animations
   Shared across all quiz pages.
   Include via: <link rel="stylesheet" href="{% static 'css/quiz_animations.css' %}">
   ================================================================ */

/* ===== AURORA HEADER — Flowing color gradient with particles ===== */
.quiz-hero-animated {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    color: #fff;
    text-align: center;
}

.quiz-hero-animated::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: conic-gradient(
        from 0deg,
        #7c3aed, #4f46e5, #0d9488, #06b6d4, #8b5cf6, #ec4899, #7c3aed
    );
    animation: qRotate 10s linear infinite;
    opacity: 0.6;
}

@keyframes qRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.quiz-hero-animated::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 14px;
    background: linear-gradient(
        135deg,
        rgba(79, 70, 229, 0.92),
        rgba(124, 58, 237, 0.88),
        rgba(13, 148, 136, 0.85)
    );
    z-index: 1;
}

.quiz-hero-animated > * {
    position: relative;
    z-index: 2;
}

/* Light sweep across header */
.quiz-hero-animated .hero-sweep {
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 30%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.06) 70%,
        transparent 100%
    );
    z-index: 3;
    animation: heroSweep 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes heroSweep {
    0% { left: -60%; }
    100% { left: 160%; }
}

/* ===== FLOATING PARTICLES ===== */
.quiz-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.qp {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: qFloat var(--float-dur, 6s) ease-in-out infinite var(--float-delay, 0s);
    filter: blur(0.5px);
}

@keyframes qFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0;
    }
    10% { opacity: 0.8; }
    50% {
        transform: translateY(calc(var(--float-y, -40px))) translateX(calc(var(--float-x, 20px))) scale(1.3);
        opacity: 0.6;
    }
    90% { opacity: 0.3; }
}

/* ===== GLOWING ORB — pulsing background accent ===== */
.quiz-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    z-index: 2;
    animation: orbPulse 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes orbPulse {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.3); opacity: 0.4; }
}

/* ===== CARD HOVER GLOW ===== */
.quiz-card-glow {
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quiz-card-glow::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 15px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5, #0d9488, #06b6d4);
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: borderGlow 3s ease infinite;
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.quiz-card-glow:hover::before {
    opacity: 1;
}

.quiz-card-glow:hover {
    transform: translateY(-6px);
    box-shadow:
        0 20px 40px rgba(124, 58, 237, 0.15),
        0 0 30px rgba(79, 70, 229, 0.1);
}

/* ===== BADGE SHIMMER ===== */
.qb-shimmer {
    position: relative;
    overflow: hidden;
}

.qb-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: badgeShimmer 3s ease-in-out infinite;
}

@keyframes badgeShimmer {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* ===== COUNTDOWN PULSE ===== */
.cd-pulse {
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; transform: scale(1.05); }
}

/* ===== TROPHY BOUNCE (for winner pages) ===== */
.trophy-bounce {
    animation: trophyBounce 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes trophyBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-3deg); }
    75% { transform: translateY(-4px) rotate(3deg); }
}

/* ===== RANK REVEAL — stagger animation for leaderboard rows ===== */
.rank-reveal {
    opacity: 0;
    transform: translateX(-20px);
    animation: rankSlideIn 0.4s ease-out forwards;
}

@keyframes rankSlideIn {
    to { opacity: 1; transform: translateX(0); }
}

/* ===== PODIUM RISE ===== */
.podium-rise {
    opacity: 0;
    transform: translateY(30px);
    animation: podiumUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes podiumUp {
    to { opacity: 1; transform: translateY(0); }
}

/* ===== SCORE COUNTER (for result page) ===== */
.score-glow {
    text-shadow:
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 40px rgba(124, 58, 237, 0.3),
        0 0 80px rgba(79, 70, 229, 0.2);
    animation: scoreGlow 2s ease-in-out infinite;
}

@keyframes scoreGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(255,255,255,0.5), 0 0 40px rgba(124,58,237,0.3); }
    50% { text-shadow: 0 0 30px rgba(255,255,255,0.8), 0 0 60px rgba(124,58,237,0.5), 0 0 100px rgba(79,70,229,0.3); }
}

/* ===== CONFETTI (for winners page) ===== */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 10px;
    animation: confettiFall var(--fall-dur, 3s) ease-in forwards var(--fall-delay, 0s);
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== STAGGER UTILITY ===== */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }
.stagger-9 { animation-delay: 0.9s; }
.stagger-10 { animation-delay: 1.0s; }
