// Sahh — landing page sections
// Each section is a self-contained band that drops into the page in order.

// ============================================================
// HERO
// ============================================================
const Hero = ({ t, dir, sample }) => {
  const ar = dir === "rtl";
  const H = t.hero;
  return (
    <section className="hero">
      <div className="hero-grid-bg" />
      <div className="hero-orb" style={{ top: -200, [ar ? "left" : "right"]: -180 }} />
      <div className="hero-content">
        <div className="fade-in">
          <span className="chip chip-green" style={{ marginBottom: 4 }}>
            <Icon name="shield" size={13} color="var(--green)" />
            <span>{H.eyebrow}</span>
          </span>
          <h1>
            {H.h1a}<br/>
            {H.h1b} <em>{H.h1c}</em>
          </h1>
          <p className="lede">{H.lede}</p>
          <div className="hero-ctas">
            <button className="btn btn-primary btn-lg">
              {H.ctaA}
              <Icon name="arrow" size={15} />
            </button>
            <button className="btn btn-outline btn-lg">
              <Icon name="play" size={13} />
              {H.ctaB}
            </button>
          </div>
          <div className="hero-meta">
            <div className="row" style={{ gap: 10 }}>
              <div style={{ display: "flex" }}>
                {["#0A5E3E","#1F7E5C","#3B9D7B","#6CC9A3"].map((c, i) => (
                  <div key={i} style={{
                    width: 28, height: 28, borderRadius: "50%",
                    background: c, color: "#fff",
                    display: "grid", placeItems: "center",
                    fontSize: 11, fontWeight: 700,
                    border: "2px solid var(--paper)",
                    marginInlineStart: i === 0 ? 0 : -10,
                  }}>{["N","B","S","K"][i]}</div>
                ))}
              </div>
              <div>
                <div><b>{H.metaCount}</b> {H.meta2}</div>
                <div style={{ fontSize: 11, color: "var(--ink-4)", marginTop: 1 }}>{H.meta1}</div>
              </div>
            </div>
            <div className="row" style={{ gap: 6 }}>
              <Icon name="check-c" size={14} color="var(--green)" />
              <span>{H.meta3}</span>
            </div>
          </div>
        </div>
        <div className="fade-in" style={{ animationDelay: "0.15s", position: "relative" }}>
          <DashboardMockup dir={dir} compact />
          {/* floating dish card */}
          <div style={{
            position: "absolute",
            bottom: -36,
            [ar ? "right" : "left"]: -28,
            width: 280,
            transform: ar ? "rotate(2deg)" : "rotate(-2deg)",
            zIndex: 3,
          }}>
            <DishCard s={sample} dir={dir} compact scoreSize={64} />
          </div>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// LOGO STRIP
// ============================================================
const LogoStrip = ({ t }) => (
  <section className="section-tighter" style={{ borderTop: "1px solid var(--hair)", borderBottom: "1px solid var(--hair)" }}>
    <div className="container">
      <div style={{ textAlign: "center", marginBottom: 28 }}>
        <span className="eyebrow">{t.logos}</span>
      </div>
      <div style={{
        display: "grid",
        gridTemplateColumns: "repeat(6, 1fr)",
        gap: 16,
        alignItems: "center",
      }}>
        {["Najd Kitchen", "Maraheb", "Bait Mandi", "Cafe Nouri", "Sufra Group", "Dunes Hotel"].map((n, i) => (
          <div key={i} style={{
            textAlign: "center",
            color: "var(--ink-4)",
            fontFamily: "var(--f-display)",
            fontWeight: 600,
            fontSize: 16,
            letterSpacing: "-0.01em",
            opacity: 0.8,
          }}>{n}</div>
        ))}
      </div>
    </div>
  </section>
);

// ============================================================
// SECTION 01 — SAHH SCORE
// ============================================================
const ScoreSection = ({ t, dir, sample }) => {
  const S = t.sectionScore;
  const ar = dir === "rtl";
  return (
    <section className="section">
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 80, alignItems: "center" }} className="grid-flip">
          <div>
            <div className="section-head" style={{ marginBottom: 32 }}>
              <div className="eyebrow eyebrow-green">{S.eyebrow}</div>
              <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px 0", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{S.h2}</h2>
              <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: 0 }}>{S.lede}</p>
            </div>
            {/* Score breakdown */}
            <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
              {[
                [ar ? "السعرات والكثافة" : "Calories & density", 88],
                [ar ? "توازن الماكروز" : "Macro balance", 92],
                [ar ? "المغذّيات الدقيقة" : "Micronutrients", 78],
                [ar ? "المعالجة والإضافات" : "Processing & additives", 82],
                [ar ? "الطزاجة والأصل" : "Freshness & sourcing", 86],
              ].map(([l, v], i) => (
                <div key={i} className="row" style={{ gap: 16 }}>
                  <div style={{ flex: 1, fontSize: 13, fontWeight: 500, color: "var(--ink-2)" }}>{l}</div>
                  <div style={{
                    flex: 2,
                    height: 6,
                    background: "var(--paper-2)",
                    borderRadius: 999,
                    overflow: "hidden",
                  }}>
                    <div style={{
                      width: v + "%",
                      height: "100%",
                      background: "var(--green)",
                      borderRadius: 999,
                    }} />
                  </div>
                  <div className="mono tnum" style={{ width: 30, textAlign: "end", fontWeight: 600, fontSize: 13 }}>{v}</div>
                </div>
              ))}
            </div>
            <div style={{
              marginTop: 28,
              padding: 20,
              background: "var(--green-soft)",
              border: "1px solid var(--green-tint)",
              borderRadius: 16,
              display: "flex",
              gap: 14,
            }}>
              <Icon name="leaf" size={20} color="var(--green)" />
              <div>
                <div style={{ fontWeight: 700, fontSize: 14, color: "var(--green-3)", marginBottom: 2 }}>{S.tagsTitle}</div>
                <div style={{ fontSize: 13, color: "var(--ink-2)", lineHeight: 1.5 }}>{S.tagsLede}</div>
              </div>
            </div>
          </div>

          {/* Big score visual */}
          <div style={{ position: "relative" }}>
            <div style={{
              background: "var(--paper-2)",
              borderRadius: 28,
              padding: 48,
              border: "1px solid var(--hair)",
              display: "grid",
              placeItems: "center",
              position: "relative",
              overflow: "hidden",
            }}>
              <div aria-hidden style={{
                position: "absolute", inset: 0,
                backgroundImage: "radial-gradient(circle at 50% 50%, rgba(10,94,62,0.04) 0%, transparent 60%)",
              }} />
              <SahhScoreRing value={86} size={280} />
              <div style={{ marginTop: 24, textAlign: "center" }}>
                <div style={{ fontSize: 11, color: "var(--ink-3)", letterSpacing: "0.14em", textTransform: "uppercase", fontWeight: 600, fontFamily: "var(--f-mono)", marginBottom: 6 }}>
                  {sample.dishName}
                </div>
                <div style={{ display: "flex", gap: 6, justifyContent: "center", flexWrap: "wrap" }}>
                  {sample.tags.map((tag, i) => (
                    <span key={i} className="chip chip-lime" style={{ fontSize: 11 }}>{tag}</span>
                  ))}
                </div>
              </div>
            </div>
            {/* score ranges */}
            <div style={{
              marginTop: 16,
              display: "grid",
              gridTemplateColumns: "1fr 1fr 1fr 1fr",
              gap: 8,
            }}>
              {[
                ["80–100", ar ? "ممتاز" : "Excellent", "var(--green)"],
                ["65–79", ar ? "متوازن" : "Balanced", "var(--lime)"],
                ["45–64", ar ? "معتدل" : "Moderate", "var(--warn)"],
                ["0–44", ar ? "متساهل" : "Indulgent", "var(--ink-3)"],
              ].map(([range, label, color], i) => (
                <div key={i} style={{ textAlign: "center", padding: "10px 8px", background: "var(--white)", border: "1px solid var(--hair)", borderRadius: 10 }}>
                  <div style={{ height: 4, width: "100%", background: color, borderRadius: 999, marginBottom: 6 }} />
                  <div className="mono tnum" style={{ fontSize: 11, color: "var(--ink-2)", fontWeight: 600 }}>{range}</div>
                  <div style={{ fontSize: 11, color: "var(--ink-3)" }}>{label}</div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// SECTION 02 — CALCULATOR
// ============================================================
const CalculatorSection = ({ t, dir, sample }) => {
  const C = t.sectionCalc;
  const ar = dir === "rtl";
  const recipeText = ar
    ? "صدر دجاج 180جم\nأرز بسمتي 150جم مطبوخ\nأفوكادو ½ حبة\nزيت زيتون 1م.ك\nخس روماني 60جم\nصلصة ليمون-ثوم 30جم"
    : "180g chicken breast, grilled\n150g basmati rice, cooked\n½ avocado, sliced\n1 tbsp olive oil\n60g romaine lettuce\n30g lemon-garlic dressing";
  return (
    <section className="section" style={{ background: "var(--paper-2)" }}>
      <div className="container">
        <div className="section-head" style={{ textAlign: "center", margin: "0 auto 56px" }}>
          <div className="eyebrow eyebrow-green">{C.eyebrow}</div>
          <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px auto", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{C.h2}</h2>
          <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: "0 auto", maxWidth: 600 }}>{C.lede}</p>
        </div>

        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 24, alignItems: "stretch" }} className="calc-grid">
          {/* Input */}
          <div className="card card-pad-lg">
            <div className="row" style={{ marginBottom: 14, justifyContent: "space-between" }}>
              <div className="row" style={{ gap: 8 }}>
                <span className="chip chip-green chip-dot" style={{ fontSize: 11 }}>{ar ? "إدخال" : "Recipe input"}</span>
              </div>
              <div className="row" style={{ gap: 4 }}>
                {[["doc", ar ? "PDF" : "PDF"], ["scan", ar ? "صورة" : "Photo"], ["bell", ar ? "صوت" : "Voice"]].map(([icon, l], i) => (
                  <button key={i} style={{
                    padding: "5px 10px",
                    borderRadius: 8,
                    background: "var(--paper)",
                    fontSize: 11,
                    color: "var(--ink-2)",
                    border: "1px solid var(--hair)",
                    display: "inline-flex",
                    alignItems: "center",
                    gap: 4,
                    fontWeight: 500,
                  }}>
                    <Icon name={icon} size={11} />
                    {l}
                  </button>
                ))}
              </div>
            </div>
            <div style={{
              background: "var(--paper)",
              border: "1px solid var(--hair)",
              borderRadius: 12,
              padding: 16,
              fontFamily: "var(--f-mono)",
              fontSize: 13,
              lineHeight: 1.7,
              color: "var(--ink)",
              minHeight: 220,
              whiteSpace: "pre-wrap",
            }}>
              <span style={{ color: "var(--ink-3)" }}>{ar ? "// الزق وصفتك" : "// paste your recipe"}</span>
              {"\n"}
              {recipeText}
              <span style={{ display: "inline-block", width: 7, height: 14, background: "var(--green)", marginInlineStart: 2, verticalAlign: "middle", animation: "blink 1s step-end infinite" }} />
            </div>
            <div className="row" style={{ marginTop: 14, justifyContent: "space-between" }}>
              <div style={{ fontSize: 12, color: "var(--ink-3)" }}>
                {ar ? "6 مكوّنات · حصة واحدة" : "6 ingredients · 1 serving"}
              </div>
              <button className="btn btn-primary btn-sm">
                <Icon name="spark" size={13} />
                {ar ? "احسب" : "Calculate"}
              </button>
            </div>
          </div>

          {/* Output */}
          <div style={{ position: "relative" }}>
            <DishCard s={sample} dir={dir} scoreSize={84} />
            {/* floating proof chip */}
            <div style={{
              position: "absolute",
              top: -12,
              [ar ? "left" : "right"]: -12,
              padding: "6px 12px",
              background: "var(--lime)",
              color: "var(--green-3)",
              borderRadius: 999,
              fontSize: 11,
              fontWeight: 700,
              boxShadow: "var(--sh-sm)",
              fontFamily: "var(--f-mono)",
              letterSpacing: "0.04em",
            }}>
              ⚡ {ar ? "في 1.2 ثانية" : "in 1.2s"}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// SECTION 03 — QR SMART MENU
// ============================================================
const QRSection = ({ t, dir, sample }) => {
  const Q = t.sectionQR;
  const ar = dir === "rtl";
  return (
    <section className="section">
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1.1fr", gap: 80, alignItems: "center" }} className="grid-flip">
          {/* QR + table mock */}
          <div style={{ position: "relative", display: "grid", placeItems: "center", padding: 32 }}>
            <div aria-hidden style={{
              position: "absolute",
              inset: 0,
              background: "radial-gradient(circle at 50% 50%, rgba(197,245,96,0.3) 0%, transparent 60%)",
              filter: "blur(50px)",
            }} />
            <div style={{ position: "relative" }}>
              <QRCard s={sample} dir={dir} />
            </div>
          </div>
          <div>
            <div className="section-head">
              <div className="eyebrow eyebrow-green">{Q.eyebrow}</div>
              <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px 0", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{Q.h2}</h2>
              <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: 0 }}>{Q.lede}</p>
            </div>
            <div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
              {[
                ["scan", ar ? "مسح فوري" : "Instant scan", ar ? "يفتح خلال ثانية. لا تطبيق، لا تسجيل." : "Opens in under a second. No app, no signup."],
                ["globe", ar ? "ثنائي اللغة" : "Bilingual by default", ar ? "العربية والإنجليزية تلقائياً، حسب لغة الجهاز." : "Arabic + English, switched automatically by the guest's device."],
                ["leaf", ar ? "حساسيات وأنظمة" : "Allergens & diets", ar ? "حلال، نباتي، خالٍ من الجلوتين، مكسرات — تنبيهات قبل الطلب." : "Halal, vegan, gluten-free, peanut-safe — flagged before they order."],
                ["shield", ar ? "ختم رسمي" : "Official seal", ar ? "كل قائمة مرتبطة بالسجل الموثّق من وزارة الصحة." : "Every menu links to the Ministry-of-Health verified registry."],
              ].map(([icon, h, p], i) => (
                <div key={i} className="row" style={{ alignItems: "flex-start", gap: 16, padding: "12px 0", borderBottom: i < 3 ? "1px solid var(--hair)" : "none" }}>
                  <div style={{ width: 36, height: 36, borderRadius: 10, background: "var(--green-soft)", display: "grid", placeItems: "center", flexShrink: 0 }}>
                    <Icon name={icon} size={16} color="var(--green)" />
                  </div>
                  <div>
                    <div style={{ fontWeight: 700, fontSize: 15, marginBottom: 2 }}>{h}</div>
                    <div style={{ color: "var(--ink-2)", fontSize: 13, lineHeight: 1.55 }}>{p}</div>
                  </div>
                </div>
              ))}
            </div>
          </div>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// SECTION 04 — DASHBOARD
// ============================================================
const DashboardSection = ({ t, dir }) => {
  const D = t.sectionDash;
  return (
    <section className="section" style={{ background: "var(--paper-2)" }}>
      <div className="container">
        <div className="section-head" style={{ textAlign: "center", margin: "0 auto 48px" }}>
          <div className="eyebrow eyebrow-green">{D.eyebrow}</div>
          <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px auto", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{D.h2}</h2>
          <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: "0 auto", maxWidth: 600 }}>{D.lede}</p>
        </div>
        <DashboardMockup dir={dir} />
      </div>
    </section>
  );
};

