/* ============================================
   LIVE UPDATES & WEBSOCKET ANIMATIONS
   ============================================ */

/* WebSocket Connection Status Indicator */
.ws-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    /* background: rgba(0, 0, 0, 0.05); */
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ws-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ws-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ws-status-connected {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
}

.ws-status-connected::before {
    background: #22c55e;
    animation: pulse-live 2s ease-in-out infinite;
}

.ws-status-refresh {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.ws-status-refresh::before {
    background: #3b82f6;
    animation: pulse 2s ease-in-out infinite;
}

.ws-status-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.ws-status-disconnected::before {
    background: #ef4444;
}

.ws-status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.ws-status-error::before {
    background: #dc2626;
    animation: blink 1s ease-in-out infinite;
}

.ws-status-cached {
    background: rgba(168, 85, 247, 0.1);
    color: #7c3aed;
}

.ws-status-cached::before {
    background: #a855f7;
    animation: pulse 2s ease-in-out infinite;
}

.ws-status-reconnecting {
    background: rgba(251, 191, 36, 0.1);
    color: #d97706;
}

.ws-status-reconnecting::before {
    background: #fbbf24;
    animation: pulse 1s ease-in-out infinite;
}

.ws-status-completed {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
}

.ws-status-completed::before {
    background: #64748b;
}

/* Live Indicator Pulse Animation */
@keyframes pulse-live {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* Blink Animation for Error State */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Pulse Animation for Reconnecting State */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* New Item Highlight Animation */
.new-item-highlight {
    animation: slideInHighlight 0.5s ease-out;
    position: relative;
}

@keyframes slideInHighlight {
    0% {
        opacity: 0;
        transform: translateX(-20px);
        background: rgba(59, 130, 246, 0.2);
    }
    50% {
        background: rgba(59, 130, 246, 0.15);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        background: transparent;
    }
}

/* Score Update Flash Animation */
.score-update-flash {
    animation: scoreFlash 0.8s ease-out;
}

@keyframes scoreFlash {
    0%, 100% {
        background: transparent;
        transform: scale(1);
    }
    50% {
        background: rgba(34, 197, 94, 0.2);
        transform: scale(1.05);
    }
}

/* Row Update Flash Animation */
.row-update-flash {
    animation: rowFlash 1s ease-out;
}

@keyframes rowFlash {
    0% {
        background: rgba(59, 130, 246, 0.2);
    }
    100% {
        background: transparent;
    }
}

/* Live Notification Styles */
.live-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.live-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.live-notification .notification-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-notification .notification-message {
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.95;
}

/* Wicket Notification */
.wicket-notification {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #ffffff;
    border-left: 4px solid #7f1d1d;
}

.wicket-notification .notification-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Boundary Notification */
.boundary-notification {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #ffffff;
    border-left: 4px solid #1e3a8a;
}

.boundary-notification .notification-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Status Notification */
.status-notification {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff;
    border-left: 4px solid #065f46;
}

.status-notification .notification-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Notification Close Button */
.live-notification::after {
    content: '×';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.live-notification::after:hover {
    opacity: 1;
}

/* Loading Indicator for Live Updates */
.live-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

.live-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Live Badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #ffffff;
    border-radius: 50%;
    animation: pulse-live 1.5s ease-in-out infinite;
}

/* Refresh Button */
.refresh-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto;
}

.refresh-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.refresh-button:active:not(:disabled) {
    transform: translateY(0);
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-button.refreshing .refresh-icon {
    animation: spin 1s linear infinite;
}

.refresh-icon {
    font-size: 16px;
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Innings Badges */
.innings-badge {
    /* display: inline-block; */
    display: none;
    padding: 4px 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #ffffff;
    border-radius: 6px 6px 0 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: -6px;
}

.innings-badge-small {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(139, 92, 246, 0.15);
    color: #7c3aed;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
}

/* Last Updated Text */
.last-updated {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
}

/* Responsive Adjustments for Live Notifications */
@media (max-width: 768px) {
    .live-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .ws-status-container {
        flex-direction: column;
        align-items: flex-start;
        display: none;
    }
    
    .refresh-button {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .last-updated {
        width: 100%;
        text-align: center;
    }
}
