/* Jet Product Gallery — Frontend */

/* ── Gallery wrapper ─────────────────────────────────────────────────────── */

.cjpg-gallery {
    display: grid;
    gap: 12px;
    position: relative;
}

/* Thumbnail positions */
.cjpg-gallery.cjpg-thumbs--left {
    grid-template-columns: 80px 1fr;
}

.cjpg-gallery.cjpg-thumbs--right {
    grid-template-columns: 1fr 80px;
}

.cjpg-gallery.cjpg-thumbs--right .cjpg-thumbs {
    order: 2;
}

.cjpg-gallery.cjpg-thumbs--bottom {
    grid-template-columns: 1fr;
}

.cjpg-gallery.cjpg-thumbs--bottom .cjpg-thumbs {
    order: 2;
    flex-direction: row;
    flex-wrap: wrap;
}

/* ── Thumbnails ──────────────────────────────────────────────────────────── */

.cjpg-thumbs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.cjpg-thumb {
    background: none;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    transition: border-color .15s;
    position: relative;
}

.cjpg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cjpg-thumb--active {
    border-color: #2271b1;
}

.cjpg-thumb:hover {
    border-color: #2271b1;
    opacity: .9;
}

.cjpg-thumb__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.3);
}

.cjpg-thumb__play::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 14px;
    border-color: transparent transparent transparent #fff;
}

/* ── Main image area ─────────────────────────────────────────────────────── */

.cjpg-main {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f6f7f7;
}

.cjpg-zoom--inner .cjpg-main,
.cjpg-zoom--lens .cjpg-main,
.cjpg-zoom--window .cjpg-main {
    cursor: zoom-in;
}

.cjpg-zoom--inner .cjpg-main .cjpg-main__item--video,
.cjpg-zoom--lens .cjpg-main .cjpg-main__item--video,
.cjpg-zoom--window .cjpg-main .cjpg-main__item--video {
    cursor: default;
}

.cjpg-main__item {
    display: none;
}

.cjpg-main__item--active {
    display: block;
}

.cjpg-main__img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Transition animations ───────────────────────────────────────────────── */

.cjpg-gallery--fade .cjpg-main__item {
    animation: cjpgFadeIn .25s ease;
}

.cjpg-gallery--slide .cjpg-main__item {
    animation: cjpgSlideIn .25s ease;
}

@keyframes cjpgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes cjpgSlideIn {
    from { transform: translateX(16px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── Zoom ────────────────────────────────────────────────────────────────── */

.cjpg-zoom--inner .cjpg-main__img {
    transition: transform .2s ease;
    transform-origin: var(--cjpg-zoom-x, 50%) var(--cjpg-zoom-y, 50%);
}

.cjpg-zoom--inner .cjpg-main.cjpg-zooming .cjpg-main__img {
    transform: scale(2);
}

/* Lens zoom */
.cjpg-zoom-lens {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 2px solid #2271b1;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity .1s;
    overflow: hidden;
    z-index: 10;
}

.cjpg-zoom-lens--visible {
    opacity: 1;
}

/* Window zoom panel */
.cjpg-zoom-window {
    display: none;
    position: absolute;
    right: calc(100% + 12px);
    top: 0;
    width: 320px;
    height: 320px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    z-index: 100;
    pointer-events: none;
}

.cjpg-zoom-window--visible {
    display: block;
}

.cjpg-zoom-window img {
    position: absolute;
    max-width: none;
    max-height: none;
}

/* ── Lightbox trigger ────────────────────────────────────────────────────── */

.cjpg-lightbox-trigger {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255,255,255,.85);
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    padding: 0;
    transition: background .15s;
}

.cjpg-lightbox-trigger:hover {
    background: #fff;
}

.cjpg-lightbox-trigger .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #1d2327;
}

/* ── Lightbox overlay ────────────────────────────────────────────────────── */

.cjpg-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cjpg-lightbox-overlay[hidden] {
    display: none;
}

.cjpg-lb-stage {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cjpg-lb-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.cjpg-lb-close,
.cjpg-lb-prev,
.cjpg-lb-next {
    position: absolute;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    transition: background .15s;
    font-size: 24px;
    line-height: 1;
    padding: 6px 14px;
}

.cjpg-lb-close {
    top: 16px;
    right: 16px;
    font-size: 18px;
    padding: 6px 12px;
}

.cjpg-lb-prev {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.cjpg-lb-next {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.cjpg-lb-close:hover,
.cjpg-lb-prev:hover,
.cjpg-lb-next:hover {
    background: rgba(255,255,255,.25);
}

.cjpg-lb-counter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,.7);
    font-size: 13px;
}

/* ── Video embed ─────────────────────────────────────────────────────────── */

.cjpg-video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
}

.cjpg-video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.cjpg-video-play {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.35);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cjpg-video-play__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cjpg-video-play__icon::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 22px;
    border-color: transparent transparent transparent #1d2327;
    margin-left: 4px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .cjpg-gallery.cjpg-thumbs--left,
    .cjpg-gallery.cjpg-thumbs--right {
        grid-template-columns: 1fr;
    }

    .cjpg-gallery.cjpg-thumbs--left .cjpg-thumbs,
    .cjpg-gallery.cjpg-thumbs--right .cjpg-thumbs {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .cjpg-thumb {
        width: 56px;
        height: 56px;
    }

    .cjpg-zoom-window {
        display: none !important;
    }
}
