/**
 * Product Gallery — Styles
 *
 * Desktop (>=1024): thumbnails left + main image right
 * Mobile  (<1024):  single slider, no thumbnails
 *
 * Same pgallery__* classes are reused inside the custom lightbox;
 * lightbox-specific overrides sit under .plightbox context.
 */

/* ==========================================================================
   Gallery Container
   ========================================================================== */

.pgallery {
    position: relative;
    padding-left: 110px; /* 94px thumbs + 16px gap */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.pgallery--single {
    padding-left: 0;
}

.pgallery--empty {
    padding-left: 0;
}

.pgallery--empty img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px;
}

/* ==========================================================================
   Thumbnails — shared element styles
   ========================================================================== */

.pgallery__thumbs {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.pgallery__thumbs-swiper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pgallery__thumb {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    transition: opacity 0.15s ease;
}

.pgallery__thumb.swiper-slide-thumb-active::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(20, 20, 21, 1);
    border-radius: 16px;
    pointer-events: none;
    z-index: 1;
}

.pgallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Thumbnail Arrows — shared styles (woodmart-font icons)
   ========================================================================== */

.pgallery__thumbs-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    color: rgba(20, 20, 21, 1);
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease, opacity 0.2s ease;
    user-select: none;
}

.pgallery__thumbs-arrow::before {
    font-family: "woodmart-font";
    font-weight: 400;
    font-size: 14px;
    line-height: 1;
}

.pgallery__thumbs-arrow--prev::before {
    content: "\f115";
}

.pgallery__thumbs-arrow--next::before {
    content: "\f129";
}

.pgallery__thumbs-arrow:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.pgallery__thumbs-arrow.is-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Main Image — shared element styles
   ========================================================================== */

.pgallery__main {
    position: relative;
}

.pgallery__main-swiper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.pgallery__main-swiper .swiper-wrapper {
    height: 100%;
    align-items: center;
}

.pgallery__main-swiper .swiper-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
}

.pgallery__slide {
    cursor: pointer;
}

.pgallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Main Image Arrows — shared styles (woodmart-font icons)
   ========================================================================== */

.pgallery__main-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease, opacity 0.2s ease, color 0.15s ease;
    user-select: none;
}

.pgallery__main-arrow::before {
    font-family: "woodmart-font";
    font-weight: 400;
    font-size: 18px;
    line-height: 1;
}

.pgallery__main-arrow--prev::before {
    content: "\f114";
}

.pgallery__main-arrow--next::before {
    content: "\f113";
}

.pgallery__main-arrow:not(.swiper-button-disabled):hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   Gallery-specific layout
   ========================================================================== */

/* Thumbs: fixed left column (desktop) */
.pgallery > .pgallery__thumbs {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 94px;
}

.pgallery .pgallery__thumb {
    width: 94px;
    height: 94px;
}

.pgallery .pgallery__thumb img {
    border-radius: 16px;
}

.pgallery .pgallery__thumbs-arrow--prev {
    top: 4px;
}

.pgallery .pgallery__thumbs-arrow--next {
    bottom: 4px;
}

/* Main: fill remaining width */
.pgallery > .pgallery__main {
    width: 100%;
    aspect-ratio: 1 / 1;
}

/* Main arrows: appear on hover, semi-transparent */
.pgallery .pgallery__main-arrow {
    color: rgba(20, 20, 21, 0.5);
    background: rgba(255, 255, 255, 0.9);
    opacity: 0;
}

.pgallery .pgallery__main-arrow--prev {
    left: 16px;
}

.pgallery .pgallery__main-arrow--next {
    right: 16px;
}

.pgallery .pgallery__main:hover .pgallery__main-arrow:not(.swiper-button-disabled) {
    opacity: 1;
    pointer-events: auto;
}

.pgallery .pgallery__main-arrow:not(.swiper-button-disabled):hover {
    color: rgba(20, 20, 21, 1);
}

/* Disabled state (Swiper adds this class at first/last slide) */
.pgallery .pgallery__main-arrow.swiper-button-disabled {
    opacity: 0;
    cursor: default;
}

.pgallery .pgallery__main:hover .pgallery__main-arrow.swiper-button-disabled {
    opacity: 0.3;
}

/* Hide counter on desktop */
.pgallery__counter {
    display: none;
}

/* ==========================================================================
   Gallery mobile (< 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    .pgallery {
        padding-left: 0;
    }

    .pgallery--empty img {
        border-radius: 8px;
    }

    .pgallery > .pgallery__thumbs {
        display: none;
    }

    .pgallery .pgallery__main-arrow {
        display: none;
    }

    .pgallery > .pgallery__main {
        aspect-ratio: 1 / 1;
    }

    .pgallery .pgallery__main-swiper {
        border-radius: 0;
        height: auto;
    }

    .pgallery .pgallery__main-swiper .swiper-slide {
        width: 100%;
    }

    .pgallery .pgallery__slide {
        aspect-ratio: 1 / 1;
        border-radius: 8px;
        overflow: hidden;
    }

    /* Mobile counter */
    .pgallery__counter {
        display: block;
        position: absolute;
        bottom: 16px;
        right: 16px;
        z-index: 10;
        padding: 6px 12px;
        background: rgba(0, 0, 0, 0.6);
        color: #fff;
        border-radius: 16px;
        font-size: 14px;
        font-weight: 500;
        line-height: 1;
        pointer-events: none;
    }
}


