/* =====================================================================
   Wholesale Shop – order table, cart and status cards
   File: assets/css/ws-chart.css

   Screens: [wholesale_store_chart] (.ws-chart), [wholesale_cart_page]
   (.ws-cart) and the status cards both print (.ws-state).
   Builds on the tokens and primitives in frontend.css (.ws-ui scope).
   Mobile breakpoint: 700px.
   ===================================================================== */

/* ---------- page width (block themes constrain content to ~620px) ---------- */
.ws-ui.ws-chart, .ws-ui.ws-cart, .ws-ui.ws-state-wrap { width: 100%; max-width: 1180px; margin-inline: auto; margin-block: 0 24px; }
.ws-ui.ws-state-wrap { max-width: 620px; }

/* ---------- header row ---------- */
.ws-ui .ws-ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ws-ui .ws-ch-head .ws-title { margin: 0; }
.ws-ui .ws-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ws-ui .ws-head-acts { display: flex; gap: 12px; align-items: center; }
.ws-ui .ws-lnk { color: var(--ws-o); text-decoration: none; font-weight: 500; font-size: 13px; }
.ws-ui .ws-lnk:hover { text-decoration: underline; }

/* ---------- order-for-user banner ---------- */
.ws-ui .ws-ofu { display: flex; align-items: center; gap: 12px; background: var(--ws-o); color: #fff; padding: 10px 14px; margin-bottom: 12px; }
.ws-ui .ws-ofu-ic { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; background: rgba(0,0,0,.15); }
.ws-ui .ws-ofu-ic svg { width: 20px; height: 20px; }
.ws-ui .ws-ofu-txt { flex: 1; min-width: 0; line-height: 1.25; }
.ws-ui .ws-ofu-txt strong { display: block; font: 600 15px var(--ws-h); letter-spacing: .3px; }
.ws-ui .ws-ofu-txt span { font-size: 12.5px; opacity: .92; }
.ws-ui .ws-ofu .ws-btn { border-color: #fff; color: #fff; }
.ws-ui .ws-ofu .ws-btn:hover { background: #fff; color: var(--ws-o); }

/* ---------- filter row ---------- */
.ws-ui .ws-filters { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--ws-ln); padding: 8px; }
.ws-ui .ws-srch { position: relative; flex: 1; min-width: 0; margin: 0; display: block; }
.ws-ui .ws-srch svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ws-mu); pointer-events: none; }
.ws-ui .ws-srch .ws-input { width: 100%; height: 36px; padding: 0 10px; padding-inline-start: 32px; border: 1px solid #D3D3D3; border-radius: 0; background: #fff; font-size: 14px; box-shadow: none; -webkit-appearance: none; appearance: none; }
.ws-ui .ws-srch .ws-input:focus { outline: none; border-color: var(--ws-o); box-shadow: 0 0 0 3px var(--ws-os); }
.ws-ui .ws-filters .ws-icon-btn { flex: 0 0 36px; }
.ws-ui .ws-cstat { white-space: nowrap; font-size: 13px; color: var(--ws-mu); }
.ws-ui .ws-cstat b { display: inline-block; min-width: 20px; text-align: center; background: var(--ws-o); color: #fff; padding: 0 5px; margin-inline-end: 4px; font-weight: 600; }

/* ---------- category tabs (glued under the filter row) ---------- */
.ws-ui .ws-cat-tabs { border-top: 0; margin-bottom: 10px; }
.ws-ui .ws-filters + .ws-cat-tabs { margin-top: 0; }
.ws-ui .ws-ch-head + .ws-cat-tabs { border-top: 1px solid var(--ws-ln); }
.ws-ui .ws-filters:not(:has(+ .ws-cat-tabs)) { margin-bottom: 10px; }

/* ---------- order table ---------- */
.ws-ui .ws-tbl-w { background: #fff; border: 1px solid var(--ws-ln); overflow-x: auto; }
.ws-ui .ws-tbl { width: 100%; border-collapse: collapse; margin: 0; border: 0; font-size: 14px; }
.ws-ui .ws-tbl th { background: var(--ws-k); color: #fff; font: 500 12px/1.2 var(--ws-h); text-transform: uppercase; letter-spacing: .4px; padding: 9px 8px; text-align: center; white-space: nowrap; border: 0; }
[dir="rtl"] .ws-ui .ws-tbl th, .rtl .ws-ui .ws-tbl th { text-transform: none; }
.ws-ui .ws-tbl th.ws-s { text-align: start; }
.ws-ui .ws-tbl th.ws-hl { color: var(--ws-o); }
.ws-ui .ws-tbl td { padding: 7px 8px; border: 0; border-bottom: 1px solid var(--ws-ln); text-align: center; vertical-align: middle; background: #fff; }
.ws-ui .ws-tbl td.ws-s { text-align: start; }
.ws-ui .ws-tbl .ws-col-image { width: 60px; }
.ws-ui .ws-tbl tr.ws-sel td { background: var(--ws-os); }
.ws-ui .ws-tbl tr.ws-sel td:first-child { box-shadow: inset 3px 0 0 var(--ws-o); }
[dir="rtl"] .ws-ui .ws-tbl tr.ws-sel td:first-child, .rtl .ws-ui .ws-tbl tr.ws-sel td:first-child { box-shadow: inset -3px 0 0 var(--ws-o); }
.ws-ui .ws-tbl .ws-no-results td { color: var(--ws-mu); padding: 18px 8px; }

.ws-ui .ws-pt { margin: 0; font: 600 14.5px/1.25 var(--ws-h); text-transform: uppercase; letter-spacing: .2px; color: var(--ws-k); display: flex; gap: 6px; align-items: center; }
[dir="rtl"] .ws-ui .ws-pt, .rtl .ws-ui .ws-pt { text-transform: none; font-weight: 700; }
.ws-ui .ws-pt .ws-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ws-ui .ws-pm { margin-top: 1px; font-size: 12px; color: var(--ws-mu); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-ui .ws-pm a { color: var(--ws-o); text-decoration: none; }
.ws-ui .ws-pm a:hover { text-decoration: underline; }
.ws-ui .ws-mprice { display: none; }

.ws-ui .ws-original-price, .ws-ui .ws-strike { color: var(--ws-mu); text-decoration: line-through; font-size: 13px; }
.ws-ui .ws-discounted-price { font: 600 15px var(--ws-h); color: var(--ws-k); }
.ws-ui .ws-box-price { font-weight: 600; }
.ws-ui .ws-total-price, .ws-ui .ws-tot { font: 700 15px var(--ws-h); color: var(--ws-k); }
.ws-ui .ws-col-weight .ws-total-weight { color: var(--ws-mu); }
.ws-ui .ws-units .ws-mline { display: none; }

/* thumbs */
.ws-ui .ws-thumb { margin: 0 auto; }
.ws-ui .ws-thumb img { max-width: 100%; max-height: 100%; height: auto; margin: 0; border-radius: 0; }
.ws-ui .ws-clickable-image { cursor: zoom-in; transition: box-shadow .15s; }
.ws-ui .ws-clickable-image:hover, .ws-ui .ws-clickable-image:focus-visible { box-shadow: 0 0 0 2px var(--ws-o); outline: none; }

/* grand totals */
.ws-ui .ws-tbl tfoot td { background: var(--ws-k); color: #fff; border: 0; padding: 10px 8px; font: 500 14px var(--ws-h); text-transform: uppercase; }
[dir="rtl"] .ws-ui .ws-tbl tfoot td, .rtl .ws-ui .ws-tbl tfoot td { text-transform: none; }
.ws-ui .ws-tbl tfoot .ws-totals-label { text-align: end; }
.ws-ui .ws-tbl tfoot .ws-grand-total-price { color: var(--ws-o); font-size: 18px; }

.ws-ui .ws-acts-r { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* important note (i) + tooltip */
.ws-ui .ws-important-note-icon {
    position: relative; flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--ws-o); color: #fff; font: 700 10px/16px Georgia, serif; text-align: center;
    cursor: help; text-transform: none; letter-spacing: 0;
}
.ws-ui .ws-important-note-icon::before {
    content: attr(data-note); position: absolute; bottom: calc(100% + 8px); inset-inline-start: 50%; transform: translateX(-50%);
    background: var(--ws-k); color: #fff; padding: 8px 10px; font: 400 12.5px/1.4 var(--ws-b); text-align: start;
    width: max-content; max-width: 240px; white-space: normal; z-index: 50;
    opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
[dir="rtl"] .ws-ui .ws-important-note-icon::before, .rtl .ws-ui .ws-important-note-icon::before { transform: translateX(50%); }
.ws-ui .ws-important-note-icon::after {
    content: ''; position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
    border: 6px solid transparent; border-top-color: var(--ws-k); opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.ws-ui .ws-important-note-icon:hover::before, .ws-ui .ws-important-note-icon:hover::after,
.ws-ui .ws-important-note-icon:focus::before, .ws-ui .ws-important-note-icon:focus::after,
.ws-ui .ws-important-note-icon.ws-open::before, .ws-ui .ws-important-note-icon.ws-open::after { opacity: 1; visibility: visible; }
/* the product cell clips long names – let the tooltip escape it */
.ws-ui .ws-tbl td.ws-col-name { overflow: visible; }

/* ---------- lightbox + autosave toast (outside .ws-ui) ---------- */
.ws-lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 99999; display: flex; align-items: center; justify-content: center; }
.ws-lightbox-content { position: relative; max-width: 90%; max-height: 90%; }
.ws-lightbox-image { max-width: 100%; max-height: 80vh; display: block; background: #fff; }
.ws-lightbox-close { position: absolute; top: -40px; inset-inline-end: 0; background: none; border: 0; color: #fff; font-size: 36px; line-height: 1; cursor: pointer; padding: 0; }
.ws-lightbox-caption { color: #fff; text-align: center; padding: 12px 0; font: 500 16px "Oswald", "Heebo", sans-serif; letter-spacing: .3px; }
.ws-auto-save-indicator {
    position: fixed; top: 16px; inset-inline-end: 16px; z-index: 99998; padding: 7px 12px;
    background: #1E8E4E; color: #fff; font: 500 12.5px "Roboto Condensed", "Heebo", sans-serif;
    opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.ws-auto-save-indicator.ws-err { background: #C62828; }
.ws-auto-save-indicator.show { opacity: 1; transform: none; }
body.admin-bar .ws-auto-save-indicator { top: 48px; }

/* ---------- status cards ---------- */
.ws-ui .ws-state { background: #fff; border: 1px solid var(--ws-ln); padding: 26px 22px; text-align: center; }
.ws-ui .ws-state-ic { width: 52px; height: 52px; margin: 0 auto 12px; display: grid; place-items: center; font: 700 22px var(--ws-h); background: #EEE; color: #333; }
.ws-ui .ws-state-ic svg { width: 24px; height: 24px; }
.ws-ui .ws-state-ic.ws-state-o { background: var(--ws-os); color: var(--ws-o); }
.ws-ui .ws-state-ic.ws-state-wa { background: var(--ws-was); color: var(--ws-wa); }
.ws-ui .ws-state-ic.ws-state-er { background: var(--ws-ers); color: var(--ws-er); }
.ws-ui .ws-state-ic.ws-state-ok { background: var(--ws-oks); color: var(--ws-ok); }
.ws-ui .ws-state h3 { margin: 0 0 6px; font: 600 19px var(--ws-h); text-transform: uppercase; color: var(--ws-k); letter-spacing: .2px; }
[dir="rtl"] .ws-ui .ws-state h3, .rtl .ws-ui .ws-state h3 { text-transform: none; }
.ws-ui .ws-state p { margin: 0 0 16px; color: var(--ws-mu); }
.ws-ui .ws-state-acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* =====================================================================
   Cart
   ===================================================================== */
.ws-ui .ws-two { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.ws-ui .ws-cart-list { min-width: 0; }
.ws-ui .ws-ci { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--ws-ln); }
.ws-ui .ws-ci:last-child { border-bottom: 0; }
.ws-ui .ws-ci.ws-busy { opacity: .55; pointer-events: none; }
.ws-ui .ws-ci-main { min-width: 0; }
.ws-ui .ws-ci-top { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.ws-ui .ws-ci-top .ws-pt { flex: 1; min-width: 0; }
.ws-ui .ws-ci-top .ws-pt .ws-nm { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ws-ui .ws-ci-top .ws-pt a { color: inherit; text-decoration: none; }
.ws-ui .ws-ci-meta { font-size: 12.5px; color: var(--ws-mu); line-height: 1.35; overflow-wrap: anywhere; }
.ws-ui .ws-ci-meta b { color: var(--ws-k); font: 600 13.5px var(--ws-h); }
.ws-ui .ws-ci-q { display: flex; align-items: center; gap: 12px; }
.ws-ui .ws-ci-q .ws-tot { min-width: 84px; text-align: end; }
.ws-ui .ws-ci .ws-x { border: 0; background: none; color: #AAA; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; flex: 0 0 auto; }
.ws-ui .ws-ci .ws-x:hover { color: var(--ws-er); }

.ws-ui .ws-sumcard .ws-card-b { padding: 12px 16px 16px; }
.ws-ui .ws-sr { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.ws-ui .ws-sr.ws-sr-t { border-top: 2px solid var(--ws-k); margin-top: 6px; padding-top: 10px; font: 600 18px var(--ws-h); }
.ws-ui .ws-sr.ws-sr-t .ws-price { color: var(--ws-o); }
.ws-ui .ws-save { background: var(--ws-oks); color: var(--ws-ok); padding: 8px 10px; font: 600 13px var(--ws-h); text-transform: uppercase; letter-spacing: .4px; display: flex; justify-content: space-between; margin-top: 10px; }
[dir="rtl"] .ws-ui .ws-save, .rtl .ws-ui .ws-save { text-transform: none; }
.ws-ui .ws-sumcard .ws-btn-block { margin-top: 12px; }
.ws-ui .ws-cart .ws-note ul { margin: 4px 0 0; padding-inline-start: 18px; }

@media (max-width: 900px) {
    .ws-ui .ws-two { grid-template-columns: 1fr; }
}

/* =====================================================================
   Mobile ≤ 700px
   ===================================================================== */
@media (max-width: 700px) {
    .ws-ui .ws-ch-head { margin-bottom: 8px; flex-wrap: nowrap; }
    .ws-ui .ws-chips { justify-content: flex-end; }
    .ws-ui .ws-chips .ws-chip { font-size: 10.5px; padding: 2px 6px; }

    .ws-ui .ws-ofu { padding: 8px 10px; gap: 8px; }
    .ws-ui .ws-ofu-ic { display: none; }
    .ws-ui .ws-ofu-txt strong { font-size: 13.5px; }

    /* sticky search row, tabs stick right under it */
    .ws-ui.ws-chart { --ws-sticky-top: 0px; }
    .ws-ui .ws-filters { position: sticky; top: var(--ws-sticky-top); z-index: 6; padding: 6px 8px; gap: 6px; height: 48px; }
    .ws-ui .ws-cat-tabs { position: sticky; top: calc(var(--ws-sticky-top) + 48px); z-index: 5; }
    .ws-ui .ws-cat-tabs button { padding: 9px 12px; font-size: 12px; }

    /* one dense row per product */
    .ws-ui .ws-tbl-w { border: 0; background: transparent; overflow: visible; }
    .ws-ui .ws-tbl thead, .ws-ui .ws-tbl tfoot, .ws-ui .ws-tbl .ws-dsk { display: none; }
    .ws-ui .ws-tbl, .ws-ui .ws-tbl tbody { display: block; }
    .ws-ui .ws-tbl tr.ws-product-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; background: #fff; padding: 7px 10px; border: 1px solid var(--ws-ln); border-top: 0; }
    .ws-ui .ws-tbl tr.ws-product-row[style*="none"] { display: none; }
    .ws-ui .ws-tbl tbody tr.ws-product-row:first-child { border-top: 1px solid var(--ws-ln); }
    .ws-ui .ws-tbl tr.ws-product-row td { display: block; padding: 0; border: 0; background: transparent !important; box-shadow: none !important; text-align: start; width: auto; }
    .ws-ui .ws-tbl tr.ws-product-row td.ws-q { text-align: end; }
    .ws-ui .ws-tbl tr.ws-product-row td.ws-dsk { display: none; }
    .ws-ui .ws-tbl tr.ws-product-row.ws-sel { background: var(--ws-os); box-shadow: inset 3px 0 0 var(--ws-o); }
    [dir="rtl"] .ws-ui .ws-tbl tr.ws-product-row.ws-sel, .rtl .ws-ui .ws-tbl tr.ws-product-row.ws-sel { box-shadow: inset -3px 0 0 var(--ws-o); }
    .ws-ui .ws-tbl .ws-no-results { display: block; background: #fff; border: 1px solid var(--ws-ln); text-align: center; }
    .ws-ui .ws-tbl .ws-no-results[hidden] { display: none; }
    .ws-ui .ws-tbl .ws-no-results td { display: block; }

    .ws-ui .ws-pt { font-size: 13.5px; }
    .ws-ui .ws-tbl .ws-pt .ws-nm { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ws-ui .ws-tbl .ws-pm { display: none; }
    .ws-ui .ws-mprice { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--ws-mu); }
    .ws-ui .ws-mprice .ws-price, .ws-ui .ws-mprice .ws-num { white-space: nowrap; }
    .ws-ui .ws-mprice b { color: var(--ws-k); font: 600 13.5px var(--ws-h); }
    .ws-ui .ws-tbl .ws-qwrap { align-items: flex-end; }
    .ws-ui .ws-units .ws-mline { display: inline; color: var(--ws-o); font: 600 12px var(--ws-h); }
    .ws-ui .ws-units .ws-mline[hidden] { display: none; }
    .ws-ui .ws-tbl .ws-qty button { width: 28px; height: 30px; }
    .ws-ui .ws-tbl .ws-qty input { width: 34px; height: 30px; font-size: 14px; }
    .ws-ui .ws-tbl tr.ws-product-row { column-gap: 8px; }

    .ws-ui .ws-acts-r { display: none; }
    .ws-ui .ws-important-note-icon::before { inset-inline-start: auto; inset-inline-end: -8px; transform: none; max-width: 200px; }
    [dir="rtl"] .ws-ui .ws-important-note-icon::before, .rtl .ws-ui .ws-important-note-icon::before { transform: none; }

    /* sticky bottom bar (frontend.css shows it; no bleed into the theme gutter here) */
    .ws-ui.ws-chart .ws-mbar, .ws-ui.ws-cart .ws-mbar { margin: 12px 0 0; }
    .ws-ui .ws-mbar .ws-mbar-sum strong { display: block; }

    /* cart rows: qty + units + line price on one row under the name */
    .ws-ui .ws-ci { grid-template-columns: 36px minmax(0, 1fr); row-gap: 6px; column-gap: 8px; padding: 8px 10px; }
    .ws-ui .ws-ci .ws-thumb { width: 36px; height: 36px; flex-basis: 36px; grid-row: span 2; align-self: start; }
    .ws-ui .ws-ci-q { grid-column: 2; justify-content: space-between; gap: 8px; }
    .ws-ui .ws-ci-q .ws-qwrap { flex-direction: row; align-items: center; gap: 8px; }
    .ws-ui .ws-ci-q .ws-tot { min-width: 0; font-size: 15px; }
    .ws-ui .ws-ci .ws-qty-sm button { width: 26px; height: 28px; }
    .ws-ui .ws-ci .ws-qty-sm input { width: 34px; height: 28px; font-size: 13px; }
    .ws-ui .ws-sumcard { display: none; }

    .ws-ui .ws-state { padding: 20px 16px; }
}

/* WordPress admin bar is fixed (46px) between 601px and 700px */
@media (min-width: 601px) and (max-width: 700px) {
    body.admin-bar .ws-ui.ws-chart { --ws-sticky-top: 46px; }
}
@media (min-width: 701px) and (max-width: 782px) {
    body.admin-bar .ws-auto-save-indicator { top: 62px; }
}
