/* Screen Transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

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

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.9);
        opacity: 0;
    }
}

/* Screen Transition Classes */
.screen.slide-in-right {
    animation: slideInRight 0.3s ease forwards;
}

.screen.slide-out-left {
    animation: slideOutLeft 0.3s ease forwards;
}

.screen.slide-in-left {
    animation: slideInLeft 0.3s ease forwards;
}

.screen.slide-out-right {
    animation: slideOutRight 0.3s ease forwards;
}

.screen.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

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

.screen.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

/* Answer Card Selection Animation */
.answer-card.selecting {
    animation: pulse 0.3s ease;
}

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

/* Confetti Animation */
@keyframes confetti-fall {
    0% {
        top: -10%;
        opacity: 1;
        transform: translateX(0) rotateZ(0deg);
    }
    100% {
        top: 100%;
        opacity: 0;
        transform: translateX(var(--drift)) rotateZ(360deg);
    }
}

.confetti-piece {
    animation: confetti-fall 3s linear forwards;
}

.confetti-piece:nth-child(odd) {
    background: var(--primary-blue);
}

.confetti-piece:nth-child(even) {
    background: var(--primary-green);
}

.confetti-piece:nth-child(3n) {
    background: var(--accent-purple);
}

.confetti-piece:nth-child(4n) {
    background: var(--accent-orange);
}

/* Percentage Circle Animation */
@keyframes countUp {
    from {
        --percent: 0;
    }
    to {
        --percent: var(--final-percent);
    }
}

.percentage-value.animating {
    animation: countUp 1s ease-out forwards;
}

/* Shake Animation (for errors) */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

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

.float {
    animation: float 3s ease-in-out infinite;
}

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 102, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 102, 255, 0.6);
    }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Progress Bar Fill Animation */
.progress-fill {
    animation: progressGrow 0.4s ease-out;
}

@keyframes progressGrow {
    from {
        transform: scaleX(0);
        transform-origin: left;
    }
    to {
        transform: scaleX(1);
        transform-origin: left;
    }
}

/* Success Checkmark */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* Celebration Burst */
@keyframes burst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.burst {
    animation: burst 0.6s ease-out;
}

/* Typing Animation (for loading text) */
@keyframes typing {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

.typing-indicator span {
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Slide Up Animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* Stagger Animation for Lists */
.stagger-item {
    opacity: 0;
    animation: slideUp 0.4s ease-out forwards;
}

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

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

.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

/* Heart Beat */
@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

.heartbeat {
    animation: heartbeat 1.3s ease-in-out infinite;
}
