/* ── B2B Product Page Styles ──────────────────────────────────────────────── */

/* ── Site color variables ── */
:root {
    --b2b-blue:   #0057D9;
    --b2b-orange: #F5622E;
    --b2b-dark:   #0A1628;
    --b2b-gray:   #F4F5F7;
    --b2b-border: #E0E4EA;
    --b2b-text:   #1A1A2E;
}

/* ── Brand header ── */
.b2b-brand-header { margin-bottom: 6px; }
.b2b-brand-logo {
    max-height: 36px;
    width: auto;
    display: block;
    mix-blend-mode: multiply;
}
.b2b-brand-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--b2b-orange);
}

/* ── Style number ── */
.b2b-style-number {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
}

/* ── Hide WC short description (shows twice) ── */
.single-product .woocommerce-product-details__short-description { display: none !important; }

/* ── Price display ── */
.single-product p.price { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.single-product p.price .woocommerce-Price-amount { font-size: 26px; font-weight: 700; color: var(--b2b-text); }
.b2b-price-from { font-size: 14px; color: #666; font-weight: 400; }
.b2b-price-each { font-size: 14px; color: #666; font-weight: 400; }

/* ── Add to cart button — blue ── */
.single-product .single_add_to_cart_button,
.single-product button[type="submit"].button {
    background-color: var(--b2b-blue) !important;
    border-color: var(--b2b-blue) !important;
    color: #fff !important;
}
.single-product .single_add_to_cart_button:hover {
    background-color: #0046B5 !important;
    border-color: #0046B5 !important;
}

/* ── Title ── */
.single-product .product_title {
    font-size: 22px !important;
    line-height: 1.3 !important;
}

/* ── Out of stock color option styling ── */
.single-product select[name="attribute_pa_color"] option[disabled] {
    color: #aaa;
    font-style: italic;
}

/* ── Hide old WC tabs ── */
.woocommerce-tabs { display: none !important; }

/* ── Hide WC stock quantity number — status label only ── */
.woocommerce-variation-availability .stock:not(.out-of-stock) {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}

/* ── Accordions ── */
.b2b-accordions {
    margin-top: 20px;
    border: 1px solid var(--b2b-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.b2b-accordion { border-bottom: 1px solid var(--b2b-border); background: #fff; }
.b2b-accordion:last-child { border-bottom: none; }

.b2b-accordion__trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--b2b-text);
    text-align: left;
    transition: background 0.15s;
}
.b2b-accordion__trigger:hover { background: #f7f8fa; }
.b2b-accordion__trigger[aria-expanded="true"] { color: var(--b2b-blue); background: #f0f5ff; }

.b2b-accordion__chevron {
    width: 18px; height: 18px;
    color: #999;
    flex-shrink: 0;
    transition: transform 0.25s ease, color 0.15s;
}
.b2b-accordion__trigger[aria-expanded="true"] .b2b-accordion__chevron {
    transform: rotate(180deg);
    color: var(--b2b-blue);
}

.b2b-accordion__body {
    display: none;
    padding: 4px 18px 18px;
    font-size: 13.5px;
    color: #444;
    line-height: 1.65;
    background: #fff;
}
.b2b-accordion__body.b2b-open { display: block; }

/* Feature bullet list */
.b2b-feature-list { margin: 0; padding: 0; list-style: none; }
.b2b-feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13.5px;
    color: #444;
    line-height: 1.5;
}
.b2b-feature-list li:last-child { border-bottom: none; }
.b2b-feature-list li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--b2b-blue);
    flex-shrink: 0;
    margin-top: 6px;
}

/* Spec table */
.b2b-spec-list { margin: 0; padding: 0; }
.b2b-spec-row {
    display: flex;
    gap: 0;
    padding: 7px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13.5px;
}
.b2b-spec-row:last-child { border-bottom: none; }
.b2b-spec-row dt {
    font-weight: 600;
    color: #333;
    min-width: 140px;
    flex-shrink: 0;
    padding-right: 12px;
}
.b2b-spec-row dd { margin: 0; color: #555; flex: 1; }
.b2b-spec-row dd a { color: var(--b2b-blue); text-decoration: none; font-weight: 500; }
.b2b-spec-row dd a:hover { text-decoration: underline; }

/* ── Size & Measurements table ── */
.b2b-meas-table-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--b2b-border);
}
.b2b-meas-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 300px; }
.b2b-meas-table thead tr { background: var(--b2b-gray); }
.b2b-meas-table th {
    padding: 9px 14px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid var(--b2b-border);
    white-space: nowrap;
}
.b2b-meas-table th:not(:first-child) { text-align: center; }
.b2b-meas-table td { padding: 8px 14px; border-bottom: 1px solid #f3f4f6; color: #555; vertical-align: middle; }
.b2b-meas-table td:not(:first-child) { text-align: center; }
.b2b-meas-table tr:last-child td { border-bottom: none; }
.b2b-meas-table tbody tr:hover { background: #f9fafb; }
.b2b-meas-label { font-weight: 500; color: #333; }

/* ── Hide WC flexslider — we use #b2b-gallery ── */
.woocommerce-product-gallery .woocommerce-product-gallery__wrapper { display: none !important; }
.woocommerce-product-gallery .flex-control-nav { display: none !important; }
.woocommerce-product-gallery { opacity: 1 !important; }

/* ── Two-column product layout ── */
@media (min-width: 993px) {
    .single-product .woocommerce-product-gallery {
        float: left !important;
        width: 42% !important;
        padding-right: 16px !important;
        box-sizing: border-box !important;
    }
    .single-product .summary.entry-summary {
        float: right !important;
        width: 55% !important;
    }
}

/* ── Mobile section reorder (checkpoint 1 of N) ──────────────────────────────
   Goal: let Product Details/FAQ (rendered by the theme's product-image.php,
   nested inside .woocommerce-product-gallery) become independently
   repositionable via CSS `order`, without moving the PHP template call —
   moving that call broke desktop once already (2026-08-03) since the theme
   file has no viewport gating of its own.
   `display: contents` makes .woocommerce-product-gallery itself disappear
   from layout on mobile, promoting its children (#b2b-gallery the design
   tool, and .b2b-left-accordions the Product Details/FAQ block) to be
   direct flex items of .product-details-wrapper (the theme-injected shared
   parent of the gallery and .summary column) instead. This is a NECESSARY
   BUT NOT SUFFICIENT step toward the full interleaved mobile order — true
   interleaving between Colors&Sizes and Add Decoration additionally
   requires restructuring #b2b-order's internal step rendering (deferred,
   separately-scoped follow-up work). This checkpoint only makes Product
   Details/FAQ and the gallery block independently orderable relative to
   each other and to the summary column as a whole. */
@media (max-width: 768px) {
    .product-details-wrapper {
        display: flex;
        flex-direction: column;
    }
    .woocommerce-product-gallery {
        display: contents;
    }
    #b2b-gallery { order: 1; }
    .b2b-left-accordions { order: 3; }

    /* .summary.entry-summary's direct children (confirmed via DOMDocument
       parse, not raw-text reading — see the 2026-08-05 lesson in tasks.json
       about why): .shoptimizer-product-prevnext, .b2b-card.b2b-info, .clear,
       #b2b-order, .b2b-accordions (Description/Specs/Size), the empty
       #shoptimizer-modals-wrapper, .call-back-feature, and its <dialog>. Only
       8 children total — small enough to order explicitly rather than defer.
       `display:contents` promotes them all to be direct flex items of
       .product-details-wrapper alongside #b2b-gallery/.b2b-left-accordions. */
    .summary.entry-summary { display: contents; }
    .shoptimizer-product-prevnext { order: 2; }
    .b2b-card.b2b-info { order: 2; }
    .summary.entry-summary > .clear { order: 2; }
    #b2b-order { order: 2; }
    .summary.entry-summary > .b2b-accordions { order: 2; }
    .call-back-feature { order: 4; }
    #shoptimizer-modals-wrapper { order: 4; }
    dialog.shoptimizer-modal { order: 4; }
}

/* ── "Request a Call Back" form (fills the theme's empty floating-button-content
   widget area) ── */
.b2b-callback__intro { margin: 0 0 14px; font-size: 13.5px; color: #555; line-height: 1.5; }
.b2b-callback__form { display: flex; flex-direction: column; gap: 12px; }
.b2b-callback__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.b2b-callback__field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--b2b-text); }
.b2b-callback__field input,
.b2b-callback__field select,
.b2b-callback__field textarea {
    font: inherit;
    font-weight: 400;
    padding: 10px 12px;
    border: 1px solid var(--b2b-border);
    border-radius: 8px;
    color: var(--b2b-text);
}
.b2b-callback__field input:focus,
.b2b-callback__field select:focus,
.b2b-callback__field textarea:focus {
    outline: none;
    border-color: var(--b2b-blue);
    box-shadow: 0 0 0 3px rgba(0,87,217,0.1);
}
.b2b-callback__submit {
    background: var(--b2b-blue);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.b2b-callback__submit:hover:not(:disabled) { background: #0046B5; }
.b2b-callback__submit:disabled { background: #cbd5e1; cursor: not-allowed; }
.b2b-callback__msg { margin: 4px 0 0; font-size: 13px; }
.b2b-callback__msg.is-ok { color: #047857; }
.b2b-callback__msg.is-error { color: #b91c1c; }

/* ── B2B Gallery ── */
.woocommerce-product-gallery { padding: 0 !important; }

#b2b-gallery { width: 100%; margin: 0; padding: 0; box-sizing: border-box; }

/* Main image — 4:5 ratio, centered, white background */
#b2b-gallery__main {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0 0 8px 0;
    padding: 0;
    box-sizing: border-box;
}
#b2b-gallery__main img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    padding: 0;
}
#b2b-gallery__main img.b2b-flipped { transform: scaleX(-1); }

/* Zoom button — top-right of the main image, opens the fullscreen lightbox. */
#b2b-gallery__zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 7;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    color: #374151;
    cursor: pointer;
}
#b2b-gallery__zoom:hover { border-color: #2563eb; color: #2563eb; }

/* Fullscreen lightbox — shows the same view (product + design) larger, with
   prev/next to switch positions, matching the reference Swag.com zoom flow. */
#b2b-gallery__lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
#b2b-gallery__lightbox[hidden] { display: none; }
#b2b-gallery__lightbox-stage {
    width: min(90vw, 1100px);
    height: min(85vh, 900px);
    display: flex;
    align-items: center;
    justify-content: center;
}
#b2b-gallery__lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
#b2b-gallery__lightbox-stage img.b2b-flipped { transform: scaleX(-1); }
#b2b-gallery__lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    color: #374151;
    cursor: pointer;
}
#b2b-gallery__lightbox-close:hover { border-color: #2563eb; color: #2563eb; }
.b2b-gallery__lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    color: #374151;
    cursor: pointer;
}
.b2b-gallery__lightbox-nav:hover { border-color: #2563eb; color: #2563eb; }
#b2b-gallery__lightbox-prev { left: 18px; }
#b2b-gallery__lightbox-next { right: 18px; }

/* Thumbnail strip */
#b2b-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
}
#b2b-gallery__thumbs.b2b-many-thumbs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}
#b2b-gallery__thumbs.b2b-many-thumbs li {
    flex: 0 0 calc(25% - 5px);
    min-width: calc(25% - 5px);
}

#b2b-gallery__thumbs li {
    width: 100%;
    aspect-ratio: 4 / 5;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#b2b-gallery__thumbs li:hover { border-color: #999; }
#b2b-gallery__thumbs li.b2b-thumb-active { border-color: var(--b2b-orange) !important; }

#b2b-gallery__thumbs li img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    padding: 0;
}
#b2b-gallery__thumbs li img.b2b-flipped { transform: scaleX(-1); }

