.video-gallery {
    margin: 2rem 0;
    background: #f8f9fa;
    padding: 1rem 5%;
    overflow: hidden;
}

.video-grid {
    display: flex;
    gap: 2rem;
    margin: 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 1rem;
}

/* Webkit scrollbar styling */
.video-grid::-webkit-scrollbar {
    height: 8px;
}

.video-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.video-grid::-webkit-scrollbar-thumb {
    background: rgb(117, 199, 197);
    border-radius: 4px;
}

.video-grid::-webkit-scrollbar-thumb:hover {
    background: rgb(97, 165, 163);
}

.video-container {
    flex: 0 0 calc((100% - 4rem) / 3);
    min-width: 400px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.video-wrapper {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
}

.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide video controls by default */
.video-wrapper video::-webkit-media-controls-panel {
    display: none !important;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Show controls on hover */
.video-wrapper:hover video::-webkit-media-controls-panel {
    display: flex !important;
    opacity: 1;
}

/* Custom video controls */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.4s ease;
    /* Add a small buffer area above the controls */
    padding-top: 30px;
    /* Move the actual controls to the bottom */
    margin-top: -20px;
    /* Prevent text selection */
    user-select: none;
    /* Ensure controls are above video */
    z-index: 2;
}

/* Show controls on hover and when video is playing */
.video-wrapper:hover .video-controls,
.video-wrapper.is-playing .video-controls {
    opacity: 1;
}

.video-controls button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 14px;
    /* Prevent double-click text selection */
    user-select: none;
    /* Smooth hover transition */
    transition: background-color 0.2s ease;
}

.video-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-controls .seek-bar,
.video-controls .volume-bar {
    height: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.video-controls .seek-bar {
    flex-grow: 1;
}

.video-controls .volume-bar {
    width: 80px;
}

@media (max-width: 1200px) {
    .video-container {
        flex: 0 0 calc(50% - 1rem);
    }
}

@media (max-width: 768px) {
    .video-container {
        flex: 0 0 100%;
        min-width: unset;
    }
    
    .video-gallery {
        padding: 1rem;
    }
}