/**
 * Elegant Real-time Odds Animations & Visual Effects
 * Professional styling for live odds updates
 */

/* Real-time Connection Status Indicator */
#realtime-status {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

/* Odds Update Animations */
.odds-updating {
    position: relative;
    overflow: hidden;
}

.odds-updating::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: shimmer 1.2s ease-in-out;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Odds Change Direction Indicators */
.odds-better {
    color: #16a34a !important;
    font-weight: 600;
}

.odds-worse {
    color: #dc2626 !important;
    font-weight: 600;
}



/* Smooth Transitions for All Odds Elements */
[data-outcome-id] {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    padding: 4px 8px;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

/* Hover Effects */
/* Disable hover movement and shadow on odds */
[data-outcome-id]:hover {
    transform: none;
    box-shadow: none;
}

/* Loading State */
.odds-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    color: transparent;
}

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

/* New Odds Notification Toast */
.odds-notification {
    position: fixed;
    top: 60px;
    right: 10px;
    z-index: 9998;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-size: 14px;
    line-height: 1.4;
}

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

.odds-notification .notification-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.odds-notification .notification-body {
    opacity: 0.9;
    font-size: 12px;
}

/* Real-time Activity Indicator */
.realtime-activity {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.realtime-activity.active {
    opacity: 1;
    transform: translateY(0);
}

.realtime-activity::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 1.5s infinite;
}

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

/* Sportsbook Logo Integration */
.odds-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sportsbook-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: contain;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    #realtime-status {
        top: 5px;
        right: 5px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .odds-notification {
        right: 5px;
        top: 45px;
        max-width: calc(100vw - 20px);
    }
    
    .realtime-activity {
        bottom: 10px;
        right: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    [data-outcome-id]:hover {
        transform: none; /* Disable hover effects on mobile */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .odds-loading {
        background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .odds-updating::before,
    .best-odds,
    .cell-flash::after,
    .odds-pill-flash::after,
    .odds-loading {
        animation: none !important;
    }

    [data-outcome-id] {
        transition: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .odds-better {
        color: #000 !important;
        background: #00ff00 !important;
    }
    
    .odds-worse {
        color: #fff !important;
        background: #ff0000 !important;
    }
    
    .best-odds { box-shadow: inset 0 0 0 3px #000 !important; }
}

/* BIG odds change flash so it's very noticeable */
.odds-flash {
    animation: oddsFlash 1.2s ease-out;
}

@keyframes oddsFlash {
    0% {
        transform: scale(1.08);
        background-color: #dbeafe; /* light blue */
        box-shadow: 0 0 0 0 rgba(59,130,246,0.65), 0 0 0 4px rgba(59,130,246,0.35);
    }
    40% {
        transform: scale(1.04);
        box-shadow: 0 0 0 10px rgba(59,130,246,0);
    }
    100% {
        transform: none;
        background-color: transparent;
        box-shadow: none;
    }
}

/* Sustained blue flash on the updated odds pill (not the whole cell) */
.odds-pill-flash {
    position: relative;
    z-index: 1;
}
.odds-pill-flash::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(59,130,246,0.35); /* blue overlay */
    pointer-events: none;
    animation: pillFadeOverlay 12s linear forwards;
}
@keyframes pillFadeOverlay {
    0%   { opacity: 1; }
    70%  { opacity: 0.5; }
    100% { opacity: 0; }
}

/* Whole-cell highlight + fade for updates (overlay approach to avoid bg overrides) */
.cell-flash {
    position: relative;
    overflow: hidden;
    /* Ensure contents render above the overlay */
    z-index: 0;
}
.cell-flash::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(59,130,246,0.35);
    pointer-events: none;
    animation: cellFadeOverlay 60s linear forwards;
    z-index: -1; /* place overlay behind cell contents */
}
/* Explicitly keep immediate children above the overlay */
.cell-flash > * { position: relative; z-index: 1; }
@keyframes cellFadeOverlay {
    0%   { opacity: 1; }
    60%  { opacity: 0.5; }
    100% { opacity: 0; }
}
