/* GATO Product 3D — gallery thumb + cover viewer */

.gs-product-3d-thumb-item {
    position: relative;
}

.gs-product-3d-thumb {
    position: relative;
    display: block;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid transparent;
    box-sizing: border-box;
}

.gs-product-3d-thumb.selected,
.gs-product-3d-thumb-item.is-active .gs-product-3d-thumb {
    border-color: #111;
}

.gs-product-3d-thumb-img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.gs-product-3d-badge {
    position: absolute;
    left: 4px;
    bottom: 4px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0, 0, 0, 0.72);
    line-height: 1.3;
    pointer-events: none;
}

.product-cover .gs-product-3d-stage {
    position: relative;
    width: 100%;
    min-height: 320px;
    background: #f4f4f4;
}

.product-cover .gs-product-3d-stage[hidden] {
    display: none !important;
}

.product-cover.gs-product-3d-active .js-qv-product-cover,
.product-cover.gs-product-3d-active .layer {
    display: none !important;
}

.product-cover .gs-product-3d-stage model-viewer,
.product-cover .gs-product-3d-stage iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 420px;
    border: 0;
    background: #f4f4f4;
}

/*
 * ThemeVolty hides .product-cover below 768px and uses the vertical slider as
 * the main gallery. Re-show the cover while 3D is active so the viewer is not
 * stuck in a display:none container (0x0).
 */
@media (max-width: 768px) {
    .tvprduct-image-info-wrapper .product-cover.gs-product-3d-active {
        display: block !important;
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        margin-bottom: 12px;
    }

    .tvprduct-image-info-wrapper .product-cover.gs-product-3d-active .gs-product-3d-stage {
        min-height: 280px;
    }

    .tvprduct-image-info-wrapper .product-cover.gs-product-3d-active .gs-product-3d-stage model-viewer,
    .tvprduct-image-info-wrapper .product-cover.gs-product-3d-active .gs-product-3d-stage iframe {
        min-height: 280px;
    }
}

/* Expand button on inline 3D stage */
.gs-product-3d-expand {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 6;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    color: #111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.gs-product-3d-expand:hover,
.gs-product-3d-expand:focus {
    background: #111;
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

/* Fullscreen lightbox */
.gs-product-3d-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.gs-product-3d-lightbox.is-open {
    display: flex;
}

.gs-product-3d-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.gs-product-3d-lightbox-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1120px, calc(100vw - 32px));
    height: min(820px, calc(100vh - 32px));
    background: #f4f4f4;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.gs-product-3d-lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gs-product-3d-lightbox-close:hover,
.gs-product-3d-lightbox-close:focus {
    background: #111;
    color: #fff;
    outline: none;
}

.gs-product-3d-lightbox-content {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.gs-product-3d-lightbox-content model-viewer,
.gs-product-3d-lightbox-content iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: 0;
    background: #f4f4f4;
}

.gs-product-3d-lightbox-notice {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 48px 12px 16px;
    font-size: 12px;
    line-height: 1.45;
    color: #555;
    background: #f0f0f0;
    border-top: 1px solid #e2e2e2;
    text-align: left;
}

.gs-product-3d-lightbox-loading,
.gs-product-3d-lightbox-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    color: #444;
    font-size: 14px;
}

body.gs-product-3d-lightbox-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .product-cover .gs-product-3d-stage {
        min-height: 260px;
    }

    .product-cover .gs-product-3d-stage model-viewer,
    .product-cover .gs-product-3d-stage iframe {
        min-height: 300px;
    }

    .gs-product-3d-expand {
        width: 36px;
        height: 36px;
        top: 8px;
        right: 8px;
    }

    .gs-product-3d-lightbox {
        padding: 8px;
    }

    .gs-product-3d-lightbox-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        border-radius: 8px;
    }
}
