/* نظام "اطلب مني" — mobile-first RTL */
:root {
  --primary: #00685d;
  --primary-dark: #004d45;
  --primary-light: #e6f4f2;
  --accent: #ff8a00;
  --wa: #128c7e;
  --wa-bright: #25d366;
  --bg: #f7f8f9;
  --surface: #ffffff;
  --text: #1a1d1e;
  --muted: #64716e;
  --line: #e4e8e7;
  --danger: #ba1a1a;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 -6px 24px rgba(0,0,0,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 90px; /* مساحة لشريط السلة */
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 16px; }

/* ---------- الهيدر ---------- */
.topbar {
  background: var(--surface);
  position: sticky; top: 0; z-index: 30;
  box-shadow: var(--shadow);
  padding: 14px 16px 0;
}
.topbar-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--line); flex-shrink: 0;
}
.rest-name { font-size: 22px; font-weight: 800; color: var(--primary); }
.rest-note { font-size: 13px; color: var(--muted); }
.top-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
.lang-btn {
  text-decoration: none; font-size: 12px; font-weight: 800; white-space: nowrap;
  color: var(--primary); border: 1.5px solid var(--primary);
  padding: 3px 12px; border-radius: 99px;
}
.badge-open { background: #e7f7ee; color: #0a7d40; }
.badge-closed { background: #fdeaea; color: var(--danger); }
.search-wrap { margin: 12px 0 10px; }
#search {
  width: 100%; border: 1px solid var(--line); border-radius: 99px;
  padding: 10px 18px; background: var(--bg); outline: none;
}
#search:focus { border-color: var(--primary); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; text-decoration: none; font-size: 14px; font-weight: 600;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  padding: 6px 16px; border-radius: 99px; transition: all .2s;
}
.chip.active, .chip:active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- المنيو ---------- */
.menu { max-width: 720px; margin: 0 auto; padding: 16px; }
.cat-title {
  font-size: 18px; font-weight: 800; color: var(--primary);
  margin: 20px 0 12px; scroll-margin-top: 140px;
}
.cat-section { scroll-margin-top: 150px; }
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; position: relative;
}
.card-img { height: 150px; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img-ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; background: linear-gradient(135deg, var(--primary-light), #f0ece2);
}
.feat {
  position: absolute; top: 10px; inset-inline-end: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
}
.card-body { padding: 12px 14px 14px; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.price { color: var(--primary); font-weight: 800; white-space: nowrap; font-size: 15px; }
.desc {
  font-size: 13px; color: var(--muted); margin: 6px 0 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-actions { display: flex; justify-content: flex-end; }
.btn-add {
  background: var(--primary); color: #fff; border: none;
  padding: 8px 18px; border-radius: 10px; font-weight: 700; font-size: 14px;
  transition: transform .1s;
}
.btn-add:active { transform: scale(.95); }
.stepper {
  display: flex; align-items: center; gap: 4px;
  background: var(--primary-light); border-radius: 10px; padding: 2px;
}
.stepper button {
  width: 34px; height: 34px; border: none; background: var(--primary); color: #fff;
  border-radius: 8px; font-size: 18px; font-weight: 700; line-height: 1;
}
.step-qty { min-width: 32px; text-align: center; font-weight: 800; color: var(--primary); }
.no-results { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- شريط السلة ---------- */
.cart-bar {
  position: fixed; bottom: 12px; right: 16px; left: 16px; z-index: 40;
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 16px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,104,93,.35);
  max-width: 688px; margin: 0 auto;
}
.cart-count {
  background: #fff; color: var(--primary); width: 26px; height: 26px;
  border-radius: 99px; display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}

/* ---------- الشاشات المنزلقة ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 60;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  max-width: 720px; margin: 0 auto;
  animation: slide-up .25s ease-out;
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-handle {
  width: 44px; height: 4px; background: var(--line); border-radius: 99px;
  margin: 4px auto 14px;
}
.sheet-title { font-size: 19px; font-weight: 800; margin-bottom: 14px; }

/* سطور السلة */
.cart-line { border-bottom: 1px solid var(--line); padding: 12px 0; }
.cart-line-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-line-name { font-weight: 700; font-size: 15px; flex: 1; }
.cart-line-price { color: var(--primary); font-weight: 800; white-space: nowrap; }
.cart-line-ctrl { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cart-line-ctrl .stepper { padding: 0; }
.cart-line-ctrl .stepper button { width: 30px; height: 30px; font-size: 16px; }
.btn-del { background: none; border: none; color: var(--danger); font-size: 13px; font-weight: 600; }
.note-input {
  width: 100%; margin-top: 8px; border: 1px dashed var(--line); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; background: var(--bg); outline: none;
}
.note-input:focus { border-color: var(--primary); border-style: solid; }
.cart-empty { text-align: center; color: var(--muted); padding: 30px 0; }

.free-del-hint {
  margin-top: 12px; padding: 9px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 700;
  background: var(--primary-light); color: var(--primary);
}
.free-del-hint.ok { background: #e7f7ee; color: #0a7d40; }
.zone-fee-note {
  font-size: 13px; font-weight: 700; color: var(--primary);
  margin: -6px 0 12px; padding: 8px 12px; border-radius: 8px;
  background: var(--primary-light);
}
.zone-fee-note.warn { background: #fff3e0; color: #b26a00; }
#order-form select {
  width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; background: var(--bg); outline: none; font-weight: 400;
}
#order-form select:focus { border-color: var(--primary); background: #fff; }

.totals { padding: 14px 0; }
.totals > div { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); padding: 3px 0; }
.totals .grand { font-size: 17px; font-weight: 800; color: var(--text); border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.totals .grand span:last-child { color: var(--primary); }

/* الأزرار */
.btn-primary, .btn-wa {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: none; border-radius: var(--radius);
  padding: 15px; font-size: 16px; font-weight: 800; color: #fff;
  text-decoration: none; transition: transform .1s;
}
.btn-primary { background: var(--primary); }
.btn-wa { background: var(--wa); box-shadow: 0 4px 14px rgba(18,140,126,.35); }
.btn-primary:active, .btn-wa:active { transform: scale(.98); }
.btn-wa[disabled] { opacity: .6; }
.btn-outline {
  width: 100%; background: none; border: 1.5px solid var(--primary); color: var(--primary);
  border-radius: 10px; padding: 11px; font-weight: 700; font-size: 14px;
}

/* النموذج */
#order-form label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
#order-form input:not([type=radio]):not([type=file]), #order-form textarea {
  width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; background: var(--bg); outline: none; font-weight: 400;
}
#order-form input:focus, #order-form textarea:focus { border-color: var(--primary); background: #fff; }
#order-form input[type=file] { margin-top: 6px; font-size: 13px; }
.hp { position: absolute; right: -9999px; opacity: 0; height: 0; }
.pay { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.pay legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 6px; }
.radio { display: flex !important; align-items: center; gap: 8px; margin-bottom: 6px !important; font-weight: 600 !important; }
.radio input { accent-color: var(--primary); width: 18px; height: 18px; }
.loc-status { font-size: 13px; margin: -6px 0 12px; color: var(--primary); font-weight: 600; }
.loc-status.err { color: var(--danger); }
#btn-loc { margin-bottom: 14px; }
.form-error {
  background: #fdeaea; color: var(--danger); font-size: 14px; font-weight: 600;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
}

/* النجاح */
#success-sheet { text-align: center; }
.success-icon { font-size: 52px; margin: 10px 0; }
.success-note { color: var(--muted); font-size: 15px; margin: 10px 0 20px; line-height: 1.8; }
#success-code { color: var(--primary); }

/* ديسكتوب: توسيط المحتوى */
@media (min-width: 900px) {
  .topbar { padding-right: calc(50% - 344px); padding-left: calc(50% - 344px); }
}