// ============================================================
// SECTION 05 — CUSTOMER MOBILE MENU
// ============================================================
const MobileSection = ({ t, dir, sample }) => {
  const M = t.sectionMobile;
  const ar = dir === "rtl";
  return (
    <section className="section">
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 80, alignItems: "center" }} className="grid-flip">
          <div>
            <div className="section-head">
              <div className="eyebrow eyebrow-green">{M.eyebrow}</div>
              <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px 0", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{M.h2}</h2>
              <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: 0 }}>{M.lede}</p>
            </div>
            <div className="grid-2" style={{ gap: 14 }}>
              {[
                [ar ? "تحميل تحت ثانية" : "Sub-second load", ar ? "حتى على شبكات بطيئة." : "Even on slow networks."],
                [ar ? "بدون تطبيق" : "No app needed", ar ? "يعمل في كل متصفح." : "Works in any browser."],
                [ar ? "وضع داكن" : "Dark mode", ar ? "تلقائياً مع الجهاز." : "Auto with device."],
                [ar ? "حفظ المفضّلة" : "Save favorites", ar ? "بنقرة واحدة." : "One-tap bookmarks."],
              ].map(([h, p], i) => (
                <div key={i} className="card card-pad" style={{ padding: 18 }}>
                  <div style={{ fontWeight: 700, fontSize: 14, marginBottom: 4 }}>{h}</div>
                  <div style={{ color: "var(--ink-3)", fontSize: 12, lineHeight: 1.5 }}>{p}</div>
                </div>
              ))}
            </div>
          </div>
          <div style={{ display: "flex", justifyContent: "center", position: "relative" }}>
            <div aria-hidden style={{
              position: "absolute", inset: -40,
              background: "radial-gradient(circle at 50% 50%, rgba(10,94,62,0.10) 0%, transparent 60%)",
              filter: "blur(40px)",
            }} />
            <PhoneMenuMock dir={dir} sample={sample} />
          </div>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// PHONE MENU MOCK (used in Mobile section)
