/* PLATO Menu — صفحة منيو المطعم
   الألوان الخاصة بكل مطعم تجي من restaurant.json (theme) وتنحط كـ --primary و --dark */
:root {
  --primary: #E2452B;
  --dark: #14110F;
  --on-primary: #fff;
  --bg: #F5F6F8;
  --card: #fff;
  --text: #14161C;
  --muted: #6B7280;
  --line: #E7E9EE;
  --ok: #128C4B;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(20, 22, 28, .06);
  --shadow-lg: 0 -12px 40px rgba(20, 22, 28, .18);
  --font: 'Cairo', 'Geeza Pro', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: 110px;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 980px; margin: 0 auto; padding-inline: 16px; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- شريط الديمو ---------- */
.demo-bar {
  background: #070A12; color: #F4F7FB; font-size: 13.5px;
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
  padding: 8px 16px; text-align: center;
}
.demo-bar a { color: #7FA6FF; font-weight: 700; }

/* ---------- الهيدر ---------- */
.hero { position: relative; background: var(--dark); color: #fff; overflow: hidden; }
.hero-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .62; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, var(--dark) 96%);
}
.hero-in { position: relative; z-index: 1; padding-block: 120px 26px; display: grid; gap: 14px; }
.hero-id { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 76px; height: 76px; border-radius: 50%; flex: none;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 800; font-size: 26px; letter-spacing: .02em;
  border: 3px solid rgba(255,255,255,.9); overflow: hidden;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 { font-size: clamp(26px, 6vw, 38px); font-weight: 800; line-height: 1.25; }
.hero-en { font-size: 13px; letter-spacing: .18em; opacity: .7; text-transform: uppercase; direction: ltr; text-align: right; }
.hero p { color: rgba(255,255,255,.86); max-width: 56ch; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: rgba(255,255,255,.75); }
.meta span { display: inline-flex; gap: 6px; align-items: center; }
.meta svg { width: 16px; height: 16px; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.btn {
  display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; border-radius: 999px; padding: 9px 18px;
  transition: transform .15s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.22); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-wa { background: #25D366; color: #06270F; }
.btn-block { width: 100%; padding: 14px 18px; font-size: 17px; }

/* ---------- التصنيفات ---------- */
.cats {
  position: sticky; top: 0; z-index: 20; background: rgba(245,246,248,.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.cats-in { display: flex; gap: 8px; overflow-x: auto; padding-block: 10px; scrollbar-width: none; }
.cats-in::-webkit-scrollbar { display: none; }
.cat {
  flex: none; font-weight: 700; font-size: 15px; padding: 7px 18px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  transition: background-color .15s ease, color .15s ease;
}
.cat.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---------- الأصناف ---------- */
.section { padding-top: 26px; scroll-margin-top: 64px; }
.section h2 { font-size: 22px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: baseline; gap: 10px; }
.section h2 small { font-size: 13px; font-weight: 600; color: var(--muted); }
.items { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: stretch;
}
.item-img {
  width: 112px; height: 112px; border-radius: 14px; object-fit: cover; background: #ECEEF2;
}
.item-ph {
  width: 112px; height: 112px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 30%, #fff), color-mix(in srgb, var(--primary) 75%, #000));
  color: #fff; font-weight: 800; font-size: 34px;
}
.item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item h3 { font-size: 16.5px; font-weight: 700; line-height: 1.4; }
.badge {
  font-size: 11.5px; font-weight: 700; padding: 0 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, #fff); color: var(--primary);
}
.item p {
  font-size: 13.5px; color: var(--muted); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-foot { margin-top: auto; padding-top: 6px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.price { font-weight: 800; font-size: 16px; color: var(--primary); white-space: nowrap; }
.price small { font-size: 12px; font-weight: 600; }
.add {
  width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-size: 24px; line-height: 1; font-weight: 600;
  transition: transform .15s ease;
}
.add:active { transform: scale(.9); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: #F1F2F5; border-radius: 999px; padding: 3px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 20px; line-height: 1; font-weight: 700; color: var(--primary);
}
.stepper output { min-width: 26px; text-align: center; font-weight: 800; }
.item.off { opacity: .55; }
.item.off .item-img, .item.off .item-ph { filter: grayscale(1); }
.soldout { font-size: 13px; font-weight: 700; color: var(--muted); background: #EEF0F3; border-radius: 999px; padding: 3px 12px; }

/* ---------- الفوتر ---------- */
.foot { margin-top: 40px; padding-block: 26px; border-top: 1px solid var(--line); display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 13.5px; }
.powered { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #0A0F1C; direction: ltr; }
.powered img { width: 20px; height: 20px; }
.powered span { color: #3B6CFF; }

/* ---------- شريط السلة ---------- */
.cartbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.cartbar-in {
  pointer-events: auto; max-width: 720px; margin: 0 auto;
  background: var(--dark); color: #fff; border-radius: 20px; box-shadow: 0 10px 34px rgba(0,0,0,.28);
  padding: 10px 10px 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  animation: rise .25s ease both;
}
.cart-info { display: flex; align-items: center; gap: 12px; padding-inline-start: 6px; min-width: 0; }
.cart-count {
  min-width: 30px; height: 30px; padding-inline: 8px; border-radius: 999px; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.cart-total { display: grid; line-height: 1.3; }
.cart-total small { font-size: 12px; opacity: .7; }
.cart-total b { font-size: 17px; font-weight: 800; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- نافذة الطلب ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 18, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; background: var(--bg); border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: up .28s cubic-bezier(.2,.8,.2,1) both;
}
.sheet-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 20px; font-weight: 800; }
.close { width: 36px; height: 36px; border-radius: 50%; background: #E9EBEF; display: grid; place-items: center; font-size: 20px; }
.sheet-b { overflow-y: auto; padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 18px; overscroll-behavior: contain; }
.lines { display: grid; gap: 8px; }
.line { background: var(--card); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.line b { font-weight: 700; font-size: 15px; }
.line small { color: var(--muted); font-size: 13px; }
.line .line-total { font-weight: 800; color: var(--primary); font-size: 14.5px; text-align: left; }
.fieldset { display: grid; gap: 10px; }
.fieldset > label, .lbl { font-weight: 700; font-size: 14.5px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; background: #E9EBEF; border-radius: 14px; padding: 4px; }
.seg button { padding: 9px 6px; border-radius: 11px; font-weight: 700; font-size: 14.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.field { display: grid; gap: 5px; }
.field label { font-size: 13.5px; font-weight: 700; }
.field input, .field textarea {
  width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 14px; font-size: 16px;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field.bad input, .field.bad textarea { border-color: #D92D20; }
.err { color: #D92D20; font-size: 13px; font-weight: 600; }
.sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.sum b { font-size: 21px; font-weight: 800; }
.hint { font-size: 12.5px; color: var(--muted); text-align: center; }
.done { display: grid; gap: 14px; justify-items: center; text-align: center; padding-block: 10px; }
.done-ic { width: 72px; height: 72px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 14%, #fff); color: var(--ok); display: grid; place-items: center; }
.done-ic svg { width: 36px; height: 36px; }
.done h3 { font-size: 22px; font-weight: 800; }
.done-box { width: 100%; background: var(--card); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; text-align: right; }
.done-box div { display: flex; justify-content: space-between; gap: 12px; }
.done-box span { color: var(--muted); }
.link { color: var(--muted); font-weight: 700; text-decoration: underline; padding: 6px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }

@media (min-width: 700px) {
  .overlay { align-items: center; padding: 20px; }
  .sheet { border-radius: 24px; max-height: 88dvh; }
  .hero-in { padding-block: 170px 34px; }
}
@media (max-width: 380px) {
  .item { grid-template-columns: 92px minmax(0, 1fr); }
  .item-img, .item-ph { width: 92px; height: 92px; }
  .btn { padding: 8px 14px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
