/* ACF Video Gallery Styles */

.acfvg-gallery {
    display: grid;
    grid-template-columns: repeat(var(--acfvg-columns, 3), 1fr);
    gap: 15px;
    margin: 20px 0;
}

/* Masonry layout: CSS columns, natural item heights */
.acfvg-gallery--masonry {
    display: block;
    column-count: var(--acfvg-columns, 3);
    column-gap: 15px;
}

.acfvg-gallery--masonry .acfvg-item {
    break-inside: avoid;
    margin-bottom: 15px;
    aspect-ratio: unset;
    height: auto;
}

.acfvg-gallery--masonry .acfvg-thumbnail {
    height: auto;
}

.acfvg-gallery--masonry .acfvg-thumbnail img {
    height: auto;
    max-height: none;
    object-fit: contain;
}

.acfvg-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: var(--acfvg-border-radius, 8px);
    aspect-ratio: 16 / 9;
    background: #f0f0f0;
}

.acfvg-thumbnail {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.acfvg-thumbnail img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.acfvg-video-thumbnail {
    background: #e0e0e0;
    opacity: 0.7;
}

.acfvg-video-thumbnail[src^="data:image"]:not([src*="svg+xml"]) {
    opacity: 1;
    background: transparent;
}

.acfvg-item:hover .acfvg-thumbnail img {
    transform: scale(1.05);
}

.acfvg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.acfvg-item:hover .acfvg-play-icon {
    opacity: 1;
}

.acfvg-play-icon svg {
    width: 60px;
    height: 60px;
}

/* Lightbox Styles */
.acfvg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.acfvg-lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.acfvg-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--acfvg-overlay-bg, rgba(0, 0, 0, 0.95));
    cursor: pointer;
}

.acfvg-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acfvg-lightbox-media {
    position: relative;
    max-width: 100%;
    max-height: 90vh;
}

.acfvg-lightbox-media img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.acfvg-lightbox-media video {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

.acfvg-lightbox .acfvg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: var(--acfvg-close-color, #fff) !important;
    font-size: 40px;
    cursor: pointer;
    z-index: 2;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    line-height: 0;
    transition: transform 0.2s ease;
}

.acfvg-lightbox-close:hover,
.acfvg-lightbox-close:focus {
    background: none;
    outline: none;
    color: var(--acfvg-close-color, #fff) !important;
}

.acfvg-lightbox-close:hover {
    transform: scale(1.2);
}

.acfvg-lightbox-prev,
.acfvg-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--acfvg-close-color, #fff) !important;
    font-size: 50px;
    cursor: pointer;
    z-index: 2;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    border-radius: 50%;
    padding: 0;
    line-height: 1;
}

.acfvg-lightbox-prev:hover,
.acfvg-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.4);
    color: var(--acfvg-close-color, #fff) !important;
}

.acfvg-lightbox-prev:focus,
.acfvg-lightbox-next:focus {
    background: transparent;
    outline: none;
    color: var(--acfvg-close-color, #fff) !important;
}

.acfvg-lightbox-prev {
    left: 20px;
}

.acfvg-lightbox-next {
    right: 20px;
}

.acfvg-lightbox-prev:disabled,
.acfvg-lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .acfvg-gallery,
    .acfvg-gallery--masonry {
        display: flex;
        flex-direction: row;
        column-count: unset;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
        padding: 10px 0;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        /* Hide scrollbar for cleaner look, but keep functionality */
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    }
    
    .acfvg-gallery::-webkit-scrollbar,
    .acfvg-gallery--masonry::-webkit-scrollbar {
        height: 6px;
    }
    
    .acfvg-gallery::-webkit-scrollbar-track,
    .acfvg-gallery--masonry::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .acfvg-gallery::-webkit-scrollbar-thumb,
    .acfvg-gallery--masonry::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }
    
    .acfvg-gallery--masonry .acfvg-item {
        margin-bottom: 0;
    }
    
    .acfvg-item {
        flex: 0 0 auto;
        width: 75vw;
        max-width: 300px;
        min-width: 200px;
    }
    
    .acfvg-lightbox-prev,
    .acfvg-lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 40px;
    }
    
    .acfvg-lightbox-prev {
        left: 10px;
    }
    
    .acfvg-lightbox-next {
        right: 10px;
    }
    
    .acfvg-lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 35px;
    }
}

