/* Custom Watch Builder v2.2 — compact "build your own watch" layout.
   Left: light 3D viewer (360 + zoom bottom-left). Right (theme column): the theme's own title,
   our live price, then a white card with tabs, progress bar, thumbnail swatches, Prev / Next, Add to Cart. */

.cw-builder, .cw-builder__panel, .cw-builder__panel *, .cw-builder__intro { box-sizing: border-box; }

/* ---------------------------------------------------------------- viewer */
.cw-builder { display: block; width: 100%; }

.cw-builder__viewer {
    position: relative;
    width: 100%;
    height: clamp(440px, calc(100vh - 170px), 700px);
    background: #f4f5f7;
    overflow: hidden;
    cursor: grab;
    touch-action: none;                /* one finger rotates in every direction, two fingers pinch-zoom (the page scrolls from the panel below) */
    overscroll-behavior: contain;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.cw-builder__viewer:active { cursor: grabbing; }
.cw-builder__canvas { width: 100%; height: 100%; display: block; outline: none; }

.cw-builder__viewer-controls { position: absolute; left: 20px; bottom: 16px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.cw-ctl { background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; color: #8a8e96; font: inherit; }
.cw-ctl--360 span { font-size: 14px; letter-spacing: .03em; margin-right: 4px; color: #9a9ea6; font-weight: 600; }
.cw-ctl--360 svg { width: 28px; height: 28px; }
.cw-ctl--zoom svg { width: 22px; height: 22px; }
.cw-ctl__divider { width: 1px; height: 26px; background: #dfe1e5; margin: 0 2px; }

.cw-builder__viewer.is-busy::after { content: ''; position: absolute; top: 18px; right: 18px; width: 16px; height: 16px; border: 2px solid #c9ccd2; border-top-color: #111; border-radius: 50%; animation: cw-spin .7s linear infinite; }
@keyframes cw-spin { to { transform: rotate(360deg); } }

.cw-builder__loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f4f5f7; transition: opacity .3s ease; z-index: 3; }
.cw-builder__loading img { max-width: 60%; max-height: 60%; object-fit: contain; opacity: .5; }
.cw-builder__loading-label { margin-top: 10px; font-size: 12px; color: #888; letter-spacing: .04em; }
.cw-builder__loading.is-hidden { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------- right side */
.cw-builder__intro { margin: 4px 0 14px; }
.cw-builder__price { font-size: 20px; line-height: 1.2; color: #1b1c1e; font-weight: 500; }

.cw-builder__panel { width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 1px 12px rgba(16, 24, 40, .08); overflow: hidden; color: #111; font-size: 14px; }

.cw-builder__tabs { display: flex; margin: 0; background: #f3f4f6; }
.cw-tab { flex: 1 1 0; min-width: 0; background: #f3f4f6; color: #111; border: 0; border-right: 1px solid #e6e8eb; padding: 0 4px; height: 44px; font-size: 14px; line-height: 1.1; white-space: nowrap; cursor: pointer; transition: background .15s; }
.cw-tab:last-child { border-right: 0; }
.cw-tab:hover { background: #eceef1; }
.cw-tab.is-active { background: #000; color: #fff; }

.cw-builder__body { padding: 22px 24px 24px; }

.cw-builder__progress { position: relative; height: 7px; background: #e9eaec; border-radius: 99px; margin: 0 0 26px; }
.cw-builder__progress-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 20%; background: #000; border-radius: 99px; transition: width .3s ease; }
.cw-builder__progress-marker { position: absolute; top: 11px; left: 20%; transform: translateX(-50%); transition: left .3s ease; }

.cw-step-header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.cw-step-number { font-weight: 800; font-size: 18px; line-height: 1.15; text-transform: uppercase; letter-spacing: .005em; }
.cw-step-selected { color: #2b2d31; font-size: 14px; text-align: right; line-height: 1.2; }

.cw-step-scroll { max-height: 330px; overflow-y: auto; padding: 3px 3px 0; margin: 0 -3px; scrollbar-width: thin; }
.cw-swatch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 12px; padding-bottom: 6px; }

.cw-swatch { cursor: pointer; text-align: center; }
.cw-swatch-thumb { display: block; width: 100%; aspect-ratio: 1; border: 1px solid #dfe1e5; border-radius: 8px; background: #fff; overflow: hidden; transition: border-color .15s; }
.cw-swatch-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 6px; }
.cw-swatch-color { display: block; width: 100%; height: 100%; }
.cw-swatch:hover .cw-swatch-thumb { border-color: #9a9ea6; }
.cw-swatch.is-selected .cw-swatch-thumb { border: 2px solid #000; }
.cw-swatch.is-disabled { opacity: .35; cursor: not-allowed; }
.cw-swatch.is-soldout { opacity: .5; }
.cw-swatch.is-soldout .cw-swatch-thumb { position: relative; background: #f3f4f6; }
.cw-swatch.is-soldout .cw-swatch-thumb::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top right, transparent calc(50% - 1px), #b3261e 50%, transparent calc(50% + 1px)); }
.cw-swatch-stock { display: block; margin-top: 1px; font-size: 11px; font-weight: 600; }
.cw-swatch-stock--out { color: #b3261e; }
.cw-swatch-stock--low { color: #b26a00; }
.cw-swatch-name { display: block; margin-top: 6px; font-size: 12px; line-height: 1.25; color: #4a4d53; font-weight: 400; }
.cw-swatch-price { display: block; margin-top: 1px; font-size: 11px; color: #8b8f97; }

.cw-field-label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 6px; color: #2b2d31; }
.cw-select { width: 100%; height: 44px; padding: 0 14px; border: 1px solid #dfe1e5; border-radius: 8px; background: #fff; font-size: 14px; margin-bottom: 16px; text-transform: uppercase; }

.cw-line-tabs { display: flex; border-bottom: 1px solid #dfe1e5; margin-bottom: 14px; }
.cw-line-tab { flex: 1; background: none; border: 0; padding: 10px 6px; font-size: 14px; cursor: pointer; color: #6b7078; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.cw-line-tab.is-active { color: #000; font-weight: 600; border-color: #000; }

.cw-help-text { font-size: 13px; line-height: 1.45; color: #2b2d31; margin: 0 0 12px; }
.cw-help-text a { color: #111; text-decoration: underline; }
.cw-valid-list { font-size: 12px; background: #f4f5f7; border-radius: 8px; padding: 9px 11px; margin: -4px 0 12px; color: #3b3e44; }

.cw-engraving-input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid #dfe1e5; border-radius: 8px; margin-bottom: 10px; font-size: 15px; background: #fff; }
.cw-engraving-input:focus { outline: none; border-color: #000; }
.cw-step-count { color: #2b2d31; }

.cw-builder__nav { display: flex; gap: 12px; margin-top: 18px; }
.cw-btn { flex: 1; height: 44px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid #000; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: #fff; color: #000; padding: 0 8px; white-space: nowrap; }
.cw-chev { font-size: 1.5em; line-height: 0; position: relative; top: -.03em; }
.cw-btn:disabled { opacity: .35; cursor: not-allowed; }
.cw-btn--add-to-cart { width: 100%; flex: none; margin-top: 12px; height: 46px; background: #000; color: #fff; font-weight: 600; font-size: 15px; }
.cw-btn--add-to-cart:disabled { opacity: .5; }

.cw-builder__error { margin-top: 10px; padding: 8px 12px; background: #fdecea; color: #a12622; border-radius: 6px; font-size: 13px; }

/* ----- custom-watch product pages: the builder replaces the theme's price / qty / add-to-cart / bottom bar ----- */
html.cw-product-page .ps-product__info .ps-product__meta,
html.cw-product-page .ps-product__info .ps-product__price,
html.cw-product-page .ps-product__info .ps-product__tax-text,
html.cw-product-page .ps-product__info .ps-product__desc,
html.cw-product-page .ps-product__info .ps-product__countdown,
html.cw-product-page .ps-product__info .number-items-available,
html.cw-product-page .ps-product__info .ps-product__shopping,
html.cw-product-page .ps-product__info .ps-product__sharing,
html.cw-product-page .navigation--mobile-product { display: none !important; }
html.cw-product-page .ps-product__info > h1 { margin: 0 0 6px; }

/* Theme gives the gallery 65% / info 35% (too narrow for the configurator): use ~57% / 43% like the reference. */
@media (min-width: 1200px) {
    html.cw-product-page .mw-product-futuristic .mw-sticky-header { column-gap: 32px !important; }
    html.cw-product-page .mw-product-futuristic .mw-sticky-header > .mw-sticky-media { flex: 0 0 57% !important; max-width: 57% !important; }
    html.cw-product-page .mw-product-futuristic .mw-sticky-header > .mw-scroll-content { flex: 0 0 calc(43% - 32px) !important; max-width: calc(43% - 32px) !important; }
}

@media (max-width: 767px) {
    .cw-builder__viewer { height: 52vh; min-height: 320px; max-height: 480px; }
    .cw-builder__viewer-controls { left: 12px; bottom: 10px; }
    .cw-builder__body { padding: 16px 14px 18px; }
    .cw-tab { font-size: 12px; height: 40px; }
    .cw-swatch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cw-step-scroll { max-height: 300px; }
}
