/* ============================================================================
   cart-2026.css — the storefront basket (/cart)

   Prefix: .m-cart-

   Sibling of delivery-checkout-2026.css (.m-dco-*): same tokens, same card,
   pill, button and summary language, so the customer walks basket → address →
   payment without the surface changing under them.

   What the screen it replaces got wrong:

     * it was a <table>. On a phone the six columns collapsed into a sideways
       scroll, so the quantity stepper and the line total — the two controls
       anyone actually touches — sat off the edge of the screen. Here a line is
       a grid that re-flows: image + details + a footer row carrying the
       stepper and the line total, and only on ≥768px does it become columns.

     * the totals were recomputed in the browser with parseInt(), so a basket
       of 12.50 items was billed on screen as 12. Every figure here is float
       maths mirroring VatCalculator, and the price shown after a quantity
       change matches the one the server will charge.

   Tokens come from the storefront theme (--theme-*) with fallbacks, so
   Settings → Theme Colour recolours the page without an edit here.
   ========================================================================== */

.m-cart {
    --m-cart-brand:     var(--m-brand, var(--theme-brand, #B8541A));
    --m-cart-brand-rgb: var(--m-brand-rgb, var(--theme-brand-rgb, 184, 84, 26));
    --m-cart-ink:       var(--theme-text, #241A13);
    --m-cart-mute:      var(--theme-text-muted, #8C7A66);
    --m-cart-line:      rgba(var(--m-cart-brand-rgb), .16);
    --m-cart-surf:      #fff;
    --m-cart-surf2:     var(--theme-bg, #FBF6EE);
    --m-cart-ok:        #16A34A;
    --m-cart-warn:      #D97706;
    --m-cart-danger:    #C73E3E;
    --m-cart-r:         16px;
    --m-cart-r-sm:      12px;
    --m-cart-ease:      cubic-bezier(.22, .61, .36, 1);

    padding: 30px 0 40px;
    background: var(--m-cart-surf2);
    color: var(--m-cart-ink);
}
@media (min-width: 992px) { .m-cart { padding: 42px 0 70px; } }

/* The global sheet forces the Riyal glyph to 15×17 with !important, which
   reads oversized inside small labels. */
.m-cart img.Saudi_Riyal {
    width: 13px !important; height: 13px !important;
    vertical-align: -1px !important;
    margin-inline: 1px !important;
    flex-shrink: 0; object-fit: contain;
}

/* Latin runs (prices, counts) inside Arabic copy. */
.m-cart-num {
    direction: ltr; unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ══════════════════════════ Page header ══════════════════════════ */
.m-cart-head { margin-bottom: 18px; }

.m-cart-crumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
    margin: 0 0 10px;
    padding: 0; list-style: none;
    font-size: 12px; color: var(--m-cart-mute); font-weight: 600;
}
.m-cart-crumb a { color: inherit; text-decoration: none; transition: color .2s var(--m-cart-ease); }
.m-cart-crumb a:hover { color: var(--m-cart-brand); }
.m-cart-crumb i { font-size: 9px; opacity: .55; }
html[dir="rtl"] .m-cart-crumb .m-cart-crumb__sep { transform: scaleX(-1); }
.m-cart-crumb [aria-current] { color: var(--m-cart-ink); font-weight: 800; }

.m-cart-title {
    display: flex; align-items: center; flex-wrap: wrap; gap: 11px;
    margin: 0;
    font-size: clamp(1.25rem, 4.6vw, 1.75rem);
    font-weight: 800;
    line-height: 1.3;
    color: var(--m-cart-ink);
}
.m-cart-title > i {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(var(--m-cart-brand-rgb), .12);
    color: var(--m-cart-brand);
    font-size: 16px;
}

/* ══════════════════════════ Steps ══════════════════════════ */
.m-cart-steps {
    display: flex; align-items: center; gap: 8px;
    margin: 16px 0 20px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.m-cart-steps::-webkit-scrollbar { display: none; }
.m-cart-step {
    display: inline-flex; align-items: center; gap: 9px; flex: none;
    padding: 9px 15px;
    border-radius: 999px;
    background: var(--m-cart-surf);
    border: 1px solid var(--m-cart-line);
    font-size: 12.5px; font-weight: 700; color: var(--m-cart-mute);
    white-space: nowrap;
}
.m-cart-step__n {
    width: 22px; height: 22px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(var(--m-cart-brand-rgb), .12);
    color: var(--m-cart-brand);
    font-size: 11.5px; font-weight: 800;
}
.m-cart-step.is-on {
    background: var(--m-cart-brand); color: #fff; border-color: transparent;
    box-shadow: 0 8px 20px -10px rgba(var(--m-cart-brand-rgb), .8);
}
.m-cart-step.is-on .m-cart-step__n { background: rgba(255, 255, 255, .22); color: #fff; }
.m-cart-steps__sep { font-size: 10px; color: var(--m-cart-mute); opacity: .55; flex: none; }
html[dir="rtl"] .m-cart-steps__sep { transform: scaleX(-1); }

/* ══════════════════════════ Cards ══════════════════════════ */
.m-cart-card {
    background: var(--m-cart-surf);
    border: 1px solid var(--m-cart-line);
    border-radius: var(--m-cart-r);
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 18px 40px -32px rgba(36, 26, 19, .55);
}
.m-cart-card__head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--m-cart-line);
    background: linear-gradient(180deg, rgba(var(--m-cart-brand-rgb), .05), transparent);
}
.m-cart-card__head h5 {
    display: flex; align-items: center; gap: 9px;
    margin: 0;
    font-size: 15px; font-weight: 800; color: var(--m-cart-ink);
}
.m-cart-card__head h5 i { color: var(--m-cart-brand); font-size: 14px; }
.m-cart-push { margin-inline-start: auto; }
.m-cart-card__body { padding: 16px; }
.m-cart-card__body--flush { padding: 0; }

/* ══════════════════════════ Pills ══════════════════════════ */
.m-cart-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 700; line-height: 1.6;
    border: 1px solid transparent;
    white-space: nowrap;
}
.m-cart-pill i { font-size: 10px; }
.m-cart-pill--brand { background: rgba(var(--m-cart-brand-rgb), .12); color: var(--m-cart-brand); }
.m-cart-pill--mute  { background: rgba(var(--m-cart-brand-rgb), .06); color: var(--m-cart-mute); border-color: var(--m-cart-line); }
.m-cart-pill--ok    { background: rgba(22, 163, 74, .12);  color: var(--m-cart-ok); }
.m-cart-pill--warn  { background: rgba(217, 119, 6, .12);  color: var(--m-cart-warn); }
.m-cart-pill--danger{ background: rgba(199, 62, 62, .12);  color: var(--m-cart-danger); }

/* ══════════════════════════ Buttons ══════════════════════════ */
.m-cart-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    padding: 12px 20px;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: var(--m-cart-r-sm);
    font-size: 14px; font-weight: 800;
    text-decoration: none; cursor: pointer;
    transition: transform .18s var(--m-cart-ease), box-shadow .25s var(--m-cart-ease),
                background .22s var(--m-cart-ease), color .22s var(--m-cart-ease),
                border-color .22s var(--m-cart-ease);
}
.m-cart-btn:active { transform: translateY(1px); }
.m-cart-btn:focus-visible { outline: 2px solid var(--m-cart-brand); outline-offset: 2px; }
.m-cart-btn--primary {
    background: var(--m-cart-brand); color: #fff;
    box-shadow: 0 14px 28px -14px rgba(var(--m-cart-brand-rgb), .95);
}
.m-cart-btn--primary:hover { color: #fff; box-shadow: 0 18px 34px -14px rgba(var(--m-cart-brand-rgb), 1); }
.m-cart-btn--ghost {
    background: var(--m-cart-surf); color: var(--m-cart-ink);
    border-color: var(--m-cart-line);
}
.m-cart-btn--ghost:hover { border-color: var(--m-cart-brand); color: var(--m-cart-brand); }
.m-cart-btn--danger {
    background: rgba(199, 62, 62, .08); color: var(--m-cart-danger);
    border-color: rgba(199, 62, 62, .28);
}
.m-cart-btn--danger:hover { background: var(--m-cart-danger); color: #fff; border-color: transparent; }
.m-cart-btn--sm { padding: 7px 13px; min-height: 34px; font-size: 12px; border-radius: 9px; }
.m-cart-btn--block { width: 100%; }
.m-cart-btn__dir { font-size: 12px; }
html[dir="rtl"] .m-cart-btn__dir { transform: scaleX(-1); }
.m-cart-btn[disabled], .m-cart-btn.is-busy { opacity: .6; pointer-events: none; }

/* ══════════════════════════ Fulfilment strip ══════════════════════════ */
.m-cart-mode {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 13px 15px;
    margin-bottom: 18px;
    border-radius: var(--m-cart-r);
    background: var(--m-cart-surf);
    border: 1px solid var(--m-cart-line);
}
.m-cart-mode__ic {
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border-radius: 11px;
    background: rgba(var(--m-cart-brand-rgb), .12);
    color: var(--m-cart-brand);
    font-size: 15px;
}
.m-cart-mode__b { min-width: 0; flex: 1 1 150px; }
.m-cart-mode__t {
    display: block;
    font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--m-cart-mute);
}
.m-cart-mode__v {
    display: block;
    font-size: 14px; font-weight: 800; color: var(--m-cart-ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ══════════════════════════ The lines ══════════════════════════ */
.m-cart-list { list-style: none; margin: 0; padding: 0; }

/* Phone: the image and the details on top, the two controls anyone actually
   touches — the stepper and the line total — on a full-width row beneath.
   Four columns so row 2 can span them: the stepper needs ~116px, which the
   34px «remove» column of row 1 would have crushed. */
.m-cart-item {
    display: grid;
    gap: 11px 13px;
    grid-template-columns: 76px minmax(0, 1fr) auto 34px;
    grid-template-areas:
        "img body body del"
        "qty qty  tot  tot";
    padding: 14px 16px;
    border-bottom: 1px solid var(--m-cart-line);
    transition: background .22s var(--m-cart-ease), opacity .22s var(--m-cart-ease),
                transform .22s var(--m-cart-ease);
}
.m-cart-item:last-child { border-bottom: 0; }
.m-cart-item:hover { background: rgba(var(--m-cart-brand-rgb), .035); }
.m-cart-item.is-busy { opacity: .55; pointer-events: none; }
.m-cart-item.is-going { opacity: 0; transform: translateY(-6px); }

.m-cart-item__img {
    grid-area: img;
    width: 76px; height: 76px;
    border-radius: var(--m-cart-r-sm);
    overflow: hidden;
    background: rgba(var(--m-cart-brand-rgb), .07);
    display: grid; place-items: center;
    border: 1px solid var(--m-cart-line);
}
.m-cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.m-cart-item__img i { color: var(--m-cart-brand); opacity: .45; font-size: 22px; }

.m-cart-item__b { grid-area: body; min-width: 0; }
.m-cart-item__nm {
    display: block;
    font-size: 14.5px; font-weight: 800; line-height: 1.45;
    color: var(--m-cart-ink); text-decoration: none;
    transition: color .2s var(--m-cart-ease);
}
.m-cart-item__nm:hover { color: var(--m-cart-brand); }
.m-cart-item__meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    margin-top: 6px;
}
.m-cart-item__add {
    margin: 7px 0 0;
    padding: 0; list-style: none;
    display: flex; flex-direction: column; gap: 3px;
}
.m-cart-item__add li {
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--m-cart-mute); font-weight: 600;
}
.m-cart-item__add i { font-size: 8px; color: var(--m-cart-brand); opacity: .7; }
.m-cart-item__unit {
    display: block;
    margin-top: 7px;
    font-size: 12px; color: var(--m-cart-mute); font-weight: 700;
}

.m-cart-item__qtywrap { grid-area: qty; display: flex; align-items: center; }
.m-cart-item__img { align-self: start; }
.m-cart-item__tot {
    grid-area: tot;
    display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
    text-align: end;
}
.m-cart-item__tot small {
    display: block;
    font-size: 10px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--m-cart-mute);
}
.m-cart-item__tot strong {
    font-size: 16px; font-weight: 800; color: var(--m-cart-brand);
}
.m-cart-item__tot strong img.Saudi_Riyal { width: 14px !important; height: 14px !important; }

.m-cart-item__del {
    grid-area: del;
    width: 32px; height: 32px; flex: none;
    display: grid; place-items: center;
    align-self: start;
    border: 1px solid var(--m-cart-line);
    border-radius: 9px;
    background: var(--m-cart-surf);
    color: var(--m-cart-mute);
    font-size: 13px; cursor: pointer;
    transition: background .2s var(--m-cart-ease), color .2s var(--m-cart-ease),
                border-color .2s var(--m-cart-ease);
}
.m-cart-item__del:hover { background: var(--m-cart-danger); color: #fff; border-color: transparent; }
.m-cart-item__del:focus-visible { outline: 2px solid var(--m-cart-danger); outline-offset: 2px; }

@media (min-width: 768px) {
    .m-cart-item {
        grid-template-columns: 92px minmax(0, 1fr) 140px 118px 34px;
        grid-template-areas: "img body qty tot del";
        align-items: center;
        gap: 16px;
        padding: 16px 18px;
    }
    .m-cart-item__img { width: 92px; height: 92px; align-self: center; }
    .m-cart-item__del { align-self: center; }
}

/* ── Quantity stepper ── */
.m-cart-qty {
    display: inline-flex; align-items: center;
    border: 1px solid var(--m-cart-line);
    border-radius: 999px;
    background: var(--m-cart-surf);
    overflow: hidden;
}
.m-cart-qty button {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 0; background: transparent;
    color: var(--m-cart-brand);
    font-size: 12px; cursor: pointer;
    transition: background .2s var(--m-cart-ease), color .2s var(--m-cart-ease);
}
.m-cart-qty button:hover { background: rgba(var(--m-cart-brand-rgb), .12); }
.m-cart-qty button:focus-visible { outline: 2px solid var(--m-cart-brand); outline-offset: -2px; }
.m-cart-qty button[disabled] { color: var(--m-cart-mute); opacity: .45; cursor: not-allowed; }
.m-cart-qty button[disabled]:hover { background: transparent; }
.m-cart-qty input {
    width: 40px; height: 38px;
    border: 0; background: transparent;
    text-align: center;
    font-size: 14px; font-weight: 800; color: var(--m-cart-ink);
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    pointer-events: none;
}
.m-cart-qty input::-webkit-outer-spin-button,
.m-cart-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ══════════════════════════ Summary ══════════════════════════ */
.m-cart-sum {
    background: var(--m-cart-surf);
    border: 1px solid var(--m-cart-line);
    border-radius: var(--m-cart-r);
    overflow: hidden;
    position: sticky; inset-block-start: 96px;
    box-shadow: 0 18px 40px -32px rgba(36, 26, 19, .55);
}
.m-cart-sum__head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--m-cart-line);
    background: linear-gradient(180deg, rgba(var(--m-cart-brand-rgb), .07), transparent);
}
.m-cart-sum__head h5 {
    display: flex; align-items: center; gap: 9px;
    margin: 0; font-size: 15px; font-weight: 800; color: var(--m-cart-ink);
}
.m-cart-sum__head h5 i { color: var(--m-cart-brand); font-size: 14px; }
.m-cart-sum__body { padding: 16px 18px 18px; }

.m-cart-sum__row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 0;
    font-size: 13.5px; color: var(--m-cart-mute); font-weight: 600;
}
.m-cart-sum__row > span:last-child { color: var(--m-cart-ink); font-weight: 800; }
.m-cart-sum__row i { font-size: 12px; margin-inline-end: 5px; color: var(--m-cart-mute); }
.m-cart-sum__row--free > span:last-child { color: var(--m-cart-ok); }
.m-cart-sum__row--off  > span:last-child { color: var(--m-cart-ok); }

.m-cart-sum__grand {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 12px; padding-top: 14px;
    border-top: 1px dashed var(--m-cart-line);
    font-size: 15px; font-weight: 800; color: var(--m-cart-ink);
}
.m-cart-sum__val { font-size: 21px; color: var(--m-cart-brand); }
.m-cart-sum__val img.Saudi_Riyal { width: 17px !important; height: 17px !important; vertical-align: -2px !important; }

.m-cart-sum__hint {
    margin: 12px 0 0;
    font-size: 11.5px; line-height: 1.7; color: var(--m-cart-mute); text-align: center;
}
.m-cart-sum__hint i { color: var(--m-cart-brand); }

/* ── Coupon ── */
.m-cart-coupon { display: flex; gap: 8px; margin: 14px 0 0; }
.m-cart-coupon input {
    flex: 1; min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 1px dashed var(--m-cart-line);
    border-radius: var(--m-cart-r-sm);
    background: rgba(var(--m-cart-brand-rgb), .04);
    font-size: 13.5px; font-weight: 700; color: var(--m-cart-ink);
    transition: border-color .2s var(--m-cart-ease), background .2s var(--m-cart-ease);
}
.m-cart-coupon input::placeholder { color: var(--m-cart-mute); font-weight: 600; }
.m-cart-coupon input:focus {
    outline: none;
    border-style: solid; border-color: var(--m-cart-brand);
    background: var(--m-cart-surf);
}
.m-cart-coupon .m-cart-btn { flex: none; padding-inline: 18px; }

.m-cart-applied {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0 0; padding: 11px 13px;
    border-radius: var(--m-cart-r-sm);
    background: rgba(22, 163, 74, .09);
    border: 1px solid rgba(22, 163, 74, .24);
    font-size: 12.5px; font-weight: 700; color: var(--m-cart-ok);
}
.m-cart-applied i { font-size: 13px; }
.m-cart-applied a {
    margin-inline-start: auto;
    color: var(--m-cart-danger); text-decoration: none;
    font-size: 11.5px; font-weight: 800;
}
.m-cart-applied a:hover { text-decoration: underline; }

.m-cart-sum__cta { margin-top: 16px; }

/* ══════════════════════════ Notes ══════════════════════════ */
.m-cart-note {
    display: flex; gap: 11px;
    padding: 12px 14px;
    border-radius: var(--m-cart-r-sm);
    font-size: 12.5px; line-height: 1.75; font-weight: 600;
    margin-bottom: 14px;
}
.m-cart-note i { font-size: 14px; margin-top: 2px; flex: none; }
.m-cart-note--info   { background: rgba(var(--m-cart-brand-rgb), .07); color: var(--m-cart-ink); }
.m-cart-note--info i { color: var(--m-cart-brand); }
.m-cart-note--warn   { background: rgba(217, 119, 6, .10); color: #7C4A06; }
.m-cart-note--warn i { color: var(--m-cart-warn); }

/* ══════════════════════════ Empty state ══════════════════════════ */
.m-cart-empty {
    text-align: center;
    padding: 44px 22px 48px;
    background: var(--m-cart-surf);
    border: 1px solid var(--m-cart-line);
    border-radius: var(--m-cart-r);
    box-shadow: 0 18px 40px -32px rgba(36, 26, 19, .55);
}
.m-cart-empty__art {
    width: 104px; height: 104px; margin: 0 auto 18px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, rgba(var(--m-cart-brand-rgb), .18), rgba(var(--m-cart-brand-rgb), .05));
    color: var(--m-cart-brand);
    font-size: 40px;
}
.m-cart-empty h3 { margin: 0; font-size: 19px; font-weight: 800; color: var(--m-cart-ink); }
.m-cart-empty p {
    margin: 9px auto 22px; max-width: 46ch;
    font-size: 13.5px; line-height: 1.8; color: var(--m-cart-mute);
}
.m-cart-empty__acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ══════════════════════════ Mobile action bar ══════════════════════════
   It parks flush on top of the bottom tab dock, whose exact height the layout
   publishes as `--m-tabbar-h` (modern-2026-mobile-pages.css). */
.m-cart-bar {
    position: fixed; inset-inline: 0;
    inset-block-end: var(--m-tabbar-h, 0px);
    border-radius: 20px 20px 0 0;
    z-index: 59;
    display: none;
    align-items: center; gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .93);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--m-cart-line);
    box-shadow: 0 -10px 26px -16px rgba(0, 0, 0, .5);
}
.m-cart-bar__t { min-width: 0; }
.m-cart-bar__t small { display: block; font-size: 10.5px; color: var(--m-cart-mute); font-weight: 700; }
.m-cart-bar__t strong {
    display: block; font-size: 17px; font-weight: 800;
    color: var(--m-cart-brand); white-space: nowrap;
}
.m-cart-bar__t strong img { width: 15px !important; height: 15px !important; vertical-align: -1.5px !important; object-fit: contain; }
.m-cart-bar .m-cart-btn { margin-inline-start: auto; flex: 1; max-width: 58%; }

@media (max-width: 991.98px) {
    .m-cart-bar { display: flex; }
    .m-cart { padding-bottom: 78px; }
    .m-cart-sum { position: static; }
    .m-cart-sum__cta { display: none; }
}

/* ══════════════════════════ Dark mode ══════════════════════════ */
body.nx-dark .m-cart {
    --m-cart-surf:  #241B13;
    --m-cart-surf2: #1A1410;
    --m-cart-ink:   #F0E6D8;
    --m-cart-mute:  #B0A08C;
    --m-cart-line:  rgba(255, 255, 255, .10);
}
body.nx-dark .m-cart-empty,
body.nx-dark .m-cart-card,
body.nx-dark .m-cart-sum,
body.nx-dark .m-cart-mode { background: var(--m-cart-surf); }
body.nx-dark .m-cart-bar { background: rgba(26, 20, 16, .95); }

/* ══════════════════════════ Motion preference ══════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .m-cart-item, .m-cart-btn, .m-cart-qty button,
    .m-cart-item__del, .m-cart-coupon input { transition: none; }
}
