/* Budget Coach AI - Animations Stylesheet */
/* iOS 26 Inspired Smooth Animations */

/* ============================================
   ANIMATION TIMING FUNCTIONS
   ============================================ */
:root {
    /* Spring animations - iOS style */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring-soft: cubic-bezier(0.25, 1.5, 0.5, 1);
    --ease-spring-bouncy: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Smooth animations */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-smooth-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-smooth-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-smooth-in-out: cubic-bezier(0.4, 0, 0.2, 1);

    /* Quick/snappy */
    --ease-quick: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-snappy: cubic-bezier(0.55, 0.055, 0.675, 0.19);

    /* Elastic */
    --ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);

    /* Animation durations */
    --duration-instant: 100ms;
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-moderate: 350ms;
    --duration-slow: 500ms;
    --duration-slower: 700ms;
}

/* ============================================
   FADE 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 fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

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

/* ============================================
   SCALE ANIMATIONS
   ============================================ */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes scaleUp {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.02);
    }
}

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

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

.animate-scale-bounce {
    animation: scaleInBounce var(--duration-slow) var(--ease-spring) forwards;
}

.animate-pop {
    animation: pop var(--duration-fast) var(--ease-spring);
}

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

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

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

@keyframes slideOutUp {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-100%);
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

.animate-slide-up {
    animation: slideInUp var(--duration-moderate) var(--ease-spring) forwards;
}

.animate-slide-down {
    animation: slideInDown var(--duration-moderate) var(--ease-spring) forwards;
}

/* ============================================
   BOUNCE ANIMATIONS
   ============================================ */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes bounceOut {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

.animate-bounce {
    animation: bounce 2s var(--ease-smooth) infinite;
}

.animate-bounce-in {
    animation: bounceIn var(--duration-slow) var(--ease-spring) forwards;
}

/* ============================================
   PULSE ANIMATIONS
   ============================================ */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 20, 60, 0.4);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(220, 20, 60, 0);
    }
}

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.animate-pulse {
    animation: pulse 2s var(--ease-smooth) infinite;
}

.animate-pulse-glow {
    animation: pulseGlow 2s var(--ease-smooth) infinite;
}

/* ============================================
   FLOAT ANIMATIONS
   ============================================ */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes floatRotate {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(2deg);
    }
    50% {
        transform: translateY(-15px) rotate(0deg);
    }
    75% {
        transform: translateY(-8px) rotate(-2deg);
    }
}

@keyframes floatShadow {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: translateY(-15px);
        box-shadow: 0 25px 30px rgba(0, 0, 0, 0.15);
    }
}

.animate-float {
    animation: float 6s var(--ease-smooth) infinite;
}

.animate-float-rotate {
    animation: floatRotate 8s var(--ease-smooth) infinite;
}

.animate-float-shadow {
    animation: floatShadow 6s var(--ease-smooth) infinite;
}

/* ============================================
   SPIN ANIMATIONS
   ============================================ */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes spinPulse {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

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

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

/* ============================================
   SHAKE ANIMATIONS
   ============================================ */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

@keyframes shakeHorizontal {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(5px);
    }
    75% {
        transform: translateX(-5px);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(3deg);
    }
    75% {
        transform: rotate(-3deg);
    }
}

.animate-shake {
    animation: shake var(--duration-slow) var(--ease-spring);
}

.animate-wiggle {
    animation: wiggle 0.5s var(--ease-spring) infinite;
}

/* ============================================
   GLOW ANIMATIONS
   ============================================ */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(220, 20, 60, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(220, 20, 60, 0.5);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow:
            0 0 5px rgba(220, 20, 60, 0.2),
            0 0 20px rgba(220, 20, 60, 0.1);
    }
    50% {
        box-shadow:
            0 0 20px rgba(220, 20, 60, 0.4),
            0 0 40px rgba(220, 20, 60, 0.2);
    }
}

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

.animate-glow {
    animation: glow 2s var(--ease-smooth) infinite;
}

.animate-glow-pulse {
    animation: glowPulse 3s var(--ease-smooth) infinite;
}

.animate-shimmer {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.5) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   MORPHING ANIMATIONS
   ============================================ */
@keyframes morphBlob {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    25% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
    50% {
        border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%;
    }
    75% {
        border-radius: 60% 40% 60% 30% / 70% 30% 50% 60%;
    }
}

@keyframes morphCard {
    0%, 100% {
        border-radius: 24px 24px 24px 24px;
    }
    25% {
        border-radius: 28px 20px 28px 20px;
    }
    50% {
        border-radius: 20px 28px 20px 28px;
    }
    75% {
        border-radius: 28px 20px 20px 28px;
    }
}

.animate-morph-blob {
    animation: morphBlob 8s var(--ease-smooth) infinite;
}

/* ============================================
   NUMBER COUNTER ANIMATION
   ============================================ */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-count {
    animation: countUp var(--duration-moderate) var(--ease-spring) forwards;
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes gradientRotate {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
}

/* ============================================
   STAGGER ANIMATIONS
   ============================================ */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all var(--duration-slow) var(--ease-spring);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all var(--duration-slow) var(--ease-spring);
}

.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all var(--duration-slow) var(--ease-spring);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--duration-slow) var(--ease-spring);
}

.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   BUTTON HOVER ANIMATIONS
   ============================================ */
.btn-hover-lift {
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast) var(--ease-smooth);
}

.btn-hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.btn-hover-lift:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.btn-hover-scale {
    transition: transform var(--duration-fast) var(--ease-spring);
}

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

.btn-hover-scale:active {
    transform: scale(0.98);
}

.btn-hover-glow {
    transition: box-shadow var(--duration-base) var(--ease-smooth);
}

.btn-hover-glow:hover {
    box-shadow: 0 0 30px rgba(220, 20, 60, 0.4);
}

/* ============================================
   CARD HOVER ANIMATIONS
   ============================================ */
.card-hover-lift {
    transition: transform var(--duration-base) var(--ease-spring),
                box-shadow var(--duration-base) var(--ease-smooth);
}

.card-hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.card-hover-3d {
    transition: transform var(--duration-base) var(--ease-smooth);
    transform-style: preserve-3d;
}

.card-hover-3d:hover {
    transform: perspective(1000px) rotateX(5deg) translateY(-10px);
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */
@keyframes loadingDots {
    0%, 20% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        opacity: 1;
        transform: scale(1);
    }
    80%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 4px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingDots 1.4s ease-in-out infinite;
}

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

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

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

@keyframes loadingBar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.loading-bar {
    position: relative;
    overflow: hidden;
    height: 4px;
    background: rgba(220, 20, 60, 0.1);
    border-radius: var(--radius-full);
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    animation: loadingBar 1.5s ease-in-out infinite;
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all var(--duration-moderate) var(--ease-spring);
}

.page-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateY(-20px);
    transition: all var(--duration-moderate) var(--ease-smooth);
}

/* ============================================
   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;
    }

    .animate-float,
    .animate-bounce,
    .animate-pulse,
    .animate-spin,
    .animate-glow,
    .animate-shimmer,
    .animate-morph-blob {
        animation: none !important;
    }

    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale {
        opacity: 1;
        transform: none;
    }
}