// components.jsx — Steaks N Buns reusable UI library
// All components consume useSnb() for i18n + tweaks.

// ─── App shell: phone frame + page-level header & sticky bottom ────────────
// A "long phone" frame that shows the whole scrollable page in one tall card.
// Top has dynamic island + status bar; bottom has home indicator.
// Designed for canvas presentation (the canvas pans/zooms; the page itself
// doesn't scroll inside the frame — it's all visible).

function SnbPhoneFrame({ width = 402, children, height }) {
  return (
    <div style={{
      width, minHeight: height,
      borderRadius: 56, padding: 8,
      background: '#0a0a0a',
      boxShadow: '0 40px 80px rgba(10,29,16,0.18), 0 0 0 1px rgba(0,0,0,0.4)',
      position: 'relative',
    }}>
      <div style={{
        borderRadius: 48, overflow: 'hidden',
        background: 'var(--snb-cream)', position: 'relative',
      }}>
        {/* Status bar */}
        <div style={{
          height: 50, display: 'flex', alignItems: 'flex-end',
          padding: '0 28px 6px', justifyContent: 'space-between',
          fontFamily: '-apple-system, system-ui, sans-serif',
          fontSize: 15, fontWeight: 600, color: 'var(--snb-ink)',
          position: 'relative',
        }}>
          <span>9:41</span>
          <div style={{
            position: 'absolute', top: 11, left: '50%', transform: 'translateX(-50%)',
            width: 110, height: 32, borderRadius: 20, background: '#000',
          }} />
          <span style={{ display: 'inline-flex', gap: 5, alignItems: 'center' }}>
            <svg width="17" height="11" viewBox="0 0 17 11"><rect x="0" y="6.5" width="2.8" height="4" rx=".6" fill="currentColor"/><rect x="4.2" y="4.5" width="2.8" height="6" rx=".6" fill="currentColor"/><rect x="8.4" y="2.5" width="2.8" height="8" rx=".6" fill="currentColor"/><rect x="12.6" y=".5" width="2.8" height="10" rx=".6" fill="currentColor"/></svg>
            <svg width="15" height="11" viewBox="0 0 15 11"><path d="M7.5 3a6 6 0 0 1 5 2.5l1-1A7.5 7.5 0 0 0 1 4.5l1 1A6 6 0 0 1 7.5 3z" fill="currentColor"/><path d="M7.5 6a3 3 0 0 1 2.5 1.3l1-1A4.5 4.5 0 0 0 4 6.3l1 1A3 3 0 0 1 7.5 6z" fill="currentColor"/><circle cx="7.5" cy="9.5" r="1.3" fill="currentColor"/></svg>
            <svg width="24" height="11" viewBox="0 0 24 11"><rect x=".5" y=".5" width="21" height="10" rx="3" fill="none" stroke="currentColor" strokeOpacity=".35"/><rect x="2" y="2" width="18" height="7" rx="1.5" fill="currentColor"/></svg>
          </span>
        </div>
        {children}
        {/* Home indicator */}
        <div style={{
          position: 'sticky', bottom: 0,
          padding: '8px 0 10px',
          display: 'flex', justifyContent: 'center',
          background: 'linear-gradient(transparent, rgba(0,0,0,.05))',
        }}>
          <div style={{ width: 130, height: 5, borderRadius: 100, background: 'rgba(0,0,0,.3)' }} />
        </div>
      </div>
    </div>
  );
}

