/* ==========================================================================
   Videos Section
   ========================================================================== */

.videos-section {
    margin: 0 auto !important;
    max-width: var(--container-max-width);
    padding: var(--spacing-lg);
    background-color: #000;
    position: relative;
}

.videos-section h2.section-title {
    margin: 0 0 var(--spacing-md) 0 !important;
    padding: 0 !important;
    color: #fff;
    text-align: center;
}

/* Layout Container */
.video-layout {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
    margin: 0;
    padding: 0;
}

/* Main Content (Left Column) */
.video-main-content {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.video-main-content h3.video-title {
    margin: 0 !important;
    padding: 15px 0 0 0 !important;
    color: #fff;
    text-align: left;
    font-size: 32px;
}

/* Add a black background that spans the full width */
.videos-section::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background: #000;
    z-index: -1;
    top: 0;
}

.video-player-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background-color: var(--color-black);
    overflow: hidden;
    margin: 0;
}

.video-title {
    color: #fff;
    font-size: var(--text-xl);
    font-weight: 600;
    text-align: left;
}

.lazy-video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lazy-video-player .thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play Button */
.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 2;
    opacity: 0.9;
    transition: opacity var(--transition-base),
                transform var(--transition-base);
}

.play-button:hover {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Video Iframe */
.video-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Thumbnails Container (Right Column) */
.thumbnails-container {
    width: 280px;
    height: calc((((var(--container-max-width) - 280px - var(--spacing-md)) * 0.5625)) + 40px);
    max-height: 600px;
    position: relative;
    background: #000;
    padding: 0;
    flex-shrink: 0;
}

/* Thumbnails Grid */
.thumbnails {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    gap: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 10px;
    margin: 0;
}

.thumbnails::-webkit-scrollbar {
    display: none;
}

.thumbnail-grid-item {
    position: relative;
    min-height: 155px;
    height: calc(33% - 7px);
    cursor: pointer;
    scroll-snap-align: start;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    background: var(--color-black);
    flex-shrink: 0;
}

.thumbnail-grid-item:last-child {
    border-bottom: none;
}

.thumbnail-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

/* Tooltip */
.tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1000;
    pointer-events: none;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.thumbnail-grid-item:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Scroll Buttons */
.scroll-button {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.scroll-button:hover {
    background: rgba(0, 0, 0, 0.9);
}

.scroll-button svg {
    width: 24px;
    height: 24px;
}

#scrollUp {
    top: -20px;
    background: #000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#scrollDown {
    bottom: -20px;
    background: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Active State */
.thumbnail-grid-item.active {
    outline: 3px solid #cc0000;
    outline-offset: -3px;
}

/* Responsive Adjustments */
@media (max-width: 968px) {
    .videos-section {
        padding: var(--spacing-md);
    }

    .video-layout {
        flex-direction: column;
        gap: var(--spacing-lg);
        width: 100%; /* Ensure full width */
    }
    
    .video-main-content {
        width: 100%; /* Ensure full width */
    }
    
    .video-player-container {
        width: 100%;
        padding-bottom: 56.25%;
        margin: 0;
    }
  
    .thumbnails-container {
        width: 100%;
        height: 140px; /* Increased height for better visibility */
        padding: 0 40px;
        margin: 0;
        max-height: none;
    }
  
    .thumbnails {
        flex-direction: row;
        height: 140px; /* Match container height */
        padding: 0;
        gap: 10px;
        overflow-x: auto;
        overflow-y: hidden;
    }
  
    .thumbnail-grid-item {
        flex: 0 0 200px; /* Wider thumbnails on mobile */
        height: 140px; /* Full height of container */
        min-height: unset;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        margin: 0;
    }
    
    .scroll-button {
        top: 50%;
        width: 32px; /* Slightly smaller buttons on mobile */
        height: 32px;
        background: rgba(0, 0, 0, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    #scrollUp {
        left: 4px;
        top: 50%;
        transform: translateY(-50%) rotate(-90deg);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    #scrollDown {
        right: 4px;
        left: auto;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%) rotate(-90deg);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    .video-title {
        text-align: center;
        margin-bottom: var(--spacing-md);
    }

    .video-main-content h3.video-title {
        text-align: center;
        padding-bottom: var(--spacing-md) !important;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .videos-section {
        padding: var(--spacing-md); /* Keep consistent padding even on smaller screens */
    }
    
    .video-layout {
        gap: var(--spacing-md); /* Slightly reduce gap on smaller screens */
    }
    
    .video-title,
    .video-main-content h3.video-title {
        font-size: 24px; /* Further reduced on mobile */
    }

    .thumbnails-container {
        margin: 0 calc(-1 * var(--spacing-md)); /* Negative margin to allow thumbnails to span full width */
        width: calc(100% + (var(--spacing-md) * 2)); /* Compensate for negative margin */
        height: 100px;
        padding: 0 32px;
    }

    .thumbnails {
        height: 100px;
        gap: 8px;
    }

    .thumbnail-grid-item {
        flex: 0 0 160px;
        height: 100px;
    }
    
    .tooltip {
        display: none;
    }
    
    .scroll-button {
        width: 28px;
        height: 28px;
    }

    .scroll-button svg {
        width: 20px;
        height: 20px;
    }
}