.cafeex-filtering-gallery-wrapper {
    width: 100%;
}

.cafeex-gallery-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

.cafeex-gallery-filters button {
    background-color: transparent;
    border: 2px solid #333;
    color: #333;
    padding: 8px 20px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cafeex-gallery-filters button.active,
.cafeex-gallery-filters button:hover {
    background-color: #333;
    color: #fff;
}

.cafeex-gallery-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
}

.cafeex-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    aspect-ratio: 4/3; /* Rectangle ratio by default */
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
    background-color: #f5f5f5;
}

.cafeex-gallery-item:hover {
    transform: scale(1.02);
}

.cafeex-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cafeex-gallery-item:hover img {
    transform: scale(1.05);
}

.cafeex-gallery-item-hide {
    display: none !important;
}

/* Play button for video */
.cafeex-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: background 0.3s ease;
}

.cafeex-gallery-item:hover .cafeex-video-icon {
    background: rgba(0, 0, 0, 0.8);
}

/* Video embed fallback */
.cafeex-video-embed {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.cafeex-video-embed iframe,
.cafeex-video-embed video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    border: none;
    transition: transform 0.3s ease;
}

.cafeex-gallery-item:hover .cafeex-video-embed iframe,
.cafeex-gallery-item:hover .cafeex-video-embed video {
    transform: scale(1.05);
}

/* Video Lightbox */
body.cafeex-lightbox-open {
    overflow: hidden;
}

.cafeex-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.cafeex-lightbox-overlay.active {
    display: flex;
}

.cafeex-lightbox-inner {
    position: relative;
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16/9;
}

.cafeex-lightbox-content {
    width: 100%;
    height: 100%;
}

.cafeex-lightbox-content iframe,
.cafeex-lightbox-content video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.cafeex-lightbox-close {
    position: absolute;
    top: -45px;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cafeex-lightbox-close:hover {
    color: #ccc;
}

/* On mobile, show the full image/video instead of cropping it to a fixed ratio */
@media (max-width: 767px) {
    .cafeex-filtering-gallery-wrapper .cafeex-gallery-item {
        aspect-ratio: auto !important;
    }

    .cafeex-filtering-gallery-wrapper .cafeex-gallery-item img {
        position: static;
        height: auto;
        object-fit: contain;
    }

    .cafeex-filtering-gallery-wrapper .cafeex-gallery-item .cafeex-video-embed {
        position: static;
        aspect-ratio: 16/9;
    }
}
