/* ===============================================
   ANIMATIONS CSS — PREMIUM FINTECH MICRO-INTERACTIONS
   =============================================== */

/* -----------------------------------------------
   1. BASE ANIMATION UTILITIES & 20. HOVER SYSTEM
   ----------------------------------------------- */
:root {
    --ease-premium: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-in-out-soft: cubic-bezier(0.45, 0, 0.55, 1);
}

/* -----------------------------------------------
   2. FADE ANIMATIONS
   ----------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.3s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   3. SLIDE ANIMATIONS
   ----------------------------------------------- */
/* Existing */
@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

.animate-slide-in-left {
    animation: slideInLeft 0.3s var(--ease-premium) forwards;
}

/* New */
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

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

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

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

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

/* New */
@keyframes scaleOut {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(0.9); opacity: 0; }
}

/* -----------------------------------------------
   5. PAGE TRANSITIONS
   ----------------------------------------------- */
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-page-enter {
    animation: pageEnter 0.25s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   6. CARD ANIMATIONS
   ----------------------------------------------- */
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-card-enter {
    animation: cardEnter 0.25s var(--ease-premium) forwards;
    opacity: 0; /* Start hidden */
}

/* Stagger Delays */
.animate-delay-1 { animation-delay: 0.05s; }
.animate-delay-2 { animation-delay: 0.10s; }
.animate-delay-3 { animation-delay: 0.15s; }
.animate-delay-4 { animation-delay: 0.20s; }
.animate-delay-5 { animation-delay: 0.25s; }

/* -----------------------------------------------
   7. BUTTON INTERACTIONS
   ----------------------------------------------- */
.btn {
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform 0.12s var(--ease-premium);
}

@media (hover: hover) {
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* -----------------------------------------------
   8. NAVIGATION ANIMATIONS
   ----------------------------------------------- */
@keyframes navIconEnter {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.mobile-nav__link {
    transition: color var(--transition-fast);
}

.mobile-nav__link.active svg {
    animation: navIconEnter 0.3s var(--ease-premium);
}

/* -----------------------------------------------
   9. MODAL ANIMATIONS
   ----------------------------------------------- */
.modal-overlay {
    transition: opacity 0.2s var(--ease-premium);
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.active .modal {
    animation: scaleIn 0.25s var(--ease-premium) forwards;
}

.modal-overlay.is-removing {
    opacity: 0;
}

.modal-overlay.is-removing .modal {
    animation: scaleOut 0.2s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   10. DRAWER ANIMATIONS
   ----------------------------------------------- */
.sidebar {
    transition: transform 0.3s var(--ease-premium);
}

.app-container.sidebar-open .sidebar {
    animation: slideInLeft 0.3s var(--ease-premium) forwards;
}

.app-container.sidebar-closing .sidebar {
    animation: slideOutLeft 0.3s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   11. DROPDOWN ANIMATIONS
   ----------------------------------------------- */
@keyframes dropdownEnter {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown {
    opacity: 0;
    visibility: hidden;
    transform-origin: top right;
    transition: opacity 0.15s var(--ease-premium), visibility 0.15s var(--ease-premium), transform 0.15s var(--ease-premium);
    transform: translateY(-8px) scale(0.95);
}

.dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* -----------------------------------------------
   12. TOAST ANIMATIONS
   ----------------------------------------------- */
.toast {
    animation: slideInRight 0.3s var(--ease-premium) forwards;
}

.toast.is-removing {
    animation: slideOutRight 0.3s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   13. NOTIFICATION ANIMATIONS
   ----------------------------------------------- */
@keyframes badgePop {
    0% { opacity: 0; transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

.notification-badge {
    animation: badgePop 0.25s var(--ease-premium) forwards;
}

/* -----------------------------------------------
   14. LOADING ANIMATIONS
   ----------------------------------------------- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-gold, #f5a623);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

/* -----------------------------------------------
   15. SKELETON / SHIMMER
   ----------------------------------------------- */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-input, #f0f0f0) 25%, var(--bg-body, #e0e0e0) 50%, var(--bg-input, #f0f0f0) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
}

/* -----------------------------------------------
   16. SUCCESS / ERROR FEEDBACK
   ----------------------------------------------- */
@keyframes successPop {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.animate-success {
    animation: successPop 0.3s var(--ease-premium) forwards;
}

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

.animate-shake {
    animation: shake 0.4s var(--ease-in-out-soft);
}

/* -----------------------------------------------
   17. LIVE / SYNC STATES
   ----------------------------------------------- */
@keyframes pulseSoft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.is-syncing {
    animation: pulseSoft 1.5s var(--ease-in-out-soft) infinite;
    pointer-events: none;
}

/* -----------------------------------------------
   18. VALUE UPDATE ANIMATIONS
   ----------------------------------------------- */
@keyframes valueUpdate {
    0% { opacity: 0.5; transform: translateY(-2px); }
    100% { opacity: 1; transform: translateY(0); }
}

.value-updated {
    animation: valueUpdate 0.3s var(--ease-premium);
}

/* -----------------------------------------------
   19. TABLE INTERACTIONS
   ----------------------------------------------- */
.table tbody tr {
    transition: background-color var(--transition-fast), transform 0.1s var(--ease-premium);
}

@media (hover: hover) {
    .table tbody tr:hover {
        background-color: rgba(0, 0, 0, 0.02);
    }
}

.table tbody tr.is-updated {
    animation: valueUpdate 0.3s var(--ease-premium);
}

.table tbody tr.is-selected {
    background-color: rgba(244, 179, 66, 0.05);
}

/* -----------------------------------------------
   20. 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;
    }
    
    .skeleton {
        animation: none;
        background: var(--bg-input, #f0f0f0);
    }
}