/* ============================================================================
   QR / mini cart  —  .m-qcart
   ----------------------------------------------------------------------------
   The cart drawer a guest sees after scanning a table sticker. Built on the
   modern-2026 tokens so it inherits the site's palette, radius and shadows.

   Two things drive every decision here:

   • It is read on a phone, one-handed, at a dinner table. Controls sit within
     thumb reach at the BOTTOM, targets are >= 44px, and the summary and pay
     button are pinned so the total never scrolls out of sight.
   • The guest must be able to check their order at a glance before paying, so
     each line shows the item, its add-ons, the unit price, the quantity and
     the line total — no arithmetic left to the reader.

   All spacing uses logical properties (inline-start/end) so RTL is automatic.
   ========================================================================== */

.m-qcart {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    font-family: var(--m-font-body);
    color: var(--m-text);
}

/* ---------- Header ---------- */
.m-qcart__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--m-line);
    flex: none;
}
.m-qcart__head-txt { min-width: 0; }
.m-qcart__head h5 {
    margin: 0 !important;
    font-size: 1rem;
    font-weight: 700;
    color: var(--m-text) !important;
    font-family: var(--m-font-body) !important;
    text-transform: none;
    letter-spacing: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.m-qcart__head h5 i { color: var(--m-brand); font-size: .95em; }

.m-qcart__table {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 10px;
    border-radius: var(--m-r-pill);
    background: var(--m-brand-soft);
    color: var(--m-brand);
    font-size: .78rem;
    font-weight: 700;
}

/* The close control is a real button-sized target, not a 12px glyph. */
.m-qcart .close_cart {
    flex: none;
    width: 38px; height: 38px;
    background: var(--m-surface-2);
    border: 1px solid var(--m-line);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--m-text-soft);
    cursor: pointer;
    transition: all var(--m-fast) var(--m-ease);
}
.m-qcart .close_cart:hover,
.m-qcart .close_cart:focus-visible {
    background: var(--m-brand); color: #fff; border-color: var(--m-brand);
    outline: none;
}

/* ---------- Item list ---------- */
.m-qcart__list {
    list-style: none;
    margin: 0;
    padding: 0;
    /* The only scrolling region — header and footer stay put. */
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.m-qcart__list::-webkit-scrollbar { width: 5px; }
.m-qcart__list::-webkit-scrollbar-thumb { background: var(--m-line-2); border-radius: 999px; }

.m-qcart__item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--m-line);
    position: relative;
    animation: m-qcart-in .28s var(--m-ease-out) both;
}
.m-qcart__item:last-child { border-bottom: 0; }
.m-qcart__item.is-busy { opacity: .5; pointer-events: none; }
.m-qcart__item.is-going {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease;
}
@keyframes m-qcart-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.m-qcart__thumb {
    flex: none;
    width: 74px; height: 74px;
    border-radius: var(--m-r-sm);
    overflow: hidden;
    background: var(--m-surface-2);
    border: 1px solid var(--m-line);
}
.m-qcart__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.m-qcart__body { flex: 1 1 auto; min-width: 0; }