// ─── Mobile menu overlay (hamburger drawer) ────────────────────────────────
function SnbMobileMenu({ open, onClose, current }) {
  const { t, lang, dir } = useSnb();
  React.useEffect(() => {
    document.body.style.overflow = open ? 'hidden' : '';
    return () => { document.body.style.overflow = ''; };
  }, [open]);
  const links = [
    { k: 'nav_home', href: 'index.html', id: 'home' },
    { k: 'nav_menu', href: 'menu.html', id: 'menu' },
    { k: 'nav_about', href: 'about.html', id: 'about' },
    { k: 'nav_gallery', href: 'gallery.html', id: 'gallery' },
    { k: 'nav_contact', href: 'contact.html', id: 'contact' },
  ];
  return (
    <div style={{
      position: 'fixed', inset: 0, zIndex: 100,
      pointerEvents: open ? 'auto' : 'none',
    }}>
      {/* Backdrop */}
      <div onClick={onClose} style={{
        position: 'absolute', inset: 0,
        background: 'rgba(2,7,9,.55)', backdropFilter: 'blur(4px)',
        opacity: open ? 1 : 0, transition: 'opacity .25s ease',
      }} />
      {/* Drawer */}
      <aside style={{
        position: 'absolute', top: 0, bottom: 0, insetInlineStart: 0,
        width: 'min(82vw, 360px)',
        background: 'var(--snb-cream)', color: 'var(--snb-green-deep)',
        padding: '24px 28px 32px',
        display: 'flex', flexDirection: 'column',
        transform: open ? 'translateX(0)' : dir === 'rtl' ? 'translateX(100%)' : 'translateX(-100%)',
        transition: 'transform .3s cubic-bezier(.2,.7,.3,1)',
        boxShadow: '0 20px 60px rgba(0,0,0,.4)',
      }}>
        <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 32 }}>
          <SnbLogo src="assets/logo.png" size={92} />
          <button onClick={onClose} aria-label="Close menu" style={{
            background: 'rgba(28,38,28,.08)', border: 0,
            color: 'var(--snb-green-deep)', width: 38, height: 38, borderRadius: '50%',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer',
          }}><SnbIcon name="close" size={20} /></button>
        </div>
        <nav style={{ display: 'flex', flexDirection: 'column', gap: 4, flex: 1 }}>
          {links.map((l, i) => {
            const isActive = l.id === current;
            return (
              <a key={l.k} href={l.href} style={{
                display: 'flex', alignItems: 'center', justifyContent: 'space-between',
                padding: '18px 0', borderBottom: i < links.length - 1 ? '1px solid rgba(28,38,28,.12)' : 0,
                color: isActive ? 'var(--snb-green)' : 'var(--snb-green-deep)',
                textDecoration: 'none',
                fontFamily: 'var(--snb-display)', fontSize: 28, fontWeight: 700,
              }}>
                <span>{t(l.k)}</span>
                <SnbIcon name="chevR" size={18} />
              </a>
            );
          })}
        </nav>
        <div style={{ marginTop: 24, paddingTop: 20, borderTop: '1px solid rgba(28,38,28,.12)' }}>
          <a href="tel:+966599950112" style={{
            display: 'inline-flex', alignItems: 'center', gap: 10,
            padding: '14px 18px', borderRadius: 999,
            background: 'var(--snb-yellow)', color: 'var(--snb-green-deep)',
            fontSize: 14, fontWeight: 700, textDecoration: 'none', marginBottom: 16,
          }}>
            <SnbIcon name="phone" size={16} stroke={2.5} />
            +966 59 995 0112
          </a>
          <div style={{ display: 'inline-flex', borderRadius: 999, background: 'rgba(28,38,28,.08)', padding: 3, marginBottom: 14 }}>
            {['en', 'ar'].map(l => (
              <button key={l} onClick={() => window.snbSwitchLang(l)} style={{
                background: lang === l ? 'var(--snb-yellow)' : 'transparent',
                color: lang === l ? 'var(--snb-green-deep)' : 'rgba(28,38,28,.45)',
                border: 0, cursor: 'pointer',
                padding: '10px 22px', borderRadius: 999,
                fontWeight: 700, fontSize: 13, letterSpacing: '0.04em',
                minHeight: 38,
              }}>
                {l === 'en' ? 'EN' : 'AR'}
              </button>
            ))}
          </div>
          <div style={{ display: 'flex', gap: 10 }}>
            {[
              { k: 'instagram', href: SNB_SOCIAL.instagram },
              { k: 'tiktok', href: SNB_SOCIAL.tiktok },
              { k: 'snap', href: SNB_SOCIAL.snap },
              { k: 'wa', href: SNB_SOCIAL.whatsapp },
            ].map(s => (
              <a key={s.k} href={s.href} target="_blank" rel="noopener noreferrer" style={{
                width: 36, height: 36, borderRadius: '50%',
                background: 'rgba(28,38,28,.08)', color: 'var(--snb-green-deep)',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              }}>
                <SnbIcon name={s.k} size={15} />
              </a>
            ))}
          </div>
        </div>
      </aside>
    </div>
  );
}

