/* video-player.css - Scoped styling for the video player */

.video-player-container {
    width: 100%;
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 0.75rem; /* Adjusted from 0.5rem to give more space on desktop */
    padding: 0.5rem;
    font-family: inherit; /* Inherit from parent to match your site */
    color: inherit; /* Inherit from parent to match your site */
}

/* Main video area */
.video-player-container .main-video {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border: 2px solid #d2b69150;
    border-radius: 0.5rem;
    background-color: #f4f4f2d0;
    margin-bottom: 0;
    box-sizing: border-box; /* Add explicit box-sizing */
}

.video-player-container .main-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Maintains aspect ratio with letterboxing */
    border-radius: 0.3rem; /* Slightly reduced to account for parent border */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: #000; /* Changed from #000 to match playlist background */
}

/* Playlist area */
.video-player-container .video-playlist {
    height: 400px; /* Same exact height as main-video */
    background-color: #f4f4f2f2;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 2px solid #d2b69150;
    box-sizing: border-box; /* Add explicit box-sizing */
    display: flex;
    flex-direction: column; /* Stack children vertically */
}

/* Adjust header elements to use minimal space */
.video-player-container .video-playlist h3.playlist-title {
    padding: 0.4rem 0.5rem;
    margin: 0;
    font-size: 1.1rem;
    flex-shrink: 0; /* Prevent shrinking */
}

.video-player-container .video-playlist p.playlist-info {
    padding: 0 0.5rem 0.4rem;
    margin: 0;
    color: #666;
    font-size: 0.9rem;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Make videos container take remaining space */
.video-player-container .video-playlist .videos {
    flex-grow: 1; /* Take all remaining space */
    height: auto; /* Let flex handle the height */
    overflow-y: auto;
    scrollbar-width: thin;
}

.video-player-container .video-playlist .videos::-webkit-scrollbar {
    width: 0.4rem;
    border-radius: 0.4rem;
    background-color: rgba(0, 0, 0, 0.1);
}

.video-player-container .video-playlist .videos::-webkit-scrollbar-thumb {
    border-radius: 0.4rem;
    background-color: #edeaf2; /* Updated to match theme from audiostyle.css */
}

/* Individual video items with thumbnails */
.video-player-container .video-playlist .video {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin-top: 0.1rem;
    cursor: pointer;
    border-radius: 0.3rem;
    transition: background-color 0.2s;
}

/* Thumbnail styling */
.video-player-container .video-playlist .video .video-thumbnail {
    width: 80px;
    height: 45px;
    border-radius: 0.2rem;
    overflow: hidden;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

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

/* Video details container */
.video-player-container .video-playlist .video .video-details {
    flex-grow: 1;
    min-width: 0; /* Important for text-overflow to work */
}

.video-player-container .video-playlist .video:hover {
    background-color: rgba(237, 234, 242, 0.3); /* Updated to use #edeaf2 with opacity */
}

.video-player-container .video-playlist .video.active {
    background-color: rgba(237, 234, 242, 0.6); /* Updated to use #edeaf2 with opacity */
    font-weight: 500;
}

/* Video number */
.video-player-container .video-playlist .video .video-index {
    margin-right: 0.5rem;
    color: #666;
}

/* Video title */
.video-player-container .video-playlist .video h3.video-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: normal;
    font-size: 0.95rem;
    padding: 0 0.5rem;
    margin: 0;
    text-align: left; /* Left-justify the text */
}



/* Add this class that will be applied via JavaScript only when text overflows */
.video-player-container .video-playlist .video h3.video-title.overflow-text:hover {
    animation: marquee 8s linear infinite;
    animation-play-state: running;
}

@keyframes marquee {
    0% { text-indent: 0; }
    100% { text-indent: -200%; }
}

/* Video duration */
.video-player-container .video-playlist .video p.video-time {
    margin: 0 0 0 auto;
    color: #666;
    font-size: 0.85rem;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .video-player-container .video-playlist {
        background-color: #f4f4f2; /* Keep consistent with light mode */
        color: rgba(0, 0, 0, 0.9); /* Darker text for dark mode */
    }
    
    .video-player-container .video-playlist p.playlist-info,
    .video-player-container .video-playlist .video .video-index,
    .video-player-container .video-playlist .video p.video-time {
        color: rgba(0, 0, 0, 0.7); /* Darker text for dark mode */
    }
    
    .video-player-container .video-playlist .video:hover {
        background-color: rgba(237, 234, 242, 0.3);
    }
    
    .video-player-container .video-playlist .video.active {
        background-color: rgba(237, 234, 242, 0.6);
    }
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .video-player-container {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 1rem;
    }
    
    .video-player-container .main-video {
        height: auto;
        padding-top: 56.25%;
        margin-bottom: 0.25rem;
    }
    
    .video-player-container .video-playlist {
        height: auto; /* Allow the playlist to shrink to content */
    }
    
    .video-player-container .video-playlist .videos {
        height: auto; /* Allow videos container to fit content */
        max-height: 300px; /* Set a maximum height if needed */
        overflow-y: auto; /* Keep scrolling if it reaches max height */
    }
}