// ============================================================
const PhoneMenuMock = ({ dir, sample }) => {
  const ar = dir === "rtl";
  return (
    <div className="phone" style={{ position: "relative" }}>
      <div className="phone-screen">
        {/* status */}
        <div className="row" style={{ padding: "14px 22px 6px", justifyContent: "space-between", fontSize: 11, fontWeight: 600, marginTop: 8 }}>
          <span className="tnum">9:41</span>
          <span className="row" style={{ gap: 4 }}>
            <Icon name="bell" size={11} />
            <Icon name="lock" size={11} />
          </span>
        </div>
        {/* header */}
        <div style={{ padding: "8px 18px 12px" }}>
          <div className="row" style={{ gap: 8, marginBottom: 14 }}>
            <SahhMark size={20} color="var(--green)" />
            <span style={{ fontFamily: "var(--f-display)", fontWeight: 700, fontSize: 15, letterSpacing: "-0.02em" }}>{ar ? "نجد كيتشن" : "Najd Kitchen"}</span>
            <span className="chip chip-green" style={{ fontSize: 9, padding: "3px 7px", marginInlineStart: "auto" }}>
              <Icon name="shield" size={9} />
              {ar ? "موثّق" : "Verified"}
            </span>
          </div>
          {/* filter row */}
          <div style={{ display: "flex", gap: 6, overflow: "hidden" }}>
            {[ar ? "الكل" : "All", ar ? "بروتين" : "High protein", ar ? "نباتي" : "Veg", ar ? "<500" : "<500"].map((f, i) => (
              <span key={i} style={{
                padding: "4px 10px",
                borderRadius: 999,
                fontSize: 10,
                fontWeight: 600,
                background: i === 0 ? "var(--ink)" : "var(--paper-2)",
                color: i === 0 ? "var(--paper)" : "var(--ink-2)",
                whiteSpace: "nowrap",
              }}>{f}</span>
            ))}
          </div>
        </div>
        {/* dishes */}
        <div style={{ flex: 1, overflow: "hidden", padding: "0 14px 14px", display: "flex", flexDirection: "column", gap: 10 }}>
          {/* featured dish */}
          <div style={{
            background: "var(--green-3)", color: "#fff",
            borderRadius: 14, padding: 14,
          }}>
            <div className="row" style={{ marginBottom: 6, justifyContent: "space-between", alignItems: "flex-start" }}>
              <div>
                <div style={{ fontSize: 9, color: "var(--lime)", letterSpacing: "0.12em", textTransform: "uppercase", fontWeight: 700, marginBottom: 2 }}>Sahh 86</div>
                <div style={{ fontWeight: 700, fontSize: 14, letterSpacing: "-0.015em" }}>{sample.dishName}</div>
              </div>
              <SahhScoreRing value={86} size={42} dark />
            </div>
            <div className="row" style={{ gap: 8, marginTop: 8, fontSize: 10 }}>
              <span className="tnum" style={{ fontWeight: 700, color: "var(--lime)" }}>520 kcal</span>
              <span style={{ opacity: 0.4 }}>·</span>
              <span className="tnum">P 42g</span>
              <span style={{ opacity: 0.4 }}>·</span>
              <span className="tnum">C 44g</span>
              <span style={{ opacity: 0.4 }}>·</span>
              <span className="tnum">F 16g</span>
            </div>
          </div>
          {[
            ["Salmon Quinoa", 612, 91, "var(--green)"],
            ["Kale Caesar", 380, 78, "var(--lime)"],
            ["Beef Shawarma", 720, 64, "var(--warn)"],
          ].map(([n, k, sc, col], i) => (
            <div key={i} className="row" style={{
              gap: 10,
              padding: 10,
              background: "var(--white)",
              borderRadius: 12,
              border: "1px solid var(--hair)",
            }}>
              <div style={{
                width: 40, height: 40,
                borderRadius: 8,
                background: "var(--paper-2)",
                display: "grid",
                placeItems: "center",
                fontFamily: "var(--f-mono)",
                fontWeight: 700,
                fontSize: 13,
                color: col,
              }}>{sc}</div>
              <div style={{ flex: 1 }}>
                <div style={{ fontWeight: 600, fontSize: 12 }}>{n}</div>
                <div style={{ fontSize: 10, color: "var(--ink-3)" }} className="tnum">{k} kcal</div>
              </div>
              <Icon name="chev" size={12} color="var(--ink-3)" />
            </div>
          ))}
        </div>
      </div>
    </div>
  );
};