// ─── Top navbar (sticky, in-page) ─────────────────────────────────────────
function SnbTopBar({ logoSrc, dark = false, current }) {
  const ctx = useSnb();
  const t = ctx.t;
  const cur = current || ctx.current || 'home';
  const [menuOpen, setMenuOpen] = React.useState(false);
  const fg = dark ? 'var(--snb-cream)' : 'var(--snb-green)';
  const bg = dark ? 'var(--snb-green)' : 'var(--snb-cream)';
  return (
    <>
      <header style={{
        position: 'sticky', top: 0, zIndex: 20,
        display: 'grid', gridTemplateColumns: '1fr auto 1fr', alignItems: 'center',
        padding: '6px 14px',
        background: bg, color: fg,
        borderBottom: dark ? '1px solid rgba(255,255,255,.08)' : '1px solid var(--snb-line)',
      }}>
        <button onClick={() => setMenuOpen(true)} aria-label="Open menu" style={{
          background: 'transparent', border: 0, color: fg, padding: 6,
          display: 'flex', justifySelf: 'start', cursor: 'pointer',
        }}>
          <SnbIcon name="menu" size={24} />
        </button>
        <a href="index.html" style={{ justifySelf: 'center', display: 'block' }}>
          <SnbLogo src={logoSrc} size={64} />
        </a>
        <a href="tel:+966599950112" style={{
          justifySelf: 'end',
          display: 'inline-flex', alignItems: 'center', gap: 6,
          padding: '8px 12px', borderRadius: 999,
          background: dark ? 'var(--snb-yellow)' : 'var(--snb-green)',
          color: dark ? 'var(--snb-green-deep)' : 'var(--snb-cream)',
          textDecoration: 'none', fontSize: 12, fontWeight: 700,
        }}>
          <SnbIcon name="phone" size={14} stroke={2.5} />
          <span>{t('cta_call')}</span>
        </a>
      </header>
      <SnbMobileMenu open={menuOpen} onClose={() => setMenuOpen(false)} current={cur} />
    </>
  );
}

// ─── Sticky mobile bottom CTA bar (Order / Call / Menu) ────────────────────
function SnbStickyBar() {
  const { t } = useSnb();
  return (
    <div style={{
      position: 'sticky', bottom: 24, zIndex: 30,
      margin: '0 12px',
      borderRadius: 999,
      background: 'var(--snb-green)', color: 'var(--snb-cream)',
      padding: 6,
      display: 'grid', gridTemplateColumns: '2fr 1fr 1fr', gap: 6,
      boxShadow: '0 20px 50px rgba(10,29,16,0.45)',
    }}>
      <a href="contact.html" style={{
        textDecoration: 'none',
        display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8,
        padding: '14px 16px', borderRadius: 999, border: 0,
        background: 'var(--snb-yellow)', color: 'var(--snb-green-deep)',
        fontWeight: 800, fontSize: 15,
      }}>
        <SnbIcon name="bag" size={18} stroke={2.5} />
        <span>{t('cta_order')}</span>
      </a>
      <a href="tel:+966599950112" style={{
        textDecoration: 'none',
        display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
        padding: 14, borderRadius: 999, border: 0,
        background: 'transparent', color: 'var(--snb-cream)',
        fontWeight: 700, fontSize: 13,
      }}>
        <SnbIcon name="phone" size={16} />
        <span>{t('sticky_call')}</span>
      </a>
      <a href="menu.html" style={{
        textDecoration: 'none',
        display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6,
        padding: 14, borderRadius: 999, border: 0,
        background: 'transparent', color: 'var(--snb-cream)',
        fontWeight: 700, fontSize: 13,
      }}>
        <SnbIcon name="menu" size={16} />
        <span>{t('sticky_menu')}</span>
      </a>
    </div>
  );
}