/* ── Thumbnail strip with scroll arrows (no visible scrollbar) ── */
.b2b-thumbs-wrap { position: relative; }
#b2b-gallery__thumbs.b2b-many-thumbs {
    scrollbar-width: none;           /* Firefox */
    -ms-overflow-style: none;        /* IE/Edge */
    scroll-behavior: smooth;
}
#b2b-gallery__thumbs.b2b-many-thumbs::-webkit-scrollbar { display: none; height: 0; } /* Chrome/Safari */

.b2b-thumbs-arrow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38px;
    border: none;
    cursor: pointer;
    display: none;                   /* shown by JS only when scrollable */
    align-items: center;
    justify-content: center;
    z-index: 3;
    color: #1a1a2e;
    padding: 0;
}
.b2b-thumbs-arrow svg { width: 20px; height: 20px; }
.b2b-thumbs-arrow.is-visible { display: flex; }
.b2b-thumbs-arrow--left {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.95) 40%, rgba(255,255,255,0));
    justify-content: flex-start;
    padding-left: 2px;
}
.b2b-thumbs-arrow--right {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.95) 40%, rgba(255,255,255,0));
    justify-content: flex-end;
    padding-right: 2px;
}

/* ── FAQ accordion (nested inside Specifications-style accordion) ── */
.b2b-faq__item { border-bottom: 1px solid #f1f3f5; }
.b2b-faq__item:last-child { border-bottom: none; }
.b2b-faq__q {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    background: none;
    border: none;
    text-align: left;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--b2b-text, #1A1A2E);
    cursor: pointer;
}
.b2b-faq__icon {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 400;
    color: var(--b2b-blue, #0057D9);
    transition: transform 0.2s;
}
.b2b-faq__q[aria-expanded="true"] .b2b-faq__icon { transform: rotate(45deg); }
.b2b-faq__a {
    display: none;
    padding: 0 0 14px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}
.b2b-faq__a.is-open { display: block; }
