/* ==========================================
   CosmosPanel - Advanced Animations
   ========================================== */

/* Fade In Animations */
.fade-in {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
}

.fade-in.delay-1 {
    animation-delay: 0.2s;
}

.fade-in.delay-2 {
    animation-delay: 0.4s;
}

.fade-in.delay-3 {
    animation-delay: 0.6s;
}

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

/* Pulse Animation */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Glow Animation */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(157, 78, 221, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(157, 78, 221, 0.8), 0 0 60px rgba(157, 78, 221, 0.4);
    }
}

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

/* Slide In from Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    opacity: 0;
    animation: slideInLeft 0.8s ease-out forwards;
}

/* Slide In from Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    opacity: 0;
    animation: slideInRight 0.8s ease-out forwards;
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    opacity: 0;
    animation: scaleIn 0.6s ease-out forwards;
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.8);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

.rotate-in {
    opacity: 0;
    animation: rotateIn 0.8s ease-out forwards;
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(157, 78, 221, 0) 0%,
        rgba(157, 78, 221, 0.3) 50%,
        rgba(157, 78, 221, 0) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

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

.bounce {
    animation: bounce 1.5s ease-in-out infinite;
}

/* Gradient Animation */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-shift {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

/* Stagger Animation Delays */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(157, 78, 221, 0.1);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Wave Animation */
@keyframes wave {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.wave-ring {
    position: absolute;
    border: 3px solid var(--primary-purple);
    border-radius: 50%;
    animation: wave 2s ease-out infinite;
}

/* Typewriter Effect */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--primary-purple);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink 0.75s step-end infinite;
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.glitch {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* Neon Pulse */
@keyframes neonPulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(157, 78, 221, 0.8),
                     0 0 20px rgba(157, 78, 221, 0.6),
                     0 0 30px rgba(157, 78, 221, 0.4);
    }
    50% {
        text-shadow: 0 0 20px rgba(157, 78, 221, 1),
                     0 0 40px rgba(157, 78, 221, 0.8),
                     0 0 60px rgba(157, 78, 221, 0.6);
    }
}

.neon-pulse {
    animation: neonPulse 2s ease-in-out infinite;
}

/* Flip Card */
.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* Progress Bar Animation */
@keyframes progressBar {
    from {
        width: 0%;
    }
}

.progress-animate {
    animation: progressBar 2s ease-out forwards;
}

/* Blob Animation */
@keyframes blob {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

.blob-animation {
    animation: blob 8s ease-in-out infinite;
}

/* Text Reveal */
@keyframes textReveal {
    from {
        clip-path: inset(0 100% 0 0);
    }
    to {
        clip-path: inset(0 0 0 0);
    }
}

.text-reveal {
    animation: textReveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) forwards;
}

/* Scroll Reveal Utility */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    will-change: opacity, transform;
    contain: layout style paint;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
    will-change: auto;
}

/* Hover Glow Effect */
.hover-glow {
    position: relative;
    overflow: hidden;
}


.hover-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(157, 78, 221, 0.3), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.hover-glow:hover::before {
    width: 300px;
    height: 300px;
}

/* Number Counter Animation */
@keyframes countUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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