// ─── HERO variants ─────────────────────────────────────────────────────────
// All heroes share the same shell + props; variant just swaps image + copy.
function SnbHero({ variant = 'food', logoSrc }) {
  const { t, lang, dir, tweaks } = useSnb();
  const variants = {
    food:   { img: 'assets/menu/beef-burger.webp', h: 'hero_h1_food',   sub: 'hero_sub_food',   kicker: 'hero_kicker', tint: 'rgba(10,29,16,.55)' },
    combo:  { img: 'assets/menu/maple-crispy-spicy.webp', h: 'hero_h1_combo',  sub: 'hero_sub_combo',  kicker: 'hero_kicker', tint: 'rgba(10,29,16,.5)' },
    late:   { img: 'assets/gamer-burger.jpg',     h: 'hero_h1_late',   sub: 'hero_sub_late',   kicker: 'hero_kicker', tint: 'rgba(10,29,16,.4)' },
    family: { img: 'assets/saudi-eating.jpg',     h: 'hero_h1_family', sub: 'hero_sub_family', kicker: 'hero_kicker', tint: 'rgba(10,29,16,.5)' },
  };
  const v = variants[variant] || variants.food;
  return (
    <section style={{
      position: 'relative', minHeight: 560,
      display: 'flex', flexDirection: 'column', justifyContent: 'flex-end',
      padding: '32px 22px 36px',
      color: 'var(--snb-cream)',
      backgroundImage: `linear-gradient(to bottom, transparent 0%, ${v.tint} 50%, rgba(10,29,16,.9) 100%), url("${v.img}")`,
      backgroundSize: 'cover', backgroundPosition: 'center',
      overflow: 'hidden',
    }}>
      {/* Floating review badge */}
      <div style={{
        position: 'absolute', top: 20, [dir === 'rtl' ? 'left' : 'right']: 16,
        background: 'rgba(255,255,229,.95)', color: 'var(--snb-green)',
        padding: '8px 14px', borderRadius: 999,
        display: 'inline-flex', alignItems: 'center', gap: 8,
        fontSize: 12, fontWeight: 700,
        backdropFilter: 'blur(8px)',
      }}>
        <SnbStars value={4} size={12} />
        <span>{tweaks?.rating ?? 4.3} · {tweaks?.reviewCount ?? '586'}</span>
      </div>

      <div style={{
        display: 'inline-flex', alignItems: 'center', gap: 8,
        padding: '6px 10px', borderRadius: 999,
        background: 'rgba(224,205,47,.95)', color: 'var(--snb-green-deep)',
        fontWeight: 800, fontSize: 10, letterSpacing: '0.12em',
        alignSelf: 'flex-start', marginBottom: 14,
      }}>
        <span style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--snb-green)' }} />
        {t(v.kicker)}
      </div>
      <h1 className="snb-display" style={{
        fontSize: lang === 'ar' ? 42 : 44, margin: 0, marginBottom: 14,
        textWrap: 'balance', maxWidth: 360,
      }}>
        {t(v.h)}
      </h1>
      <p style={{
        margin: 0, marginBottom: 22,
        fontSize: 15, lineHeight: 1.5, opacity: .92, maxWidth: 340,
      }}>{t(v.sub)}</p>
      <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
        <a href={SNB_SOCIAL.hungerstation} target="_blank" rel="noopener noreferrer" className="snb-btn snb-btn-yellow" style={{ padding: '16px 26px', fontSize: 16 }}>
          <SnbIcon name="bag" size={16} stroke={2.5} />
          {t('cta_order')}
        </a>
        <a href="menu.html" className="snb-btn snb-btn-cream" style={{ padding: '16px 22px', fontSize: 15 }}>
          {t('cta_menu')}
        </a>
      </div>
    </section>
  );
}

