/* websocket-styles.css - Styles for WebSocket visual feedback */

/* WebSocket connection status indicator */
.ws-status-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    z-index: 1001;
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.ws-status-success {
    background-color: #1a4d3a;
    color: #4caf50;
    border: 1px solid #4caf50;
}

.ws-status-error {
    background-color: #55171d;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.ws-status-info {
    background-color: #1a3a55;
    color: #64b5f6;
    border: 1px solid #64b5f6;
}

.ws-status-hidden {
    opacity: 0;
    transform: translateY(-20px);
}

/* Price update animations */
.price-updated {
    animation: priceFlash 1s ease-out;
}

@keyframes priceFlash {
    0% {
        background-color: rgba(255, 235, 59, 0.3);
        transform: scale(1.02);
    }
    50% {
        background-color: rgba(255, 235, 59, 0.6);
        transform: scale(1.05);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Bid price update flash */
.price-box.bid.price-updated {
    animation: bidPriceFlash 1s ease-out;
}

@keyframes bidPriceFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(14, 192, 154, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(14, 192, 154, 0.3);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(14, 192, 154, 0);
        transform: scale(1);
    }
}

/* Offer price update flash */
.price-box.offer.price-updated {
    animation: offerPriceFlash 1s ease-out;
}

@keyframes offerPriceFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(216, 0, 92, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(216, 0, 92, 0.3);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(216, 0, 92, 0);
        transform: scale(1);
    }
}

/* WebSocket connection indicator in header */
.ws-connection-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    background-color: rgba(255, 255, 255, 0.1);
}

.ws-connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.ws-connection-dot.connected {
    background-color: #4caf50;
    animation: connectionPulse 2s infinite;
}

.ws-connection-dot.disconnected {
    background-color: #f44336;
}

.ws-connection-dot.connecting {
    background-color: #ff9800;
    animation: connectionBlink 1s infinite;
}

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

@keyframes connectionBlink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

/* Real-time data badge */
.realtime-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.realtime-badge::before {
    content: '';
    width: 4px;
    height: 4px;
    background-color: #4caf50;
    border-radius: 50%;
    animation: realtimePulse 1.5s infinite;
}

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

/* Activity notifications */
.activity-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 16px;
    background-color: #1f1f1f;
    color: white;
    border-radius: 4px;
    border-left: 4px solid #4054b2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.activity-notification.show {
    transform: translateX(0);
}

.activity-notification .notification-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
}

.activity-notification .notification-message {
    font-size: 12px;
    color: #aaaaaa;
}

/* Order notification styles */
.activity-notification.order {
    border-left-color: #4054b2;
}

.activity-notification.trade {
    border-left-color: #4caf50;
}

.activity-notification.error {
    border-left-color: #f44336;
}

/* Loading state for WebSocket */
.ws-loading {
    position: relative;
}

.ws-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: wsLoadingShimmer 1.5s infinite;
}

@keyframes wsLoadingShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Subscription status in component headers */
.subscription-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #666;
    margin-left: 8px;
}

.subscription-status.subscribed {
    color: #4caf50;
}

.subscription-status.unsubscribed {
    color: #666;
}

/* Enhanced table row highlighting for real-time updates */
.table-row-updated {
    animation: rowHighlight 0.8s ease-out;
}

@keyframes rowHighlight {
    0% {
        background-color: rgba(64, 84, 178, 0.2);
    }
    100% {
        background-color: transparent;
    }
}

/* WebSocket reconnection overlay */
.ws-reconnection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ws-reconnection-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.ws-reconnection-content {
    background-color: #1f1f1f;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #333;
    max-width: 400px;
}

.ws-reconnection-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top: 3px solid #4054b2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.ws-reconnection-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #fff;
}

.ws-reconnection-message {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 20px;
}

.ws-reconnection-button {
    background-color: #4054b2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.ws-reconnection-button:hover {
    background-color: #3145a8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ws-status-indicator {
        top: 5px;
        right: 5px;
        font-size: 11px;
        padding: 6px 12px;
        max-width: 250px;
    }
    
    .activity-notification {
        bottom: 10px;
        right: 10px;
        max-width: 250px;
        font-size: 11px;
    }
    
    .ws-reconnection-content {
        margin: 20px;
        padding: 20px;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .ws-status-indicator {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .activity-notification {
        background-color: #2a2a2a;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
}