/* منقوشة - site styles. Mobile-first, RTL/LTR via logical properties, system fonts only (no web-font download = faster). */
:root {
  --red: #E0272F; --red-dark: #b81d24; --orange: #E98226; --yellow: #E9C819;
  --bg: #f7f7f7; --card: #fff; --text: #231f20; --muted: #6b6667; --line: #e6e2e2;
  --radius: 14px; --shadow: 0 2px 10px rgba(0,0,0,.07);
  --font: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 16px; }
body.noscroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--red-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; } h2 { font-size: 1.2rem; margin: 0 0 .6em; } h3 { font-size: 1.05rem; margin: 0 0 .3em; }
.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 16px; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
.muted { color: var(--muted); } .center { text-align: center; } .big { font-size: 1.2rem; font-weight: 700; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.bar { display: flex; align-items: center; gap: 12px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 1.25rem; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 50%; background: #fff; }
.nav { display: none; gap: 4px; margin-inline-start: 12px; }
.nav a { color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.18); text-decoration: none; }
.actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.cart-btn { position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(255,255,255,.18); color: #fff; cursor: pointer; display: grid; place-items: center; }
.cart-btn:hover { background: rgba(255,255,255,.3); }
.cart-btn .count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--yellow); color: #231f20; font-size: .78rem; font-weight: 800; display: grid; place-items: center; }
@media (min-width: 720px) { .nav { display: flex; } }
@media (max-width: 520px) {
  .bar { gap: 8px; } .brand span { display: none; } .actions { gap: 6px; }
  .topbar .btn.small { padding: 7px 10px; font-size: .85rem; }
}

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 20px; font: inherit; font-weight: 700; cursor: pointer; transition: background .15s, transform .05s; text-decoration: none; }
.btn:hover { text-decoration: none; } .btn:active { transform: scale(.98); }
.btn.primary { background: var(--red); color: #fff; } .btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.6); }
.btn.small { padding: 8px 14px; font-size: .92rem; white-space: nowrap; }
.btn.block { width: 100%; }
.btn.link { background: none; color: var(--red-dark); padding: 6px 8px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { background: none; border: 0; font-size: 1.2rem; cursor: pointer; padding: 8px; border-radius: 10px; color: inherit; }
.icon-btn:hover { background: rgba(0,0,0,.07); }

/* generic blocks */
main { padding-block: 18px 40px; min-height: 70vh; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.section { margin-top: 28px; }
.grid { display: grid; gap: 14px; }
.state { text-align: center; padding: 48px 16px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: #fff6e0; border: 1px solid #f1dc9b; padding: 10px 12px; border-radius: 10px; }
.price { font-weight: 800; color: var(--red-dark); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; background: #eee; }
.badge.st-placed, .badge.st-accepted { background: #fff1cf; color: #7a5600; }
.badge.st-preparing, .badge.st-out_for_delivery { background: #ffe1c6; color: #8a4300; }
.badge.st-delivered { background: #d9f3dd; color: #17692a; } .badge.st-cancelled { background: #fadadd; color: #9b1c25; }

/* hero */
.hero { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 28px 16px; border-radius: 20px; color: #fff;
        background: linear-gradient(135deg, var(--red) 0%, #ee5a2a 55%, var(--orange) 100%); }
.hero-logo { border-radius: 50%; background: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.25); }
.hero h1 { font-size: 1.7rem; margin: 0 0 6px; } .hero p { margin: 0 0 14px; opacity: .95; }
.hero .btn.primary { background: var(--yellow); color: #231f20; } .hero .btn.primary:hover { background: #f4d93a; }
@media (min-width: 720px) { .hero { flex-direction: row; text-align: start; padding: 36px 40px; gap: 32px; } .hero h1 { font-size: 2.2rem; } }
.branches { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.branch { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; } .branch p { margin: 0; }

/* menu */
.menu-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.menu-head h1 { margin: 0; }
.search { flex: 1 1 220px; max-width: 360px; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: #fff; }
.search:focus, input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.tabs { position: sticky; top: 62px; z-index: 20; display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; margin: 10px 0 4px; background: var(--bg); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 16px; background: #fff; border: 1.5px solid var(--line); border-radius: 999px; color: var(--text); font-weight: 700; white-space: nowrap; }
.tab:hover { border-color: var(--red); color: var(--red-dark); text-decoration: none; }
.cat { margin-top: 18px; scroll-margin-top: 124px; }
.items { grid-template-columns: 1fr; }
@media (min-width: 640px) { .items { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .items { grid-template-columns: repeat(3, 1fr); } }
.item { padding: 0; overflow: hidden; display: flex; flex-direction: row; }
.item-photo { flex: none; width: 110px; background: #f0ebe6; display: grid; place-items: center; }
.item-photo img, .item-photo .ph { width: 110px; height: 100%; min-height: 110px; object-fit: cover; }
.item-photo .ph { display: grid; place-items: center; font-size: 2.2rem; }
.item-body { padding: 12px 14px; display: flex; flex-direction: column; flex: 1; min-width: 0; }
.item-body p { margin: 0 0 6px; font-size: .9rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (min-width: 640px) {
  .item { flex-direction: column; } .item-photo { width: 100%; height: 170px; } .item-photo img, .item-photo .ph { width: 100%; height: 170px; }
}

/* drawer + dialog */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(420px, 100%); background: #fff; z-index: 50; display: flex; flex-direction: column;
          transform: translateX(100%); transition: transform .22s ease; visibility: hidden; }
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); } .drawer-head h2 { margin: 0; }
.drawer-lines { flex: 1; overflow-y: auto; padding: 8px 16px; }
.drawer-empty { padding: 40px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.drawer-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.line { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 700; } .line-mods { font-size: .85rem; color: var(--muted); } .line-price { font-weight: 700; margin-top: 2px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: #f3efef; border-radius: 12px; padding: 2px; }
.stepper button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #fff; font-size: 1.2rem; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }
.sum-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; } .sum-row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 1.1rem; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: .95rem; }

.item-dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, 94vw); max-height: 92vh; box-shadow: 0 10px 40px rgba(0,0,0,.3); color: var(--text); font-family: var(--font); }
.item-dialog::backdrop { background: rgba(0,0,0,.5); }
.item-dialog[open] { display: flex; flex-direction: column; }
.dlg-close { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; background: rgba(255,255,255,.9); }
.dlg-body { padding: 16px; overflow-y: auto; }
.dlg-photo { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-bottom: 10px; }
.dlg-foot { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); } .dlg-foot .btn { flex: 1; }
.group { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px 6px; margin: 12px 0; } .group legend { font-weight: 700; padding-inline: 6px; } .group small { color: var(--muted); font-weight: 400; }
.opt { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; } .opt input { width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.opt-name { flex: 1; } .opt-price { color: var(--muted); font-size: .9rem; }
.opt.box { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.opt.box:has(input:checked) { border-color: var(--red); background: #fff5f5; }

/* forms */
.form { display: grid; gap: 12px; } .narrow { max-width: 440px; margin: 20px auto; }
.field { display: grid; gap: 4px; } .field-label { font-weight: 700; font-size: .93rem; }
input[type=text], input[type=tel], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 13px; font: inherit; color: inherit; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; }
textarea { resize: vertical; }
.form-error { color: #b3261e; font-weight: 600; min-height: 1.2em; margin: 0; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.checkout { display: grid; gap: 18px; align-items: start; } .checkout-main { display: grid; gap: 14px; } .checkout-side { display: grid; gap: 12px; }
@media (min-width: 900px) { .checkout { grid-template-columns: 1fr 360px; } .checkout-side { position: sticky; top: 84px; } }
.addr-list { display: grid; }

/* orders */
.list { display: grid; gap: 10px; }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: inherit; } .order-row:hover { text-decoration: none; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.order-row .end { display: grid; gap: 6px; justify-items: end; }
.timeline { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 0; }
.step { position: relative; padding: 10px 0; padding-inline-start: 34px; color: var(--muted); }
.step::before { content: ''; position: absolute; inset-inline-start: 4px; top: 14px; width: 16px; height: 16px; border-radius: 50%; background: #d9d4d4; }
.step::after { content: ''; position: absolute; inset-inline-start: 11px; top: 30px; bottom: -14px; width: 2px; background: #e5e0e0; }
.step:last-child::after { display: none; }
.step.done { color: var(--text); } .step.done::before { background: var(--orange); } .step.done::after { background: var(--orange); }
.step.current { font-weight: 800; } .step.current::before { background: var(--red); box-shadow: 0 0 0 5px rgba(224,39,47,.18); }
.step.cancelled::before { background: #9b1c25; }
.timeline + .card, .card + .card { margin-top: 12px; }

/* footer, toast */
.footer { background: #231f20; color: #ddd; padding: 18px 0; font-size: .9rem; } .foot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.foot-links { display: flex; gap: 16px; } .footer a { color: #fff; }
.toast { position: fixed; inset-inline: 16px; bottom: 20px; margin-inline: auto; max-width: 420px; background: #231f20; color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center; z-index: 80;
         opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; } .toast.error { background: #b3261e; }
.noscript { text-align: center; padding: 20px; background: #fff6e0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }
