/* ===================================
   SCARMY - Animations
   =================================== */

/* ========== Keyframe Animations ========== */

/* Floating Animation */
@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.bounce {
    animation: bounce 2s ease infinite;
}

.bounce.delay-1 {
    animation-delay: 0.2s;
}

.bounce.delay-2 {
    animation-delay: 0.4s;
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(78, 205, 196, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(78, 205, 196, 0);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                    -0.05em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }
    14% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                    -0.05em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }
    15% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                    0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    49% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                    0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    50% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                    0.05em 0 0 rgba(0, 255, 0, 0.75),
                    0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    99% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                    0.05em 0 0 rgba(0, 255, 0, 0.75),
                    0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    100% {
        text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75),
                    -0.025em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
}

.glitch {
    position: relative;
}

.glitch:hover {
    animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

/* Fade In Up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* Fade In */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 1s ease-in forwards;
}

/* Slide In Left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.8s ease-out forwards;
}

/* Slide In Right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.8s ease-out forwards;
}

/* Rotate In */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg) scale(0);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

.rotate-in {
    animation: rotateIn 0.8s ease-out forwards;
}

/* Scale In */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

/* Wiggle */
@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

.wiggle:hover {
    animation: wiggle 0.5s ease-in-out;
}

/* Shake */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake:hover {
    animation: shake 0.5s ease-in-out;
}

/* Glow */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(78, 205, 196, 0.5),
                    0 0 10px rgba(78, 205, 196, 0.4),
                    0 0 15px rgba(78, 205, 196, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(78, 205, 196, 0.8),
                    0 0 20px rgba(78, 205, 196, 0.6),
                    0 0 30px rgba(78, 205, 196, 0.4);
    }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Rainbow Background */
@keyframes rainbow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.rainbow-bg {
    background: linear-gradient(
        45deg,
        #ff6b6b,
        #4ecdc4,
        #ffe66d,
        #a78bfa,
        #ff8c42,
        #ff6b6b
    );
    background-size: 400% 400%;
    animation: rainbow 10s ease infinite;
}

/* Gradient Shift */
@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;
}

/* Flicker */
@keyframes flicker {
    0%, 100% {
        opacity: 1;
    }
    41.99% {
        opacity: 1;
    }
    42% {
        opacity: 0;
    }
    43% {
        opacity: 0;
    }
    43.01% {
        opacity: 1;
    }
    45.99% {
        opacity: 1;
    }
    46% {
        opacity: 0;
    }
    46.9% {
        opacity: 0;
    }
    47% {
        opacity: 1;
    }
}

.flicker {
    animation: flicker 3s linear infinite;
}

/* Typewriter Effect */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 0.15em solid var(--color-primary);
    white-space: nowrap;
    animation: typewriter 4s steps(40) 1s 1 normal both,
               blink 0.75s step-end infinite;
}

@keyframes blink {
    from, to {
        border-color: transparent;
    }
    50% {
        border-color: var(--color-primary);
    }
}

/* Spin */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 2s linear infinite;
}

/* Zoom In Out */
@keyframes zoomInOut {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.zoom-in-out {
    animation: zoomInOut 2s ease-in-out infinite;
}

/* Skeleton Loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0px,
        rgba(255, 255, 255, 0.15) 40px,
        rgba(255, 255, 255, 0.05) 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Neon Glow */
@keyframes neonGlow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(78, 205, 196, 0.8),
                     0 0 20px rgba(78, 205, 196, 0.6),
                     0 0 30px rgba(78, 205, 196, 0.4),
                     0 0 40px rgba(78, 205, 196, 0.2);
    }
    50% {
        text-shadow: 0 0 20px rgba(78, 205, 196, 1),
                     0 0 30px rgba(78, 205, 196, 0.8),
                     0 0 40px rgba(78, 205, 196, 0.6),
                     0 0 50px rgba(78, 205, 196, 0.4);
    }
}

.neon-glow {
    animation: neonGlow 2s ease-in-out infinite;
}

/* ========== Scroll Animations ========== */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-animate.active {
    opacity: 1;
    transform: translateY(0);
}

/* ========== Hover Effects ========== */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.6),
                0 0 30px rgba(78, 205, 196, 0.4);
}

/* ========== Delay Classes ========== */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }

/* ========== Responsive Animations ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== Loading Animation ========== */
@keyframes loading-spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    border: 4px solid rgba(78, 205, 196, 0.2);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: loading-spinner 1s linear infinite;
}

/* ========== Particle Effect (Optional) ========== */
@keyframes particle-float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-1000px) translateX(100px);
        opacity: 0;
    }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: particle-float 10s linear infinite;
}

/* Pulse Glow Animation for Contract Box */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.3);
        border-color: var(--color-primary);
    }
    50% {
        box-shadow: 0 0 40px rgba(78, 205, 196, 0.6);
        border-color: var(--color-accent);
    }
}

/* Gradient Flow Animation for CA Address */
@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Solana Loading Animation */
.solana-loader {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solana-ring {
    position: absolute;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: solana-spin 2s linear infinite;
}

.solana-ring:nth-child(1) {
    width: 70px;
    height: 70px;
    border-top-color: #14F195;
    border-right-color: #14F195;
    animation-delay: 0s;
}

.solana-ring:nth-child(2) {
    width: 55px;
    height: 55px;
    border-top-color: #9945FF;
    border-right-color: #9945FF;
    animation-delay: -0.3s;
    animation-direction: reverse;
}

.solana-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    border-top-color: #00D4FF;
    border-right-color: #00D4FF;
    animation-delay: -0.6s;
}

@keyframes solana-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}