/* ===================================
   Kirvem - Animations
   =================================== */

/* ===== Keyframes ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

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

    100% {
        background-position: 200% 0;
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }
}

@keyframes countUp {
    from {
        opacity: 0.5;
        transform: translateY(-5px);
    }

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

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(2px);
    }
}

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

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

/* ===== Animation Classes ===== */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
}

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

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

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

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

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

/* ===== Value Change Animation ===== */
.value-updated {
    animation: countUp 0.3s ease-out;
}

/* ===== Stagger Animation ===== */
.calculator-section:nth-child(1) {
    animation-delay: 0.1s;
}

.calculator-section:nth-child(2) {
    animation-delay: 0.2s;
}

.calculator-section:nth-child(3) {
    animation-delay: 0.3s;
}

.calculator-section:nth-child(4) {
    animation-delay: 0.4s;
}

.calculator-section:nth-child(5) {
    animation-delay: 0.5s;
}

.calculator-section {
    animation: slideUp 0.6s ease-out backwards;
}

/* ===== Card Animations ===== */
.input-card,
.result-card,
.analysis-card {
    animation: fadeIn 0.4s ease-out backwards;
}

.input-card:nth-child(1) {
    animation-delay: 0.1s;
}

.input-card:nth-child(2) {
    animation-delay: 0.15s;
}

.input-card:nth-child(3) {
    animation-delay: 0.2s;
}

.input-card:nth-child(4) {
    animation-delay: 0.25s;
}

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg,
            var(--color-border-light) 25%,
            var(--color-border) 50%,
            var(--color-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ===== Transitions ===== */
.transition-colors {
    transition: color var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

.transition-transform {
    transition: transform var(--transition-base);
}

.transition-all {
    transition: all var(--transition-base);
}

/* ===== Profit/Loss Color Transitions ===== */
.profit-positive {
    color: var(--color-success) !important;
    transition: color var(--transition-base);
}

.profit-negative {
    color: var(--color-danger) !important;
    transition: color var(--transition-base);
}

.profit-warning {
    color: var(--color-warning) !important;
    transition: color var(--transition-base);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}