/**
 * Bruo Product Gallery Styles
 */

/* Container */
.bpg-gallery-container {
    width: 100%;
    position: relative;
}

/* ========================================
   SLIDER LAYOUT
======================================== */

.bpg-slider-wrapper {
    display: flex;
    gap: 15px;
    width: 100%;
}

/* Horizontal layout (thumbnails bottom) */
.bpg-slider-wrapper.position-bottom {
    flex-direction: column;
}

/* Vertical layout (thumbnails left) */
.bpg-slider-wrapper.position-left {
    flex-direction: row;
}

.bpg-slider-wrapper.position-left .bpg-thumbnails {
    order: -1;
}

/* Vertical layout (thumbnails right) */
.bpg-slider-wrapper.position-right {
    flex-direction: row;
}

/* No thumbnails */
.bpg-slider-wrapper.no-thumbnails {
    flex-direction: column;
}

/* Main Swiper */
.bpg-main-swiper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.bpg-main-slider {
    width: 100%;
    height: 100%;
}

.bpg-main-slider .swiper-slide {
    height: auto !important;
}

/* Main Image */
.bpg-main-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #fff;
    cursor: zoom-in;
    position: relative;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.bpg-main-image:hover {
    border-color: #dee2e6;
}

.bpg-main-image img,
.ast-article-single .bpg-main-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    box-shadow: none !important;
}

/* Thumbnails */
.bpg-thumbnails {
    display: flex;
    overflow: hidden;
}

.bpg-thumbnails.position-bottom {
    flex-direction: row;
    width: 100%;
    gap: 10px;
}

.bpg-thumbnails.position-left,
.bpg-thumbnails.position-right {
    flex-direction: column;
    max-width: 120px;
    gap: 10px;
}

.bpg-thumbnail-slider {
    width: 100%;
    height: 100%;
}

.bpg-thumbnail-item {
    width: 80px;
    height: 80px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bpg-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bpg-thumbnail-item:hover {
    opacity: 1 !important;
    border-color: #dee2e6;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bpg-thumbnail-item.swiper-slide-thumb-active {
    border-color: #0d6efd !important;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

/* Navigation Arrows */
.bpg-button-prev,
.bpg-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.96);
    color: #212529;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.bpg-main-swiper:hover .bpg-button-prev,
.bpg-main-swiper:hover .bpg-button-next {
    opacity: 1;
}

.bpg-button-prev:hover,
.bpg-button-next:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.bpg-button-prev.swiper-button-disabled,
.bpg-button-next.swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
}

.bpg-button-prev {
    left: 16px;
}

.bpg-button-next {
    right: 16px;
}

.bpg-button-prev i,
.bpg-button-next i {
    font-size: 20px;
    line-height: 1;
    font-style: normal;
}

/* Pagination Dots */
.swiper-pagination {
    bottom: 16px !important;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
    margin: 0 6px !important;
}

.swiper-pagination-bullet:hover {
    background-color: rgba(255, 255, 255, 0.8);
}

.swiper-pagination-bullet-active {
    background-color: rgba(255, 255, 255, 1);
    width: 24px;
    border-radius: 4px;
}

/* ========================================
   GRID LAYOUT
======================================== */

.bpg-grid-layout {
    display: grid;
    gap: 15px;
    width: 100%;
}

.bpg-grid-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f8f9fa;
    cursor: zoom-in;
    position: relative;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bpg-grid-item:hover {
    border-color: #dee2e6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.bpg-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ========================================
   LIGHTBOX
======================================== */

.bpg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    pointer-events: none;
}

.bpg-lightbox.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.bpg-lightbox:not(.active) * {
    pointer-events: none !important;
}

.bpg-lightbox-content {
    position: relative;
    max-width: 85vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: bpg-lightbox-zoom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bpg-lightbox-zoom {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.bpg-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 16px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    background: #000;
}

.bpg-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    z-index: 10;
}

.bpg-lightbox.active .bpg-lightbox-close:hover {
    color: rgba(255, 255, 255, 1);
}

.bpg-lightbox-close i {
    font-size: 24px;
    line-height: 1;
    font-style: normal;
}

.bpg-lightbox-prev,
.bpg-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: none !important;
    border: none !important;
    color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    border-radius: 0;
    box-shadow: none !important;
}

.bpg-lightbox.active .bpg-lightbox-prev:hover,
.bpg-lightbox.active .bpg-lightbox-next:hover {
    background: none !important;
    color: rgba(0, 0, 0, 1);
    box-shadow: none !important;
}

.bpg-lightbox-prev {
    left: 24px;
}

.bpg-lightbox-next {
    right: 24px;
}

.bpg-lightbox-prev i,
.bpg-lightbox-next i {
    font-size: 28px;
    line-height: 1;
    font-style: normal;
    transition: transform 0.2s ease;
}

.bpg-lightbox-prev:hover i {
    transform: translateX(-2px);
}

.bpg-lightbox-next:hover i {
    transform: translateX(2px);
}

.bpg-lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 10px 24px;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Loading spinner in lightbox */
.bpg-lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.bpg-lightbox-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bpg-spin 0.8s linear infinite;
}

@keyframes bpg-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE
======================================== */

@media screen and (max-width: 768px) {
    /* Force thumbnails to bottom on mobile */
    .bpg-slider-wrapper.position-left,
    .bpg-slider-wrapper.position-right {
        flex-direction: column;
    }

    .bpg-thumbnails.position-left,
    .bpg-thumbnails.position-right {
        flex-direction: row;
        max-width: 100%;
        order: 1;
    }

    .bpg-thumbnail-item {
        width: 60px;
        height: 60px;
    }

    .bpg-button-prev,
    .bpg-button-next {
        width: 35px;
        height: 35px;
        opacity: 1;
    }

    .bpg-button-prev {
        left: 5px;
    }

    .bpg-button-next {
        right: 5px;
    }

    .bpg-grid-layout {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    .bpg-lightbox {
        padding: 20px;
    }

    .bpg-lightbox-content {
        max-width: 95vw;
        max-height: 80vh;
    }

    .bpg-lightbox-image {
        max-height: 80vh;
        border-radius: 12px;
        border-width: 2px;
    }

    .bpg-lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .bpg-lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .bpg-lightbox-close i {
        font-size: 22px;
    }

    .bpg-lightbox-prev,
    .bpg-lightbox-next {
        width: 44px;
        height: 44px;
    }

    .bpg-lightbox-prev {
        left: 12px;
    }

    .bpg-lightbox-next {
        right: 12px;
    }

    .bpg-lightbox-prev i,
    .bpg-lightbox-next i {
        font-size: 26px;
    }

    .bpg-lightbox-counter {
        bottom: 20px;
        font-size: 14px;
        padding: 8px 18px;
    }
}

@media screen and (max-width: 480px) {
    .bpg-thumbnail-item {
        width: 50px;
        height: 50px;
    }

    .bpg-slider-wrapper {
        gap: 10px;
    }

    .bpg-lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* Prevent body scroll when lightbox is open */
body.bpg-lightbox-open {
    overflow: hidden;
}
