/* Enhanced Default Scrollbar with Date Indicator */

/* GPU-accelerated scrollbar styling for maximum smoothness */
::-webkit-scrollbar {
    width: 16px;
    background: transparent;
    will-change: transform;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    margin: 4px;
    box-shadow: 
        inset 0 0 8px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0d6efd 0%, #3b82f6 40%, #60a5fa 100%);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 0 12px rgba(13, 110, 253, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform, box-shadow;
    transform: translateZ(0); /* Force GPU acceleration */
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #2563eb 40%, #3b82f6 100%);
    box-shadow: 
        0 0 20px rgba(13, 110, 253, 0.7),
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    transform: translateZ(0) scale(1.08);
    border-color: rgba(255, 255, 255, 0.25);
}

::-webkit-scrollbar-thumb:active {
    background: linear-gradient(135deg, #0a58ca 0%, #1d4ed8 40%, #2563eb 100%);
    box-shadow: 
        0 0 25px rgba(13, 110, 253, 0.9),
        0 2px 10px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    transform: translateZ(0) scale(1.15);
    transition-duration: 0.1s;
}

/* Smooth corner rounding */
::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox scrollbar styling with enhanced smoothness */
html {
    scrollbar-width: auto;
    scrollbar-color: rgba(13, 110, 253, 0.9) rgba(0, 0, 0, 0.15);
    scroll-behavior: smooth;
}

/* Mobile scrollbar adjustments with better touch response */
@media (max-width: 767px) {
    ::-webkit-scrollbar {
        width: 14px; /* Slightly larger for touch */
    }
    
    ::-webkit-scrollbar-track {
        border-radius: 8px;
        margin: 2px;
    }
    
    ::-webkit-scrollbar-thumb {
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.15);
        /* More subtle animations on mobile for better performance */
        transition: all 0.25s ease-out;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        transform: translateZ(0) scale(1.05);
    }
}

/* Enhanced body settings for better scroll performance */
body.streams-page {
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-y: auto;
    /* Optimize for smooth scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Date tooltip enhancements */
.scrollbar-date-tooltip {
    /* Additional GPU acceleration hints */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    /* Prevent subpixel rendering issues */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Hide scrollbar date tooltip when modals are open */
body.modal-open .scrollbar-date-tooltip {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

/* Smooth page loading */
body.streams-page {
    transition: opacity 0.3s ease-in-out;
}

/* Enhanced accessibility with smooth transitions */
@media (prefers-reduced-motion: reduce) {
    ::-webkit-scrollbar-thumb {
        transition: background-color 0.2s ease !important;
        transform: none !important;
    }
    
    html {
        scroll-behavior: auto;
    }
    
    .scrollbar-date-tooltip {
        transition: opacity 0.15s ease !important;
    }
}

@media (prefers-contrast: high) {
    ::-webkit-scrollbar-thumb {
        background: #0d6efd !important;
        border: 2px solid white !important;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.8) !important;
    }
    
    ::-webkit-scrollbar-track {
        background: black !important;
        border: 1px solid white !important;
    }
    
    .scrollbar-date-tooltip {
        background: black !important;
        border: 2px solid white !important;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.8) !important;
    }
}

/* Prevent layout shifts during scroll */
.streams-container, #streams-container {
    contain: layout style paint;
}

/* Optimize scroll performance for stream cards */
.stream-card, .card {
    will-change: transform;
    contain: layout style paint;
}
