/* ==========================================================================
   Sam's — order cart (browse-and-show-to-cashier)
   Mirrors css/chat-widget.css's structure and tokens; sits on the opposite
   (start) side of the screen from the chat widget so the two never collide.
   ========================================================================== */

.sams-cart {
  position: fixed;
  z-index: 998;
  inset-block-end: 20px;
  inset-inline-start: 20px;
  font-family: var(--font-body);
}

.sams-cart__toggle {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-pill);
  background: var(--orange);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.sams-cart__toggle:hover { transform: scale(1.05); }
.sams-cart__toggle svg { width: 26px; height: 26px; }
.sams-cart__badge {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--charcoal);
  color: #fff;
  border: 2px solid #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.sams-cart.has-items .sams-cart__badge { display: flex; }

.sams-cart__panel {
  position: absolute;
  inset-block-end: 76px;
  inset-inline-start: 0;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.sams-cart.is-open .sams-cart__panel { display: flex; }

@media (max-width: 480px) {
  .sams-cart__panel {
    position: fixed;
    inset: 12px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    z-index: 1;
  }
  .sams-cart.is-open .sams-cart__toggle {
    position: fixed;
    inset-block-start: 24px;
    inset-inline-start: 24px;
    inset-block-end: auto;
    width: 44px;
    height: 44px;
    z-index: 2;
    box-shadow: none;
  }
}

.sams-cart__header {
  background: var(--charcoal);
  color: #fff;
  padding: 16px 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sams-cart__header h2 { margin: 0; font-size: 1.05rem; color: #fff; }
.sams-cart__close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-shrink: 0;
}
.sams-cart__close svg { width: 20px; height: 20px; }

.sams-cart__body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sams-cart__empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sams-cart__line {
  display: flex;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.sams-cart__line-photo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--cream);
}
.sams-cart__line-photo--placeholder { background: var(--cream); }
.sams-cart__line-info { flex: 1; min-width: 0; }
.sams-cart__line-name { font-weight: 700; font-size: 0.88rem; }
.sams-cart__line-meta, .sams-cart__line-note { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.sams-cart__line-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
.sams-cart__qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--cream);
  color: var(--charcoal);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sams-cart__line-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
}
.sams-cart__line-price { font-weight: 800; color: var(--orange-dark); font-size: 0.88rem; }
.sams-cart__line-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
}
.sams-cart__line-remove:hover { color: var(--error); }

.sams-cart__footer {
  flex-shrink: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sams-cart__total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1rem;
}
.sams-cart__total--big { font-size: 1.3rem; padding-bottom: 4px; }
.sams-cart__cta {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.sams-cart__cta:hover { background: var(--orange-dark); }
.sams-cart__clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px;
}
.sams-cart__back {
  background: none;
  border: none;
  color: var(--charcoal);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 0 0;
  text-align: start;
}

/* -- summary ("show to cashier") view: bigger, calmer, no editing controls -- */
.sams-cart.is-summary .sams-cart__panel { background: var(--cream); }
.sams-cart__summary-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.sams-cart__summary-list { display: flex; flex-direction: column; gap: 12px; }
.sams-cart__summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
}
.sams-cart__summary-photo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}
.sams-cart__summary-info { flex: 1; min-width: 0; }
.sams-cart__summary-name { font-weight: 800; font-size: 1rem; }
.sams-cart__summary-en { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }
.sams-cart__summary-price { font-weight: 800; color: var(--orange-dark); font-size: 1rem; flex-shrink: 0; }

/* Add-to-cart controls embedded in the existing menu cards/modal (main.js) */
.food-card__add {
  margin-top: 8px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  align-self: flex-start;
}
.food-card__add:hover { background: var(--orange-dark); }
.food-card__size-row--addable {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
}
.food-card__size-add {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--orange);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-inline-start: 8px;
}
.food-card__size-add:hover { background: var(--orange-dark); }

.item-modal__cart-controls {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-modal__size-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.item-modal__size-btn {
  border: 1.5px solid var(--border-soft);
  background: var(--white);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--charcoal);
}
.item-modal__size-btn.is-selected {
  border-color: var(--orange);
  background: var(--cream);
  color: var(--orange-dark);
}
.item-modal__combo-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.item-modal__qty {
  display: flex;
  align-items: center;
  gap: 12px;
}
.item-modal__qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: var(--cream);
  font-size: 1.1rem;
  cursor: pointer;
}
.item-modal__add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.item-modal__add-btn {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  flex: 1;
}
.item-modal__add-btn:hover { background: var(--orange-dark); }
.item-modal__size-hint {
  font-size: 0.78rem;
  color: var(--error);
  display: none;
}
.item-modal__size-hint.is-visible { display: block; }

/* Latin-script/numeric content must stay LTR even inside an Arabic (RTL) page. */
[dir="rtl"] .sams-cart [dir="ltr"] { unicode-bidi: isolate; }
