#mainVideoPlayer {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Default 16:9 for horizontal videos */
    background-color: #000;
}

/* Better approach: Use aspect-ratio property with fallback */
@supports (aspect-ratio: 16 / 9) {
    #mainVideoPlayer {
        padding-bottom: 0;
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 300px;
        max-height: 80vh;
    }
    
    #mainVideoPlayer iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain; /* This helps with different aspect ratios */
    }
}

/* Container for vertical videos */
#mainVideoPlayer.vertical-video {
    padding-bottom: 177.78%; /* 9:16 for vertical videos */
    max-height: 80vh; /* Limit height on large screens */
}

/* Responsive handling for vertical videos on smaller screens */
@media (max-width: 768px) {
    #mainVideoPlayer.vertical-video {
        padding-bottom: 133.33%; /* 3:4 aspect ratio for mobile vertical videos */
        max-height: 70vh;
    }
}

/* Auto-sizing container that adapts to video content */
#mainVideoPlayer.auto-size {
    padding-bottom: 0;
    height: auto;
    min-height: 300px;
    max-height: 80vh;
}

#mainVideoPlayer.auto-size iframe {
    position: relative;
    width: 100%;
    height: 56.25vw; /* Default responsive height */
    max-height: 80vh;
    min-height: 300px;
}

@media (max-width: 768px) {
    #mainVideoPlayer.auto-size iframe {
        height: 56.25vw;
        max-height: 70vh;
        min-height: 250px;
    }
}

/* Flexible container that works for most cases */
#mainVideoPlayer.flexible {
    padding-bottom: 0;
    height: 60vw; /* Responsive height based on viewport */
    max-height: 80vh;
    min-height: 300px;
}

#mainVideoPlayer.flexible iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

#thumbnailsContainer {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding-top: 15px;
}

.thumbnailWrapper {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.thumbnailImage {
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    position: relative;
    background-color: #000; /* Optional: in case image doesn't cover area */
}

.thumbnailImage img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnailTitle {
    text-align: left; /* Align text to the left */
    font-size: 17px; /* Adjust font size as needed */
    color: #000; /* Text color */
    width: 100%; /* Ensure the title width matches the thumbnail */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* Limit text to three lines */
    margin-top: 10px; /* Space between thumbnail and title */
    line-height: 1.75em; /* Adjust line height to control space between lines */
}
