/* Product Gallery Popup - Lightbox */
.gtsg-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gtsg-popup.is-open {
    display: flex;
    opacity: 1;
}

/* Backdrop click to close */
.gtsg-popup__backdrop {
    position: absolute;
    inset: 0;
    cursor: pointer;
}

/* Container */
.gtsg-popup__container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 24px;
    z-index: 1;
    pointer-events: none;
}

.gtsg-popup__stage {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - 220px);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.gtsg-popup__media {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gtsg-popup__media img,
.gtsg-popup__media iframe,
.gtsg-popup__media video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: #000;
}

.gtsg-popup__media iframe,
.gtsg-popup__media video {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
}

/* Close button */
.gtsg-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    z-index: 3;
    pointer-events: auto;
}

.gtsg-popup__close:hover,
.gtsg-popup__close:focus {
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.gtsg-popup__close svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Prev/Next nav - synced with .ctsp-main-nav */
.gtsg-popup__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 44px;
    background: rgb(255 255 255 / 49%);
    color: #1f1f1f;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s ease, opacity 0.15s ease;
    z-index: 2;
    pointer-events: auto;
}

.gtsg-popup__nav:hover,
.gtsg-popup__nav:focus {
    background: rgb(255 255 255 / 75%);
    outline: none;
}

.gtsg-popup__nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gtsg-popup__nav--prev { left: 16px; }
.gtsg-popup__nav--next { right: 16px; }

.gtsg-popup__nav svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Counter */
.gtsg-popup__counter {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    z-index: 2;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 999px;
}

/* Thumbs strip */
.gtsg-popup__thumbs {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px;
    max-width: 900px;
    width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
}

.gtsg-popup__thumbs::-webkit-scrollbar {
    height: 4px;
}

.gtsg-popup__thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.gtsg-popup__thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.gtsg-popup__thumb {
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.1);
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.gtsg-popup__thumb:hover {
    transform: translateY(-2px);
}

.gtsg-popup__thumb.is-active {
    border-color: #fff;
}

.gtsg-popup__thumb-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
}

.gtsg-popup__thumb-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Body lock */
body.is-popup-open {
    overflow: hidden;
}

/* close button only gets touch-action control when open */
body.is-popup-open .gtsg-popup.is-open {
    touch-action: none;
}

/* Video poster overlay */
.gtsg-popup__video-poster {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    z-index: 1;
}

.gtsg-popup__video-poster::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
}

.gtsg-popup__video-play {
    position: relative;
    z-index: 1;
    width: 72px;
    height: 72px;
    background: rgba(255, 0, 0, 0.9);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, background 0.15s ease;
}

.gtsg-popup__video-poster:hover .gtsg-popup__video-play {
    transform: scale(1.1);
    background: rgba(255, 0, 0, 1);
}

.gtsg-popup__video-play svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
    margin-left: 4px;
}

/* Mobile */
@media (max-width: 768px) {
    .gtsg-popup__container {
        padding: 48px 8px 16px;
    }

    .gtsg-popup__stage {
        max-height: calc(100vh - 180px);
    }

    .gtsg-popup__nav {
        width: 36px;
        height: 48px;
    }

    .gtsg-popup__nav--prev { left: 8px; }
    .gtsg-popup__nav--next { right: 8px; }

    .gtsg-popup__nav svg {
        width: 22px;
        height: 22px;
    }

    .gtsg-popup__close {
        top: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
    }

    .gtsg-popup__counter {
        top: 8px;
        font-size: 12px;
        padding: 4px 10px;
    }

    .gtsg-popup__thumbs {
        margin-top: 12px;
        gap: 6px;
    }

    .gtsg-popup__thumb {
        width: 50px;
        height: 50px;
    }

    .gtsg-popup__video-play {
        width: 56px;
        height: 56px;
    }

    .gtsg-popup__video-play svg {
        width: 24px;
        height: 24px;
    }
}

/* Loading state */
.gtsg-popup__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}
