/**
 * منيو عام — تصميم مينيمال للموبايل (tm-*)
 */

/* صفحة المنيو: واجهة مثل التطبيق */
body.tm-menu-page {
  /* أسعار المينيو: نبيتي (على خلفية فاتحة) */
  --tawla-menu-price: #722f37;
  /* تباين جيد لنبيتي فاتح على شريط السلة الداكن */
  --tawla-menu-price-on-dark: #f0b8c4;
}

body.tm-menu-page .tawla-header,
body.tm-menu-page .tawla-footer {
  display: none;
}

body.tm-menu-page.tawla-body {
  background: var(--tawla-cream);
  overflow-x: clip;
}

.tm-main {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: clip;
}

.tm-wrap {
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
  padding: 0 0 calc(96px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

/* محتوى المنيو تحت الهيرو — padding أفقي ثابت + توسيط مع العمود */
.tm-inner {
  padding: 0 18px;
  box-sizing: border-box;
}

/* هيرو بعرض عمود المنيو (بدون 100vw لتفادي شريط التمرير الأفقي) */
.tm-hero-block {
  position: relative;
  width: 100%;
  min-height: 200px;
  border-radius: 0 0 18px 18px;
  overflow: hidden;
  margin-bottom: 4px;
}

@media (min-width: 480px) {
  .tm-hero-block {
    min-height: 220px;
    border-radius: 0 0 20px 20px;
  }
}

.tm-hero-block__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tm-hero-block__bg--fallback {
  background: linear-gradient(165deg, #ede6dc 0%, #f7f1ea 50%, #e5ddd4 100%);
}

.tm-hero-block__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(26, 20, 16, 0.15) 0%, rgba(26, 20, 16, 0.62) 100%);
}

.tm-hero-block--plain .tm-hero-block__overlay {
  background: linear-gradient(180deg, transparent, rgba(26, 20, 16, 0.04));
}

.tm-hero-block__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: inherit;
  padding: max(20px, env(safe-area-inset-top, 0px)) 18px 20px;
  color: #fff;
  box-sizing: border-box;
}

.tm-hero-block--plain .tm-hero-block__inner {
  color: var(--tawla-ink);
}

.tm-hero-block__row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tm-hero-block__logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 4px 20px rgba(26, 20, 16, 0.2);
}

.tm-hero-block--plain .tm-hero-block__logo {
  background: #f3ede4;
  border-color: rgba(26, 20, 16, 0.08);
  box-shadow: none;
}

.tm-hero-block__text {
  min-width: 0;
  flex: 1;
}

.tm-hero-block__name {
  font-size: clamp(1.2rem, 4.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 12px rgba(26, 20, 16, 0.35);
}

.tm-hero-block--plain .tm-hero-block__name {
  text-shadow: none;
}

.tm-hero-block__desc {
  font-size: 0.88rem;
  margin: 6px 0 0;
  line-height: 1.45;
  opacity: 0.92;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-shadow: 0 1px 8px rgba(26, 20, 16, 0.4);
}

.tm-hero-block--plain .tm-hero-block__desc {
  color: var(--tawla-muted);
  opacity: 1;
  text-shadow: none;
}

.tm-hero-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.tm-hero-contact__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.tm-hero-contact__btn:active {
  transform: scale(0.94);
}

.tm-hero-contact__btn--wa {
  background: rgba(37, 211, 102, 0.35);
  border-color: rgba(255, 255, 255, 0.55);
}

.tm-hero-block--plain .tm-hero-contact__btn {
  background: #fff4ec;
  color: var(--tawla-orange);
  border-color: rgba(217, 109, 44, 0.35);
}

.tm-hero-block--plain .tm-hero-contact__btn--wa {
  background: rgba(37, 211, 102, 0.18);
  color: #128c3a;
  border-color: rgba(37, 211, 102, 0.45);
}

.tm-hero-contact__btn svg {
  display: block;
}

/* تبويبات الأقسام */
.tm-tabs-wrap {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -18px;
  padding: 0 18px;
  background: rgba(251, 247, 240, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(26, 20, 16, 0.06);
}

.tm-tabs {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 10px 0 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tm-tabs::-webkit-scrollbar {
  display: none;
}

.tm-tab {
  scroll-snap-align: start;
  border: 0;
  background: transparent;
  padding: 6px 2px 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--tawla-muted);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.tm-tab.is-active {
  color: var(--tawla-ink);
}

.tm-tab.is-active::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--tawla-orange);
  border-radius: 2px;
}

/* أقسام */
.tm-cat-section {
  scroll-margin-top: 72px;
}

.tm-cat-section--hidden {
  display: none;
}

.tm-cat {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tawla-muted);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.tm-cat::before {
  content: "";
  width: 20px;
  height: 1px;
  background: rgba(26, 20, 16, 0.22);
  flex-shrink: 0;
}

.tm-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tm-row {
  display: grid;
  grid-template-columns: 64px 1fr auto 36px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(26, 20, 16, 0.06);
}

.tm-row__thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #f3ede4;
  flex-shrink: 0;
}

