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

/* Fade In */
.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

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

/* Slide Up */
.animate-slide-up {
    opacity: 0;
    transform: translateY(30px);
    animation: slideUp 0.6s ease forwards;
    animation-delay: var(--delay, 0s);
}

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

/* Slide In Left */
.animate-slide-left {
    animation: slideInLeft 0.5s ease forwards;
}

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

/* Scale In */
.animate-scale-in {
    animation: scaleIn 0.4s ease forwards;
}

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

/* Bounce */
.animate-bounce {
    animation: bounce 0.5s ease;
}

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

/* Shake (for errors) */
.animate-shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Glow effect for focused inputs */
.input-glow {
    animation: glow 2s ease infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
    50% { box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.2); }
}

/* Ripple effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 10%, transparent 10%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
    transform: scale(0);
    opacity: 1;
    transition: 0s;
}

/* Item row enter animation */
.item-row-enter {
    animation: itemEnter 0.4s ease forwards;
}

@keyframes itemEnter {
    from {
        opacity: 0;
        transform: translateY(-10px);
        background-color: rgba(59, 130, 246, 0.1);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        background-color: transparent;
    }
}

/* Item row exit animation */
.item-row-exit {
    animation: itemExit 0.3s ease forwards;
}

@keyframes itemExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(50px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Counter animation for totals */
.value-updated {
    animation: valueFlash 0.5s ease;
}

@keyframes valueFlash {
    0% { color: var(--primary); transform: scale(1); }
    50% { color: var(--success); transform: scale(1.15); }
    100% { color: var(--primary); transform: scale(1); }
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    gap: 3px;
    padding: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

@keyframes typingDot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Smooth page transitions */
.page-transition-enter {
    animation: pageEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Hover lift */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Gradient text animation */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Success checkmark */
.success-check {
    animation: successPop 0.5s ease;
}

@keyframes successPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
