.ara-product-gallery,
.woocommerce div.product div.images.ara-product-gallery {
    position: relative;
    width: 48%;
    float: left;
    margin: 0 0 2rem;
}

.ara-product-gallery * {
    box-sizing: border-box;
}

.apg-shell {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
}

.apg-thumbs-wrap {
    min-width: 0;
    display: grid;
    grid-template-rows: 30px minmax(0, 1fr) 30px;
    gap: 7px;
}

.apg-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 560px;
    overflow: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding: 1px;
}

.apg-thumbs::-webkit-scrollbar {
    display: none;
}

.apg-thumb,
.apg-thumb-nav,
.apg-arrow,
.apg-expand,
.apg-watch-video,
.apg-lightbox-close,
.apg-lightbox-arrow {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    font: inherit;
}

.apg-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
    flex: 0 0 auto;
}

.apg-thumb:hover {
    transform: translateY(-1px);
}

.apg-thumb.is-active {
    border-color: #0F3D2E;
    box-shadow: 0 0 0 1px #0F3D2E;
}

.apg-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apg-thumb-video-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(15, 61, 46, .92);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    padding-left: 2px;
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}

.apg-thumb-nav {
    width: 100%;
    height: 30px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.apg-stage {
    position: relative;
    overflow: hidden;
    min-height: 480px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .05);
}

.apg-main {
    width: 100%;
    min-height: 480px;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    background: #fff;
}

.apg-main img,
.apg-main iframe,
.apg-main video {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
}

.apg-main img {
    object-fit: contain;
    cursor: zoom-in;
}

.apg-main iframe,
.apg-main video {
    object-fit: contain;
    background: #000;
}

.apg-arrow {
    position: absolute;
    top: 50%;
    z-index: 6;
    width: 42px;
    height: 42px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    color: #111827;
    cursor: pointer;
    font-size: 32px;
    line-height: 1;
    box-shadow: 0 8px 24px rgba(15,23,42,.12);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}

.apg-stage:hover .apg-arrow,
.apg-arrow:focus-visible {
    opacity: 1;
}

.apg-arrow--prev { left: 14px; }
.apg-arrow--next { right: 14px; }

.apg-expand {
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 7;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    color: #111827;
    cursor: pointer;
    font-size: 19px;
    box-shadow: 0 8px 24px rgba(15,23,42,.12);
}

.apg-watch-video {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 7;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 17px;
    border-radius: 999px;
    background: rgba(255,255,255,.96);
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(15,23,42,.14);
}

.apg-watch-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 10px;
    padding-left: 2px;
}

.apg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
}

.apg-lightbox.is-open {
    display: block;
}

.apg-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.96);
}

.apg-lightbox-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 40px 80px;
}

.apg-lightbox-media {
    width: min(1100px, 86vw);
    height: min(86vh, 1100px);
    display: grid;
    place-items: center;
}

.apg-lightbox-media img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 16px 60px rgba(0,0,0,.28);
}

.apg-lightbox-close {
    position: absolute;
    right: 22px;
    top: 16px;
    z-index: 5;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 38px;
    line-height: 1;
}

.apg-lightbox-arrow {
    position: absolute;
    top: 50%;
    z-index: 5;
    width: 54px;
    height: 54px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
    font-size: 42px;
    line-height: 1;
}

.apg-lightbox-arrow--prev { left: 18px; }
.apg-lightbox-arrow--next { right: 18px; }

.apg-lightbox-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    color: rgba(255,255,255,.85);
    font-size: 14px;
    line-height: 1;
}

body.apg-no-scroll {
    overflow: hidden !important;
}

@media (max-width: 900px) {
    .ara-product-gallery,
    .woocommerce div.product div.images.ara-product-gallery {
        width: 100%;
        float: none;
    }

    .apg-shell {
        grid-template-columns: 74px minmax(0, 1fr);
    }

    .apg-stage,
    .apg-main {
        min-height: 400px;
    }
}

@media (max-width: 640px) {
    .apg-shell {
        display: flex;
        flex-direction: column-reverse;
        gap: 10px;
    }

    .apg-thumbs-wrap {
        display: block;
    }

    .apg-thumb-nav {
        display: none;
    }

    .apg-thumbs {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 8px;
        padding: 2px 1px 6px;
    }

    .apg-thumb {
        width: 68px;
        flex: 0 0 68px;
        border-radius: 11px;
    }

    .apg-stage,
    .apg-main {
        min-height: 310px;
    }

    .apg-stage {
        border-radius: 16px;
    }

    .apg-arrow {
        width: 36px;
        height: 36px;
        font-size: 27px;
        opacity: 1;
    }

    .apg-arrow--prev { left: 8px; }
    .apg-arrow--next { right: 8px; }

    .apg-expand {
        right: 9px;
        top: 9px;
        width: 36px;
        height: 36px;
    }

    .apg-watch-video {
        left: 10px;
        bottom: 10px;
        min-height: 40px;
        padding: 8px 13px;
    }

    .apg-lightbox-dialog {
        padding: 50px 16px 30px;
    }

    .apg-lightbox-media {
        width: 100%;
        height: 82vh;
    }

    .apg-lightbox-arrow {
        width: 42px;
        height: 42px;
        font-size: 32px;
    }

    .apg-lightbox-arrow--prev { left: 6px; }
    .apg-lightbox-arrow--next { right: 6px; }
}