// ============================================================
// SECTION 06 — ANALYTICS
// ============================================================
const AnalyticsSection = ({ t, dir }) => {
  const A = t.sectionAnalytics;
  const ar = dir === "rtl";
  return (
    <section className="section green-section">
      <div aria-hidden style={{ position: "absolute", inset: 0, opacity: 0.4, backgroundImage: "radial-gradient(circle at 80% 0%, rgba(197,245,96,0.4) 0%, transparent 50%)" }} />
      <div className="container" style={{ position: "relative" }}>
        <div className="section-head" style={{ marginBottom: 56 }}>
          <div className="eyebrow eyebrow-green">{A.eyebrow}</div>
          <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px 0", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{A.h2}</h2>
          <p style={{ fontSize: 17, lineHeight: 1.55, margin: 0 }}>{A.lede}</p>
        </div>
        <div className="grid-3" style={{ gap: 20 }}>
          <AnalyticsKPI label={ar ? "مسحات الأسبوع" : "Scans this week"} value="84,231" delta="+18%" chart="line" />
          <AnalyticsKPI label={ar ? "أعلى مؤشر صح" : "Top Sahh Score"} value="91" sub="Salmon Quinoa" chart="bars" />
          <AnalyticsKPI label={ar ? "متوسط السعرات" : "Average kcal"} value="584" delta="-12%" chart="dist" />
        </div>
      </div>
    </section>
  );
};

