/*
 * EcuaSports - Animations Library
 * Dynamic animations for sports store experience
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleUp {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.05);
    }
}

/* Bounce & Pulse */
@keyframes bounce {

    0%,
    20%,
    53%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    43% {
        transform: translateY(-20px);
    }

    70% {
        transform: translateY(-10px);
    }

    80% {
        transform: translateY(0);
    }

    90% {
        transform: translateY(-4px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(255, 215, 0, 0);
    }
}

/* Sports Dynamic Effects */
@keyframes energyWave {
    0% {
        transform: translateX(-100%) skewX(-15deg);
    }

    100% {
        transform: translateX(200%) skewX(-15deg);
    }
}

@keyframes sprint {
    0% {
        transform: translateX(-10px);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Floating Effect */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes floatRotate {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(3deg);
    }
}

/* Shake */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Rotate */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes spinSlow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Glow Effects */
@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    }
}

@keyframes borderGlow {

    0%,
    100% {
        border-color: var(--ecua-yellow);
        box-shadow: 0 0 10px var(--ecua-yellow);
    }

    33% {
        border-color: var(--ecua-red);
        box-shadow: 0 0 10px var(--ecua-red);
    }

    66% {
        border-color: var(--ecua-blue);
        box-shadow: 0 0 10px var(--ecua-blue);
    }
}

/* Typewriter */
@keyframes typewriter {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {

    0%,
    50% {
        border-color: transparent;
    }

    51%,
    100% {
        border-color: var(--ecua-white);
    }
}

/* Scroll Indicator */
@keyframes scrollDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Loading */
@keyframes loading {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ============================================
   ANIMATION CLASSES
   ============================================ */

/* Fade */
.ecua-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.ecua-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.ecua-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

.ecua-fade-in-left {
    animation: fadeInLeft 0.6s ease-out forwards;
}

.ecua-fade-in-right {
    animation: fadeInRight 0.6s ease-out forwards;
}

/* Scale */
.ecua-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

/* Dynamic */
.ecua-bounce {
    animation: bounce 1s ease infinite;
}

.ecua-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.ecua-float {
    animation: float 3s ease-in-out infinite;
}

.ecua-float-rotate {
    animation: floatRotate 4s ease-in-out infinite;
}

.ecua-shake {
    animation: shake 0.5s ease-in-out;
}

.ecua-spin {
    animation: spin 1s linear infinite;
}

.ecua-spin-slow {
    animation: spinSlow 8s linear infinite;
}

/* Glow */
.ecua-glow {
    animation: glowPulse 2s ease-in-out infinite;
}

.ecua-border-glow {
    animation: borderGlow 3s linear infinite;
}

.ecua-pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* Sports Energy */
.ecua-energy-wave {
    position: relative;
    overflow: hidden;
}

.ecua-energy-wave::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: energyWave 2s ease-in-out infinite;
}

.ecua-sprint {
    animation: sprint 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Loading States */
.ecua-loading {
    position: relative;
    overflow: hidden;
}

.ecua-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.ecua-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ecua-gray-200);
    border-top-color: var(--ecua-black);
    border-radius: 50%;
    animation: loading 0.8s linear infinite;
}

/* Typewriter Effect */
.ecua-typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid;
    animation:
        typewriter 3s steps(40) 1s forwards,
        blink 0.75s step-end infinite;
}

/* Scroll Indicator */
.ecua-scroll-indicator {
    width: 30px;
    height: 50px;
    border: 2px solid var(--ecua-white);
    border-radius: 25px;
    position: relative;
}

.ecua-scroll-indicator::before {
    content: '';
    width: 6px;
    height: 10px;
    background: var(--ecua-white);
    border-radius: 3px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollDown 1.5s ease-in-out infinite;
}

/* ============================================
   HOVER ANIMATIONS
   ============================================ */

.ecua-hover-lift {
    transition: transform var(--ecua-transition-normal), box-shadow var(--ecua-transition-normal);
}

.ecua-hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--ecua-shadow-xl);
}

.ecua-hover-scale {
    transition: transform var(--ecua-transition-normal);
}

.ecua-hover-scale:hover {
    transform: scale(1.05);
}

.ecua-hover-glow {
    transition: box-shadow var(--ecua-transition-normal);
}

.ecua-hover-glow:hover {
    box-shadow: var(--ecua-shadow-glow-yellow);
}

.ecua-hover-rotate {
    transition: transform var(--ecua-transition-normal);
}

.ecua-hover-rotate:hover {
    transform: rotate(5deg);
}

/* Icon Hover */
.ecua-icon-hover {
    transition: all var(--ecua-transition-fast);
}

.ecua-icon-hover:hover {
    transform: scale(1.2) rotate(-5deg);
    color: var(--ecua-yellow);
}

/* ============================================
   SCROLL-TRIGGERED ANIMATIONS
   ============================================ */

.ecua-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ecua-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.ecua-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ecua-reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.ecua-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ecua-reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.ecua-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ecua-reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Stagger children animations */
.ecua-stagger-children>* {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ecua-stagger-children.visible>*:nth-child(1) {
    transition-delay: 0.1s;
}

.ecua-stagger-children.visible>*:nth-child(2) {
    transition-delay: 0.2s;
}

.ecua-stagger-children.visible>*:nth-child(3) {
    transition-delay: 0.3s;
}

.ecua-stagger-children.visible>*:nth-child(4) {
    transition-delay: 0.4s;
}

.ecua-stagger-children.visible>*:nth-child(5) {
    transition-delay: 0.5s;
}

.ecua-stagger-children.visible>*:nth-child(6) {
    transition-delay: 0.6s;
}

.ecua-stagger-children.visible>* {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   ANIMATION DELAYS
   ============================================ */

.ecua-delay-100 {
    animation-delay: 100ms;
}

.ecua-delay-200 {
    animation-delay: 200ms;
}

.ecua-delay-300 {
    animation-delay: 300ms;
}

.ecua-delay-400 {
    animation-delay: 400ms;
}

.ecua-delay-500 {
    animation-delay: 500ms;
}

.ecua-delay-700 {
    animation-delay: 700ms;
}

.ecua-delay-1000 {
    animation-delay: 1000ms;
}

/* Animation Duration */
.ecua-duration-fast {
    animation-duration: 300ms;
}

.ecua-duration-normal {
    animation-duration: 500ms;
}

.ecua-duration-slow {
    animation-duration: 800ms;
}

.ecua-duration-slower {
    animation-duration: 1200ms;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}