/* ============================================================
   DIGITAL MENU — Design tokens & base styles
   Fonts: Cairo (Arabic) / Poppins (English)
   ============================================================ */

:root {
  /* Palette — "spice market" identity: brass, paprika, sage on parchment/ink */
  --ink: #1A1614;
  --ink-surface: #241E19;
  --ink-surface-2: #2E2620;
  --parchment: #FBF7F0;
  --parchment-surface: #FFFFFF;
  --parchment-surface-2: #F3EAD9;
  --brass: #C89B4A;
  --brass-strong: #B4863A;
  --paprika: #B5432B;
  --sage: #6E8B6A;
  --slate: #6B6259;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-soft: 0 8px 24px rgba(26, 22, 20, 0.08);
  --shadow-deep: 0 16px 40px rgba(26, 22, 20, 0.18);

  --font-ar: "Cairo", system-ui, sans-serif;
  --font-en: "Poppins", system-ui, sans-serif;
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --bg: var(--parchment);
  --surface: var(--parchment-surface);
  --surface-2: var(--parchment-surface-2);
  --text: #241E19;
  --text-muted: var(--slate);
  --border: rgba(36, 30, 25, 0.10);
}

/* Dark theme */
[data-theme="dark"] {
  --bg: var(--ink);
  --surface: var(--ink-surface);
  --surface-2: var(--ink-surface-2);
  --text: #F3EAD9;
  --text-muted: #B7AC9D;
  --border: rgba(243, 234, 217, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en);
  transition: background 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body, body.lang-ar { font-family: var(--font-ar); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.15s ease, background 0.15s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: var(--surface-2); }

.pill-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 3px;
  gap: 2px;
}
.pill-toggle button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.pill-toggle button.active {
  background: var(--brass);
  color: #fff;
}

.currency-select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------------- Hero ---------------- */

.hero {
  padding: 40px 20px 20px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0 0 8px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.hero p {
  color: var(--text-muted);
  margin: 0 auto 22px;
  max-width: 520px;
}

.search-wrap {
  max-width: 460px;
  margin: 0 auto;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 13px 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-start: 16px;
  opacity: 0.5;
}

/* ---------------- Category chips ---------------- */

.categories-bar {
  position: sticky;
  top: 68px;
  z-index: 30;
  background: var(--bg);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.categories-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 20px;
  scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip.active {
  background: var(--paprika);
  border-color: var(--paprika);
  color: #fff;
}

/* ---------------- Product grid ---------------- */

.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 34px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding-bottom: 60px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }

/* Signature element: calorie "seal" badge on the image corner */
.cal-badge {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--ink);
  color: #F3EAD9;
  border: 2px dashed var(--brass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: var(--shadow-soft);
}
.cal-badge b { font-size: 0.95rem; font-weight: 800; }
.cal-badge span { font-size: 0.5rem; opacity: 0.8; margin-top: 2px; }

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title {
  font-weight: 800;
  font-size: 1.02rem;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}

.price {
  font-weight: 800;
  color: var(--paprika);
  font-size: 1.05rem;
}

.badge-featured {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--sage);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 2.4rem; margin-bottom: 10px; }

.footer {
  text-align: center;
  padding: 30px 20px 50px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---------------- PWA install banner ---------------- */

.install-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 440px;
  margin: 0 auto;
  background: var(--ink);
  color: #F3EAD9;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-deep);
  z-index: 60;
  transform: translateY(150%);
  transition: transform 0.35s ease;
}
.install-banner.show { transform: translateY(0); }
.install-banner .txt { flex: 1; font-size: 0.86rem; }
.install-banner button.install {
  background: var(--brass);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
}
.install-banner button.dismiss {
  background: transparent;
  border: none;
  color: #B7AC9D;
  font-size: 1.1rem;
  padding: 4px 8px;
}

/* ---------------- Skeleton loading ---------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-lg);
  height: 260px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 560px) {
  .hero { padding: 28px 16px 16px; }
  .categories-bar { top: 64px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .card-body { padding: 12px; }
}
