/* ==========================================================================
   Sufra — نظام التصميم (mobile-first · RTL · فاتح/داكن)
   ========================================================================== */
:root {
  /* لوحة دافئة تفتح الشهية */
  --bg: #fbf7f0;
  --bg-soft: #f3ece0;
  --surface: #ffffff;
  --surface-2: #fbf7f0;
  --line: #ece2d3;
  --text: #2a2119;
  --text-soft: #6f6357;
  --text-mute: #9a8c7d;
  --accent: #e8622c; /* تراكوتا */
  --accent-strong: #c24e1e;
  --gold: #e0a02e;
  --danger: #d64545; /* حساسيات */
  --danger-bg: #fdecec;
  --ok: #3f9d5a;
  --shadow: 0 6px 24px rgba(42, 33, 25, 0.1);
  --shadow-lg: 0 16px 48px rgba(42, 33, 25, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --maxw: 560px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --bg-soft: #1b1815;
    --surface: #201c18;
    --surface-2: #17140f;
    --line: #322c25;
    --text: #f4ede2;
    --text-soft: #c3b6a6;
    --text-mute: #8d8071;
    --accent: #ff7a45;
    --accent-strong: #ff8f5f;
    --gold: #eab54e;
    --danger: #ff6b6b;
    --danger-bg: #3a1f1f;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Tajawal", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.55;
  min-height: 100dvh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- الترويسة ---------- */
.app-header {
  padding: calc(20px + var(--safe-t)) 16px 16px;
  text-align: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.brand .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.rest-name {
  font-size: 28px;
  font-weight: 800;
  margin: 10px 0 4px;
}
.rest-tag {
  color: var(--text-soft);
  font-size: 15px;
  margin: 0;
}

/* ---------- شبكة المنيو ---------- */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 8px 0 40px;
}
@media (max-width: 380px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

.dish-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dish-card:active {
  transform: scale(0.98);
}
.dish-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-soft);
  overflow: hidden;
}
.dish-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dish-thumb .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 40px;
  opacity: 0.5;
}
.badge-3d {
  position: absolute;
  inset-inline-start: 10px;
  inset-block-start: 10px;
  background: rgba(20, 18, 16, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(6px);
}
.dish-body {
  padding: 12px 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.dish-name {
  font-weight: 700;
  font-size: 16px;
  margin: 0;
}
.dish-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.chip {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dish-price {
  font-weight: 800;
  color: var(--accent-strong);
  font-size: 16px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- صفحة الطبق ---------- */
.stage {
  position: relative;
  height: 56dvh;
  min-height: 320px;
  background: radial-gradient(120% 90% at 50% 20%, var(--bg-soft), var(--bg));
}
model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background: transparent;
}
.stage .stage-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 24px;
}
.stage-hint {
  position: absolute;
  inset-block-end: 12px;
  inset-inline: 0;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  pointer-events: none;
}
.back-btn {
  position: absolute;
  inset-block-start: calc(12px + var(--safe-t));
  inset-inline-start: 12px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--text);
}

/* بطاقة التفاصيل (تصعد فوق المشهد) */
.sheet {
  position: relative;
  margin-top: -22px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  padding: 20px 16px calc(120px + var(--safe-b));
  min-height: 46dvh;
}
.sheet-grip {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 14px;
}
.dish-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 2px;
}
.dish-cat {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.dish-desc {
  color: var(--text-soft);
  margin: 12px 0 0;
  font-size: 15px;
}

/* شبكة الحقائق (حجم/وزن/قطع/يكفّي/سعرات) */
.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0 6px;
}
.fact {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.fact .ic {
  font-size: 22px;
  line-height: 1;
}
.fact .k {
  font-size: 12px;
  color: var(--text-mute);
}
.fact .v {
  font-weight: 700;
  font-size: 15px;
}

/* الحجم الحقيقي — بارز (القيمة الأساسية للمنتج) */
.realsize {
  margin: 16px 0 6px;
  background: linear-gradient(135deg, rgba(232, 98, 44, 0.1), rgba(224, 160, 46, 0.08));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.realsize .ic {
  font-size: 26px;
}
.realsize .t {
  font-size: 13px;
  color: var(--text-soft);
}
.realsize .b {
  font-weight: 800;
  font-size: 16px;
}

/* المكوّنات والحساسيات */
.section-title {
  font-weight: 800;
  font-size: 16px;
  margin: 20px 0 10px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
}
.tag.allergen {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-weight: 700;
}

/* شريط AR السفلي الثابت */
.ar-bar {
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 20;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--surface) 72%, transparent);
  display: flex;
  justify-content: center;
}
.ar-btn {
  width: 100%;
  max-width: calc(var(--maxw) - 32px);
  min-height: 56px;
  border: none;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 22px rgba(232, 98, 44, 0.4);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.ar-btn:active {
  transform: translateY(1px) scale(0.99);
  background: var(--accent-strong);
}
.ar-btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.ar-btn[disabled] {
  opacity: 0.55;
  box-shadow: none;
}

/* شريط تنبيه المتصفح داخل التطبيق */
.inapp-warn {
  background: var(--gold);
  color: #201400;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.inapp-warn.hidden {
  display: none;
}

/* حالات مساعدة */
.center-note {
  text-align: center;
  color: var(--text-mute);
  padding: 60px 20px;
}
.hidden {
  display: none !important;
}
.spicy {
  color: var(--accent);
}
.footer {
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  padding: 20px 0 30px;
}
