/* Real-time Market Data Animations - Tech-Forward Style */

/* Flash animations for price changes */
@keyframes flashUp {
    0% { 
        background-color: rgba(0, 255, 0, 0.3);
        transform: scale(1);
        box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
    }
    50% { 
        background-color: rgba(0, 255, 0, 0.6);
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(0, 255, 0, 0.6);
    }
    100% { 
        background-color: rgba(0, 255, 0, 0);
        transform: scale(1);
        box-shadow: none;
    }
}

@keyframes flashDown {
    0% { 
        background-color: rgba(255, 68, 68, 0.3);
        transform: scale(1);
        box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
    }
    50% { 
        background-color: rgba(255, 68, 68, 0.6);
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(255, 68, 68, 0.6);
    }
    100% { 
        background-color: rgba(255, 68, 68, 0);
        transform: scale(1);
        box-shadow: none;
    }
}

@keyframes flashNeutral {
    0% { 
        background-color: rgba(0, 206, 209, 0.2);
        transform: scale(1);
    }
    50% { 
        background-color: rgba(0, 206, 209, 0.4);
        transform: scale(1.01);
    }
    100% { 
        background-color: rgba(0, 206, 209, 0);
        transform: scale(1);
    }
}

/* Tech-forward pulse animation */
@keyframes techPulse {
    0% { 
        transform: scale(1);
        text-shadow: 0 0 5px currentColor;
    }
    50% { 
        transform: scale(1.05);
        text-shadow: 0 0 15px currentColor, 0 0 25px currentColor;
    }
    100% { 
        transform: scale(1);
        text-shadow: 0 0 5px currentColor;
    }
}

/* Glowing animation for active elements */
@keyframes glow {
    0% { 
        box-shadow: 0 0 5px rgba(0, 206, 209, 0.3);
    }
    50% { 
        box-shadow: 0 0 20px rgba(0, 206, 209, 0.6), 0 0 30px rgba(0, 206, 209, 0.4);
    }
    100% { 
        box-shadow: 0 0 5px rgba(0, 206, 209, 0.3);
    }
}

/* Data stream animation */
@keyframes dataStream {
    0% { 
        opacity: 0;
        transform: translateY(-10px);
    }
    50% { 
        opacity: 1;
        transform: translateY(0);
    }
    100% { 
        opacity: 0.8;
        transform: translateY(0);
    }
}

/* Flash animation classes */
.flash-up {
    animation: flashUp 0.5s ease-out;
}

.flash-down {
    animation: flashDown 0.5s ease-out;
}

.flash-neutral {
    animation: flashNeutral 0.3s ease-out;
}

/* Price elements */
.price {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.price.updating {
    transform: scale(1.02);
}

/* Change indicators */
.change {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.change.positive {
    color: #00FF00;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

.change.negative {
    color: #FF4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.3);
}

/* Streaming indicator */
.streaming-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00CED1;
    border-radius: 50%;
    animation: glow 2s infinite;
    margin-left: 8px;
}

.streaming-indicator.disconnected {
    background: #FF4444;
    animation: none;
}

/* Watchlist animations */
.watchlist-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px solid transparent;
}

.watchlist-item.price-up {
    border-left-color: #00FF00;
    background: linear-gradient(90deg, rgba(0, 255, 0, 0.1) 0%, transparent 100%);
}

.watchlist-item.price-down {
    border-left-color: #FF4444;
    background: linear-gradient(90deg, rgba(255, 68, 68, 0.1) 0%, transparent 100%);
}

/* Quote display animations */
.quote-container {
    position: relative;
    overflow: hidden;
}

.quote-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 206, 209, 0.1), transparent);
    animation: dataStream 2s infinite;
    pointer-events: none;
}

.quote-container.live::before {
    animation-duration: 1.5s;
}

/* Market status animations */
.market-status.open .status-indicator {
    background: #00FF00;
    animation: glow 2s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.4);
}

.market-status.closed .status-indicator {
    background: #FF4444;
    animation: none;
}

/* Connection status overlay */
.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #00CED1;
    font-size: 0.9em;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.connection-status.visible {
    opacity: 1;
    transform: translateY(0);
}

.connection-status.connected {
    border-color: #00FF00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.connection-status.disconnected {
    border-color: #FF4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.2);
}

/* Pulse animation for active elements */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* Smooth hover effects for streaming elements */
.streaming-element {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.streaming-element:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 206, 209, 0.2);
}

/* Performance optimizations */
.price, .change, .watchlist-item {
    will-change: transform, opacity;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .change.positive {
        color: #00FF00;
        text-shadow: none;
    }
    
    .change.negative {
        color: #FF0000;
        text-shadow: none;
    }
}