/**
 * Ürün detay — tam ekran galeri lightbox (izole sınıflar)
 */

.product-gallery-open {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
}

.product-gallery-open:hover {
    background: rgba(15, 23, 42, 0.92);
}

.product-gallery-open i {
    font-size: 14px;
}

/* Overlay */
.product-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: none;
    box-sizing: border-box;
}

.product-gallery-lightbox.is-open {
    display: block;
}

.product-gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.96);
    cursor: pointer;
}

.product-gallery-lightbox__dialog {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding:
        max(52px, calc(env(safe-area-inset-top) + 44px))
        max(12px, env(safe-area-inset-right))
        max(12px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
    pointer-events: none;
}

.product-gallery-lightbox__dialog > * {
    pointer-events: auto;
}

.product-gallery-lightbox__close {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    z-index: 11002;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.product-gallery-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* Görsel alanı — genişlik/yükseklik JS ile px olarak verilir */
.product-gallery-lightbox__viewport {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
}

.product-gallery-lightbox__viewport .product-gallery-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
    user-select: none;
    -webkit-user-drag: none;
    vertical-align: middle;
}

.product-gallery-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product-gallery-lightbox__nav:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.32);
}

.product-gallery-lightbox__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.product-gallery-lightbox__nav--prev {
    left: 8px;
}

.product-gallery-lightbox__nav--next {
    right: 8px;
}

.product-gallery-lightbox__counter {
    margin: 12px 0 0;
    padding: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

.product-gallery-lightbox__thumbs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 2px 4px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.product-gallery-lightbox__thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    opacity: 0.6;
}

.product-gallery-lightbox__thumb.is-active {
    border-color: var(--secondary-color, #008ed9);
    opacity: 1;
}

.product-gallery-lightbox__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
}

body.product-gallery-open {
    overflow: hidden;
}

/* Masaüstü: nav yanlarda overlay, dialog ortada */
@media (min-width: 769px) {
    .product-gallery-lightbox__dialog {
        padding-top: max(48px, calc(env(safe-area-inset-top) + 36px));
    }

    .product-gallery-lightbox__thumbs {
        justify-content: center;
        max-width: min(960px, 100%);
    }
}

@media (max-width: 768px) {
    .product-gallery-open span {
        display: none;
    }

    .product-gallery-open {
        padding: 10px 12px;
    }

    .product-gallery-lightbox__nav {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .product-gallery-lightbox__nav--prev {
        left: 4px;
    }

    .product-gallery-lightbox__nav--next {
        right: 4px;
    }

    .product-gallery-lightbox__thumb {
        width: 48px;
        height: 48px;
    }
}
