/* ==========================================================
   صهوات — online ordering styles: add-to-cart controls, the cart
   bar and the checkout sheet. Colours follow the product dialog.
   ========================================================== */

:root {
  --o-surface: #fcf9f4;
  --o-raised: #ffffff;
  --o-ink: #463022;
  --o-muted: #796b5e;
  --o-line: #e6dbce;
  --o-accent: #795132;
  --o-accent-ink: #fff6e8;
  --o-gold: #c6963e;
  --o-danger: #a82c20;
  --o-danger-bg: #fdf0ed;
  --o-ok: #4f7a3a;
  --o-bar: #2a1d14;
  --o-bar-ink: #f3e3c6;
  --o-bar-chip: rgba(243, 227, 198, 0.13);
  --o-ease: cubic-bezier(.22, 1, .36, 1);
}
html[data-theme="dark"] {
  --o-surface: #261e18;
  --o-raised: #30251d;
  --o-ink: #f2e7db;
  --o-muted: #c7b6a5;
  --o-line: #594635;
  --o-accent: #d8b58a;
  --o-accent-ink: #25190f;
  --o-danger: #f4b8a9;
  --o-danger-bg: #482b25;
  --o-ok: #a9cf8f;
  --o-bar: #f3e3c6;
  --o-bar-ink: #25190f;
  --o-bar-chip: rgba(37, 25, 15, 0.1);
}

/* The card only shows its focus ring for keyboard focus on the card itself,
   not when a finger taps the quantity buttons inside it. */
.product-card:focus-within { outline: none; }
.product-card:has(.product-open:focus-visible) { outline: 3px solid var(--menu-heading); outline-offset: 4px; }

.o-price { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-en-body); font-weight: 600; white-space: nowrap; }
.o-price .riyal-symbol { width: .92em; height: 1.02em; }

/* ---------------- Add-to-cart control ---------------- */

.oc { direction: ltr; }
.oc--card { position: absolute; z-index: 2; bottom: 8px; inset-inline-end: 8px; }

.oc-add {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--o-accent);
  color: var(--o-accent-ink);
  box-shadow: 0 0 0 3px var(--o-surface), 0 8px 16px -8px rgba(33, 22, 14, .7);
  cursor: pointer;
  transition: transform .15s ease;
}
.oc-add:active { transform: scale(.9); }

.oc-stepper {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 2px;
  border: 1.5px solid var(--o-accent);
  border-radius: 999px;
  background: var(--o-surface);
  box-shadow: 0 8px 16px -8px rgba(33, 22, 14, .55);
  animation: oc-grow .26s var(--o-ease);
}
@keyframes oc-grow { from { transform: scale(.82); opacity: .4; } to { transform: none; opacity: 1; } }
.oc-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--o-accent);
  cursor: pointer;
}
.oc-btn:disabled { opacity: .3; cursor: default; }
.oc-btn:active:not(:disabled) { background: color-mix(in srgb, var(--o-accent) 14%, transparent); }
.oc-qty { min-width: 22px; text-align: center; color: var(--o-ink); font: 600 15px/1 var(--font-en-body); }
.oc-add:focus-visible, .oc-btn:focus-visible, .oc-add-wide:focus-visible, .oc-view:focus-visible {
  outline: 2px solid var(--o-accent);
  outline-offset: 3px;
}

/* Sold out */
.sold-out-badge {
  position: absolute;
  z-index: 1;
  bottom: 8px;
  inset-inline-start: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(36, 24, 17, .82);
  color: #f3e3c6;
  font: 600 11.5px/1.6 "Cairo Menu", sans-serif;
}
.product-card.is-unavailable .product-img img { filter: grayscale(.75); opacity: .55; }
.product-card.is-unavailable .product-name,
.product-card.is-unavailable .product-price { opacity: .6; }

