/**
 * FileBird ACF Gallery - Complete Integration System
 * Version: 5.0.0
 * Features: Masonry, Hover Expand, Responsive, Lightbox, Video Support, 360 Viewer
 */

/* ============================================================================
   GALLERY CONTAINER & GRID
   ============================================================================ */

.fb-acf-gallery {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.fb-acf-grid {
    width: 100%;
    display: block;
    position: relative;
}

/* ============================================================================
   GALLERY ITEMS - BASE STYLES
   ============================================================================ */

.fb-acf-item {
    width: calc(33.333% - 20px);
    margin-bottom: 20px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
    transition: all 0.6s 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, z-index;
}

.fb-acf-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ============================================================================
   VIDEO ITEMS - NATURAL ASPECT RATIO
   ============================================================================ */

.fb-acf-video-wrapper {
    width: 100%;
    position: relative;
}

.fb-acf-video-wrapper video {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.fb-acf-item.fb-acf-video:hover video {
    transform: scale(1.05);
}

/* Video Play Icon Overlay */
.fb-acf-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.fb-acf-item.fb-acf-video:hover .fb-acf-play-icon {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================================================
   360 PANORAMA ITEMS - GLOBE THUMBNAIL
   ============================================================================ */

.fb-acf-360-wrapper {
    width: 100%;
    position: relative;
}

.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%);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.fb-acf-item.fb-acf-360:hover .fb-acf-globe-icon {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.1) rotate(20deg);
}

/* ============================================================================
   IMAGE ITEMS - DYNAMIC HEIGHTS BASED ON ASPECT RATIO
   ============================================================================ */

.fb-acf-image-wrapper {
    /* No fixed aspect ratio - let images determine their own height */
    width: 100%;
    position: relative;
}

.fb-acf-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.fb-acf-item.fb-acf-image:hover img {
    transform: scale(1.08);
}

/* ============================================================================
   HOVER EXPANSION - DISABLED
   ============================================================================ */

/* Hover expansion feature disabled - keeping basic hover effects only */

/* ============================================================================
   RESPONSIVE GRID - TABLET (2 COLUMNS)
   ============================================================================ */

@media (max-width: 1024px) and (min-width: 769px) {
    .fb-acf-item {
        width: calc(50% - 20px);
    }
}

/* ============================================================================
   RESPONSIVE GRID - MOBILE (2 COLUMNS)
   ============================================================================ */

@media (max-width: 768px) {
    .fb-acf-item {
        width: calc(50% - 10px);
        margin-bottom: 10px;
        border-radius: 8px;
    }
    
    .fb-acf-play-icon,
    .fb-acf-globe-icon {
        width: 60px;
        height: 60px;
    }
    
    .fb-acf-play-icon svg,
    .fb-acf-globe-icon svg {
        width: 40px;
        height: 40px;
    }
}

/* ============================================================================
   LIGHTBOX - OVERLAY AND CONTAINER
   ============================================================================ */

.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;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.fb-acf-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Lightbox Media */
.fb-acf-lightbox-content img,
.fb-acf-lightbox-content video {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================================================
   LIGHTBOX - CONTROLS
   ============================================================================ */

.fb-acf-lightbox-close,
.fb-acf-lightbox-prev,
.fb-acf-lightbox-next {
    position: absolute;
    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;
}

.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%);
}

/* ============================================================================
   LIGHTBOX - PREV/NEXT THUMBNAILS (FADED)
   ============================================================================ */

.fb-acf-lightbox-thumb-prev,
.fb-acf-lightbox-thumb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 120px;
    height: 80px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    pointer-events: none;
    overflow: hidden;
    border-radius: 8px;
    z-index: 5;
}

.fb-acf-lightbox-thumb-prev:hover,
.fb-acf-lightbox-thumb-next:hover {
    opacity: 0.6;
}

.fb-acf-lightbox-thumb-prev {
    left: 100px;
}

.fb-acf-lightbox-thumb-next {
    right: 100px;
}

.fb-acf-lightbox-thumb-prev img,
.fb-acf-lightbox-thumb-next img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================================================
   LIGHTBOX - COUNTER
   ============================================================================ */

.fb-acf-lightbox-counter {
    position: absolute;
    bottom: 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;
}

/* ============================================================================
   360 PANORAMA VIEWER IN LIGHTBOX
   ============================================================================ */

.fb-acf-360-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    perspective: 1000px;
    user-select: none;
}

.fb-acf-360-viewer.dragging {
    cursor: grabbing;
}

.fb-acf-360-viewer img {
    max-width: 90vw;
    max-height: 90vh;
    transition: transform 0.1s ease-out;
    transform-style: preserve-3d;
    border-radius: 8px;
}

.fb-acf-360-hint {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 11;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

body.fb-acf-no-scroll {
    overflow: hidden;
}

/* Loading State */
.fb-acf-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Error State */
.fb-acf-error {
    padding: 20px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    text-align: center;
}

/* ============================================================================
   MOBILE RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@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-thumb-prev,
    .fb-acf-lightbox-thumb-next {
        display: none;
    }
    
    .fb-acf-lightbox-counter {
        bottom: 15px;
        font-size: 12px;
        padding: 8px 16px;
    }
    
    .fb-acf-360-hint {
        top: 60px;
        font-size: 12px;
        padding: 8px 16px;
    }
}
