/* BSS Product 3D Viewer — public styles (product-box chips + details buttons + modal viewer + QR) */

/* Lock page scroll while a modal is open. */
.bssp3d-modal-open { overflow: hidden; }


.bssp3d-no3d .bssp3d-details,
.bssp3d-no3d .bssp3d-chip-row { display: none !important; }

/* --- 3D viewer modal --- */
.bssp3d-viewer {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
}
.bssp3d-viewer.is-open { display: block; }
.bssp3d-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .6);
}
.bssp3d-viewer__dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, 94vw);
    height: min(720px, 88vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
/* Per-product modal size (editor → Presentation → Modal size). */
.bssp3d-viewer__dialog--compact {
    width: min(620px, 92vw);
    height: min(540px, 80vh);
}
.bssp3d-viewer__dialog--wide {
    width: min(1240px, 96vw);
    height: min(840px, 92vh);
}

.bssp3d-viewer__dialog:focus,
.bssp3d-qr__dialog:focus { outline: none; }
.bssp3d-viewer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #f4f4f5;
}
.bssp3d-viewer__mv {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
}
.bssp3d-viewer__close {
    position: absolute;
    top: 12px;
    /* Logical, not `right`: in an RTL storefront a physical right puts the close button on the
       start side, over the model. */
    inset-inline-end: 12px;
    z-index: 2;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(17, 17, 17, .82);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease;
}
.bssp3d-viewer__close:hover { background: #111; }
.bssp3d-viewer__actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 14px;
    border-top: 1px solid #ececec;
}
.bssp3d-viewer__ar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    border: 1px solid #111;
    background: #111;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.bssp3d-viewer__ar-btn:hover { background: #fff; color: #111; }
.bssp3d-viewer__ar-btn[hidden] { display: none; }

/* --- Loading state: covers the stage until the GLB is on screen --- */
.bssp3d-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: inherit;
}
.bssp3d-loading[hidden] { display: none; }
/* Neutral fallback spinner — the theme replaces this with its own loader. */
.bssp3d-loading__spinner {
    display: block;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(17, 17, 17, .15);
    border-top-color: #111;
    border-radius: 50%;
    animation: bssp3d-spin .8s linear infinite;
}
@keyframes bssp3d-spin {
    to { transform: rotate(360deg); }
}

/* --- Variant swatch rail: change the finish without leaving the viewer --- */
.bssp3d-variants {
    position: absolute;
    top: 50%;
    inset-inline-end: 14px;
    transform: translateY(-50%);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-height: calc(100% - 28px);
    padding: 12px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.bssp3d-variants__caption {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #6b7280;
    /* Vertical so a long attribute name doesn't force the rail wide. */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    max-height: 90px;
    overflow: hidden;
}
.bssp3d-variants__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    /* Room for the active ring so it isn't clipped by the scroll container. */
    padding: 3px;
}
.bssp3d-variants__swatch {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .18);
    cursor: pointer;
    transition: box-shadow .2s ease, transform .2s ease;
}
.bssp3d-variants__swatch span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bssp3d-swatch, #fff);
}
.bssp3d-variants__swatch:hover { transform: scale(1.08); }
.bssp3d-variants__swatch.is-active {
    box-shadow: 0 0 0 2px #111;
}

@media only screen and (max-width: 600px) {
    /* Vertical rail eats the model on a phone — lay it along the bottom instead. */
    .bssp3d-variants {
        top: auto;
        bottom: 12px;
        inset-inline-start: 50%;
        inset-inline-end: auto;
        transform: translateX(-50%);
        flex-direction: row;
        max-width: calc(100% - 24px);
        padding: 8px 12px;
    }
    .bssp3d-variants__caption { display: none; }
    .bssp3d-variants__list { flex-direction: row; }
}

/* --- Hotspots (editor-placed annotations) --- */
.bssp3d-hotspot {
    display: block;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    cursor: pointer;
    --min-hotspot-opacity: .35;
}
.bssp3d-hotspot__label {
    position: absolute;
    /* Flips with the reading direction so the label never covers its own pin. */
    inset-inline-start: 26px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, .95);
    color: #111;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
}
.bssp3d-hotspot:hover .bssp3d-hotspot__label,
.bssp3d-hotspot:focus .bssp3d-hotspot__label { opacity: 1; }

/* --- Custom loading bar (editor → Best practices → Use custom progress bar) --- */
.bssp3d-progress {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(240px, 60%);
    height: 4px;
    border-radius: 999px;
    background: rgba(17, 17, 17, .12);
    overflow: hidden;
    transition: opacity .3s ease;
}
.bssp3d-progress--done { opacity: 0; }
.bssp3d-progress__bar {
    width: 0;
    height: 100%;
    background: #111;
    transition: width .2s ease;
}


.bssp3d-details {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}
.bssp3d-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.bssp3d-btn__icon { display: inline-flex; }

/* --- Product-box chips (neutral base; NopFurniture styles them as round icon chips) --- */
.bssp3d-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #f1f1f1;
    color: #111;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}
.bssp3d-chip:hover { background: #111; color: #fff; }
/* --- Dimension lines: dot hotspots, SVG lines, label hotspots --- */
.bssp3d-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #16a5e6;
    box-shadow: 0 0 0 2px rgba(22, 165, 230, .35);
    padding: 0;
    position: absolute;
    transform: translate3d(-50%, -50%, 0);
    pointer-events: none;
    --min-hotspot-opacity: 0;
}
.bssp3d-dim {
    display: block;
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .25);
    color: rgba(0, 0, 0, .8);
    font-family: Futura, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 700;
    max-width: 128px;
    overflow-wrap: break-word;
    padding: 4px 10px;
    position: absolute;
    width: max-content;
    height: max-content;
    transform: translate3d(-50%, -50%, 0);
    pointer-events: none;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    --min-hotspot-opacity: 0;
}
.bssp3d-dim-svg {
    pointer-events: none;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}
.bssp3d-dim-line {
    stroke: #16a5e6;
    stroke-width: 2;
    stroke-dasharray: 2;
}
.bssp3d-hide {
    display: none;
}
/* Dots are invisible — the lines run through them */
model-viewer .bssp3d-dot { background: #16a5e6; }

@media only screen and (max-width: 600px) {
    .bssp3d-dim { font-size: 11px; padding: 3px 7px; }
    .bssp3d-dot { width: 6px; height: 6px; }
}

/* --- QR Modal (AR handoff to mobile) --- */
.bssp3d-qr {
    position: fixed; inset: 0;
    display: none;
    z-index: 10040;
}
.bssp3d-qr.is-open { display: block; }
.bssp3d-qr__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.6);
}
.bssp3d-qr__dialog {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 420px; max-width: 95vw;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0,0,0,.4);
    overflow: hidden;
}
.bssp3d-qr__header {
     align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
}
.bssp3d-qr__title { margin: 0; font-size: 16px; font-weight: 600; text-align: center;}
.bssp3d-qr__close {
    background: transparent; border: none; font-size: 24px; line-height: 1;
    cursor: pointer; color: #6b7280;
}
.bssp3d-qr__body {
    padding: 20px;
    text-align: center;
}
.bssp3d-qr__code {
    display: inline-block;
    margin: 12px 0;
    padding: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.bssp3d-qr__description { font-size: 14px; color: #374151; margin-bottom: 6px; }
.bssp3d-qr__note { font-size: 12px; color: #6b7280; margin: 8px 0 12px; }