// ─── Trust bar ─────────────────────────────────────────────────────────────
function SnbTrustBar() {
  const { t } = useSnb();
  const items = [
    { icon: 'star',  k: 'trust_rating',   hi: true },
    { icon: 'moon',  k: 'trust_late' },
    { icon: 'bike',  k: 'trust_delivery' },
    { icon: 'fire',  k: 'trust_price' },
  ];
  return (
    <div style={{
      background: 'var(--snb-green-deep)', color: 'var(--snb-cream)',
      padding: '14px 16px',
      display: 'flex', overflowX: 'auto', gap: 18,
      fontSize: 12, fontWeight: 600,
    }}>
      {items.map((it, i) => (
        <div key={i} style={{
          display: 'flex', alignItems: 'center', gap: 8, whiteSpace: 'nowrap',
          color: it.hi ? 'var(--snb-yellow)' : 'var(--snb-cream)',
        }}>
          <SnbIcon name={it.icon} size={16} />
          <span>{t(it.k)}</span>
        </div>
      ))}
    </div>
  );
}

// ─── Order mode grid ───────────────────────────────────────────────────────
function SnbOrderModes({ active = 'delivery' }) {
  const { t } = useSnb();
  const modes = [
    { id: 'delivery',  icon: 'bike',  k: 'mode_delivery',  s: 'mode_delivery_sub' },
    { id: 'takeaway',  icon: 'bag',   k: 'mode_takeaway',  s: 'mode_takeaway_sub' },
    { id: 'dinein',    icon: 'chair', k: 'mode_dinein',    s: 'mode_dinein_sub' },
    { id: 'nocontact', icon: 'box',   k: 'mode_nocontact', s: 'mode_nocontact_sub' },
  ];
  return (
    <section className="snb-section tight">
      <h2 className="snb-display" style={{ fontSize: 28, margin: '0 0 16px' }}>{t('order_mode_h')}</h2>
      <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10 }}>
        {modes.map(m => {
          const isActive = m.id === active;
          return (
            <button key={m.id} style={{
              textAlign: 'inherit', cursor: 'pointer',
              padding: '16px 14px', borderRadius: 18,
              border: 0,
              background: isActive ? 'var(--snb-green)' : 'var(--snb-paper)',
              color: isActive ? 'var(--snb-cream)' : 'var(--snb-ink)',
              boxShadow: isActive
                ? '0 12px 28px rgba(29,58,37,.28)'
                : 'inset 0 0 0 1.5px var(--snb-line)',
              display: 'flex', flexDirection: 'column', gap: 8,
              minHeight: 110,
              position: 'relative',
            }}>
              <span style={{
                width: 38, height: 38, borderRadius: 12,
                background: isActive ? 'rgba(224,205,47,.2)' : 'var(--snb-cream)',
                color: isActive ? 'var(--snb-yellow)' : 'var(--snb-green)',
                display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              }}>
                <SnbIcon name={m.icon} size={20} stroke={2.2} />
              </span>
              <div style={{ fontWeight: 700, fontSize: 15 }}>{t(m.k)}</div>
              <div style={{ fontSize: 11, opacity: .7, lineHeight: 1.3 }}>{t(m.s)}</div>
              {isActive && (
                <span style={{
                  position: 'absolute', top: 10, right: 10,
                  width: 18, height: 18, borderRadius: '50%',
                  background: 'var(--snb-yellow)', color: 'var(--snb-green-deep)',
                  display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
                }}>
                  <SnbIcon name="check" size={12} stroke={3} />
                </span>
              )}
            </button>
          );
        })}
      </div>
    </section>
  );
}