/* Inside the product dialog */
.oc--dialog { display: flex; align-items: center; gap: 10px; margin-top: 26px; }
.oc--dialog[hidden] { display: none; }
.oc-add-wide, .oc-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--o-accent);
  color: var(--o-accent-ink);
  font: 600 15px/1.5 "Cairo Menu", sans-serif;
  direction: rtl;
  cursor: pointer;
  transition: background .18s ease;
}
html[lang="en"] .oc-add-wide, html[lang="en"] .oc-view { direction: ltr; font-family: var(--font-en-body); }
html[lang="ar"] .oc-add-wide, html[lang="ar"] .oc-view { font-family: var(--font-ar-display); font-size: 19px; font-weight: 400; }
.oc-add-wide .o-price { font-size: 16px; }
.oc-view { justify-content: center; background: transparent; border-color: var(--o-accent); color: var(--o-accent); }
.oc--dialog .oc-stepper { height: 52px; padding: 0 4px; box-shadow: none; }
.oc--dialog .oc-btn { width: 44px; height: 44px; }
.oc--dialog .oc-qty { min-width: 28px; font-size: 17px; }
/* With ordering on, "back to the menu" steps down to a quiet secondary action. */
.product-dialog.has-order .product-dialog-back,
html[data-theme="dark"] .product-dialog.has-order .product-dialog-back {
  margin-top: 10px;
  background: transparent;
  color: var(--o-muted);
  border-color: transparent;
}
html[lang="ar"] .product-dialog.has-order .product-dialog-back { font-size: 17px; }
@media (hover: hover) {
  .oc-add-wide:hover { background: color-mix(in srgb, var(--o-accent) 86%, #000); }
  .oc-view:hover { background: color-mix(in srgb, var(--o-accent) 9%, transparent); }
  .product-dialog.has-order .product-dialog-back:hover,
  html[data-theme="dark"] .product-dialog.has-order .product-dialog-back:hover { background: color-mix(in srgb, var(--o-accent) 9%, transparent); color: var(--o-ink); }
}

/* ---------------- Cart bar ---------------- */

body.has-cart-bar { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
body.order-sheet-open { overflow: hidden; }

.cart-bar {
  position: fixed;
  z-index: 45;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none;
  animation: cart-bar-in .42s var(--o-ease);
}
.cart-bar[hidden] { display: none; }
@keyframes cart-bar-in { from { transform: translateY(110%); } to { transform: none; } }

.cart-bar-btn {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 540px);
  min-height: 62px;
  padding: 9px;
  padding-inline-start: 14px;
  border: 1px solid color-mix(in srgb, var(--o-gold) 60%, transparent);
  border-radius: 20px;
  background: var(--o-bar);
  color: var(--o-bar-ink);
  box-shadow: 0 20px 44px -16px rgba(20, 12, 6, .7), inset 0 1px 0 rgba(255, 255, 255, .07);
  cursor: pointer;
  transition: transform .15s ease;
}
.cart-bar-btn:active { transform: scale(.985); }
.cart-bar-btn:focus-visible { outline: 3px solid var(--o-gold); outline-offset: 3px; }
.cart-bar-count {
  flex: 0 0 auto;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--o-gold);
  color: #1e140d;
  font: 700 14.5px/32px var(--font-en-body);
  text-align: center;
}
.cart-bar-count.is-bumped { animation: cart-bump .34s var(--o-ease); }
@keyframes cart-bump { 40% { transform: scale(1.28); } }
.cart-bar-label { flex: 1; text-align: start; font: 400 21px/1.5 var(--font-ar-display); }
html[lang="en"] .cart-bar-label { font: italic 600 17px/1.5 var(--font-en-display); }
.cart-bar-total { padding: 9px 15px; border-radius: 13px; background: var(--o-bar-chip); font-size: 16px; }

/* ---------------- Notices on the menu page ---------------- */

.order-closed {
  margin: 0;
  padding: 11px 18px;
  border-bottom: 1px solid var(--o-line);
  background: var(--o-surface);
  color: var(--o-muted);
  font: 500 13.5px/1.8 "Cairo Menu", "Tajawal", sans-serif;
  text-align: center;
}
html[lang="en"] .order-closed { font-family: var(--font-en-body); }

.order-chip {
  position: fixed;
  z-index: 44;
  inset-inline: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100% - 28px);
  margin-inline: auto;
  padding: 10px 16px;
  border: 1px solid var(--o-line);
  border-radius: 999px;
  background: var(--o-surface);
  color: var(--o-ink);
  box-shadow: 0 12px 30px -14px rgba(33, 22, 14, .5);
  font: 600 14px/1.6 "Cairo Menu", "Tajawal", sans-serif;
}
.order-chip[hidden] { display: none; }
html[lang="en"] .order-chip { font-family: var(--font-en-body); }
body.has-cart-bar .order-chip { bottom: calc(96px + env(safe-area-inset-bottom)); }
.order-chip svg { width: 16px; height: 16px; color: var(--o-muted); }
html[dir="rtl"] .order-chip svg { transform: rotate(180deg); }
.order-chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--o-gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--o-gold) 25%, transparent); }

