/* ============================================================
   FLAVSTART ANIMATION LIBRARY
   Reusable animations and scroll-triggered effects.
   ============================================================ */

/* ── Fade Animations ── */
@keyframes fs-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fs-fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

/* ── Scale Animations ── */
@keyframes fs-scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fs-scaleUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fs-bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Slide Animations ── */
@keyframes fs-slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fs-slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

/* ── Pulse & Heartbeat ── */
@keyframes fs-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes fs-heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

@keyframes fs-ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

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

@keyframes fs-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fs-dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@keyframes fs-progressBar {
    from { width: 0%; }
    to { width: 100%; }
}

/* ── Confetti (for checkout success) ── */
@keyframes fs-confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

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

/* ── Float (for decorative elements) ── */
@keyframes fs-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* ── Animation Utility Classes ── */
.fs-animate {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

.fs-animate--delay-1 { animation-delay: 0.1s; }
.fs-animate--delay-2 { animation-delay: 0.2s; }
.fs-animate--delay-3 { animation-delay: 0.3s; }
.fs-animate--delay-4 { animation-delay: 0.4s; }
.fs-animate--delay-5 { animation-delay: 0.5s; }

.fs-animate--fade-in { animation-name: fs-fadeIn; }
.fs-animate--fade-in-up { animation-name: fs-fadeInUp; }
.fs-animate--fade-in-down { animation-name: fs-fadeInDown; }
.fs-animate--fade-in-left { animation-name: fs-fadeInLeft; }
.fs-animate--fade-in-right { animation-name: fs-fadeInRight; }
.fs-animate--scale-in { animation-name: fs-scaleIn; }
.fs-animate--bounce-in { animation-name: fs-bounceIn; }
.fs-animate--slide-up { animation-name: fs-slideUp; }
.fs-animate--slide-in-left { animation-name: fs-slideInLeft; }
.fs-animate--slide-in-right { animation-name: fs-slideInRight; }

/* Scroll-triggered animations — initially hidden */
.fs-scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fs-scroll-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children animations */
.fs-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fs-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.fs-stagger.is-visible > *:nth-child(2) { transition-delay: 0.1s; }
.fs-stagger.is-visible > *:nth-child(3) { transition-delay: 0.15s; }
.fs-stagger.is-visible > *:nth-child(4) { transition-delay: 0.2s; }
.fs-stagger.is-visible > *:nth-child(5) { transition-delay: 0.25s; }
.fs-stagger.is-visible > *:nth-child(6) { transition-delay: 0.3s; }
.fs-stagger.is-visible > *:nth-child(7) { transition-delay: 0.35s; }
.fs-stagger.is-visible > *:nth-child(8) { transition-delay: 0.4s; }
.fs-stagger.is-visible > *:nth-child(9) { transition-delay: 0.45s; }
.fs-stagger.is-visible > *:nth-child(10) { transition-delay: 0.5s; }
.fs-stagger.is-visible > *:nth-child(11) { transition-delay: 0.55s; }
.fs-stagger.is-visible > *:nth-child(12) { transition-delay: 0.6s; }

.fs-stagger.is-visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ── Hover Effects ── */
.fs-hover-lift {
    transition: transform var(--fs-transition-normal), box-shadow var(--fs-transition-normal);
}

.fs-hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: var(--fs-shadow-xl);
}

.fs-hover-glow {
    transition: box-shadow var(--fs-transition-normal);
}

.fs-hover-glow:hover {
    box-shadow: 0 0 30px rgba(241, 100, 30, 0.2);
}

.fs-hover-scale {
    transition: transform var(--fs-transition-normal);
}

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

/* Wishlist heart animation */
.fs-wishlist-heart {
    transition: all var(--fs-transition-normal);
}

.fs-wishlist-heart.is-active {
    animation: fs-heartbeat 0.6s ease-in-out;
    color: var(--fs-error);
}

/* Cart icon bounce */
.fs-cart-bounce {
    animation: fs-bounceIn 0.5s ease;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .fs-scroll-animate {
        opacity: 1;
        transform: none;
    }

    .fs-stagger > * {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
