/* ═══════════════════════════════════════════════════════════
   menulee — Public Menu Base Styles (ml-* class system)
   Templates override colors/fonts. This handles structure.
   ═══════════════════════════════════════════════════════════ */

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

html { scroll-behavior: smooth; }

body {
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  /* Neutral fallback when no template is set */
  background: #f9fafb;
  color: #111827;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Container ───────────────────────────────────────────── */
#public-menu-container {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 4rem;
}

/* ── Header ─────────────────────────────────────────────── */
.ml-header { /* Template styles this */ }

.ml-restaurant-name { line-height: 1.15; }

.ml-restaurant-desc { line-height: 1.5; }

/* ── Category ───────────────────────────────────────────── */
.ml-category { /* Template styles this */ }

.ml-category-title { line-height: 1.3; }

/* ── Item List (default: stacked list) ──────────────────── */
.ml-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ml-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.ml-item-body {
  flex: 1;
  min-width: 0;
}

.ml-item-name { line-height: 1.3; }
.ml-item-desc { line-height: 1.4; }

.ml-item-price {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Image handling ─────────────────────────────────────── */
.ml-item-image {
  display: none;       /* Hidden by default when no image */
  overflow: hidden;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 8px;
}

.ml-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Show the image wrapper when has-image class is present or img exists */
.ml-item.has-image .ml-item-image,
.ml-item-image:has(img) {
  display: block;
}

/* ── Grid Layout ────────────────────────────────────────── */
[data-layout="grid"] .ml-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

[data-layout="grid"] .ml-item {
  flex-direction: column;
  gap: 0;
}

[data-layout="grid"] .ml-item-image {
  width: 100%;
  height: 120px;
  border-radius: 8px 8px 0 0;
}

[data-layout="grid"] .ml-item-body {
  flex: none;
  width: 100%;
}

[data-layout="grid"] .ml-item-price {
  align-self: flex-start;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 2px; }

/* ── No-JS / loading state ──────────────────────────────── */
.ml-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  flex-direction: column;
  gap: 1rem;
  color: #6b7280;
}
