/**
 * WealthFromAI Animation System
 * Smooth, purposeful animations for enhanced UX
 *
 * @package WealthFromAI
 * @version 1.0.0
 */

/* ===========================
   KEYFRAME DEFINITIONS
   =========================== */

@keyframes wfai-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes wfai-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wfai-fade-in-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wfai-slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes wfai-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes wfai-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes wfai-pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(0, 212, 170, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 212, 170, 0.5);
    }
}

@keyframes wfai-pulse-glow-gold {
    0%, 100% {
        box-shadow: 0 0 10px rgba(201, 169, 98, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(201, 169, 98, 0.5);
    }
}

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

@keyframes wfai-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes wfai-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes wfai-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes wfai-glow-border {
    0%, 100% {
        border-color: rgba(0, 212, 170, 0.3);
    }
    50% {
        border-color: rgba(0, 212, 170, 0.6);
    }
}

/* ===========================
   ANIMATION CLASSES
   =========================== */

/* Base animation setup for scroll-triggered elements */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.is-animated {
    opacity: 1;
}

/* Fade animations */
.animate-fade-in.is-animated {
    animation: wfai-fade-in 0.6s var(--wfai-ease-out) forwards;
}

.animate-fade-in-up {
    transform: translateY(20px);
}

.animate-fade-in-up.is-animated {
    transform: translateY(0);
    animation: wfai-fade-in-up 0.6s var(--wfai-ease-out) forwards;
}

.animate-fade-in-down {
    transform: translateY(-20px);
}

.animate-fade-in-down.is-animated {
    transform: translateY(0);
    animation: wfai-fade-in-down 0.6s var(--wfai-ease-out) forwards;
}

/* Slide animations */
.animate-slide-left {
    transform: translateX(-30px);
}

.animate-slide-left.is-animated {
    transform: translateX(0);
}

.animate-slide-right {
    transform: translateX(30px);
}

.animate-slide-right.is-animated {
    transform: translateX(0);
}

/* Scale animation */
.animate-scale-in {
    transform: scale(0.95);
}

.animate-scale-in.is-animated {
    transform: scale(1);
}

/* Staggered animation delays for groups */
.animate-stagger > *:nth-child(1) { transition-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { transition-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { transition-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { transition-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { transition-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { transition-delay: 0.6s; }
.animate-stagger > *:nth-child(7) { transition-delay: 0.7s; }
.animate-stagger > *:nth-child(8) { transition-delay: 0.8s; }

/* ===========================
   CONTINUOUS ANIMATIONS
   =========================== */

.animate-pulse {
    animation: wfai-pulse 2s ease-in-out infinite;
}

.animate-pulse-glow {
    animation: wfai-pulse-glow 2s ease-in-out infinite;
}

.animate-pulse-glow-gold {
    animation: wfai-pulse-glow-gold 2s ease-in-out infinite;
}

.animate-float {
    animation: wfai-float 3s ease-in-out infinite;
}

.animate-spin {
    animation: wfai-spin 1s linear infinite;
}

.animate-bounce {
    animation: wfai-bounce 1s ease-in-out infinite;
}

.animate-glow-border {
    animation: wfai-glow-border 2s ease-in-out infinite;
}

/* ===========================
   LOADING STATES
   =========================== */

.wfai-skeleton {
    background: linear-gradient(
        90deg,
        var(--wfai-surface) 25%,
        var(--wfai-card) 50%,
        var(--wfai-surface) 75%
    );
    background-size: 200% 100%;
    animation: wfai-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--wfai-radius-md);
}

.wfai-skeleton-text {
    height: 1em;
    margin-bottom: var(--wfai-space-2);
}

.wfai-skeleton-heading {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--wfai-space-3);
}

.wfai-skeleton-image {
    aspect-ratio: 16 / 9;
}

.wfai-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--wfai-radius-full);
}

/* Loading spinner */
.wfai-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--wfai-border);
    border-top-color: var(--wfai-secondary);
    border-radius: var(--wfai-radius-full);
    animation: wfai-spin 0.8s linear infinite;
}

.wfai-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.wfai-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.wfai-spinner-gold {
    border-top-color: var(--wfai-accent);
}

/* ===========================
   HOVER ANIMATIONS
   =========================== */

.hover-lift {
    transition: transform var(--wfai-duration-normal) var(--wfai-ease-out);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-glow {
    transition: box-shadow var(--wfai-duration-normal) var(--wfai-ease-out);
}

.hover-glow:hover {
    box-shadow: var(--wfai-glow-md);
}

.hover-glow-gold:hover {
    box-shadow: var(--wfai-glow-gold-md);
}

.hover-scale {
    transition: transform var(--wfai-duration-normal) var(--wfai-ease-out);
}

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

.hover-scale-sm:hover {
    transform: scale(1.01);
}

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

.hover-rotate {
    transition: transform var(--wfai-duration-normal) var(--wfai-ease-out);
}

.hover-rotate:hover {
    transform: rotate(3deg);
}

.hover-border-glow {
    transition: border-color var(--wfai-duration-normal) var(--wfai-ease-out),
                box-shadow var(--wfai-duration-normal) var(--wfai-ease-out);
}

.hover-border-glow:hover {
    border-color: var(--wfai-secondary);
    box-shadow: var(--wfai-glow-sm);
}

/* ===========================
   PAGE TRANSITIONS
   =========================== */

.page-transition-enter {
    opacity: 0;
    transform: translateY(10px);
}

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

.page-transition-exit {
    opacity: 1;
}

.page-transition-exit-active {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

/* ===========================
   SCROLL REVEAL VARIANTS
   =========================== */

/* Delayed fade-up */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* Custom durations */
.animate-fast { animation-duration: 0.3s; }
.animate-normal { animation-duration: 0.6s; }
.animate-slow { animation-duration: 1s; }

/* ===========================
   BUTTON ANIMATIONS
   =========================== */

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

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

.btn-ripple:active::after {
    width: 200px;
    height: 200px;
    opacity: 1;
}

/* ===========================
   ICON ANIMATIONS
   =========================== */

.icon-bounce:hover svg,
.icon-bounce:hover i {
    animation: wfai-bounce 0.5s ease-in-out;
}

.icon-spin:hover svg,
.icon-spin:hover i {
    animation: wfai-spin 0.5s linear;
}

.icon-pulse:hover svg,
.icon-pulse:hover i {
    animation: wfai-pulse 0.5s ease-in-out;
}

/* ===========================
   REDUCED MOTION
   =========================== */

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

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

    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }
}
