/**
 * Thai Pronunciation Trainer - Animations
 * Completion celebration with lots of confetti
 */

/* ============================================
   Completion Celebration (Popup)
   ============================================ */

.tpr-completion-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 10000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none; /* Désactivé quand cachée */
}

.tpr-completion-celebration.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto; /* Activé quand visible */
}

.tpr-celebration-content {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(147, 51, 234, 0.95));
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 64px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.tpr-celebration-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpr-celebration-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.tpr-celebration-emoji {
    font-size: 80px;
    animation: tptCelebrationBounce 0.6s ease-in-out;
    margin-bottom: 16px;
}

@keyframes tptCelebrationBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.tpr-celebration-title {
    font-size: 32px;
    font-weight: 800;
    color: white;
    margin: 0 0 12px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tpr-celebration-text {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 24px 0;
}

.tpr-celebration-btn {
    background: white;
    color: #3b82f6;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tpr-celebration-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    background: #f0f9ff;
}

/* Confetti popup */
.tpr-celebration-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffd700;
    top: -10px;
    animation: tptConfettiFall 3s linear infinite;
}

.confetti:nth-child(1) { left: 10%; animation-delay: 0s; background: #ff6b6b; }
.confetti:nth-child(2) { left: 25%; animation-delay: 0.2s; background: #4ecdc4; }
.confetti:nth-child(3) { left: 40%; animation-delay: 0.4s; background: #ffd700; }
.confetti:nth-child(4) { left: 55%; animation-delay: 0.6s; background: #95e1d3; }
.confetti:nth-child(5) { left: 70%; animation-delay: 0.8s; background: #ff6b6b; }
.confetti:nth-child(6) { left: 85%; animation-delay: 1s; background: #4ecdc4; }
.confetti:nth-child(7) { left: 15%; animation-delay: 1.2s; background: #ffd700; }
.confetti:nth-child(8) { left: 60%; animation-delay: 1.4s; background: #95e1d3; }
.confetti:nth-child(9) { left: 30%; animation-delay: 1.6s; background: #ff6b6b; }
.confetti:nth-child(10) { left: 75%; animation-delay: 1.8s; background: #4ecdc4; }
.confetti:nth-child(11) { left: 45%; animation-delay: 2s; background: #ffd700; }
.confetti:nth-child(12) { left: 90%; animation-delay: 2.2s; background: #95e1d3; }

@keyframes tptConfettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(600px) rotate(720deg); opacity: 0; }
}

@media (max-width: 768px) {
    .tpr-celebration-content {
        padding: 32px 40px;
    }
    
    .tpr-celebration-emoji {
        font-size: 60px;
    }
    
    .tpr-celebration-title {
        font-size: 24px;
    }
    
    .tpr-celebration-text {
        font-size: 16px;
    }
}

/* ============================================
   Banner Confetti - Simple mais beaucoup !
   ============================================ */

.tpr-banner-confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.tpr-banner-confetti .mini-confetti {
    position: absolute;
    width: 7px;
    height: 14px;
    top: -30px;
    opacity: 0;
}

/* 10 couleurs avec dégradés */
.tpr-banner-confetti .mini-confetti:nth-child(10n+1) { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+2) { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+3) { background: linear-gradient(135deg, #f472b6, #ec4899); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+4) { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+5) { background: linear-gradient(135deg, #34d399, #10b981); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+6) { background: linear-gradient(135deg, #fb923c, #f97316); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+7) { background: linear-gradient(135deg, #ef4444, #dc2626); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+8) { background: linear-gradient(135deg, #22d3ee, #06b6d4); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+9) { background: linear-gradient(135deg, #facc15, #eab308); }
.tpr-banner-confetti .mini-confetti:nth-child(10n+10) { background: linear-gradient(135deg, #818cf8, #6366f1); }

/* 40 confettis - positions aléatoires avec delays négatifs pour remplissage immédiat */
.tpr-banner-confetti .mini-confetti:nth-child(1) { left: 47%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -2.1s; }
.tpr-banner-confetti .mini-confetti:nth-child(2) { left: 12%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -0.3s; }
.tpr-banner-confetti .mini-confetti:nth-child(3) { left: 85%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -1.5s; }
.tpr-banner-confetti .mini-confetti:nth-child(4) { left: 23%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -2.8s; }
.tpr-banner-confetti .mini-confetti:nth-child(5) { left: 67%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -0.9s; }
.tpr-banner-confetti .mini-confetti:nth-child(6) { left: 34%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -3.2s; }
.tpr-banner-confetti .mini-confetti:nth-child(7) { left: 91%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -1.8s; }
.tpr-banner-confetti .mini-confetti:nth-child(8) { left: 8%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -2.5s; }
.tpr-banner-confetti .mini-confetti:nth-child(9) { left: 56%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -0.6s; }
.tpr-banner-confetti .mini-confetti:nth-child(10) { left: 73%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -1.2s; }
.tpr-banner-confetti .mini-confetti:nth-child(11) { left: 19%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -2.9s; }
.tpr-banner-confetti .mini-confetti:nth-child(12) { left: 42%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -0.4s; }
.tpr-banner-confetti .mini-confetti:nth-child(13) { left: 95%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -1.7s; }
.tpr-banner-confetti .mini-confetti:nth-child(14) { left: 61%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -3.1s; }
.tpr-banner-confetti .mini-confetti:nth-child(15) { left: 28%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -0.8s; }
.tpr-banner-confetti .mini-confetti:nth-child(16) { left: 5%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -2.3s; }
.tpr-banner-confetti .mini-confetti:nth-child(17) { left: 78%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -1.1s; }
.tpr-banner-confetti .mini-confetti:nth-child(18) { left: 39%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -2.6s; }
.tpr-banner-confetti .mini-confetti:nth-child(19) { left: 14%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -0.5s; }
.tpr-banner-confetti .mini-confetti:nth-child(20) { left: 82%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -1.9s; }
.tpr-banner-confetti .mini-confetti:nth-child(21) { left: 51%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -3.3s; }
.tpr-banner-confetti .mini-confetti:nth-child(22) { left: 25%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -0.7s; }
.tpr-banner-confetti .mini-confetti:nth-child(23) { left: 69%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -2.2s; }
.tpr-banner-confetti .mini-confetti:nth-child(24) { left: 36%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -1.4s; }
.tpr-banner-confetti .mini-confetti:nth-child(25) { left: 88%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -2.7s; }
.tpr-banner-confetti .mini-confetti:nth-child(26) { left: 11%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -0.2s; }
.tpr-banner-confetti .mini-confetti:nth-child(27) { left: 63%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -1.6s; }
.tpr-banner-confetti .mini-confetti:nth-child(28) { left: 45%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -3s; }
.tpr-banner-confetti .mini-confetti:nth-child(29) { left: 17%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -1s; }
.tpr-banner-confetti .mini-confetti:nth-child(30) { left: 76%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -2.4s; }
.tpr-banner-confetti .mini-confetti:nth-child(31) { left: 32%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -0.35s; }
.tpr-banner-confetti .mini-confetti:nth-child(32) { left: 58%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -1.85s; }
.tpr-banner-confetti .mini-confetti:nth-child(33) { left: 93%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -2.95s; }
.tpr-banner-confetti .mini-confetti:nth-child(34) { left: 21%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -0.75s; }
.tpr-banner-confetti .mini-confetti:nth-child(35) { left: 70%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -1.35s; }
.tpr-banner-confetti .mini-confetti:nth-child(36) { left: 44%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -2.65s; }
.tpr-banner-confetti .mini-confetti:nth-child(37) { left: 7%; animation: tptFall1 3.5s ease-in infinite; animation-delay: -0.55s; }
.tpr-banner-confetti .mini-confetti:nth-child(38) { left: 81%; animation: tptFall2 3.5s ease-in infinite; animation-delay: -2.15s; }
.tpr-banner-confetti .mini-confetti:nth-child(39) { left: 53%; animation: tptFall3 3.5s ease-in infinite; animation-delay: -1.25s; }
.tpr-banner-confetti .mini-confetti:nth-child(40) { left: 29%; animation: tptFall4 3.5s ease-in infinite; animation-delay: -3.25s; }

/* 4 animations simples avec rotation 3D */
@keyframes tptFall1 {
    0% { transform: translateY(0) rotateZ(0deg) rotateY(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(150px) rotateZ(720deg) rotateY(180deg); opacity: 0; }
}

@keyframes tptFall2 {
    0% { transform: translateY(0) rotateZ(0deg) rotateY(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(150px) rotateZ(-720deg) rotateY(-180deg); opacity: 0; }
}

@keyframes tptFall3 {
    0% { transform: translateY(0) rotateZ(0deg) rotateY(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(150px) rotateZ(540deg) rotateY(270deg); opacity: 0; }
}

@keyframes tptFall4 {
    0% { transform: translateY(0) rotateZ(0deg) rotateY(0deg); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(150px) rotateZ(-540deg) rotateY(-270deg); opacity: 0; }
}