/* KnexPay Animations - Clear Glass UI + iOS Native */

/* ========================================
   KEYFRAMES
   ======================================== */

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

@keyframes pulse-logo {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(255,140,0,0.5));
    }
    50% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 30px rgba(255,140,0,0.7));
    }
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.15);
    }
}

@keyframes pulse-biometric {
    0%, 100% {
        transform: scale(1);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.3;
    }
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255,140,0,0.3), 0 0 10px rgba(255,140,0,0.15);
    }
    50% {
        box-shadow: 0 0 10px rgba(255,140,0,0.4), 0 0 20px rgba(255,140,0,0.2);
    }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes success-check {
    0% { stroke-dashoffset: 50; }
    100% { stroke-dashoffset: 0; }
}

@keyframes typing-cursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes border-glow {
    0%, 100% {
        border-color: var(--stroke-subtle);
    }
    50% {
        border-color: rgba(255,140,0,0.3);
    }
}

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

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* iOS-style spring entrance */
@keyframes ios-spring-in {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    60% {
        opacity: 1;
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Scan success — circle draws in */
@keyframes scan-circle {
    to { stroke-dashoffset: 0; }
}

/* Scan success — checkmark draws in */
@keyframes scan-check {
    to { stroke-dashoffset: 0; }
}

/* ========================================
   ANIMATION CLASSES
   ======================================== */

.animate-fade-in {
    animation: fade-in 0.3s ease forwards;
}

.animate-fade-out {
    animation: fade-out 0.3s ease forwards;
}

.animate-slide-up {
    animation: slide-up 0.3s ease forwards;
}

.animate-slide-down {
    animation: slide-down 0.3s ease forwards;
}

.animate-scale-in {
    animation: scale-in 0.3s ease forwards;
}

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

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

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

.animate-ios-spring {
    animation: ios-spring-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ========================================
   TRANSITION UTILITIES
   ======================================== */

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

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

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

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: var(--neon);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn.loading {
    color: transparent;
}

/* ========================================
   SKELETON LOADING
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.10) 50%,
        rgba(255,255,255,0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

.toast {
    animation: slide-up 0.3s ease forwards;
}

.toast.hiding {
    animation: fade-out 0.3s ease forwards;
}

/* ========================================
   SUCCESS CHECK ANIMATION
   ======================================== */

.success-check {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: success-check 0.5s ease forwards;
}
