/**
 * CoinTrail Live Price Animations
 *
 * Beautiful animations for real-time cryptocurrency price updates
 * Includes flash effects, pulse animations, and ripple transitions
 *
 * @package CoinTrail
 * @author CoinTrail Development Team
 */

/* Price change colors */
.price-up {
    color: #10b981 !important;
    animation: priceFlashGreen 0.6s ease-out;
}

.price-down {
    color: #ef4444 !important;
    animation: priceFlashRed 0.6s ease-out;
}

.price-positive {
    color: #10b981;
}

.price-negative {
    color: #ef4444;
}

/* Dark mode adjustments */
.dark .price-up {
    color: #34d399 !important;
}

.dark .price-down {
    color: #f87171 !important;
}

.dark .price-positive {
    color: #34d399;
}

.dark .price-negative {
    color: #f87171;
}

/* Pulse animation on price update */
.price-pulse {
    animation: pricePulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pricePulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
        font-weight: 700;
    }
    100% {
        transform: scale(1);
    }
}

/* Flash animations */
@keyframes priceFlashGreen {
    0% {
        background-color: rgba(16, 185, 129, 0);
    }
    50% {
        background-color: rgba(16, 185, 129, 0.2);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    }
    100% {
        background-color: rgba(16, 185, 129, 0);
    }
}

@keyframes priceFlashRed {
    0% {
        background-color: rgba(239, 68, 68, 0);
    }
    50% {
        background-color: rgba(239, 68, 68, 0.2);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
    }
    100% {
        background-color: rgba(239, 68, 68, 0);
    }
}

/* Glow effect for live indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
}

.dark .live-indicator {
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.live-indicator-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: livePulse 2s ease-in-out infinite;
}

.dark .live-indicator-dot {
    background: #34d399;
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Shimmer effect for loading */
.price-shimmer {
    background: linear-gradient(90deg,
        rgba(156, 163, 175, 0.1) 0%,
        rgba(156, 163, 175, 0.3) 50%,
        rgba(156, 163, 175, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .price-shimmer {
    background: linear-gradient(90deg,
        rgba(75, 85, 99, 0.1) 0%,
        rgba(75, 85, 99, 0.3) 50%,
        rgba(75, 85, 99, 0.1) 100%
    );
    background-size: 200% 100%;
}

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

/* Number counter animation */
.price-counter {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Arrow indicators for price direction */
.price-arrow {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.75em;
    animation: arrowBounce 0.6s ease-out;
}

.price-arrow-up {
    color: #10b981;
}

.price-arrow-down {
    color: #ef4444;
}

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

/* Percentage badge animation */
.percent-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.percent-badge-positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.percent-badge-negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.dark .percent-badge-positive {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.dark .percent-badge-negative {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

/* Smooth transitions for all price elements */
.price-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glow effect on hover */
.price-glow:hover {
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    cursor: pointer;
}

/* Market cap animation */
.market-cap-pulse {
    animation: marketCapPulse 3s ease-in-out infinite;
}

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

/* Connection status indicator */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.dark .connection-status {
    background: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.connection-status.connected {
    border-left: 3px solid #10b981;
}

.connection-status.disconnected {
    border-left: 3px solid #ef4444;
}

.connection-status.connecting {
    border-left: 3px solid #f59e0b;
}

/* Ripple effect animation - CoinTrail */
@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.price-ripple-up {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, rgba(16, 185, 129, 0) 70%);
}

.price-ripple-down {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.4) 0%, rgba(239, 68, 68, 0) 70%);
}

/* Number morphing transition - CoinTrail */
.price-morphing {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Row highlight on update - CoinTrail */
.row-update-highlight {
    transition: background-color 0.3s ease-in-out;
}