.m-qcart__row1 {
    display: flex; align-items: flex-start; gap: 8px;
    justify-content: space-between;
}
.m-qcart__name {
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--m-text) !important;
    text-decoration: none;
    /* Two lines then ellipsis: long dish names must not push the price row
       out of view on a narrow phone. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.m-qcart__name:hover { color: var(--m-brand) !important; }

.m-qcart__del {
    flex: none;
    width: 30px; height: 30px;
    border: 1px solid var(--m-line);
    background: var(--m-surface);
    border-radius: 50%;
    color: var(--m-text-mute);
    font-size: .8rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all var(--m-fast) var(--m-ease);
}
.m-qcart__del:hover,
.m-qcart__del:focus-visible {
    background: var(--m-danger-soft); color: var(--m-danger);
    border-color: var(--m-danger); outline: none;
}

.m-qcart__size {
    display: inline-block;
    margin-top: 3px;
    font-size: .74rem;
    color: var(--m-text-mute);
}

.m-qcart__extras { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.m-qcart__chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: var(--m-r-pill);
    background: var(--m-surface-2);
    border: 1px solid var(--m-line);
    font-size: .7rem;
    color: var(--m-text-soft);
    line-height: 1.7;
}
.m-qcart__chip i { font-size: .55rem; color: var(--m-brand); }
.m-qcart__chip b { font-weight: 700; color: var(--m-text); }

.m-qcart__row2 {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-top: 9px; flex-wrap: wrap;
}

/* ---------- Quantity stepper ---------- */
.m-qcart__qty {
    display: inline-flex; align-items: center;
    background: var(--m-surface-2);
    border: 1px solid var(--m-line);
    border-radius: var(--m-r-pill);
    padding: 2px;
}
.m-qcart__qty-btn {
    width: 30px; height: 30px;
    border: 0; background: transparent;
    border-radius: 50%;
    color: var(--m-text-soft);
    font-size: .7rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all var(--m-fast) var(--m-ease);
}
.m-qcart__qty-btn:hover:not(:disabled),
.m-qcart__qty-btn:focus-visible:not(:disabled) {
    background: var(--m-brand); color: #fff; outline: none;
}
.m-qcart__qty-btn:disabled { opacity: .35; cursor: not-allowed; }
.m-qcart__qty-val {
    min-width: 30px; text-align: center;
    font-weight: 800; font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.m-qcart__prices { text-align: end; margin-inline-start: auto; }
.m-qcart__unit {
    display: block;
    font-size: .7rem;
    color: var(--m-text-mute);
    font-variant-numeric: tabular-nums;
}
.m-qcart__line {
    display: block;
    font-size: .95rem;
    font-weight: 800;
    color: var(--m-brand) !important;
    margin: 2px 0 0 !important;
    font-variant-numeric: tabular-nums;
}

/* ---------- Footer: summary + actions ---------- */
.m-qcart__foot {
    flex: none;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--m-line);
    background: var(--m-surface);
    /* Clears the iOS home indicator so the pay button is never half-covered. */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.m-qcart__sums { margin-bottom: 12px; }
.m-qcart__sum {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    font-size: .82rem;
    color: var(--m-text-soft);
    padding: 3px 0;
    font-variant-numeric: tabular-nums;
}
.m-qcart__sum--grand {
    margin-top: 8px; padding-top: 10px;
    border-top: 1px dashed var(--m-line-2);
    font-size: 1rem;
    color: var(--m-text);
    font-weight: 700;
}
.m-qcart__sum--grand strong { font-size: 1.15rem; font-weight: 900; color: var(--m-brand); }

/* Primary action. Three-part layout — icon / label / amount — so the guest
   confirms what they are about to pay in the same glance as the tap. */
.m-qcart__cta {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: var(--m-r);
    font-size: .95rem;
    font-weight: 800;
    text-decoration: none !important;
    transition: all var(--m-fast) var(--m-ease);
    margin-bottom: 8px;
}
.m-qcart__cta span { flex: 1 1 auto; text-align: start; }
.m-qcart__cta b {
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.m-qcart__cta--pay {
    background: linear-gradient(135deg, var(--m-brand), var(--m-brand-2));
    color: #fff !important;
    box-shadow: var(--m-shadow-brand);
}
.m-qcart__cta--pay:hover,
.m-qcart__cta--pay:focus-visible {
    filter: brightness(1.06);
    transform: translateY(-1px);
    color: #fff !important;
    outline: none;
}
.m-qcart__cta--pay:active { transform: translateY(0); }
.m-qcart__cta--ghost {
    background: var(--m-surface-2);
    border: 1px solid var(--m-line);
    color: var(--m-text) !important;
    justify-content: center;
    min-height: 46px;
    font-size: .86rem;
    box-shadow: none;
}
.m-qcart__cta--ghost:hover,
.m-qcart__cta--ghost:focus-visible {
    border-color: var(--m-brand); color: var(--m-brand) !important; outline: none;
}
/* The arrow points the way the language reads. */
html[dir="rtl"] .m-qcart__cta-dir { transform: scaleX(1); }
html[dir="ltr"] .m-qcart__cta-dir { transform: scaleX(-1); }

.m-qcart__more {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--m-text-soft) !important;
    text-decoration: none !important;
    border-radius: var(--m-r-sm);
    transition: all var(--m-fast) var(--m-ease);
}
.m-qcart__more:hover { color: var(--m-brand) !important; background: var(--m-brand-soft); }

/* ---------- Empty state ---------- */
.m-qcart__empty { text-align: center; padding: 48px 20px; margin: auto 0; }
.m-qcart__empty-icon {
    width: 92px; height: 92px; margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--m-brand-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 38px; color: var(--m-brand);
}
.m-qcart__empty h6 { font-size: 1.05rem; font-weight: 800; margin: 0 0 6px; color: var(--m-text); }
.m-qcart__empty p { font-size: .85rem; color: var(--m-text-mute); margin: 0 0 20px; }
.m-qcart__empty-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px;
    border-radius: var(--m-r-pill);
    background: linear-gradient(135deg, var(--m-brand), var(--m-brand-2));
    color: #fff !important;
    font-weight: 800; font-size: .88rem;
    text-decoration: none !important;
    box-shadow: var(--m-shadow-brand);
    transition: all var(--m-fast) var(--m-ease);
}
.m-qcart__empty-btn:hover { transform: translateY(-2px); filter: brightness(1.06); color: #fff !important; }

/* The drawer must be a flex column for the sticky footer to work at all. */
.wsus__menu_cart_boody {
    display: flex;
    flex-direction: column;
}

/* ============================================================
   PHONE — the drawer becomes a bottom sheet.
   A side panel on a 390px screen wastes the edge the thumb can
   actually reach; a sheet puts the pay button right above it.
   ============================================================ */
@media (max-width: 767px) {
    .wsus__menu_cart_area .wsus__menu_cart_boody {
        inset-inline: 0 !important;
        inset-block: auto 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: 88dvh;
        border-radius: var(--m-r-xl) var(--m-r-xl) 0 0 !important;
        border: 1px solid var(--m-line) !important;
        border-bottom: 0 !important;
        padding: 10px 16px 16px !important;
        transform-origin: bottom !important;
        box-shadow: 0 -20px 50px -12px rgba(0, 0, 0, .3) !important;
    }

    /* Grab handle — the universal "drag me down" affordance. */
    .m-qcart::before {
        content: "";
        width: 42px; height: 4px;
        border-radius: 999px;
        background: var(--m-line-2);
        margin: 2px auto 12px;
        flex: none;
    }

    .m-qcart__list { max-height: 46dvh; }
    .m-qcart__thumb { width: 64px; height: 64px; }
    .m-qcart__name { font-size: .88rem; }

    /* Bigger tap targets where fingers actually land. */
    .m-qcart__qty-btn { width: 34px; height: 34px; }
    .m-qcart__del { width: 34px; height: 34px; }
    .m-qcart__cta { min-height: 56px; font-size: 1rem; }
}

@media (max-width: 360px) {
    .m-qcart__row2 { gap: 6px; }
    .m-qcart__unit { display: none; }   /* line total is what matters when space is tight */
}

/* Users who asked for less motion get none of the entrance animation. */
@media (prefers-reduced-motion: reduce) {
    .m-qcart__item { animation: none; }
    .m-qcart__cta, .m-qcart__empty-btn { transition: none; }
    .m-qcart__cta--pay:hover { transform: none; }
}