.tm-row__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tm-row__thumb--placeholder::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tm-cat-dot, rgba(26, 20, 16, 0.2));
}

.tm-row--a0 {
  --tm-cat-dot: #a890b5;
}
.tm-row--a1 {
  --tm-cat-dot: #8b9a7b;
}
.tm-row--a2 {
  --tm-cat-dot: #7ba3c0;
}
.tm-row--a3 {
  --tm-cat-dot: #c98b7a;
}
.tm-row--a4 {
  --tm-cat-dot: #c4a574;
}

.tm-row__body {
  min-width: 0;
}

.tm-row__title {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.25;
  margin: 0;
}

.tm-row__desc {
  font-size: 0.82rem;
  color: var(--tawla-muted);
  margin: 3px 0 0;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.tm-row__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tm-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f3ede4;
  color: rgba(26, 20, 16, 0.72);
}

.tm-row__price {
  font-weight: 700;
  color: var(--tawla-menu-price);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  align-self: center;
}

.tm-add {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  background: #fff4ec;
  color: var(--tawla-orange);
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.tm-add:active {
  transform: scale(0.92);
}

@keyframes tm-add-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.88);
  }
  100% {
    transform: scale(1);
  }
}

.tm-add.tm-add--pulse {
  animation: tm-add-pulse 0.35s ease;
}

/* جذر السلة + الشيت */
.tm-cart-root {
  position: relative;
  z-index: 80;
}

.tm-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.35);
  z-index: 85;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tm-sheet-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.tm-sheet-backdrop:not(.is-open) {
  pointer-events: none;
}

.tm-sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: min(78vh, 640px);
  overflow-y: auto;
  z-index: 90;
  box-shadow: 0 -8px 40px rgba(26, 20, 16, 0.1);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.tm-sheet.is-open {
  transform: translateY(0);
}

.tm-sheet:not(.is-open) {
  pointer-events: none;
}

.tm-sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: rgba(26, 20, 16, 0.12);
  margin: -8px auto 16px;
}

.tm-sheet__title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
}

.tm-sheet__empty {
  margin: 0;
  color: var(--tawla-muted);
  font-size: 0.95rem;
}

.tm-sheet__lines {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.tm-sheet__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(26, 20, 16, 0.06);
  font-size: 0.92rem;
}

.tm-sheet__line-title {
  min-width: 0;
  line-height: 1.35;
}

.tm-line-qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.tm-line-qty__btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: #fff4ec;
  color: var(--tawla-orange);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.tm-line-qty__btn:active {
  transform: scale(0.92);
}

.tm-line-qty__n {
  min-width: 1.4rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.tm-sheet__line-total {
  font-weight: 700;
  color: var(--tawla-menu-price);
  font-variant-numeric: tabular-nums;
  justify-self: end;
  text-align: end;
  white-space: nowrap;
}

.tm-sheet__sum {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 16px;
  font-variant-numeric: tabular-nums;
}

.tm-sheet__btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--tawla-orange);
  color: #fff;
  margin-top: 8px;
}

.tm-sheet__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tm-sheet__btn--ghost {
  background: transparent;
  color: var(--tawla-ink);
  border: 1px solid rgba(26, 20, 16, 0.12);
}

.tm-field {
  margin-bottom: 12px;
}

.tm-field label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--tawla-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tm-field input,
.tm-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid rgba(26, 20, 16, 0.15);
  padding: 6px 0 7px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  background: transparent;
  border-radius: 0;
}

.tm-field input:focus,
.tm-field textarea:focus {
  outline: none;
  border-bottom-color: var(--tawla-orange);
}

