/*
* Helios Clinic Kuwait - Gallery Styles
* Version: 1.2.0 - Fixed image coverage and responsive design
*/

/* Gallery Section Styles
=================================================================== */
#gallery {
    padding: 80px 0 40px;
}

.gallery-preview {
    display: flex;
    flex-wrap: wrap;
    margin: 30px -10px;
    justify-content: center;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 10px;
    width: calc(25% - 20px);
    background-color: #000;
    aspect-ratio: 1/1; /* Square aspect ratio */
}

/* Specific styling for video gallery items */
.gallery-item:has(video.video-gallery) {
    overflow: hidden;
    background-color: #000;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.5s ease;
    object-fit: cover;
    border-radius: 12px;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Video Gallery Styles
=================================================================== */
.video-gallery {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    transition: transform 0.3s ease;
    display: block;
    background-color: #000;
}

.video-gallery:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

/* Custom video controls */
.video-gallery::-webkit-media-controls {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 0 0 12px 12px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.video-gallery:hover::-webkit-media-controls {
    opacity: 1;
}

/* Gallery item with video specific styling */
.gallery-item:has(video) {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

/* Ensure video controls are visible and properly styled */
.video-gallery::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 0 0 12px 12px;
    padding: 8px;
}

.video-gallery::-webkit-media-controls-play-button,
.video-gallery::-webkit-media-controls-volume-slider,
.video-gallery::-webkit-media-controls-mute-button,
.video-gallery::-webkit-media-controls-timeline,
.video-gallery::-webkit-media-controls-current-time-display,
.video-gallery::-webkit-media-controls-time-remaining-display,
.video-gallery::-webkit-media-controls-fullscreen-button {
    opacity: 0.9;
}

/* Video thumbnail (before playing) */
.video-thumbnail {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.video-thumbnail img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.video-thumbnail:hover img {
    transform: scale(1.05);
}

/* Responsive Styles
=================================================================== */
@media (max-width: 1200px) {
    .gallery-item {
        width: calc(33.333% - 20px);
    }
}

@media (max-width: 991px) {
    .gallery-item {
        width: calc(33.333% - 20px);
    }
}

@media (max-width: 767px) {
    #gallery {
        padding: 60px 0 30px;
    }
    
    .gallery-item {
        width: calc(50% - 20px);
    }
    
    /* Ensure gallery items have proper spacing */
    .gallery-preview {
        margin: 20px -10px;
    }
}

@media (max-width: 576px) {
    .gallery-preview {
        margin: 15px -8px;
    }
    
    .gallery-item {
        width: calc(50% - 16px);
        margin: 8px;
        border-radius: 8px;
    }
    
    .gallery-item img,
    .video-gallery {
        border-radius: 8px;
    }
    
    /* Ensure section headers are readable */
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .gallery-item {
        width: calc(100% - 16px);
    }
}