// ─── Menu category tabs (horizontal scroll) ────────────────────────────────
function SnbCategoryTabs({ active = 'burgers', onChange }) {
  const { t } = useSnb();
  const cats = [
    { id: 'all',         icon: '🍽️', k: 'cat_all' },
    { id: 'burgers',     icon: '🍔', k: 'cat_burgers' },
    { id: 'sandwiches',  icon: '🥪', k: 'cat_sandwiches' },
    { id: 'appetizers',  icon: '🍟', k: 'cat_appetizers' },
    { id: 'drinks',      icon: '🥤', k: 'cat_drinks' },
    { id: 'kids',        icon: '🧒', k: 'cat_kids' },
    { id: 'sauces',      icon: '🥫', k: 'cat_sauces' },
  ];
  return (
    <div style={{
      position: 'sticky', top: 64, zIndex: 10,
      background: 'var(--snb-cream)', padding: '12px 0',
      borderBottom: '1px solid var(--snb-line)',
    }}>
      <div style={{
        display: 'flex', gap: 8, overflowX: 'auto',
        padding: '0 16px', scrollbarWidth: 'none',
      }}>
        {cats.map(c => {
          const isActive = c.id === active;
          return (
            <button key={c.id} onClick={() => onChange?.(c.id)} style={{
              flex: '0 0 auto', cursor: 'pointer', border: 0,
              padding: '10px 16px', borderRadius: 999,
              background: isActive ? 'var(--snb-green)' : 'var(--snb-paper)',
              color: isActive ? 'var(--snb-cream)' : 'var(--snb-ink)',
              fontWeight: 600, fontSize: 13,
              boxShadow: isActive ? '0 6px 16px rgba(29,58,37,.25)' : 'inset 0 0 0 1px var(--snb-line)',
              display: 'inline-flex', alignItems: 'center', gap: 6,
            }}>
              <span aria-hidden>{c.icon}</span>
              {t(c.k)}
            </button>
          );
        })}
      </div>
    </div>
  );
}

// ─── Menu item card ────────────────────────────────────────────────────────
function SnbMenuItem({ item, layout = 'row' }) {
  const { t, lang } = useSnb();
  const name = item.name?.[lang] || item.name?.en || item.name;
  const desc = item.desc?.[lang] || item.desc?.en || item.desc;
  if (layout === 'tile') {
    return (
      <article className="snb-card" style={{ overflow: 'hidden' }}>
        <div style={{
          aspectRatio: '1 / 0.85',
          background: `url("${item.img}") center/cover, var(--snb-cream-2)`,
          position: 'relative',
        }}>
          {item.badge && (
            <span style={{
              position: 'absolute', top: 10, left: 10,
              padding: '4px 10px', borderRadius: 999,
              background: 'var(--snb-yellow)', color: 'var(--snb-green-deep)',
              fontSize: 10, fontWeight: 800, letterSpacing: '.06em',
            }}>{item.badge}</span>
          )}
        </div>
        <div style={{ padding: '12px 14px 14px' }}>
          <h3 style={{ margin: 0, fontSize: 15, fontWeight: 700 }}>{name}</h3>
          {desc && <p style={{ margin: '4px 0 10px', fontSize: 12, color: 'var(--snb-ink-soft)', lineHeight: 1.4 }}>{desc}</p>}
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
            <div style={{ fontWeight: 800, color: 'var(--snb-green)', fontSize: 16 }}>
              {item.price}<span style={{ fontSize: 11, marginInlineStart: 3, opacity: .65 }}>{t('sar')}</span>
              {item.cal && <span style={{ fontSize: 11, color: 'var(--snb-ink-faint)', marginInlineStart: 8, fontWeight: 500 }}>· {item.cal} {t('cal')}</span>}
            </div>
            <button style={{
              border: 0, width: 32, height: 32, borderRadius: '50%',
              background: 'var(--snb-green)', color: 'var(--snb-cream)',
              display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
              cursor: 'pointer',
            }}>
              <SnbIcon name="plus" size={18} stroke={3} />
            </button>
          </div>
        </div>
      </article>
    );
  }
  // row layout (default — menu page)
  return (
    <article style={{
      display: 'grid', gridTemplateColumns: '1fr 96px', gap: 12,
      padding: '14px 0', borderBottom: '1px solid var(--snb-line)',
      alignItems: 'center',
    }}>
      <div>
        <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 }}>
          <h3 style={{ margin: 0, fontSize: 15, fontWeight: 700 }}>{name}</h3>
          {item.badge && (
            <span style={{
              padding: '2px 6px', borderRadius: 4,
              background: 'var(--snb-yellow)', color: 'var(--snb-green-deep)',
              fontSize: 9, fontWeight: 800, letterSpacing: '.06em',
            }}>{item.badge}</span>
          )}
        </div>
        {desc && <p style={{ margin: '0 0 8px', fontSize: 12, color: 'var(--snb-ink-soft)', lineHeight: 1.4 }}>{desc}</p>}
        <div style={{ display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap' }}>
          <span style={{ fontWeight: 800, color: 'var(--snb-green)', fontSize: 15 }}>
            {item.price}<span style={{ fontSize: 11, marginInlineStart: 3, opacity: .65 }}>{t('sar')}</span>
          </span>
          {item.cal != null && <span style={{ fontSize: 11, color: 'var(--snb-ink-faint)' }}>{item.cal} {t('cal')}</span>}
        </div>
      </div>
      <div style={{ position: 'relative' }}>
        <div style={{
          aspectRatio: '1 / 1',
          background: `url("${item.img}") center/cover, var(--snb-cream-2)`,
          borderRadius: 14,
        }} />
        <button style={{
          position: 'absolute', bottom: -6, right: -6,
          border: 0, width: 32, height: 32, borderRadius: '50%',
          background: 'var(--snb-green)', color: 'var(--snb-cream)',
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          cursor: 'pointer', boxShadow: '0 4px 10px rgba(10,29,16,.25)',
        }}>
          <SnbIcon name="plus" size={18} stroke={3} />
        </button>
      </div>
    </article>
  );
}

