/* $TAP Mini App - Animations */

/* Tap Animations */
.tap-button.tapped {
    animation: tapPulse 0.3s ease;
}

.tap-button.tapped .tap-ripple {
    animation: rippleEffect 0.6s ease;
}

.tap-counter.show {
    animation: counterFly 1s ease;
}

@keyframes tapPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes rippleEffect {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes counterFly {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    70% {
        opacity: 1;
        transform: translateX(-50%) translateY(-30px);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-60px);
    }
}

/* Screen Transitions */
.screen.fade-in {
    animation: screenFadeIn 0.4s ease;
}

.screen.fade-out {
    animation: screenFadeOut 0.3s ease;
}

@keyframes screenFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes screenFadeOut {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Toast Animations */
.toast-overlay.show {
    animation: toastShow 0.5s ease;
}

.toast-overlay.hide {
    animation: toastHide 0.3s ease;
}

@keyframes toastShow {
    0% {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

@keyframes toastHide {
    0% {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
    100% {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
}

.toast-content.show {
    animation: toastContentShow 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes toastContentShow {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Loading Animations */
.loading-content {
    animation: loadingBounce 2s ease-in-out infinite;
}

@keyframes loadingBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.tap-logo {
    animation: logoRotate 3s linear infinite;
}

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

/* Button Hover Animations */
.btn:hover {
    animation: buttonHover 0.3s ease;
}

@keyframes buttonHover {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
    100% {
        transform: translateY(-2px);
    }
}

/* Progress Bar Animation */
.progress-fill {
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translateX(-100%);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Timer Animation */
.timer-fill {
    animation: timerPulse 1s ease-in-out infinite alternate;
}

@keyframes timerPulse {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

/* Balance Counter Animation */
.balance-amount {
    position: relative;
}

.balance-amount.counting {
    animation: balanceGlow 0.5s ease;
}

@keyframes balanceGlow {
    0% {
        text-shadow: none;
    }
    50% {
        text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    100% {
        text-shadow: none;
    }
}

/* Invite Link Copy Animation */
.copy-btn.copied {
    animation: copySuccess 0.5s ease;
}

@keyframes copySuccess {
    0% {
        background: var(--bg-card);
        transform: scale(1);
    }
    50% {
        background: var(--success);
        transform: scale(1.1);
    }
    100% {
        background: var(--success);
        transform: scale(1);
    }
}

/* Leaderboard Entry Animation */
.leaderboard-item {
    animation: slideInLeft 0.3s ease;
}

.leaderboard-item:nth-child(1) {
    animation-delay: 0.1s;
}

.leaderboard-item:nth-child(2) {
    animation-delay: 0.2s;
}

.leaderboard-item:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-20px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Task Completion Animation */
.task-item.completing {
    animation: taskComplete 0.8s ease;
}

@keyframes taskComplete {
    0% {
        transform: scale(1);
        background: transparent;
    }
    25% {
        transform: scale(1.02);
        background: rgba(0, 212, 170, 0.1);
    }
    50% {
        transform: scale(1.02);
        background: rgba(0, 212, 170, 0.2);
    }
    100% {
        transform: scale(1);
        background: transparent;
    }
}

/* Exchange Request Animation */
.exchange-btn.processing {
    animation: exchangeProcess 2s ease infinite;
    pointer-events: none;
}

@keyframes exchangeProcess {
    0% {
        background: var(--gradient-accent);
    }
    50% {
        background: var(--gradient-success);
    }
    100% {
        background: var(--gradient-accent);
    }
}

/* Staking Reward Animation */
.status-value.reward-update {
    animation: rewardIncrease 0.8s ease;
}

@keyframes rewardIncrease {
    0% {
        transform: scale(1);
        color: var(--text-primary);
    }
    50% {
        transform: scale(1.1);
        color: var(--success);
    }
    100% {
        transform: scale(1);
        color: var(--text-primary);
    }
}

/* Navigation Item Active Animation */
.nav-item.active {
    animation: navActive 0.3s ease;
}

@keyframes navActive {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Floating Action Animations */
.floating-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--gradient-success);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: floatingNotify 3s ease;
}

@keyframes floatingNotify {
    0% {
        opacity: 0;
        transform: translateX(100px);
    }
    10% {
        opacity: 1;
        transform: translateX(0);
    }
    90% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Error Shake Animation */
.shake {
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Sparkle Effect for Special Events */
.sparkle-effect {
    position: relative;
}

.sparkle-effect::before,
.sparkle-effect::after {
    content: '✨';
    position: absolute;
    animation: sparkle 2s ease-in-out infinite;
}

.sparkle-effect::before {
    top: -10px;
    left: -10px;
    animation-delay: 0s;
}

.sparkle-effect::after {
    bottom: -10px;
    right: -10px;
    animation-delay: 1s;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

/* Mobile-specific animations */
@media (max-width: 480px) {
    .tap-button {
        transition: all var(--transition-fast);
    }
    
    .tap-button:active {
        transform: scale(0.9);
    }
    
    /* Reduce motion for better performance on mobile */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }
}

/* High-performance mode animations */
.performance-mode {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Custom easing functions */
.ease-bounce {
    animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ease-smooth {
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ease-sharp {
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
}