/* ====== VIDR ANIMATIONS - 60fps ====== */

/* GPU Acceleration for all animated elements */
.animate-gpu {
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ====== MICRO INTERACTIONS ====== */

/* Button Press */
.press-effect {
    transition: transform 0.1s ease;
}
.press-effect:active {
    transform: scale(0.92);
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.3s ease;
}

.ripple:active::after {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
    transition: 0s;
}

/* Glow Pulse */
.glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 107, 157, 0.2); }
    50% { box-shadow: 0 0 25px rgba(255, 107, 157, 0.5); }
}

/* Reward Glow */
.reward-glow {
    animation: rewardGlow 1s ease;
}

@keyframes rewardGlow {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    50% { box-shadow: 0 0 30px 15px rgba(255, 215, 0, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

/* Floating Hearts */
.heart-burst {
    position: absolute;
    pointer-events: none;
}

.heart-burst .heart {
    position: absolute;
    font-size: 20px;
    animation: heartBurst 1s ease-out forwards;
}

@keyframes heartBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0.5);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(1.5) rotate(var(--r));
    }
}

/* Coin Rain */
.coin-rain-particle {
    position: fixed;
    font-size: 24px;
    animation: coinRain var(--duration, 2s) linear forwards;
    z-index: 450;
    pointer-events: none;
}

@keyframes coinRain {
    0% {
        opacity: 1;
        transform: translateY(-50px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Slide In Animations */
.slide-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-down {
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-left {
    animation: slideLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-right {
    animation: slideRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Scale In */
.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* Fade In */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Shake */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Confetti */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    z-index: 500;
    pointer-events: none;
    animation: confettiFall var(--duration, 3s) ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg) scale(0.3);
    }
}

/* Username Spotlight */
.username-spotlight {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    animation: spotlightIn 0.5s ease, spotlightOut 0.5s ease 2s forwards;
    pointer-events: none;
}

.spotlight-name {
    font-size: 48px;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    animation: spotlightPulse 0.5s ease infinite alternate;
}

@keyframes spotlightIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spotlightOut {
    to { opacity: 0; }
}

@keyframes spotlightPulse {
    from { transform: scale(1); text-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
    to { transform: scale(1.05); text-shadow: 0 0 80px rgba(255, 215, 0, 1); }
}

/* Level Up Animation */
.level-up-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
    pointer-events: none;
}

.level-up-text {
    font-size: 56px;
    font-weight: 900;
    background: var(--vip-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: levelUpBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.level-up-number {
    font-size: 80px;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    animation: levelUpBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s backwards;
}

@keyframes levelUpBounce {
    0% { transform: scale(0); opacity: 0; }
    60% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Shimmer Loading */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0%,
        var(--pastel-pink-light) 50%,
        var(--bg-card) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Badge Unlock */
.badge-unlock {
    animation: badgeUnlock 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgeUnlock {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(20deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Combo Counter */
.combo-counter {
    animation: comboPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes comboPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* Progress Fill */
.progress-animate {
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stagger children */
.stagger-children > * {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* Particle explosion */
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleBurst 1s ease-out forwards;
}

@keyframes particleBurst {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--px), var(--py)) scale(0);
    }
}

/* Hover lift */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Smooth number counter */
.counter-animate {
    display: inline-block;
    transition: transform 0.3s ease;
}

.counter-animate.updating {
    animation: counterFlip 0.3s ease;
}

@keyframes counterFlip {
    0% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-10px); opacity: 0; }
    51% { transform: translateY(10px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}