// ─── Review card ───────────────────────────────────────────────────────────
function SnbReview({ author, locale, stars, body, when }) {
  const { lang } = useSnb();
  return (
    <article style={{
      flex: '0 0 88%', scrollSnapAlign: 'start',
      background: 'var(--snb-paper)', borderRadius: 20, padding: 18,
      boxShadow: 'inset 0 0 0 1px var(--snb-line)',
      display: 'flex', flexDirection: 'column', gap: 10,
    }}>
      <SnbStars value={stars} size={14} />
      <p style={{ margin: 0, fontSize: 14, lineHeight: 1.55, color: 'var(--snb-ink)' }}>
        "{body?.[lang] || body?.en || body}"
      </p>
      <div style={{ display: 'flex', alignItems: 'center', gap: 10, marginTop: 'auto', paddingTop: 4 }}>
        <div style={{
          width: 32, height: 32, borderRadius: '50%',
          background: 'var(--snb-green)', color: 'var(--snb-cream)',
          display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          fontWeight: 700, fontSize: 13,
        }}>{author?.charAt(0)}</div>
        <div style={{ flex: 1, minWidth: 0 }}>
          <div style={{ fontSize: 13, fontWeight: 600 }}>{author}</div>
          <div style={{ fontSize: 11, color: 'var(--snb-ink-faint)' }}>{locale} · {when}</div>
        </div>
        <svg width="48" height="14" viewBox="0 0 48 14" aria-hidden>
          <text x="0" y="11" fontSize="11" fontWeight="700" fill="var(--snb-ink-soft)">Google</text>
        </svg>
      </div>
    </article>
  );
}

// ─── Section header (eyebrow + title) ──────────────────────────────────────
function SnbSectionHead({ kicker, title, sub }) {
  return (
    <header style={{ marginBottom: 18 }}>
      {kicker && <div className="snb-eyebrow" style={{ marginBottom: 8 }}>{kicker}</div>}
      <h2 className="snb-display" style={{ fontSize: 30, margin: '0 0 6px', lineHeight: 1.05 }}>{title}</h2>
      {sub && <p style={{ margin: 0, color: 'var(--snb-ink-soft)', fontSize: 14, lineHeight: 1.5 }}>{sub}</p>}
    </header>
  );
}

