/* Tee Designer v3 — compact, small, neat buy flow. Mobile-first.
   One accent colour (ink black + orange accent) + green check marks.
   Buttons and controls are deliberately small: 13–14px type, tight
   padding, tight spacing. Big photos, small chrome. */
.tee-designer {
    margin: 20px 0;
    padding: 0;
    border: 0;
    background: #fff;
    font-size: 14px;
}
.tee-designer-title { margin: 0 0 2px; font-size: 1.35em; line-height: 1.25; }
.tee-designer-sub { margin: 0 0 14px; color: #555; font-size: 14px; }

/* --- v4 layout: steps scroll left, live preview sticks right -------- */
/* The whole product page is full-width (no gallery column, no sidebar)
   and the designer uses all of it: steps in a scrolling column, the
   shirt photo in a sticky column that never scrolls away. */
.tee-layout { display: flex; flex-direction: column; gap: 16px; }
.tee-steps-col { min-width: 0; }
.tee-preview-col {
    order: -1; /* preview first on mobile, so it is on screen before the steps */
    position: sticky;
    top: 64px; /* just under the sticky site header */
    z-index: 40;
    background: #fff;
    padding-bottom: 10px;
}
@media (min-width: 900px) {
    .tee-layout {
        display: grid;
        /* v4.5: steps narrower (420px), preview takes the rest of the
           1440px container — Umar: reduce the width of the options,
           increase the width of the preview on the right. Mobile is
           unchanged (stacked, preview first and compact). */
        grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
        gap: 28px;
        align-items: start;
    }
    .tee-preview-col {
        order: 0;
        position: sticky;
        top: 76px;
        padding-bottom: 0;
        /* v4.1: the sticky panel now also holds title, price, quantity,
           Add to Cart, View Cart and the live total below the canvas —
           cap its height so the buy button can never be pushed below
           the fold on a short screen; the panel scrolls internally. */
        max-height: calc(100vh - 92px);
        overflow-y: auto;
    }
    /* v4.5: canvas cap raised 420px -> 560px (the canvas is 600x700,
       so this is safe) — the wider preview panel earns its width. */
    .tee-preview-col #tee-canvas { max-width: 560px; }
}
/* "Now showing: Front / Back / Left Sleeve — close-up" — updated on
   every tap, so a view switch always visibly registers. */
.tee-now-showing {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    margin: 8px 0 0;
    color: #111;
}
/* Shown only when a view's own photo is missing/failed and the front
   photo is drawn instead — never a blank canvas with no explanation. */
.tee-view-note {
    display: none;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin: 4px 0 0;
    color: #8a4b00;
}
.tee-view-note.is-visible { display: block; }

/* --- Steps ---------------------------------------------------------- */
.tee-step {
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #fff;
    margin-bottom: 12px;
    overflow: hidden;
}
.tee-step-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
}
.tee-step-head h4 { margin: 0; font-size: 14px; flex: 1; }
.tee-step-num {
    flex: 0 0 auto;
    width: 24px; height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: #111;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.tee-step-check {
    display: none;
    width: 22px; height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #1a7f37;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.tee-step.is-done .tee-step-check { display: inline-block; }
.tee-step.is-done .tee-step-head { background: #eef7f0; }
.tee-step-tag {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 999px;
    padding: 2px 8px;
}
.tee-step-body { padding: 12px; }
.tee-step-attention { outline: 3px solid #e4572e; outline-offset: 2px; }
.tee-select-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.tee-select {
    width: 100%;
    max-width: 320px;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #111;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
}
.tee-step-hint { margin: 8px 0 0; color: #666; font-size: 12px; }

/* --- v4.5: order multiple sizes (Step 2) ---------------------------- */
/* One row per size: checkbox + size, its own quantity stepper, and
   its line total. The row is a <div> (see the PHP note): the − / +
   buttons sit inside the row, and a button inside a <label> would
   toggle the checkbox when tapped. */
.tee-multi-sizes { margin-top: 12px; border-top: 1px dashed #ddd; padding-top: 10px; }
.tee-multi-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tee-multi-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fff;
}
.tee-multi-row.is-checked { border-color: #111; background: #f8f8f8; }
.tee-multi-pick { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.tee-multi-check { width: 18px; height: 18px; accent-color: #111; margin: 0; cursor: pointer; }
.tee-multi-size { font-weight: 700; font-size: 13px; }
.tee-multi-stepper { display: flex; gap: 4px; align-items: center; justify-self: end; }
.tee-multi-step {
    width: 28px; height: 28px;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}
.tee-multi-step:hover { background: #111; color: #fff; border-color: #111; }
.tee-multi-qty {
    width: 52px;
    padding: 5px 4px;
    text-align: center;
    border: 1px solid #111;
    border-radius: 6px;
    font-size: 13px;
}
.tee-multi-line-total { font-size: 13px; font-weight: 700; min-width: 76px; text-align: right; }

/* --- v4.5: "N items in your cart" line (cart page) ------------------ */
/* Plain and unmistakable: the TOTAL quantity across cart lines
   (4 tees + 1 hoodie + 1 hoodie = 6 items). Inserted by
   cart-lightbox.js as a sibling BEFORE the cart block, so a block
   re-render can never remove it. Hidden whenever the count is 0 or
   cannot be established — never a wrong number. */
.tee-cart-count { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: #111; }

/* --- Swatches + sizes (tick on the selected one) --------------------- */
.tee-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.tee-swatch {
    position: relative;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid #bbb;
    cursor: pointer;
    padding: 0;
}
.tee-swatch .tee-swatch-tick {
    display: none;
    position: absolute; inset: 0;
    line-height: 30px;
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.tee-swatch.is-active { border-color: #111; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }
.tee-swatch.is-active .tee-swatch-tick { display: block; }
.tee-sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.tee-size-btn {
    position: relative;
    min-width: 44px;
    padding: 8px 10px;
    border: 1px solid #bbb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
}
.tee-size-btn .tee-size-tick {
    display: none;
    position: absolute;
    top: -9px; right: -6px;
    width: 18px; height: 18px;
    line-height: 18px;
    border-radius: 50%;
    background: #1a7f37;
    color: #fff;
    font-size: 11px;
}
.tee-size-btn.is-active { background: #111; color: #fff; border-color: #111; }
.tee-size-btn.is-active .tee-size-tick { display: inline-block; }

/* --- Viewer: rotating view sequence (not a 3D model) ---------------- */
.tee-designer-view-toggle { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
.tee-designer-view-toggle .tee-label { margin-bottom: 0; font-size: 13px; }
.tee-view-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.tee-view-btn.is-active { background: #111; color: #fff; border-color: #111; }
.tee-stage-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
#tee-canvas {
    width: 100%;
    max-width: 520px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 12px;
    touch-action: pan-y;
    cursor: grab;
    background: #fafafa;
    transition: opacity 0.16s ease;
}
/* On mobile the sticky preview must stay compact, or it would cover
   the steps it is meant to stay visible beside. */
@media (max-width: 899px) {
    #tee-canvas { max-height: 300px; width: auto; max-width: 100%; }
    .tee-stage-wrap { justify-content: center; }
}
#tee-canvas:active { cursor: grabbing; }
.tee-view-arrow {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    margin: 0 4px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #111;
}
.tee-view-arrow:hover { background: #111; color: #fff; }
.tee-view-dots { display: flex; gap: 8px; justify-content: center; margin: 10px 0 4px; }
.tee-view-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 2px solid #999;
    background: #fff;
    cursor: pointer;
    padding: 0;
}
.tee-view-dot.is-active { background: #111; border-color: #111; }
.tee-designer-note { font-size: 12px; color: #666; }

/* --- Design controls ------------------------------------------------- */
/* v4.2: a single-column stack — (1) Upload, (2) Add your own text UNDER
   it, (3) templates, (4) sliders, (5) actions. Nothing sits side by
   side in this step, so more space is left for the overall preview of
   the shirt. (v4.1 and earlier used a two-column grid at >=768px.) */
.tee-designer-controls { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.tee-control label, .tee-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.tee-control input[type="text"] { width: 100%; max-width: 320px; padding: 8px 10px; font-size: 14px; }
.tee-text-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tee-text-row input[type="color"] { width: 36px; height: 34px; padding: 2px; }
.tee-text-row .button { padding: 7px 12px; font-size: 13px; }
.tee-templates { display: flex; flex-wrap: wrap; gap: 8px; }
.tee-template {
    width: 64px; height: 64px;
    padding: 3px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}
.tee-template:hover { border-color: #111; }
.tee-template img { width: 100%; height: 100%; object-fit: contain; }
.tee-empty { color: #666; font-size: 13px; }
.tee-sliders { display: flex; flex-wrap: wrap; gap: 16px; }
.tee-sliders label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.tee-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tee-actions .button { padding: 7px 12px; font-size: 13px; }

/* --- v4.1: title, price under the shirt (v4.7.2: preview-only) ----- */
/* The product title and price travel with the shirt in the sticky
   preview panel (rendered in PHP from the product), so they stay
   visible while the steps scroll. The summary's own title/price are
   hidden for designer products in the theme CSS. v4.7.2: the panel is
   preview-only — the Add to Cart button, quantity input and View Cart
   link that used to live here are gone; the only visible Add to Cart
   is #tee-atc-second in Step 4. */
.tee-preview-buy { border-top: 1px solid #eee; margin-top: 12px; padding-top: 10px; }
.tee-preview-title { margin: 0 0 2px; font-size: 16px; line-height: 1.3; }
.tee-preview-price { margin: 0 0 10px; font-size: 17px; font-weight: 700; color: #111; }
.tee-preview-price del { color: #888; font-weight: 400; margin-right: 6px; }
.tee-preview-price ins { text-decoration: none; }
/* v4.2: the product short description travels with the shirt — small
   and quiet, directly under the price in the sticky panel. The
   summary's own short description is hidden for designer products in
   the theme CSS, so it appears once, here. */
.tee-preview-desc { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: #555; }
/* Live total: unit price x quantity, updates on every quantity or
   variation-price change (designer.js updateTotal). */
.tee-live-total {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: #eef7f0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #1a7f37;
}

/* --- Step 4: live summary + Add to Cart ----------------------------- */
.tee-selection-summary {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
    padding: 8px 10px;
    background: #f6f4f1;
    border-radius: 8px;
    color: #333;
}
.tee-selection-summary.is-ready { background: #eef7f0; color: #1a7f37; }
.tee-buy-message { font-size: 13px; font-weight: 600; margin: 0 0 10px; color: #8a4b00; }
.tee-buy-message.is-ready { color: #1a7f37; }
.tee-buy-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
/* v4.2: the Add to Cart trigger in Step 4 — same look and same
   blocked state as the real button (designer.js toggles
   .tee-atc-blocked on it in updateBuyState). Since v4.7.2 it is the
   ONLY visible Add to Cart button on the page. */
.tee-buy-row .tee-atc-second {
    flex: 1;
    min-width: 180px;
    font-size: 14px !important;
    padding: 10px 18px !important;
    border-radius: 8px !important;
}
.tee-buy-row .tee-atc-second.tee-atc-blocked {
    background: #ccc !important;
    border-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
}

/* Native WooCommerce variation selects: hidden from the very first
   visit whenever the designer JS is present (designer.js adds .tee-js
   to form.cart at load). The native selects render above the designer
   with an empty "Choose an option" until WooCommerce's JS populates
   them — that is the empty dropdown list the customer saw at the top
   of the page. If the script fails, the class is absent and the normal
   selects stay visible and usable. The chosen variation's price line
   (.single_variation) is hidden too — the sticky panel under the shirt
   shows the unit price and the live total instead.
   v4.7.2: the same class also hides the native quantity input + Add
   to Cart button IN PLACE (they stay in the form, so they still
   submit — Step 4's #tee-atc-second calls the real button's click).
   v4.7.3 ROOT CAUSE FIX: v4.7.2 ALSO hid the wrapper
   (.woocommerce-variation-add-to-cart) — and the WHOLE designer
   (steps + live preview canvas) is rendered INSIDE that wrapper,
   because tee_designer_render() hooks
   woocommerce_before_add_to_cart_button, which fires inside it. So
   the moment designer.js added .tee-js, the entire preview vanished
   — it showed at first load, then went off. NEVER hide the wrapper
   itself: hide only the quantity div and the button directly (they
   sit inside the wrapper AFTER the designer, so hiding them cannot
   touch the preview). The "in case a theme renders them outside the
   wrapper" direct selectors stay — they are the safe ones. */
form.cart.tee-js table.variations,
form.cart.tee-js .single_variation,
form.cart.tee-js .quantity,
form.cart.tee-js .single_add_to_cart_button { display: none; }

/* (v4.2: the two-column .tee-designer-controls grid at >=768px was
   removed — Step 3 is a single-column stack now, see above.) */

/* --- v4.4: Add to Cart processing overlay ------------------------------ */
/* Full-screen, blocks all pointer input while the order goes through, so
   the customer cannot tap Add to Cart twice or three times. Shown ONLY
   once validation has passed (designer.js showProcessing). The step list
   is UI progress over the real server round-trip (preview export + save
   + cart add), not separate server stages. [hidden] must win over the
   flex display below, hence the explicit rule. */
.tee-processing[hidden] { display: none; }
.tee-processing {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 17, 17, 0.6);
    padding: 16px;
}
.tee-processing-panel {
    background: #fff;
    border-radius: 12px;
    padding: 24px 22px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.tee-processing-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    border: 4px solid #e5e0da;
    border-top-color: #111;
    border-radius: 50%;
    animation: tee-spin 0.9s linear infinite;
}
@keyframes tee-spin { to { transform: rotate(360deg); } }
.tee-processing-panel h3 {
    margin: 0 0 14px;
    font-size: 17px;
    line-height: 1.35;
}
.tee-processing-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}
.tee-processing-steps li {
    position: relative;
    padding: 6px 0 6px 30px;
    font-size: 14px;
    color: #888;
}
.tee-processing-steps li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 9px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
}
.tee-processing-steps li.is-active { color: #111; font-weight: 700; }
.tee-processing-steps li.is-active::before {
    border-color: #111;
    border-top-color: transparent;
    animation: tee-spin 0.9s linear infinite;
}
.tee-processing-steps li.is-done { color: #1a7f37; }
.tee-processing-steps li.is-done::before {
    content: "\2713";
    border: none;
    background: none;
    color: #1a7f37;
    font-size: 15px;
    line-height: 1;
    top: 8px;
    left: 5px;
    animation: none;
}
.tee-atc-busy { opacity: 0.7 !important; cursor: wait !important; }

/* --- v4.4: cart/checkout design-snapshot lightbox ---------------------- */
/* Clicking a saved design snapshot in the cart opens ONLY that full-size
   image (cart-lightbox.js). Plain product photos are never intercepted.
   [hidden] must win over the flex display below, hence the explicit
   rule. */
.tee-lightbox[hidden] { display: none; }
.tee-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.tee-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.65);
}
.tee-lightbox-panel {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.tee-lightbox-panel h3 { margin: 0 0 12px; font-size: 17px; }
.tee-lightbox-close {
    position: absolute;
    top: 8px;
    right: 12px;
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
}
.tee-lightbox-img {
    max-width: 100%;
    max-height: 62vh;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.tee-lightbox-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
}
body.tee-lightbox-open { overflow: hidden; }
