/* ===== MenuKhana public menu ===== */
:root {
  --brand: #d09630; /* overridden per tenant from AppSettings.theme_color */
  --brand-soft: color-mix(in srgb, var(--brand) 14%, transparent);
  --brand-strong: color-mix(in srgb, var(--brand) 82%, #000);
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #f1eee9;
  --text: #1d1b19;
  --muted: #6f6a63;
  --line: #e7e2db;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --gutter: 16px;
  --max: 1100px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --surface: #1c1a18;
    --surface-2: #262320;
    --text: #f3efe9;
    --muted: #a59e94;
    --line: #2f2b27;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --brand-soft: color-mix(in srgb, var(--brand) 22%, transparent);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", "Tajawal", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px; /* room for the cart bar */
}

[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 230px;
  background: var(--brand-strong) center / cover no-repeat;
  background-image: var(--cover, linear-gradient(135deg, var(--brand), var(--brand-strong)));
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.brand-card {
  position: relative;
  z-index: 1;
  margin-top: -64px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.brand-card__head { display: flex; align-items: center; gap: 14px; }

.brand-card__logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  margin-top: -44px;
  flex-shrink: 0;
}

.brand-card__name { margin: 0; font-size: 1.45rem; font-weight: 700; line-height: 1.3; }
.brand-card__desc { margin: 0; color: var(--muted); font-size: 0.95rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.chip i { color: var(--brand); }
.chip:hover { background: var(--brand-soft); }

.notice {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}

.notice i { color: var(--brand); margin-top: 4px; }
.notice p { margin: 0; white-space: pre-line; }

/* ===== Sections ===== */
.section { margin-top: 32px; }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section__title { margin: 0; font-size: 1.2rem; font-weight: 700; }

.slider-controls { display: none; gap: 8px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: background 0.2s, transform 0.2s var(--ease);
}

.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }

/* ===== Specials carousel ===== */
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78%, 300px);
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar { display: none; }
.carousel > * { scroll-snap-align: start; }

/* ===== Categories ===== */
.categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.category-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: var(--shadow);
  isolation: isolate;
}

.category-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
  z-index: -2;
}

.category-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.72));
  z-index: -1;
}

.category-card:hover img { transform: scale(1.06); }

.category-card__label {
  position: absolute;
  inset-inline: 14px;
  bottom: 12px;
  color: #fff;
}

.category-card__label h3 { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.category-card__label span { font-size: 0.8rem; opacity: 0.85; }

/* ===== Category page top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar__row { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.topbar__title { margin: 0; font-size: 1.1rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

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

.cat-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.cat-tab[aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.search {
  position: relative;
  margin-top: 16px;
}

.search i {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.category-intro { margin: 12px 0 0; color: var(--muted); }

/* ===== Product cards ===== */
.products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.product {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}

.product__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

.product__media img { width: 100%; height: 100%; object-fit: cover; }

.placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
}

.badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.product__body { display: flex; flex-direction: column; gap: 4px; padding: 12px; flex: 1; }
.product__name { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.4; }

.product__desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product__foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.price { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.price small { font-weight: 500; color: var(--muted); font-size: 0.75rem; }

/* list view */
.products--list { grid-template-columns: 1fr; }
.products--list .product { flex-direction: row; }
.products--list .product__media { width: 112px; aspect-ratio: auto; flex-shrink: 0; }
.products--list .product__media .badge { top: 8px; inset-inline-start: 8px; font-size: 0.7rem; }

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-state i { font-size: 2.2rem; color: var(--brand); margin-bottom: 10px; display: block; }

/* ===== Add / stepper ===== */
.stepper { display: inline-flex; align-items: center; }

.add-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--brand) 40%, transparent);
  transition: transform 0.2s var(--ease);
}

.add-btn:active { transform: scale(0.9); }

.qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 3px;
}

.qty button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}

.qty button:active { transform: scale(0.9); }
.qty span { min-width: 20px; text-align: center; font-weight: 700; }