const AnalyticsKPI = ({ label, value, delta, sub, chart }) => (
  <div style={{
    background: "rgba(255,255,255,0.06)",
    border: "1px solid rgba(255,255,255,0.12)",
    borderRadius: 22,
    padding: 24,
    backdropFilter: "blur(8px)",
    WebkitBackdropFilter: "blur(8px)",
  }}>
    <div style={{ fontSize: 11, color: "rgba(255,255,255,0.6)", letterSpacing: "0.1em", textTransform: "uppercase", fontWeight: 600, marginBottom: 8 }}>{label}</div>
    <div className="row" style={{ alignItems: "baseline", gap: 10, marginBottom: 4 }}>
      <div className="h-display tnum" style={{ fontSize: 44, color: "var(--lime)" }}>{value}</div>
      {delta && <div style={{ fontSize: 12, fontWeight: 600, color: "rgba(255,255,255,0.7)" }}>{delta}</div>}
    </div>
    {sub && <div style={{ fontSize: 12, color: "rgba(255,255,255,0.7)", marginBottom: 12 }}>{sub}</div>}
    <div style={{ height: 80, marginTop: 14 }}>
      {chart === "line" && <MiniLine />}
      {chart === "bars" && <MiniBars />}
      {chart === "dist" && <MiniDist />}
    </div>
  </div>
);

