/* ========================================
   AppGold - Animations
   ======================================== */

/* ========================================
   Keyframe Animations
   ======================================== */

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

@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);
    }
}

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

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

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

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

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--primary-glow);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 20px 5px var(--primary-glow);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

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

@keyframes loadProgress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

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

@keyframes shimmer-bg {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-glow), 0 0 10px var(--primary-glow);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-glow), 0 0 40px var(--primary-glow);
    }
}

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

@keyframes typing {
    0% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.3;
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* ========================================
   Animation Classes
   ======================================== */

.animate-fadeIn {
    animation: fadeIn 0.3s ease;
}

.animate-fadeInUp {
    animation: fadeInUp 0.4s ease;
}

.animate-fadeInDown {
    animation: fadeInDown 0.4s ease;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.4s ease;
}

.animate-fadeInRight {
    animation: fadeInRight 0.4s ease;
}

.animate-scaleIn {
    animation: scaleIn 0.3s ease;
}

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

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

.animate-bounce {
    animation: bounce 1s ease infinite;
}

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

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

/* ========================================
   Staggered Animations
   ======================================== */

.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }
.stagger-7 { animation-delay: 0.35s; }
.stagger-8 { animation-delay: 0.4s; }
.stagger-9 { animation-delay: 0.45s; }
.stagger-10 { animation-delay: 0.5s; }

/* ========================================
   Hover Animations
   ======================================== */

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

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

.hover-scale {
    transition: transform 0.2s ease;
}

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

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow);
}

/* ========================================
   Loading States
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-input) 0%,
        var(--bg-card-hover) 50%,
        var(--bg-input) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    width: 100%;
    margin-bottom: 0.5em;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

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

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

/* ========================================
   Page Transitions
   ======================================== */

.page-enter {
    opacity: 0;
    transform: translateX(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.page-exit-active {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ========================================
   Confetti Effect
   ======================================== */

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-toast);
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti 3s ease-out forwards;
}

.confetti:nth-child(2n) {
    background: var(--gold);
    width: 15px;
    height: 8px;
}

.confetti:nth-child(3n) {
    background: var(--success);
    width: 8px;
    height: 12px;
}

.confetti:nth-child(4n) {
    background: var(--info);
    width: 12px;
    height: 6px;
}

/* ========================================
   Particle Effect
   ======================================== */

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.particle-gold {
    background: var(--gold);
    box-shadow: 0 0 6px var(--gold);
}

.particle-primary {
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary);
}

/* ========================================
   Progress Animations
   ======================================== */

.progress-animated .progress-bar {
    animation: loadProgress 1.5s ease forwards;
}

.counter-animated {
    animation: countUp 0.5s ease forwards;
}

/* ========================================
   Success/Error Feedback
   ======================================== */

.success-feedback {
    animation: scaleIn 0.3s ease, pulse 0.5s ease 0.3s;
}

.error-feedback {
    animation: shake 0.5s ease;
}

/* ========================================
   Live Indicator
   ======================================== */

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 82, 82, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--error);
}

.live-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   Number Counter Animation
   ======================================== */

.number-counter {
    display: inline-block;
    transition: transform 0.3s ease;
}

.number-counter.updating {
    transform: scale(1.1);
}

/* ========================================
   Card Reveal Animation
   ======================================== */

.card-reveal {
    opacity: 0;
    transform: translateY(30px);
}

.card-reveal.revealed {
    animation: fadeInUp 0.5s ease forwards;
}

/* ========================================
   Button Ripple Effect
   ======================================== */

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 50%;
    transform: scale(1) translate(-50%, -50%);
    transform-origin: center;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* ========================================
   Notification Ping
   ======================================== */

.notification-ping {
    position: relative;
}

.notification-ping::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   Status Dots
   ======================================== */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.offline {
    background: var(--text-muted);
}

.status-dot.busy {
    background: var(--warning);
    animation: blink 1s ease-in-out infinite;
}

/* ========================================
   Price Update Animation
   ======================================== */

.price-up {
    color: var(--success);
    animation: fadeInUp 0.3s ease;
}

.price-down {
    color: var(--error);
    animation: fadeInDown 0.3s ease;
}

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