/* ---------------- Checkout sheet ---------------- */

.order-sheet {
  width: 100%;
  max-width: 540px;
  max-height: min(92dvh, 880px);
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--o-line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--o-surface);
  color: var(--o-ink);
  box-shadow: 0 -18px 70px #21160e40;
  overflow: hidden;
  font-family: "Cairo Menu", "Tajawal", sans-serif;
}
html[lang="en"] .order-sheet { font-family: "Poppins", "Cairo Menu", "Tajawal", sans-serif; }
.order-sheet[open] { display: flex; flex-direction: column; animation: order-sheet-enter .38s var(--o-ease) both; }
.order-sheet.is-closing { animation: order-sheet-exit .2s ease-in both; }
.order-sheet::backdrop { background: #21180f80; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.order-sheet[open]::backdrop { animation: product-backdrop-enter .3s ease-out both; }
.order-sheet.is-closing::backdrop { animation: product-backdrop-exit .2s ease-in both; }
@keyframes order-sheet-enter { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes order-sheet-exit { to { transform: translateY(60px); opacity: 0; } }

.os-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid var(--o-line);
}
.os-head h2 {
  flex: 1;
  margin: 0;
  padding-inline-start: 8px;
  font: 400 28px/1.5 var(--font-ar-display);
}
html[lang="en"] .os-head h2 { font: italic 600 23px/1.6 var(--font-en-display); }
.os-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--o-line);
  border-radius: 12px;
  background: transparent;
  color: var(--o-ink);
  cursor: pointer;
}
.os-icon[hidden] { display: none; }
.os-icon:focus-visible, .os-primary:focus-visible, .os-locate:focus-visible { outline: 2px solid var(--o-accent); outline-offset: 3px; }
html[dir="ltr"] .os-back svg { transform: rotate(180deg); }
.os-back + h2 { padding-inline-start: 4px; }

.os-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px 18px; }
.os-foot {
  flex: 0 0 auto;
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--o-line);
  background: var(--o-surface);
}

.os-empty { margin: 0; padding: 56px 12px; color: var(--o-muted); font-size: 16px; line-height: 2; text-align: center; }

.os-items { margin: 0; padding: 0; list-style: none; }
.os-item { display: flex; align-items: center; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--o-line); }
.os-thumb { flex: 0 0 auto; width: 62px; height: 62px; border-radius: 13px; overflow: hidden; background: #f0e8e5; }
.os-thumb img { width: 100%; height: 100%; object-fit: cover; }
.os-item-main { flex: 1; min-width: 0; }
.os-item-name { margin: 0; font: 700 19px/1.6 "Aref Ruqaa", serif; overflow-wrap: anywhere; }
html[lang="en"] .os-item-name { font: 600 15px/1.5 var(--font-en-body); }
.os-item-price { margin: 2px 0 0; color: var(--o-muted); font-size: 13px; }
.os-item-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.oc--row .oc-stepper { height: 36px; box-shadow: none; animation: none; }
.oc--row .oc-btn { width: 32px; height: 32px; }
.os-item-total { margin: 0; font-size: 14.5px; }

.os-field { display: block; margin-top: 18px; }
.os-label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 14.5px; }
.os-label small { margin-inline-start: 4px; color: var(--o-muted); font-size: 12.5px; font-weight: 500; }
.os-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid var(--o-line);
  border-radius: 13px;
  background: var(--o-raised);
  color: var(--o-ink);
  /* 16px keeps iOS from zooming the page on focus. */
  font: 500 16px/1.6 inherit;
  font-family: inherit;
  resize: none;
}
.os-input::placeholder { color: color-mix(in srgb, var(--o-muted) 70%, transparent); }
.os-input:focus { outline: 2px solid var(--o-accent); outline-offset: 1px; border-color: transparent; }
.os-input[aria-invalid="true"] { border-color: var(--o-danger); }
.os-input[dir="ltr"] { text-align: start; font-family: var(--font-en-body); letter-spacing: .03em; }
html[dir="rtl"] .os-input[dir="ltr"] { text-align: right; }
.os-hint { margin: 6px 2px 0; color: var(--o-muted); font-size: 12.5px; line-height: 1.7; }
/* The error says the same thing more pointedly, so it replaces the hint. */
.os-hint:has(+ .os-error:not([hidden])) { display: none; }
.os-error { margin: 6px 2px 0; color: var(--o-danger); font-size: 13px; font-weight: 600; line-height: 1.7; }
.os-error[hidden], .os-alert[hidden] { display: none; }

