/* 
 * SimpleFeasibility v2 - Animations
 * Premium motion design for a polished experience
 */

/* ═══════════════════════════════════════════════════════════════
   KEYFRAME ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

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

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
    }
}

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.6);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes checkmark {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

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

/* Staggered animations for lists */
@keyframes staggerFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATION UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════ */

.animate-fade-in {
    animation: fadeIn var(--duration-300) var(--ease-out) forwards;
}

.animate-fade-in-up {
    animation: fadeInUp var(--duration-300) var(--ease-out) forwards;
}

.animate-fade-in-down {
    animation: fadeInDown var(--duration-300) var(--ease-out) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--duration-300) var(--ease-out) forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--duration-300) var(--ease-out) forwards;
}

.animate-scale-in {
    animation: scaleIn var(--duration-300) var(--ease-out) forwards;
}

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

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

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

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

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

/* ═══════════════════════════════════════════════════════════════
   STAGGERED ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

.stagger-animation > * {
    animation: staggerFadeIn var(--duration-500) var(--ease-out) both;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
.stagger-animation > *:nth-child(2) { animation-delay: 50ms; }
.stagger-animation > *:nth-child(3) { animation-delay: 100ms; }
.stagger-animation > *:nth-child(4) { animation-delay: 150ms; }
.stagger-animation > *:nth-child(5) { animation-delay: 200ms; }
.stagger-animation > *:nth-child(6) { animation-delay: 250ms; }
.stagger-animation > *:nth-child(7) { animation-delay: 300ms; }
.stagger-animation > *:nth-child(8) { animation-delay: 350ms; }
.stagger-animation > *:nth-child(9) { animation-delay: 400ms; }
.stagger-animation > *:nth-child(10) { animation-delay: 450ms; }

/* Delay utilities */
.delay-75 { animation-delay: 75ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ═══════════════════════════════════════════════════════════════
   TRANSITION UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.transition-none {
    transition: none;
}

.transition-all {
    transition: all var(--duration-200) var(--ease-out);
}

.transition-colors {
    transition: color var(--duration-200) var(--ease-out),
                background-color var(--duration-200) var(--ease-out),
                border-color var(--duration-200) var(--ease-out);
}

.transition-opacity {
    transition: opacity var(--duration-200) var(--ease-out);
}

.transition-transform {
    transition: transform var(--duration-200) var(--ease-out);
}

.transition-shadow {
    transition: box-shadow var(--duration-200) var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════
   HOVER EFFECTS
   ═══════════════════════════════════════════════════════════════ */

.hover-lift {
    transition: transform var(--duration-200) var(--ease-out),
                box-shadow var(--duration-200) var(--ease-out);
}

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

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

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

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

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

/* ═══════════════════════════════════════════════════════════════
   LOADING STATES
   ═══════════════════════════════════════════════════════════════ */

.loading-dots {
    display: flex;
    gap: var(--space-1);
    align-items: center;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

/* Spinner variants */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--color-primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* ═══════════════════════════════════════════════════════════════
   PAGE TRANSITIONS
   ═══════════════════════════════════════════════════════════════ */

.page-enter {
    animation: fadeInUp var(--duration-300) var(--ease-out);
}

.page-exit {
    animation: fadeOut var(--duration-200) var(--ease-in);
}

/* ═══════════════════════════════════════════════════════════════
   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-spin,
    .animate-pulse,
    .animate-bounce,
    .animate-float {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   NUMBER COUNTER ANIMATION
   ═══════════════════════════════════════════════════════════════ */

.count-up {
    display: inline-block;
    animation: countUp var(--duration-500) var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM ENTERPRISE ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */

/* Gold shimmer for enterprise elements */
@keyframes goldShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.animate-gold-shimmer {
    background: linear-gradient(
        90deg,
        var(--color-gold-500) 0%,
        var(--color-gold-300) 25%,
        var(--color-gold-500) 50%,
        var(--color-gold-300) 75%,
        var(--color-gold-500) 100%
    );
    background-size: 200% auto;
    animation: goldShimmer 3s linear infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Premium glow pulse */
@keyframes premiumGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
    }
}

.animate-premium-glow {
    animation: premiumGlow 2s ease-in-out infinite;
}

/* Wizard step entrance */
@keyframes wizardStepIn {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-wizard-step {
    animation: wizardStepIn 0.6s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* Tier card entrance - staggered */
@keyframes tierCardIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Stage card processing animation */
@keyframes stageProcessing {
    0% {
        border-color: var(--color-primary-400);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        border-color: var(--color-primary-500);
        box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
    }
    100% {
        border-color: var(--color-primary-400);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.animate-processing {
    animation: stageProcessing 2s ease-in-out infinite;
}

/* Success checkmark */
@keyframes successCheck {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.animate-success-check {
    animation: successCheck 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Celebration confetti burst */
@keyframes confettiBurst {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.animate-confetti {
    animation: confettiBurst 0.8s ease-out forwards;
}

/* Premium slide up reveal */
@keyframes slideUpReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.animate-reveal {
    animation: slideUpReveal 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

/* Progressive reveal for lists */
.reveal-stagger > * {
    opacity: 0;
    animation: slideUpReveal 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.reveal-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.reveal-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.reveal-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.reveal-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.reveal-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.reveal-stagger > *:nth-child(6) { animation-delay: 0.3s; }
.reveal-stagger > *:nth-child(7) { animation-delay: 0.35s; }
.reveal-stagger > *:nth-child(8) { animation-delay: 0.4s; }

/* Button shine effect */
@keyframes buttonShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
}

.btn-shine:hover::before {
    animation: buttonShine 0.6s ease-out;
}

/* Typing indicator for AI */
@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-3);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-primary-500);
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ═══════════════════════════════════════════════════════════════
   CARD HOVER EFFECTS
   ═══════════════════════════════════════════════════════════════ */

.card-interactive {
    transition: all var(--duration-200) var(--ease-out);
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--color-primary-200);
}

[data-theme="dark"] .card-interactive:hover {
    border-color: var(--color-primary-800);
}

/* Gradient border on hover */
.card-gradient-hover {
    position: relative;
    transition: all var(--duration-300) var(--ease-out);
}

.card-gradient-hover::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: var(--gradient-brand);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--duration-300) var(--ease-out);
    pointer-events: none;
}

.card-gradient-hover:hover::before {
    opacity: 1;
}

