/**
 * Premium Animations & Transitions
 * Smooth, elegant, world-class animations
 */

/* ==================== Page Transitions ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

/* ==================== Background Animations ==================== */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) translateX(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-30px) translateX(10px) rotate(5deg);
    }
    66% {
        transform: translateY(-15px) translateX(-10px) rotate(-5deg);
    }
}

@keyframes floatAlt {
    0%, 100% {
        transform: translateY(0px) translateX(0px) scale(1);
    }
    50% {
        transform: translateY(-40px) translateX(20px) scale(1.1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes drift {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(100px) translateY(-50px);
    }
    50% {
        transform: translateX(200px) translateY(0);
    }
    75% {
        transform: translateX(100px) translateY(50px);
    }
}

@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: rotate(360deg);
        opacity: 0.5;
    }
}

/* ==================== Animated Backgrounds ==================== */
.animated-bg {
    background: linear-gradient(-45deg, #6B8DD6, #8E9AAF, #7B9AC0, #9BAEBB, #B4C5D8);
    background-size: 400% 400%;
    animation: gradientShift 18s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.animated-bg-subtle {
    background: linear-gradient(-45deg, #eff6ff, #dbeafe, #bfdbfe, #93c5fd);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
}

/* Floating Shapes */
.floating-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: float 20s ease-in-out infinite;
    will-change: transform;
}

.floating-shape-1 {
    width: 300px;
    height: 300px;
    background: #3b82f6;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-shape-2 {
    width: 250px;
    height: 250px;
    background: #60a5fa;
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.floating-shape-3 {
    width: 200px;
    height: 200px;
    background: #93c5fd;
    bottom: 10%;
    left: 50%;
    animation-delay: 4s;
}

.floating-shape-4 {
    width: 220px;
    height: 220px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    top: 35%;
    right: 15%;
    animation: floatAlt 14s ease-in-out infinite;
    animation-delay: 1.5s;
    opacity: 0.35;
}

.floating-shape-5 {
    width: 180px;
    height: 180px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    bottom: 25%;
    right: 8%;
    animation: floatAlt 16s ease-in-out infinite;
    animation-delay: 3s;
    opacity: 0.3;
}

/* Hero Particles */
.hero-particle {
    position: absolute;
    background: white;
    border-radius: 50%;
    pointer-events: none;
}

.hero-particle-1 {
    width: 4px;
    height: 4px;
    top: 20%;
    left: 15%;
    animation: twinkle 3s ease-in-out infinite;
}

.hero-particle-2 {
    width: 6px;
    height: 6px;
    top: 40%;
    left: 30%;
    animation: twinkle 4s ease-in-out infinite;
    animation-delay: 1s;
}

.hero-particle-3 {
    width: 3px;
    height: 3px;
    top: 60%;
    left: 20%;
    animation: twinkle 3.5s ease-in-out infinite;
    animation-delay: 0.5s;
}

.hero-particle-4 {
    width: 5px;
    height: 5px;
    top: 30%;
    right: 25%;
    animation: twinkle 3.8s ease-in-out infinite;
    animation-delay: 1.5s;
}

.hero-particle-5 {
    width: 4px;
    height: 4px;
    top: 50%;
    right: 15%;
    animation: twinkle 4.2s ease-in-out infinite;
    animation-delay: 0.8s;
}

.hero-particle-6 {
    width: 7px;
    height: 7px;
    top: 70%;
    right: 35%;
    animation: twinkle 3.3s ease-in-out infinite;
    animation-delay: 2s;
}

/* Light Rays */
.hero-light-ray {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 50%,
        transparent 100%);
    top: 0;
    animation: drift 30s linear infinite;
    opacity: 0.3;
}

.hero-light-ray-1 {
    left: 25%;
    animation-delay: 0s;
}

.hero-light-ray-2 {
    left: 50%;
    animation-delay: 7s;
}

.hero-light-ray-3 {
    left: 75%;
    animation-delay: 14s;
}

/* Glow Orbs */
.hero-modern::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    animation: rotateGlow 40s linear infinite;
    pointer-events: none;
}

/* ==================== Page Load Animations ==================== */
.page-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.section-fade-in {
    animation: fadeInUp 0.8s ease-out;
}

.card-fade-in {
    animation: scaleIn 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

/* Stagger animations for lists */
.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; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

/* ==================== Highlight Animations (Premium Gimmick) ==================== */
@keyframes highlightCorrectPremium {
    0% {
        background-color: transparent;
        transform: scale(1);
        box-shadow: none;
    }
    15% {
        background-color: rgba(16, 185, 129, 0.5);
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
    }
    50% {
        background-color: rgba(16, 185, 129, 0.35);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.15);
    }
    100% {
        background-color: rgba(16, 185, 129, 0.18);
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
    }
}

@keyframes highlightIncorrect {
    0% {
        background-color: transparent;
        transform: scale(1);
    }
    15% {
        background-color: rgba(239, 68, 68, 0.4);
        transform: scale(1.01);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.3);
    }
    100% {
        background-color: rgba(239, 68, 68, 0.12);
        transform: scale(1);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25), inset 0 0 0 1px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4), inset 0 0 0 1px rgba(16, 185, 129, 0.5);
    }
}

.highlight-correct {
    animation: highlightCorrectPremium 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    border-left: 4px solid #10b981 !important;
    position: relative;
}

.highlight-correct::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 4px;
    pointer-events: none;
    animation: glowPulse 2s ease-in-out infinite;
}

.highlight-incorrect {
    animation: highlightIncorrect 0.6s ease-out forwards;
    border-left: 4px solid #ef4444 !important;
}

.highlight-null {
    background-color: rgba(156, 163, 175, 0.08);
    border-left: 3px solid #9ca3af !important;
}

/* ==================== Loading Animations ==================== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.spinner {
    border: 3px solid rgba(37, 99, 235, 0.1);
    border-top-color: #2563eb;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
}

.pulse-ring {
    animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==================== Hover Animations ==================== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(37, 99, 235, 0.3);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
}

/* ==================== Button Animations ==================== */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
    transition: 0s;
}

/* ==================== Smooth Transitions ==================== */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.smooth-transition-slow {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.checkmark-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: checkmark 0.5s ease-out forwards;
}

/* ==================== Progress Bar ==================== */
@keyframes progress {
    0% {
        width: 0%;
    }
}

.progress-bar-animated {
    animation: progress 1s ease-out forwards;
}

/* ==================== Skeleton Loading ==================== */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

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

.count-up {
    animation: countUp 0.8s ease-out;
}

/* ==================== Fade Transitions ==================== */
.fade-enter {
    opacity: 0;
    transform: translateY(10px);
}

.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ==================== Utilities ==================== */
.no-animation {
    animation: none !important;
    transition: none !important;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
