/* ============================================
   新纪元英语词汇系统 - 动画效果
   ============================================ */

/* Fade In Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Up */
.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade In Scale */
.fade-in-scale {
    animation: fadeInScale 0.4s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Coin Pop Animation */
.coin-pop {
    animation: coinPop 0.8s ease-out forwards;
    position: absolute;
    pointer-events: none;
}

@keyframes coinPop {
    0% {
        transform: scale(0.5) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) translateY(-30px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-60px);
        opacity: 0;
    }
}

/* Combo Animation */
.combo-animate {
    animation: comboPulse 0.5s ease;
}

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

/* Bounce Animation */
.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Shake Animation (for errors) */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Pulse Animation */
.pulse-ring {
    animation: pulseRing 2s ease-out infinite;
}

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

/* Float Animation */
.float {
    animation: float 3s ease-in-out infinite;
}

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

/* Glow Animation */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(79, 70, 229, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(79, 70, 229, 0.8), 0 0 40px rgba(79, 70, 229, 0.4);
    }
}

/* Slide In From Left */
.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide In From Right */
.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Flip Animation for Cards */
.flip-enter {
    animation: flipEnter 0.6s ease;
}

@keyframes flipEnter {
    0% {
        transform: rotateY(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateY(0);
        opacity: 1;
    }
}

/* Success Check Animation */
.checkmark {
    animation: checkmark 0.5s ease;
}

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

/* Stagger Children Animation */
.stagger-children > * {
    opacity: 0;
    animation: staggerFadeIn 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Confetti-like Particle Animation */
.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFall 1s ease-out forwards;
}

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

/* Heartbeat Animation */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* Wiggle Animation */
.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Gradient Text Animation */
.gradient-text-animate {
    background: linear-gradient(90deg, #4f46e5, #10b981, #f59e0b, #4f46e5);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

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

/* ============================================
   3D Card Flip Styles
   ============================================ */

/* Perspective Container */
.perspective-1000 {
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

/* 3D Transform Utilities */
.transform-style-3d {
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.backface-hidden {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.rotate-y-180 {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* Flashcard Container */
#flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    -webkit-transition: -webkit-transform 0.6s;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

#flashcard-inner.rotate-y-180 {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* Flashcard Faces */
#flashcard-inner > div {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#flashcard-inner > div:last-child {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* Test Option Styles */
.test-option {
    transition: all 0.3s ease;
}

.test-option.correct {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
}

.test-option.wrong {
    border-color: #f43f5e !important;
    background-color: #fff1f2 !important;
}

/* Context Option Styles */
.context-option {
    transition: all 0.3s ease;
}

.context-option.correct {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
}

.context-option.wrong {
    border-color: #f43f5e !important;
    background-color: #fff1f2 !important;
}

/* Matching Option Styles */
.matching-option {
    transition: all 0.3s ease;
}

.matching-option.correct {
    border-color: #10b981 !important;
    background-color: #ecfdf5 !important;
}

.matching-option.wrong {
    border-color: #f43f5e !important;
    background-color: #fff1f2 !important;
}

/* Scale Animation */
.scale-110 {
    transform: scale(1.1);
}

/* Cursor Styles */
.cursor-not-allowed {
    cursor: not-allowed;
}
