/**
 * FileBird ACF Gallery - FIXED VERSION
 * Version: 7.0.0
 * Features: Perfect Masonry (3/2/1), Hover Zoom, Professional Lightbox, Slide Animations
 * 
 * FIXES:
 * - Desktop: 3 columns
 * - Tablet: 2 columns
 * - Mobile: 1 column
 * - Hover zoom stays inside container
 * - Lightbox with thumbnail strip
 * - Smooth slide animations
 */

/* ============================================================================
   GALLERY CONTAINER & GRID
   ============================================================================ */

.fb-acf-gallery {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.fb-acf-grid {
    width: 100%;
    display: block;
    position: relative;
}

/* ============================================================================
   GALLERY ITEMS - MASONRY LAYOUT
   Mobile First: 1 Column
   ============================================================================ */

.fb-acf-item {
    width: 100%;
    margin-bottom: 15px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
    will-change: transform, box-shadow, border-radius;
}

.fb-acf-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-4px);
    border-radius: 0;
    z-index: 10;
}

/* ============================================================================
   IMAGE ITEMS - ZOOM ON HOVER (Container fixed, image scales)
   ============================================================================ */

.fb-acf-image-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.fb-acf-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: scale(1);
}

.fb-acf-item:hover .fb-acf-image-wrapper img {
    transform: scale(1.15);
}

/* ============================================================================
   VIDEO ITEMS - AUTOPLAY IN GALLERY
   ============================================================================ */

.fb-acf-video-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.fb-acf-video-wrapper video {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fb-acf-item:hover .fb-acf-video-wrapper video {
    transform: scale(1.05);
}

/* Video play indicator (subtle overlay) */
.fb-acf-video-wrapper::after {
    content: '▶';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    padding-left: 3px;
}

.fb-acf-item:hover .fb-acf-video-wrapper::after {
    opacity: 1;
}

/* ============================================================================
   360 PANORAMA ITEMS
   ============================================================================ */

.fb-acf-360-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
    line-height: 0;
}

.fb-acf-360-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.fb-acf-globe-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ============================================================================
   RESPONSIVE MASONRY LAYOUT
   ============================================================================ */

/* Tablet: 2 Columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .fb-acf-item {
        width: calc(50% - 10px);
        margin-bottom: 20px;
    }
}

/* Desktop: 3 Columns */
@media (min-width: 1024px) {
    .fb-acf-item {
        width: calc(33.333% - 14px);
        margin-bottom: 20px;
    }
}

/* ============================================================================
   LIGHTBOX - FULL SCREEN WITH THUMBNAILS
   ============================================================================ */

.fb-acf-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Main Content Container */
.fb-acf-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: calc(90vh - 150px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Main Image/Video - with slide animations */
.fb-acf-lightbox-content img,
.fb-acf-lightbox-content video {
    max-width: 100%;
    max-height: calc(90vh - 150px);
    object-fit: contain;
    border-radius: 8px;
}

/* Slide Animations */
.fb-acf-lightbox-content img.slide-right,
.fb-acf-lightbox-content video.slide-right {
    animation: slideInRight 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fb-acf-lightbox-content img.slide-left,
.fb-acf-lightbox-content video.slide-left {
    animation: slideInLeft 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================================
   LIGHTBOX - CONTROLS
   ============================================================================ */

.fb-acf-lightbox-close,
.fb-acf-lightbox-prev,
.fb-acf-lightbox-next {
    position: fixed;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 24px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.3s ease;
    font-weight: bold;
    user-select: none;
}

.fb-acf-lightbox-close:hover,
.fb-acf-lightbox-prev:hover,
.fb-acf-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.fb-acf-lightbox-close {
    top: 30px;
    right: 30px;
    font-size: 32px;
}

.fb-acf-lightbox-prev {
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
}

.fb-acf-lightbox-next {
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
}

.fb-acf-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.fb-acf-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Counter */
.fb-acf-lightbox-counter {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    z-index: 10;
}

/* ============================================================================
   LIGHTBOX - THUMBNAIL STRIP AT BOTTOM
   ============================================================================ */

.fb-acf-lightbox-thumbnails {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    max-width: 90vw;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 10;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.fb-acf-lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.fb-acf-lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.fb-acf-lightbox-thumbnail {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.5;
    position: relative;
}

.fb-acf-lightbox-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.fb-acf-lightbox-thumbnail.active {
    opacity: 1;
    border-color: white;
    transform: scale(1.1);
}

.fb-acf-lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video indicator on thumbnail */
.fb-acf-lightbox-thumbnail.is-video::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .fb-acf-lightbox-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 28px;
    }

    .fb-acf-lightbox-prev,
    .fb-acf-lightbox-next {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .fb-acf-lightbox-prev {
        left: 15px;
    }

    .fb-acf-lightbox-next {
        right: 15px;
    }

    .fb-acf-lightbox-counter {
        top: 15px;
        font-size: 12px;
        padding: 8px 16px;
    }

    .fb-acf-lightbox-thumbnails {
        bottom: 10px;
        padding: 10px 15px;
        gap: 8px;
    }

    .fb-acf-lightbox-thumbnail {
        width: 60px;
        height: 45px;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

body.fb-acf-no-scroll {
    overflow: hidden;
}

.fb-acf-loading {
    opacity: 0.5;
    pointer-events: none;
}

.fb-acf-error {
    padding: 20px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    text-align: center;
}