.os-locate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  margin-bottom: 10px;
  padding: 10px 16px;
  border: 1px dashed var(--o-accent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--o-accent) 6%, transparent);
  color: var(--o-accent);
  font: 700 14.5px/1.6 inherit;
  font-family: inherit;
  cursor: pointer;
}
.os-locate:disabled { opacity: .7; cursor: progress; }
.os-located {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 50px;
  margin: 0 0 10px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--o-ok) 45%, transparent);
  border-radius: 13px;
  background: color-mix(in srgb, var(--o-ok) 9%, transparent);
  color: var(--o-ok);
  font-weight: 700;
  font-size: 14.5px;
}
.os-located span { flex: 1; }
.os-located button { padding: 6px 4px; border: 0; background: none; color: var(--o-muted); font: 500 13px inherit; font-family: inherit; text-decoration: underline; cursor: pointer; }

.os-sum { margin: 0; }
.os-sum > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; color: var(--o-muted); font-size: 14.5px; }
.os-sum dt, .os-sum dd { margin: 0; }
.os-sum .os-sum-total { color: var(--o-ink); font-size: 16px; font-weight: 700; }
.os-sum .os-sum-total dd { font-size: 21px; }
.os-note { margin: 4px 0 0; color: var(--o-muted); font-size: 12.5px; line-height: 1.7; }
.os-primary + .os-note { margin-top: 10px; text-align: center; }

.os-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  margin-top: 13px;
  padding: 12px 20px;
  border: 0;
  border-radius: 15px;
  background: var(--o-accent);
  color: var(--o-accent-ink);
  font: 400 22px/1.5 var(--font-ar-display);
  cursor: pointer;
  transition: background .18s ease, transform .15s ease;
}
html[lang="en"] .os-primary { font: 600 16px/1.5 var(--font-en-body); }
.os-primary:active:not(:disabled) { transform: scale(.985); }
.os-primary:disabled { opacity: .75; cursor: progress; }
@media (hover: hover) { .os-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--o-accent) 86%, #000); } }

.os-alert {
  margin: 0 0 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--o-danger-bg);
  color: var(--o-danger);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.8;
}
.os-body > .os-alert { margin-top: 14px; }
.os-alert button { padding: 0; border: 0; background: none; color: inherit; font: 700 13.5px inherit; font-family: inherit; text-decoration: underline; cursor: pointer; }

.os-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: os-spin .8s linear infinite;
}
@keyframes os-spin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .order-sheet { margin: auto; max-height: min(86dvh, 820px); border-bottom: 1px solid var(--o-line); border-radius: 24px; box-shadow: 0 24px 80px #21160e40; }
  @keyframes order-sheet-enter { from { transform: translateY(16px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes order-sheet-exit { to { transform: translateY(16px) scale(.985); opacity: 0; } }
  .os-body { padding-inline: 26px; }
  .os-foot { padding-inline: 26px; }
  .oc--card { bottom: 10px; inset-inline-end: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-bar, .oc-stepper, .cart-bar-count.is-bumped,
  .order-sheet[open], .order-sheet.is-closing, .order-sheet[open]::backdrop, .order-sheet.is-closing::backdrop { animation: none; }
  .oc-add, .cart-bar-btn, .os-primary { transition: none; }
}