const MiniLine = () => {
  const pts = [10, 22, 18, 32, 28, 45, 40, 58, 52, 68, 62, 78];
  const max = Math.max(...pts);
  const path = pts.map((v, i) => `${(i/(pts.length-1))*100} ${100 - (v/max)*100}`).join(" L");
  return (
    <svg viewBox="0 0 100 100" preserveAspectRatio="none" style={{ width: "100%", height: "100%" }}>
      <defs>
        <linearGradient id="ln-grad" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="var(--lime)" stopOpacity="0.4" />
          <stop offset="1" stopColor="var(--lime)" stopOpacity="0" />
        </linearGradient>
      </defs>
      <path d={`M${path} L100 100 L0 100 Z`} fill="url(#ln-grad)" />
      <path d={`M${path}`} stroke="var(--lime)" strokeWidth="1.5" fill="none" vectorEffect="non-scaling-stroke" />
    </svg>
  );
};
const MiniBars = () => {
  const bars = [40, 55, 78, 62, 91, 84, 70];
  return (
    <div style={{ display: "grid", gridTemplateColumns: `repeat(${bars.length}, 1fr)`, gap: 5, alignItems: "end", height: "100%" }}>
      {bars.map((v, i) => (
        <div key={i} style={{
          height: v + "%",
          background: i === 4 ? "var(--lime)" : "rgba(197,245,96,0.35)",
          borderRadius: "3px 3px 0 0",
        }} />
      ))}
    </div>
  );
};
const MiniDist = () => {
  const buckets = [12, 24, 36, 48, 32, 18, 10];
  const max = Math.max(...buckets);
  return (
    <div style={{ display: "grid", gridTemplateColumns: `repeat(${buckets.length}, 1fr)`, gap: 4, alignItems: "end", height: "100%" }}>
      {buckets.map((v, i) => (
        <div key={i} style={{
          height: (v/max) * 100 + "%",
          background: `rgba(197,245,96,${0.25 + (v/max)*0.6})`,
          borderRadius: "3px 3px 0 0",
        }} />
      ))}
    </div>
  );
};

