/* =========================================================
   SILAKOM - PRODUCT DETAIL GALLERY
   ========================================================= */

.product-detail-gallery-wrap {
    position: relative;
    width: 100%;
}

.silakom-product-gallery {
    width: 100%;
    min-width: 0;
}

/* Main image */
.product-gallery-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 20px;

    cursor: zoom-in;
    appearance: none;

    background:
        linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
    border: 1px solid var(--silakom-border);
    border-radius: 24px;

    overflow: hidden;
    box-shadow: 0 16px 42px rgba(18, 54, 43, .07);
}

.product-gallery-main:focus-visible,
.product-gallery-thumb:focus-visible,
.product-gallery-viewer button:focus-visible {
    outline: 3px solid rgba(10, 107, 79, .24);
    outline-offset: 3px;
}

.product-gallery-main img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    transition: transform .25s ease;
}

.product-gallery-main:hover img {
    transform: scale(1.015);
}

/* Category pill overlays the main gallery */
.product-detail-category {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 5;

    display: inline-flex;
    align-items: center;

    max-width: calc(100% - 110px);
    padding: 7px 11px;

    overflow: hidden;
    color: #26433a;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;

    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(20, 32, 29, .07);
    border-radius: 999px;
    box-shadow: 0 7px 20px rgba(20, 32, 29, .08);
    backdrop-filter: blur(8px);
}

/* Zoom pill */
.product-gallery-zoom {
    position: absolute;
    right: 14px;
    bottom: 14px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 8px 11px;

    color: #43534e;
    font-size: .75rem;
    font-weight: 700;

    background: rgba(255, 255, 255, .95);
    border: 1px solid rgba(20, 32, 29, .08);
    border-radius: 999px;
    box-shadow: 0 7px 20px rgba(20, 32, 29, .08);
    backdrop-filter: blur(8px);
}

/* Thumbnails */
.product-gallery-thumbnails {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;
    margin-top: 14px;
    padding: 2px 2px 7px;

    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #cddbd6 transparent;
}

.product-gallery-thumb {
    flex: 0 0 82px;
    width: 82px;
    height: 82px;
    padding: 5px;

    cursor: pointer;
    appearance: none;

    background: #ffffff;
    border: 1px solid #dce6e2;
    border-radius: 14px;

    overflow: hidden;
    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        transform .18s ease;
}

.product-gallery-thumb:hover {
    transform: translateY(-2px);
    border-color: #a8c5bb;
}

.product-gallery-thumb.is-active {
    border: 2px solid var(--silakom-primary);
    box-shadow:
        0 0 0 3px rgba(10, 107, 79, .08),
        0 8px 18px rgba(10, 107, 79, .08);
}

.product-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 9px;
}

/* =========================================================
   FULLSCREEN VIEWER
   ========================================================= */

.product-gallery-viewer {
    position: fixed;
    inset: 0;
    z-index: 1095;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 28px;

    background: rgba(7, 16, 13, .90);
    backdrop-filter: blur(8px);
}

.product-gallery-viewer.is-open {
    display: flex;
}

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

.product-gallery-viewer-dialog {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    width: min(1120px, 94vw);
    height: min(820px, 88vh);
}

.product-gallery-viewer-image {
    display: block;
    max-width: calc(100% - 120px);
    max-height: calc(100% - 56px);

    object-fit: contain;

    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, .28);
}

.product-gallery-viewer-close,
.product-gallery-viewer-prev,
.product-gallery-viewer-next {
    position: absolute;
    z-index: 2;

    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;
    padding: 0;

    cursor: pointer;
    appearance: none;

    color: #ffffff;
    font-size: 1.2rem;

    background: rgba(0, 0, 0, .48);
    border: 1px solid rgba(255, 255, 255, .20);
    border-radius: 50%;

    transition: background .18s ease, transform .18s ease;
}

.product-gallery-viewer-close:hover,
.product-gallery-viewer-prev:hover,
.product-gallery-viewer-next:hover {
    background: rgba(0, 0, 0, .72);
}

.product-gallery-viewer-close {
    top: 0;
    right: 0;
}

.product-gallery-viewer-prev {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.product-gallery-viewer-next {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.product-gallery-viewer-prev:hover {
    transform: translateY(-50%) scale(1.04);
}

.product-gallery-viewer-next:hover {
    transform: translateY(-50%) scale(1.04);
}

.product-gallery-viewer-counter {
    position: absolute;
    bottom: 0;
    left: 50%;

    padding: 7px 12px;

    color: #ffffff;
    font-size: .78rem;
    font-weight: 700;

    background: rgba(0, 0, 0, .48);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;

    transform: translateX(-50%);
}

/* Tablet */
@media (max-width: 991.98px) {
    .product-gallery-main {
        max-height: 620px;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .product-gallery-main {
        aspect-ratio: 1 / 1;
        padding: 12px;
        border-radius: 18px;
    }

    .product-gallery-main img {
        border-radius: 12px;
    }

    .product-gallery-thumb {
        flex-basis: 70px;
        width: 70px;
        height: 70px;
    }

    .product-gallery-zoom {
        right: 10px;
        bottom: 10px;
    }

    .product-gallery-zoom span {
        display: none;
    }

    .product-detail-category {
        top: 10px;
        left: 10px;
        max-width: calc(100% - 70px);
    }

    .product-gallery-viewer {
        padding: 12px;
    }

    .product-gallery-viewer-dialog {
        width: 100%;
        height: 90vh;
    }

    .product-gallery-viewer-image {
        max-width: 100%;
        max-height: calc(100% - 78px);
        border-radius: 12px;
    }

    .product-gallery-viewer-close {
        top: 4px;
        right: 4px;
    }

    .product-gallery-viewer-prev,
    .product-gallery-viewer-next {
        width: 42px;
        height: 42px;
        background: rgba(0, 0, 0, .58);
    }

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

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

@media (prefers-reduced-motion: reduce) {
    .product-gallery-main img,
    .product-gallery-thumb,
    .product-gallery-viewer-close,
    .product-gallery-viewer-prev,
    .product-gallery-viewer-next {
        transition: none;
    }
}