.tm-field textarea {
  resize: vertical;
  min-height: 44px;
  max-height: 120px;
}

.tm-notes-wrap {
  margin-bottom: 12px;
}

.tm-notes-toggle {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed rgba(26, 20, 16, 0.2);
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tawla-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tm-notes-toggle:hover {
  border-color: var(--tawla-orange);
  color: var(--tawla-orange);
  background: rgba(255, 244, 236, 0.5);
}

.tm-notes-hide {
  display: block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tawla-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tm-notes-hide:hover {
  color: var(--tawla-ink);
}

.tm-notes-field {
  min-height: 40px;
  max-height: 100px;
}

.tm-fulfill {
  margin-bottom: 18px;
}

.tm-fulfill__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tawla-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tm-fulfill__choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tm-fulfill__choice {
  border: 1px solid rgba(26, 20, 16, 0.12);
  background: #faf8f5;
  border-radius: 12px;
  padding: 12px 10px;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--tawla-ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tm-fulfill__choice.is-selected {
  border-color: var(--tawla-orange);
  background: #fff4ec;
  color: var(--tawla-orange);
}

.tm-sheet__breakdown {
  margin: 8px 0 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(26, 20, 16, 0.08);
  border-bottom: 1px solid rgba(26, 20, 16, 0.08);
}

.tm-sheet__breakdown--final {
  margin-top: 16px;
  border-bottom: 0;
}

.tm-sheet__breakdown-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.9rem;
  padding: 4px 0;
}

.tm-sheet__breakdown-total {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(26, 20, 16, 0.08);
}

.tm-sheet__breakdown-num {
  color: var(--tawla-menu-price);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tm-sheet__breakdown-muted {
  opacity: 0.45;
  font-weight: 500;
}

/* شريط السلة السفلي — توسيط بدون transform (أقل مشاكل مع RTL وsubpixel) */
.tm-cartbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: auto;
  max-width: 596px;
  margin-inline: auto;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--tawla-ink);
  color: #fff;
  box-shadow: 0 10px 30px rgba(26, 20, 16, 0.2);
  z-index: 80;
  cursor: pointer;
  border: 0;
  font: inherit;
  text-align: start;
  box-sizing: border-box;
}

.tm-cartbar.is-visible {
  display: flex;
}

.tm-cartbar__cta {
  font-weight: 700;
  font-size: 0.95rem;
}

.tm-cartbar__meta {
  font-size: 0.82rem;
  color: var(--tawla-menu-price-on-dark);
  opacity: 1;
  font-variant-numeric: tabular-nums;
}

/* إشعارات داخل الصفحة (بدل alert المتصفح) */
.tm-toast-host {
  position: fixed;
  inset-inline: 12px;
  top: max(12px, env(safe-area-inset-top, 0px));
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.tm-toast {
  pointer-events: auto;
  max-width: min(420px, 100%);
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 8px 28px rgba(26, 20, 16, 0.18);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.tm-toast.is-in {
  opacity: 1;
  transform: translateY(0);
}

.tm-toast--ok {
  background: var(--tawla-ink);
  color: #fff;
}

.tm-toast--err {
  background: #fff8f5;
  color: #6b2e20;
  border: 1px solid rgba(217, 109, 44, 0.35);
}

/* خطأ تحميل */
.tm-error {
  padding: 24px 18px;
  max-width: 620px;
  margin-inline: auto;
}

.tm-error .tawla-alert {
  margin: 0;
}

/* ===== شريط CTA الديمو ===== */
.tm-demo-cta {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  inset-inline: 12px;
  max-width: 596px;
  margin-inline: auto;
  z-index: 75;
  border-radius: 18px;
  background: linear-gradient(135deg, #D96D2C 0%, #f28c3d 100%);
  box-shadow: 0 12px 36px rgba(217, 109, 44, 0.45), 0 2px 8px rgba(0,0,0,0.15);
  animation: tm-demo-cta-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tm-demo-cta-in {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.tm-demo-cta__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 16px;
  direction: rtl;
}

.tm-demo-cta__badge {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(255,255,255,0.22);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.tm-demo-cta__text {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tm-demo-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 12px;
  background: #fff;
  color: #D96D2C;
  font-weight: 800;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}

.tm-demo-cta__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  color: #c05a1f;
}

@media (max-width: 380px) {
  .tm-demo-cta__text { display: none; }
}