// ─── Final CTA banner ──────────────────────────────────────────────────────
function SnbFinalCTA() {
  const { t } = useSnb();
  return (
    <section style={{
      background: 'var(--snb-green)', color: 'var(--snb-cream)',
      padding: '40px 22px 50px', position: 'relative', overflow: 'hidden',
    }}>
      <SnbCheckerStripe height={28} />
      <div style={{ padding: '28px 0 8px' }}>
        <h2 className="snb-display" style={{ fontSize: 32, margin: '0 0 10px', lineHeight: 1.05 }}>
          {t('final_cta_h')}
        </h2>
        <p style={{ margin: '0 0 22px', opacity: .85, fontSize: 14 }}>{t('final_cta_sub')}</p>
        <div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
          <a href={SNB_SOCIAL.hungerstation} target="_blank" rel="noopener noreferrer" className="snb-btn snb-btn-yellow" style={{ padding: '15px 24px' }}>
            <SnbIcon name="bag" size={16} stroke={2.5} />
            {t('cta_order')}
          </a>
          <a href={SNB_SOCIAL.phone} className="snb-btn" style={{
            background: 'transparent', color: 'var(--snb-cream)',
            boxShadow: 'inset 0 0 0 2px var(--snb-cream)', padding: '15px 24px',
          }}>
            <SnbIcon name="phone" size={16} stroke={2.5} />
            {t('cta_call')}
          </a>
        </div>
      </div>
    </section>
  );
}

// ─── Footer ────────────────────────────────────────────────────────────────
function SnbFooter() {
  const { t } = useSnb();
  const links = [
    { k: 'nav_home',    href: 'index.html' },
    { k: 'nav_menu',    href: 'menu.html' },
    { k: 'nav_about',   href: 'about.html' },
    { k: 'nav_gallery', href: 'gallery.html' },
    { k: 'nav_contact', href: 'contact.html' },
  ];
  return (
    <footer style={{
      background: 'var(--snb-cream)', color: 'var(--snb-green-deep)',
      borderTop: '1px solid var(--snb-line)',
      padding: '32px 22px 28px',
    }}>
      <a href="index.html" style={{ display: 'inline-block', textDecoration: 'none' }}>
        <SnbLogo src="assets/logo.png" size={92} />
      </a>
      <div style={{ marginTop: 16, fontSize: 12, color: 'var(--snb-ink-soft)', lineHeight: 1.6 }}>
        {t('contact_addr')}<br />
        +966 59 995 0112
      </div>
      <nav style={{
        marginTop: 20, paddingTop: 18,
        borderTop: '1px solid var(--snb-line)',
        display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 10,
      }}>
        {links.map(l => (
          <a key={l.k} href={l.href} style={{ color: 'var(--snb-green-deep)', textDecoration: 'none', fontSize: 13, fontWeight: 600 }}>
            {t(l.k)}
          </a>
        ))}
      </nav>
      <div style={{ marginTop: 20, display: 'flex', gap: 10 }}>
        {[
          { k: 'instagram', href: SNB_SOCIAL.instagram },
          { k: 'tiktok',    href: SNB_SOCIAL.tiktok },
          { k: 'snap',      href: SNB_SOCIAL.snap },
          { k: 'wa',        href: SNB_SOCIAL.whatsapp },
        ].map(s => (
          <a key={s.k} href={s.href} target="_blank" rel="noopener noreferrer" style={{
            width: 36, height: 36, borderRadius: '50%',
            background: 'var(--snb-green)', color: 'var(--snb-cream)',
            display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
          }}>
            <SnbIcon name={s.k} size={16} />
          </a>
        ))}
      </div>
      <div style={{ marginTop: 24, fontSize: 11, color: 'var(--snb-ink-faint)' }}>
        © 2026 Steaks N Buns · {t('since')}
      </div>
    </footer>
  );
}

Object.assign(window, {
  SnbPhoneFrame, SnbTopBar, SnbStickyBar,
  SnbHero, SnbTrustBar, SnbOrderModes,
  SnbCategoryTabs, SnbMenuItem, SnbReview,
  SnbSectionHead, SnbFinalCTA, SnbFooter,
});