/* ==========================================================================
   Custom Lightbox — Base
   ========================================================================== */

.plightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    opacity: 0;
    transition: opacity 0.2s ease;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.plightbox.is-open {
    opacity: 1;
}

.plightbox__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

/* Close button */
.plightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background: #fff;
    color: rgba(20, 20, 21, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease;
    user-select: none;
}

.plightbox__close:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.plightbox__close::before {
    content: "\f112";
    font-family: "woodmart-font";
    font-weight: 400;
    font-size: 14px;
    line-height: 1;
}

/* Lightbox: slides are not clickable */
.plightbox .pgallery__slide {
    cursor: default;
}

/* ==========================================================================
   Custom Lightbox — Desktop (white bg, vertical thumbs left)
   ========================================================================== */

.plightbox--desktop {
    flex-direction: row;
}

.plightbox--desktop .plightbox__backdrop {
    background: #fff;
}

/* ----- Thumbnails (left, vertical) ----- */

.plightbox--desktop .pgallery__thumbs {
    position: relative;
    width: 120px;
    min-width: 120px;
    height: 100%;
    padding: 0 16px;
    box-sizing: border-box;
}

.plightbox--desktop .pgallery__thumbs-swiper {
    flex: 1;
    min-height: 0;
    height: auto;
    padding: 16px 0;
}

.plightbox--desktop .pgallery__thumb {
    width: 88px;
    height: 88px;
}

.plightbox--desktop .pgallery__thumb:hover {
    opacity: 0.8;
}

.plightbox--desktop .pgallery__thumb.swiper-slide-thumb-active {
    opacity: 1;
}


.plightbox--desktop .pgallery__thumb img {
    background: rgba(0, 0, 0, 0.05);
}

/* Thumb arrows (smaller in lightbox) */
.plightbox--desktop .pgallery__thumbs-arrow {
    width: 36px;
    height: 36px;
}

.plightbox--desktop .pgallery__thumbs-arrow::before {
    font-size: 12px;
}

.plightbox--desktop .pgallery__thumbs-arrow--prev {
    top: 4px;
}

.plightbox--desktop .pgallery__thumbs-arrow--next {
    bottom: 4px;
}

/* ----- Main Image ----- */

.plightbox--desktop .pgallery__main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 80px;
    box-sizing: border-box;
}

.plightbox--desktop .pgallery__main-swiper {
    max-height: 100%;
    border-radius: 0;
}

.plightbox--desktop .pgallery__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.plightbox--desktop .pgallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: none;
}

/* Main arrows: always visible, solid white */
.plightbox--desktop .pgallery__main-arrow {
    color: rgba(20, 20, 21, 1);
    background: #fff;
    opacity: 1;
    pointer-events: auto;
}

.plightbox--desktop .pgallery__main-arrow--prev {
    left: 24px;
}

.plightbox--desktop .pgallery__main-arrow--next {
    right: 24px;
}

.plightbox--desktop .pgallery__main-arrow.swiper-button-disabled {
    opacity: 0.3;
    cursor: default;
}

/* ==========================================================================
   Custom Lightbox — Mobile (white bg, horizontal thumbs bottom)
   ========================================================================== */

.plightbox--mobile {
    flex-direction: column;
}

.plightbox--mobile .plightbox__backdrop {
    background: #fff;
}

.plightbox--mobile .plightbox__close {
    top: 16px;
    right: 16px;
    background: #fff;
    color: rgba(20, 20, 21, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.plightbox--mobile .plightbox__close:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* ----- Main Image ----- */

.plightbox--mobile .pgallery__main {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0 16px;
    box-sizing: border-box;
}

.plightbox--mobile .pgallery__main-swiper {
    max-height: 100%;
    border-radius: 0;
}

.plightbox--mobile .pgallery__slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.plightbox--mobile .pgallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: none;
}

/* Hide main arrows on mobile lightbox */
.plightbox--mobile .pgallery__main-arrow {
    display: none;
}

/* ----- Thumbnails (bottom, horizontal) — native scroll ----- */

.plightbox--mobile .pgallery__thumbs {
    position: relative;
    flex-direction: row;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    order: 2;
    padding: 8px 0 12px 0;
}

.plightbox--mobile .pgallery__thumbs-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    height: 64px;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.plightbox--mobile .pgallery__thumbs-scroll::-webkit-scrollbar {
    display: none;
}

.plightbox--mobile .pgallery__thumbs-list {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 64px;
    align-items: center;
    width: max-content;
}

.plightbox--mobile .pgallery__thumbs-item {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin: 0;
    overflow: hidden;
    cursor: pointer;
    transition: width 0.2s ease, height 0.2s ease;
}

.plightbox--mobile .pgallery__thumbs-item:first-child {
    margin-left: 16px;
}

.plightbox--mobile .pgallery__thumbs-item:last-child {
    margin-right: 16px;
}

.plightbox--mobile .pgallery__thumbs-item.is-active {
    width: 64px;
    height: 64px;
}

.plightbox--mobile .pgallery__thumbs-item.is-active::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(20, 20, 21, 1);
    border-radius: 12px;
    pointer-events: none;
    z-index: 1;
}

.plightbox--mobile .pgallery__thumbs-item img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

/* Hide thumb arrows on mobile lightbox */
.plightbox--mobile .pgallery__thumbs-arrow {
    display: none;
}
