/* static/css/video-gallery.css */

.video-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem 1.5rem;
}

.video-card {
    cursor: pointer;
    border: none;
    background: transparent;
}

/* This is the container for both the thumbnail and the video player.
   position: relative is CRUCIAL for containing the absolute-positioned player. */
.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden; /* This clips anything that tries to go outside the rounded corners */
    margin-bottom: 0.75rem;
    background-color: #282828;
    transition: border-radius 0.2s ease-in-out;
}

.video-card:hover .video-thumbnail {
    border-radius: 0;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease-in-out;
}

/* --- The Player Container --- */
.video-player-container {
    /* This makes the player an overlay that perfectly fills the thumbnail container. */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none; /* Prevents interaction when hidden */
    transition: opacity 0.3s ease-in-out;
    z-index: 10; /* Ensures it sits on top of the image */
}

/* --- The Hover Logic --- */
/* On hover, hide the thumbnail image and show the video player */
.video-card:hover .video-thumbnail img {
    opacity: 0;
}
.video-card:hover .video-player-container {
    opacity: 1;
}

/* THIS IS THE FIX for the duration badge overlaying the video */
.video-card:hover .video-duration-badge {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.video-player-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 11; /* Ensure badge is on top of the thumbnail image */
    transition: opacity 0.2s ease-in-out;
}

/* ... (Your other styles for .video-info, .video-title, etc. are fine) ... */
.video-info { display: flex; gap: 0.75rem; align-items: flex-start; }
.video-avatar img { width: 48px; height: 48px; border-radius: 50%; background-color: #fff; object-fit: cover; }
.video-title { font-size: 1rem; font-weight: 500; line-height: 1.4; margin-bottom: 0.25rem; color: #f1f1f1; }
.video-creator, .video-stats { font-size: 0.875rem; color: #aaa; line-height: 1.2; margin: 0; }