// ============================================================
// PRICING
// ============================================================
const PricingSection = ({ t, dir }) => {
  const P = t.pricing;
  return (
    <section className="section" id="pricing">
      <div className="container">
        <div className="section-head" style={{ textAlign: "center", margin: "0 auto 56px" }}>
          <div className="eyebrow eyebrow-green">{P.eyebrow}</div>
          <h2 className="h-display" style={{ fontSize: "clamp(36px, 4vw, 56px)", margin: "16px auto", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{P.h2}</h2>
          <p style={{ color: "var(--ink-2)", fontSize: 17, lineHeight: 1.55, margin: "0 auto", maxWidth: 600 }}>{P.lede}</p>
        </div>
        <div className="price-grid">
          {P.tiers.map((tier, i) => {
            const featured = tier.featured;
            return (
              <div key={i} className={`price-card ${featured ? "price-card-feature" : ""}`} style={{ position: "relative" }}>
                {featured && (
                  <div style={{
                    position: "absolute",
                    top: 16, [dir === "rtl" ? "left" : "right"]: 16,
                    background: "var(--lime)", color: "var(--green-3)",
                    padding: "4px 10px", borderRadius: 999,
                    fontSize: 10, fontWeight: 700, letterSpacing: "0.06em",
                    textTransform: "uppercase",
                  }}>★ {dir === "rtl" ? "الأكثر رواجاً" : "Most popular"}</div>
                )}
                <div style={{ marginBottom: 20 }}>
                  <h3 style={{
                    fontFamily: "var(--f-display)",
                    fontWeight: 600,
                    fontSize: 18,
                    letterSpacing: "-0.02em",
                    margin: 0,
                    marginBottom: 6,
                    color: featured ? "#fff" : "var(--ink)",
                  }}>{tier.name}</h3>
                  <div style={{ fontSize: 13, color: featured ? "rgba(255,255,255,0.7)" : "var(--ink-3)", lineHeight: 1.5 }}>{tier.for}</div>
                </div>
                <div className="row" style={{ alignItems: "baseline", gap: 6, marginBottom: 24 }}>
                  <div className="price-amount" style={{ color: featured ? "var(--lime)" : "var(--green-3)" }}>{tier.price}</div>
                  <div style={{ fontSize: 13, color: featured ? "rgba(255,255,255,0.7)" : "var(--ink-3)" }}>{tier.unit}</div>
                </div>
                <button className={featured ? "btn btn-on-green btn-lg" : "btn btn-primary btn-lg"} style={{ width: "100%", justifyContent: "center", marginBottom: 24 }}>
                  {tier.cta}
                  <Icon name="arrow" size={14} />
                </button>
                <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
                  {tier.features.map((f, j) => (
                    <div key={j} className="row" style={{ gap: 10, fontSize: 13, color: featured ? "rgba(255,255,255,0.85)" : "var(--ink-2)" }}>
                      <Icon name="check" size={14} color={featured ? "var(--lime)" : "var(--green)"} />
                      <span>{f}</span>
                    </div>
                  ))}
                </div>
              </div>
            );
          })}
        </div>
      </div>
    </section>
  );
};

// ============================================================
// ONBOARDING STRIP
// ============================================================
const OnboardingStrip = ({ t, dir }) => {
  const O = t.onboarding;
  return (
    <section className="section" style={{ background: "var(--paper-2)" }}>
      <div className="container">
        <div className="section-head" style={{ textAlign: "center", margin: "0 auto 56px" }}>
          <div className="eyebrow eyebrow-green">{O.eyebrow}</div>
          <h2 className="h-display" style={{ fontSize: "clamp(32px, 3.5vw, 48px)", margin: "16px auto", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{O.h2}</h2>
        </div>
        <div className="grid-3" style={{ gap: 24 }}>
          {O.steps.map(([num, title, body], i) => (
            <div key={i} className="card card-pad-lg card-hover" style={{ position: "relative" }}>
              <div style={{
                fontFamily: "var(--f-mono)",
                fontSize: 12,
                color: "var(--green)",
                fontWeight: 600,
                letterSpacing: "0.1em",
                marginBottom: 20,
              }}>{num} —</div>
              <div style={{ fontFamily: "var(--f-display)", fontWeight: 700, fontSize: 20, letterSpacing: "-0.02em", marginBottom: 8 }}>{title}</div>
              <div style={{ color: "var(--ink-2)", fontSize: 14, lineHeight: 1.55 }}>{body}</div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
};

// ============================================================
// FINAL CTA
// ============================================================
const FinalCTA = ({ t, dir }) => {
  const C = t.cta;
  return (
    <section className="section green-section" style={{ padding: "100px 32px" }}>
      <div aria-hidden style={{
        position: "absolute", inset: 0,
        backgroundImage: "radial-gradient(circle at 50% 100%, rgba(197,245,96,0.5) 0%, transparent 50%)",
        opacity: 0.6,
      }} />
      <div className="container-narrow" style={{ position: "relative", textAlign: "center" }}>
        <div style={{ display: "flex", justifyContent: "center", marginBottom: 24 }}>
          <SahhMark size={64} color="var(--lime)" />
        </div>
        <h2 className="h-display" style={{ fontSize: "clamp(36px, 5vw, 64px)", margin: "0 0 16px", letterSpacing: "-0.035em", lineHeight: 1.04 }}>{C.h}</h2>
        <p style={{ fontSize: 17, maxWidth: 560, margin: "0 auto 32px", lineHeight: 1.55 }}>{C.sub}</p>
        <div className="row" style={{ justifyContent: "center", gap: 12, flexWrap: "wrap" }}>
          <button className="btn btn-on-green btn-lg">{C.a}<Icon name="arrow" size={15} /></button>
          <button className="btn btn-outline-on-green btn-lg">{C.b}</button>
        </div>
      </div>
    </section>
  );
};

// ============================================================
// FOOTER
// ============================================================
const Footer = ({ t, dir }) => {
  const F = t.foot;
  const ar = dir === "rtl";
  return (
    <footer style={{ padding: "64px 32px 32px", background: "var(--paper)", borderTop: "1px solid var(--hair)" }}>
      <div className="container">
        <div style={{ display: "grid", gridTemplateColumns: "2fr 1fr 1fr 1fr", gap: 40, marginBottom: 48 }}>
          <div>
            <SahhNavMark />
            <p style={{ fontSize: 13, color: "var(--ink-3)", maxWidth: 320, marginTop: 16, lineHeight: 1.55 }}>{F.sub}</p>
          </div>
          {[[F.product, F.pLinks, F.pHrefs], [F.company, F.cLinks], [F.legal, F.lLinks]].map(([title, links, hrefs], i) => (
            <div key={i}>
              <div className="eyebrow" style={{ marginBottom: 16, fontSize: 11 }}>{title}</div>
              <div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
                {links.map((l, j) => (
                  <a key={j} href={(hrefs && hrefs[j]) || "#"} style={{ fontSize: 13, color: "var(--ink-2)" }}>{l}</a>
                ))}
              </div>
            </div>
          ))}
        </div>
        <div className="row" style={{ justifyContent: "space-between", paddingTop: 24, borderTop: "1px solid var(--hair)", flexWrap: "wrap", gap: 12 }}>
          <div style={{ fontSize: 12, color: "var(--ink-3)" }}>© 2026 Sahh Technologies. {ar ? "كل الحقوق محفوظة." : "All rights reserved."}</div>
          <div className="row" style={{ gap: 16, fontSize: 12, color: "var(--ink-3)" }}>
            <span className="row" style={{ gap: 6 }}><Icon name="shield" size={12} color="var(--green)" /> MoH verified</span>
            <span className="row" style={{ gap: 6 }}><Icon name="globe" size={12} /> Jeddah · Dubai</span>
          </div>
        </div>
      </div>
    </footer>
  );
};

window.Hero = Hero;
window.LogoStrip = LogoStrip;
window.ScoreSection = ScoreSection;
window.CalculatorSection = CalculatorSection;
window.QRSection = QRSection;
window.DashboardSection = DashboardSection;
window.MobileSection = MobileSection;
window.AnalyticsSection = AnalyticsSection;
window.PricingSection = PricingSection;
window.OnboardingStrip = OnboardingStrip;
window.FinalCTA = FinalCTA;
window.Footer = Footer;