.pop { animation: pop 0.35s var(--ease); }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ===== Feedback CTA ===== */
.feedback-cta {
  margin-top: 40px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.feedback-cta h2 { margin: 0; font-size: 1.05rem; }
.feedback-cta p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s var(--ease), background 0.2s, opacity 0.2s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--block { width: 100%; }
.btn--brand { background: var(--brand); color: #fff; }
.btn--brand:hover { background: var(--brand-strong); }
.btn--whatsapp { background: #25d366; color: #fff; }
.btn--whatsapp:hover { background: #1fb857; }
.btn--ghost { background: var(--surface-2); color: var(--text); }
.btn--ghost:hover { background: var(--line); }
.btn--danger-text { background: none; color: #d64545; padding: 6px 10px; font-size: 0.85rem; }

/* ===== Footer ===== */
.footer {
  margin-top: 40px;
  padding-block: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.socials { display: flex; justify-content: center; gap: 10px; margin-bottom: 16px; }

.social {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  text-decoration: none;
  transition: transform 0.2s var(--ease), color 0.2s;
}

.social:hover { transform: translateY(-2px); color: var(--brand); }
.footer p { margin: 4px 0; }
.footer a { color: var(--text); font-weight: 600; text-decoration: none; }

/* ===== Cart bar ===== */
.cart-bar {
  position: fixed;
  z-index: 30;
  inset-inline: var(--gutter);
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 560px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  border-radius: 18px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  transform: translateY(160%);
  visibility: hidden;
  transition: transform 0.4s var(--ease), visibility 0.4s;
}

.cart-bar.is-visible { transform: translateY(0); visibility: visible; }

.cart-bar__count {
  min-width: 30px;
  height: 30px;
  padding-inline: 8px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.cart-bar__label { flex: 1; text-align: start; font-weight: 600; }
.cart-bar__total { font-weight: 700; }

/* ===== Sheet (cart drawer) ===== */
.sheet { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.sheet.is-open { visibility: visible; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.3s;
}

.sheet.is-open .sheet__backdrop { opacity: 1; }

.sheet__panel {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease);
}

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

.sheet__grip {
  width: 44px;
  height: 5px;
  border-radius: 99px;
  background: var(--line);
  margin: 10px auto 0;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.sheet__head h2 { margin: 0; font-size: 1.15rem; }
.sheet__body { overflow-y: auto; padding: 16px 20px 24px; overscroll-behavior: contain; }

.cart-items { display: grid; gap: 10px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { margin: 0; font-weight: 600; font-size: 0.95rem; }
.cart-item__price { color: var(--muted); font-size: 0.85rem; }

.summary {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.05rem;
}

.form-title { margin: 24px 0 10px; font-size: 1rem; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 0.88rem; font-weight: 600; }

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input.is-invalid { border-color: #d64545; }
textarea.input { min-height: 84px; resize: vertical; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}

.segmented input { position: absolute; opacity: 0; pointer-events: none; }

.segmented label {
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.segmented input:checked + label { background: var(--surface); box-shadow: var(--shadow); color: var(--brand-strong); }
.segmented input:focus-visible + label { outline: 3px solid var(--brand); }

.actions { display: grid; gap: 10px; margin-top: 18px; }

/* ===== Dialog ===== */
.dialog {
  width: min(92vw, 460px);
  border: none;
  border-radius: 22px;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog form { padding: 20px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog__head h2 { margin: 0; font-size: 1.1rem; }

/* ===== Toast ===== */
.toast-stack {
  position: fixed;
  z-index: 60;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px);
  inset-inline: 16px;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--ease);
}

.toast--error { background: #d64545; color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Larger screens ===== */
@media (min-width: 640px) {
  .qty button { width: 32px; height: 32px; }
  .categories { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .products { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .products--list { grid-template-columns: repeat(2, 1fr); }
  .hero { min-height: 300px; }
  .brand-card { padding: 24px 28px; }
  .brand-card__logo { width: 96px; height: 96px; margin-top: -56px; }
  .brand-card__name { font-size: 1.75rem; }
  .carousel { grid-auto-columns: 280px; margin-inline: 0; padding-inline: 0; }
  .slider-controls { display: flex; }
}

@media (min-width: 960px) {
  :root { --gutter: 24px; }
  .categories { grid-template-columns: repeat(4, 1fr); }
  .products { grid-template-columns: repeat(4, 1fr); }
  .products--list { grid-template-columns: repeat(2, 1fr); }
  .hero { min-height: 340px; }
  .product:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

  /* cart becomes a side drawer on the inline-end (left in RTL) */
  .sheet__panel {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 440px;
    max-height: none;
    border-radius: 0;
    transform: translateX(-100%);
  }
  .sheet.is-open .sheet__panel { transform: translateX(0); }
  .sheet__grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
