/* ============================================================
   Serabi CRM — Landing page
   ============================================================ */
const { useState, useEffect, useRef } = React;

/* Bilingual content dictionary. Each value: [id, en] */
const L = {
  nav:        [["Fitur","Cara Kerja","Harga","FAQ"], ["Features","How it works","Pricing","FAQ"]],
  signIn:     ["Masuk", "Sign in"],
  tryFree:    ["Coba Gratis", "Start free"],

  heroBadge:  ["AI sudah aktif untuk 2.400+ toko", "AI live for 2,400+ shops"],
  heroH1a:    ["Biarkan AI yang jaga chat,", "Let AI mind the chats,"],
  heroH1b:    ["kamu fokus", "you focus on"],
  heroH1c:    ["jualan.", "selling."],
  heroSub:    ["Serabi menyatukan semua chat WhatsApp bisnismu dalam satu inbox dan membalas pelanggan otomatis 24 jam dengan AI yang paham produkmu — dan tahu kapan harus memanggilmu.",
               "Serabi brings all your business WhatsApp chats into one inbox and replies to customers 24/7 with AI that knows your products — and knows when to hand over to you."],
  heroCta1:   ["Daftar Gratis", "Sign up Free"],
  heroCta2:   ["Explore Fitur", "Explore Features"],
  trust1:     ["Tanpa kartu kredit", "No credit card"],
  trust2:     ["Pasang < 1 menit", "Setup in < 1 min"],
  trust3:     ["100.000 Token AI gratis", "100,000 free AI Tokens"],

  phoneName:  ["Dapur Serabi Bu Imah", "Dapur Serabi Bu Imah"],
  phoneOnline:["online", "online"],
  pm1:        ["Halo kak, serabi cokelat masih ready buat besok? 😊", "Hi, is chocolate serabi available for tomorrow? 😊"],
  pm2:        ["Halo Kak! 🍫 Serabi Cokelat ready ya. Rp 7.000/pcs, 1 box isi 10 (Rp 70.000). Mau ambil berapa box, Kak?",
               "Hi! 🍫 Chocolate serabi is available. Rp 7,000/pcs, 1 box of 10 (Rp 70,000). How many boxes would you like?"],
  pm3:        ["Ambil 3 box ya, antar pagi 🙏", "I'll take 3 boxes, morning delivery 🙏"],
  floatReply: ["Balasan AI", "AI replies"],
  floatTime:  ["Waktu respons", "Response time"],

  stripLabel: ["Dipercaya UMKM kuliner & retail di seluruh Indonesia", "Trusted by F&B and retail SMEs across Indonesia"],
  stat1:      ["2.400+", "Toko aktif", "2,400+", "Active shops"],
  stat2:      ["78%", "Chat dijawab AI", "78%", "Chats handled by AI"],
  stat3:      ["1,4 mnt", "Rata-rata respons", "1.4 min", "Avg. response"],
  stat4:      ["24/7", "Selalu siaga", "24/7", "Always on"],

  probTag:    ["Kenapa Serabi", "Why Serabi"],
  probH2:     ["Chat numpuk, pelanggan kabur", "Piled-up chats, lost customers"],
  probLead:   ["Setiap chat yang lambat dibalas adalah orderan yang hilang. Ini yang dihadapi pemilik toko setiap hari:",
               "Every slow reply is a lost order. Here's what shop owners face every day:"],
  prob: [
    ["clock", "Telat balas, hilang order", "Pelanggan WhatsApp ingin dibalas dalam hitungan menit. Kalau telat, mereka pindah ke kompetitor.",
     "Slow replies lose orders", "WhatsApp customers expect replies in minutes. Reply late and they move to a competitor."],
    ["chat", "Pertanyaan yang itu-itu lagi", "Harga? Ready? Bisa kirim? Kamu menjawab pertanyaan yang sama puluhan kali setiap hari.",
     "The same questions, again", "Price? In stock? Delivery? You answer the same questions dozens of times a day."],
    ["megaphone", "Promo bikin nomor kena ban", "Broadcast manual ke ratusan kontak gampang bikin nomor WhatsApp-mu diblokir.",
     "Blasts get your number banned", "Manually broadcasting to hundreds of contacts easily gets your WhatsApp number blocked."],
  ],

  featTag:    ["Fitur", "Features"],
  featH2:     ["Semua yang toko WhatsApp-mu butuhkan", "Everything your WhatsApp shop needs"],
  featLead:   ["Satu aplikasi untuk membalas, mengelola, dan menumbuhkan pelangganmu — ditenagai AI.",
               "One app to reply, manage, and grow your customers — powered by AI."],
  feat: [
    ["bot","violet", "AI Auto-reply", "AI membalas pelanggan otomatis 24 jam, dengan gaya bahasa dan harga sesuai tokomu.",
     "AI Auto-reply", "AI replies to customers 24/7, in your tone and with your real prices."],
    ["chat","green", "Unified Inbox", "Semua chat dalam satu layar rapi. Pin, filter, dan nyalakan AI per percakapan.",
     "Unified Inbox", "Every chat in one tidy screen. Pin, filter, and toggle AI per conversation."],
    ["book","blue", "Knowledge Base", "Ajari AI sekali dengan FAQ atau unggah katalog — AI menjawab akurat selamanya.",
     "Knowledge Base", "Teach the AI once with FAQs or upload your catalog — accurate answers forever."],
    ["alert","red", "Eskalasi Pintar", "AI tahu batasnya. Saat ragu atau ada komplain, kamu langsung dinotifikasi.",
     "Smart Escalation", "The AI knows its limits. When unsure or facing a complaint, you're notified instantly."],
    ["shieldCheck","green", "Broadcast Anti-ban", "Kirim promo ke ratusan kontak dengan jeda acak & rate limit agar nomor tetap aman.",
     "Anti-ban Broadcast", "Send promos to hundreds with random delays & rate limits so your number stays safe."],
    ["home","amber", "Dashboard Analitik", "Pantau volume chat, waktu respons, dan performa AI dalam satu pandangan.",
     "Analytics Dashboard", "Track chat volume, response time, and AI performance at a glance."],
  ],

  show1Tag:   ["AI Auto-reply", "AI Auto-reply"],
  show1H:     ["AI yang benar-benar paham tokomu", "AI that truly understands your shop"],
  show1P:     ["Bukan bot kaku. Serabi belajar dari katalog, harga, dan FAQ-mu, lalu membalas dengan hangat seperti kamu sendiri yang menjawab.",
               "Not a rigid bot. Serabi learns from your catalog, prices, and FAQs, then replies as warmly as you would yourself."],
  show1List:  [["Jawab harga & stok dari data aslimu","Gaya bahasa bisa diatur: ramah, santai, formal","Tidak pernah mengarang harga"],
               ["Answers price & stock from your real data","Tone is adjustable: friendly, casual, formal","Never makes up prices"]],

  show2Tag:   ["Eskalasi ke Manusia", "Human Handover"],
  show2H:     ["AI tahu kapan harus memanggilmu", "The AI knows when to call you in"],
  show2P:     ["Saat pelanggan minta nego, komplain, atau kirim foto — AI berhenti dan langsung mengoper ke kamu lewat notifikasi WhatsApp. Tidak ada pelanggan penting yang terlewat.",
               "When a customer negotiates, complains, or sends a photo — the AI pauses and hands over to you via WhatsApp notification. No important customer slips through."],
  show2List:  [["Notifikasi instan ke nomor adminmu","Picu otomatis lewat kata kunci sensitif","Ambil alih & kembalikan ke AI kapan saja"],
               ["Instant alert to your admin number","Auto-trigger on sensitive keywords","Take over & hand back to AI anytime"]],

  howTag:     ["Cara Kerja", "How it works"],
  howH2:      ["Aktif dalam 3 langkah mudah", "Live in 3 easy steps"],
  howLead:    ["Tanpa setup teknis. Kalau kamu bisa pakai WhatsApp, kamu bisa pakai Serabi.",
               "No technical setup. If you can use WhatsApp, you can use Serabi."],
  how: [
    ["Hubungkan WhatsApp", "Scan QR sekali dari HP-mu. Nomor bisnismu tersambung dalam kurang dari semenit.",
     "Connect WhatsApp", "Scan a QR once from your phone. Your business number connects in under a minute."],
    ["Ajari AI-mu", "Isi FAQ atau unggah katalog & daftar harga. AI langsung belajar menjawab.",
     "Teach your AI", "Fill in FAQs or upload your catalog & price list. The AI learns to answer instantly."],
    ["AI mulai membalas", "AI menangani chat masuk otomatis. Kamu pantau dari dashboard & ambil alih kapan saja.",
     "AI starts replying", "The AI handles incoming chats automatically. You watch from the dashboard & step in anytime."],
  ],

  shieldH:    ["Broadcast tanpa takut diblokir", "Broadcast without fear of bans"],
  shieldP:    ["Proteksi anti-ban bawaan: jeda acak 8–25 detik, batas kirim per jam, warmup nomor, variasi pesan (spintax), dan auto-pause saat ada anomali.",
               "Built-in anti-ban protection: random 8–25s delays, hourly send limits, number warmup, message variation (spintax), and auto-pause on anomalies."],
  shieldBadges: [["Jeda acak","Rate limit per jam","Variasi spintax","Auto-pause"],
                 ["Random delays","Hourly rate limit","Spintax variation","Auto-pause"]],
  shieldRingLabel: ["lebih aman", "safer"],

  priceTag:   ["Harga", "Pricing"],
  priceH2:    ["Gratis selama masa beta", "Free during beta"],
  priceLead:  ["Serabi sedang uji coba. Semua paket GRATIS sekarang — lengkap dengan 100.000 Token AI tiap bulan. Tanpa kartu kredit.",
               "Serabi is in beta. Every plan is FREE right now — including 100,000 AI Tokens every month. No credit card."],
  perMo:      ["/bln", "/mo"],
  freeLabel:  ["GRATIS", "FREE"],
  betaPill:   ["Selama beta", "During beta"],
  plans: [
    ["CRM Basic", "Inbox, kontak, dashboard & broadcast.", "99.000",
     ["1 nomor WhatsApp","Unified inbox + media","Kontak & tahap lead","Broadcast anti-ban","Dashboard analitik"],
     "Coba gratis", "green",
     "CRM Basic", "Inbox, contacts, dashboard & broadcast.",
     ["1 WhatsApp number","Unified inbox + media","Contacts & lead stages","Anti-ban broadcast","Analytics dashboard"],
     "Try free"],
    ["AI Add-on", "Semua di Basic + AI auto-reply cerdas.", "149.000",
     ["Semua fitur CRM Basic","AI auto-reply 24/7","Knowledge base + RAG","Eskalasi ke manusia","100.000 Token AI / bulan"],
     "Coba gratis", "amber",
     "AI Add-on", "Everything in Basic + smart AI auto-reply.",
     ["All CRM Basic features","AI auto-reply 24/7","Knowledge base + RAG","Human escalation","100,000 AI Tokens / month"],
     "Try free"],
  ],
  popular:    ["Gratis saat beta", "Free in beta"],
  priceNote:  ["1 token = 1 kata. Kalau token gratis habis, top-up mulai Rp 10.000 untuk 100.000 token — sampai Rp 350.000 untuk 5.000.000 token.",
               "1 token = 1 word. If your free tokens run out, top up from Rp 10,000 for 100,000 tokens — up to Rp 350,000 for 5,000,000 tokens."],

  testTag:    ["Testimoni", "Testimonials"],
  testH2:     ["Dicintai pemilik toko", "Loved by shop owners"],
  test: [
    ["Sejak pakai Serabi, chat malam hari tetap kebalas. Orderan naik hampir 30% tanpa nambah karyawan.",
     "Imah K.", "Dapur Serabi Bu Imah · Bandung",
     "Since using Serabi, night-time chats still get answered. Orders rose nearly 30% without hiring."],
    ["AI-nya jawabnya sopan banget, pelanggan kira itu admin asli. Aku jadi punya waktu buat produksi.",
     "Dewi L.", "Kopi Senja · Jakarta",
     "The AI replies so politely customers think it's a real admin. I finally have time for production."],
    ["Fitur broadcast-nya aman, nomorku gak pernah kena banned lagi. Promo gajian laku keras.",
     "Andi P.", "Snack Hits ID · Tangerang",
     "The broadcast is safe, my number never gets banned anymore. Payday promos sell out fast."],
  ],

  faqTag:     ["FAQ", "FAQ"],
  faqH2:      ["Pertanyaan yang sering ditanya", "Frequently asked questions"],
  faq: [
    ["Apakah nomor WhatsApp saya aman?", "Ya. Serabi memakai protokol perangkat tertaut resmi WhatsApp — sama seperti WhatsApp Web. Kami tidak menyimpan chat atau kata sandimu, dan broadcast memakai throttling anti-ban.",
     "Is my WhatsApp number safe?", "Yes. Serabi uses WhatsApp's official linked-device protocol — just like WhatsApp Web. We never store your chats or password, and broadcasts use anti-ban throttling."],
    ["Apakah saya perlu keahlian teknis?", "Tidak sama sekali. Cukup scan QR, isi beberapa FAQ atau unggah katalog, dan AI langsung siap. Kalau bisa pakai WhatsApp, kamu bisa pakai Serabi.",
     "Do I need technical skills?", "Not at all. Just scan a QR, add a few FAQs or upload a catalog, and the AI is ready. If you can use WhatsApp, you can use Serabi."],
    ["Bagaimana kalau AI tidak bisa menjawab?", "AI dirancang untuk tahu batasnya. Saat ragu, ada komplain, atau pelanggan minta bicara dengan orang — AI berhenti dan langsung menotifikasi kamu.",
     "What if the AI can't answer?", "The AI is built to know its limits. When unsure, facing a complaint, or asked for a human — it pauses and notifies you instantly."],
    ["Apa itu Token AI?", "1 token = 1 kata. Token dipakai setiap kali AI membalas pesan (≈ 40 token per balasan). Selama beta kamu dapat 100.000 token gratis tiap bulan, dan bisa top-up mulai Rp 10.000 untuk 100.000 token.",
     "What are AI Tokens?", "1 token = 1 word. Tokens are used each time the AI replies (≈ 40 tokens per reply). During beta you get 100,000 free tokens monthly, and can top up from Rp 10,000 for 100,000 tokens."],
    ["Berapa biaya Serabi?", "Selama masa beta, semua paket GRATIS — termasuk 100.000 Token AI tiap bulan. Tanpa kartu kredit, dan kamu bisa berhenti kapan saja.",
     "How much does Serabi cost?", "During beta, every plan is FREE — including 100,000 AI Tokens monthly. No credit card, and you can cancel anytime."],
  ],

  finalH:     ["Siap berhenti kewalahan balas chat?", "Ready to stop drowning in chats?"],
  finalP:     ["Mulai gratis hari ini. Pasang dalam semenit, dan biarkan AI yang jaga tokomu.",
               "Start free today. Set up in a minute, and let AI mind your shop."],
  finalCta1:  ["Daftar Gratis", "Sign up Free"],
  finalCta2:  ["Hubungi kami", "Contact us"],

  footTagline:["CRM WhatsApp + AI untuk UMKM Indonesia. Balas lebih cepat, jualan lebih banyak, kerja lebih tenang.",
               "WhatsApp CRM + AI for Indonesian SMEs. Reply faster, sell more, work calmer."],
  footProduct:["Produk", "Product"],
  footCompany:["Perusahaan", "Company"],
  footSupport:["Bantuan", "Support"],
  footLinks: {
    product: [["Fitur"], ["Features"]],
    company: [["Tentang"], ["About"]],
    support: [["Panduan"], ["Guides"]],
  },
  footRights: ["© 2026 Serabi. Dibuat dengan ❤️ untuk UMKM Indonesia.", "© 2026 Serabi. Made with ❤️ for Indonesian SMEs."],
};

function useReveal() {
  useEffect(() => {
    const els = document.querySelectorAll(".lp-reveal");
    const io = new IntersectionObserver((entries) => {
      entries.forEach((e) => { if (e.isIntersecting) { e.target.classList.add("in"); io.unobserve(e.target); } });
    }, { threshold: 0.12, rootMargin: "0px 0px -40px 0px" });
    els.forEach((el) => io.observe(el));
    return () => io.disconnect();
  });
}

function Nav({ lang, setLang, i }) {
  const [scrolled, setScrolled] = useState(false);
  const [open, setOpen] = useState(false);
  useEffect(() => {
    const h = () => setScrolled(window.scrollY > 8);
    window.addEventListener("scroll", h); return () => window.removeEventListener("scroll", h);
  }, []);
  const links = L.nav[i];
  const anchors = ["#fitur", "#cara-kerja", "#harga", "#faq"];
  return (
    <nav className={"lp-nav" + (scrolled ? " scrolled" : "")}>
      <div className="lp-wrap lp-nav-inner">
        <a href="#top"><Logo size={30} /></a>
        <div className="lp-nav-links">
          {links.map((l, k) => <a key={k} href={anchors[k]}>{l}</a>)}
        </div>
        <div className="lp-nav-right">
          <div className="lp-lang">
            <button className={lang === "id" ? "on" : ""} onClick={() => setLang("id")}>ID</button>
            <button className={lang === "en" ? "on" : ""} onClick={() => setLang("en")}>EN</button>
          </div>
          <a href="https://app.serabi.id" className="btn btn-ghost btn-sm lp-hide-sm">{L.signIn[i]}</a>
          <a href="https://app.serabi.id" className="btn btn-primary btn-sm">{L.tryFree[i]}</a>
        </div>
      </div>
    </nav>
  );
}

function Hero({ i }) {
  return (
    <section className="lp-hero" id="top">
      <div className="lp-hero-glow" />
      <div className="lp-wrap lp-hero-grid">
        <div>
          <span className="lp-eyebrow"><span className="sd" /> {L.heroBadge[i]}</span>
          <h1 className="lp-h1">
            {L.heroH1a[i]}<br />
            {L.heroH1b[i]} <span className="hl"><span className="hl-mark">{L.heroH1c[i]}</span></span>
          </h1>
          <p className="lp-sub">{L.heroSub[i]}</p>
          <div className="lp-cta-row">
            <a href="https://app.serabi.id" className="btn btn-primary btn-lg"><Icon name="sparkle" /> {L.heroCta1[i]}</a>
            <a href="https://app.serabi.id" className="btn btn-ghost btn-lg"><Icon name="play" /> {L.heroCta2[i]}</a>
          </div>
          <div className="lp-trust">
            {[L.trust1[i], L.trust2[i], L.trust3[i]].map((t, k) => (
              <span className="lp-trust-item" key={k}><Icon name="check" size={16} /> {t}</span>
            ))}
          </div>
        </div>
        <div className="lp-hero-visual">
          <div className="lp-float lp-float-1">
            <div className="lp-float-ic" style={{ background: "var(--violet-soft)", color: "var(--violet)" }}><Icon name="bot" size={20} /></div>
            <div><div className="val">78%</div><div className="lab">{L.floatReply[i]}</div></div>
          </div>
          <div className="lp-phone">
            <div className="lp-phone-screen">
              <div className="lp-phone-head">
                <Avatar name="Rina W" size={36} />
                <div className="grow"><div className="nm">Rina Wijaya</div><div className="st"><span className="dot dot-green" style={{ width: 6, height: 6 }} /> {L.phoneOnline[i]}</div></div>
                <Icon name="phone" size={18} />
              </div>
              <div className="lp-phone-body">
                <div className="lp-msg them" style={{ animationDelay: ".1s" }}>{L.pm1[i]}<span className="mt">09:12</span></div>
                <div className="lp-msg ai" style={{ animationDelay: ".5s" }}>
                  <span className="ai-tag"><Icon name="sparkle" size={10} /> {L.floatReply[i]}</span>
                  {L.pm2[i]}<span className="mt">09:12 ✓✓</span>
                </div>
                <div className="lp-msg them" style={{ animationDelay: "1s" }}>{L.pm3[i]}<span className="mt">09:13</span></div>
              </div>
            </div>
          </div>
          <div className="lp-float lp-float-2">
            <div className="lp-float-ic" style={{ background: "var(--amber-soft)", color: "var(--amber-600)" }}><Icon name="clock" size={20} /></div>
            <div><div className="val">1,4<span style={{ fontSize: 12, fontWeight: 600 }}> mnt</span></div><div className="lab">{L.floatTime[i]}</div></div>
          </div>
        </div>
      </div>
    </section>
  );
}

function Strip({ i }) {
  const stats = [L.stat1, L.stat2, L.stat3, L.stat4];
  return (
    <section className="lp-strip">
      <div className="lp-wrap" style={{ display: "flex", flexDirection: "column", gap: 18, alignItems: "center" }}>
        <span className="lp-strip-label">{L.stripLabel[i]}</span>
        <div className="lp-strip-stats">
          {stats.map((s, k) => (
            <React.Fragment key={k}>
              {k > 0 && <span className="lp-strip-sep lp-hide-sm" />}
              <div className="lp-strip-stat">
                <div className="n tnum">{s[i === 0 ? 0 : 2]}</div>
                <div className="l">{s[i === 0 ? 1 : 3]}</div>
              </div>
            </React.Fragment>
          ))}
        </div>
      </div>
    </section>
  );
}

function Problem({ i }) {
  return (
    <section className="lp-sec lp-problem">
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag" style={{ background: "var(--red-soft)", color: "var(--red-600)" }}>{L.probTag[i]}</span>
          <h2 className="lp-h2">{L.probH2[i]}</h2>
          <p className="lp-lead">{L.probLead[i]}</p>
        </div>
        <div className="lp-prob-grid">
          {L.prob.map((p, k) => (
            <div className="lp-prob-card lp-reveal" key={k} style={{ transitionDelay: k * 0.08 + "s" }}>
              <div className="lp-prob-ic"><Icon name={p[0]} size={22} /></div>
              <h3>{p[i === 0 ? 1 : 3]}</h3>
              <p>{p[i === 0 ? 2 : 4]}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function Features({ i }) {
  return (
    <section className="lp-sec" id="fitur">
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag">{L.featTag[i]}</span>
          <h2 className="lp-h2">{L.featH2[i]}</h2>
          <p className="lp-lead">{L.featLead[i]}</p>
        </div>
        <div className="lp-feat-grid">
          {L.feat.map((f, k) => (
            <div className="lp-feat lp-reveal" key={k} style={{ transitionDelay: (k % 3) * 0.08 + "s" }}>
              <div className={"lp-feat-ic " + f[1]}><Icon name={f[0]} size={24} /></div>
              <h3>{f[i === 0 ? 2 : 4]}</h3>
              <p>{f[i === 0 ? 3 : 5]}</p>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function Showcase({ i }) {
  return (
    <section className="lp-sec" style={{ background: "var(--surface-2)", borderTop: "1px solid var(--border)", borderBottom: "1px solid var(--border)" }}>
      <div className="lp-wrap">
        {/* Show 1 — AI auto-reply */}
        <div className="lp-show lp-reveal">
          <div className="lp-show-text">
            <span className="lp-tag" style={{ background: "var(--violet-soft)", color: "var(--violet)" }}>{L.show1Tag[i]}</span>
            <h3>{L.show1H[i]}</h3>
            <p>{L.show1P[i]}</p>
            <ul className="lp-show-list">
              {L.show1List[i].map((t, k) => <li key={k}><span className="ck"><Icon name="check" size={14} /></span> {t}</li>)}
            </ul>
          </div>
          <div className="lp-show-visual">
            <div className="lp-mock">
              <div className="lp-mock-bar">
                <span className="tl" style={{ background: "#ff5f57" }} /><span className="tl" style={{ background: "#febc2e" }} /><span className="tl" style={{ background: "#28c840" }} />
                <span className="faint mono" style={{ fontSize: 12, marginLeft: 8 }}>Knowledge Base</span>
              </div>
              <div className="lp-mock-body">
                <div className="lp-kb-item"><div className="lp-kb-ic"><Icon name="coin" size={17} /></div><div><div className="lp-kb-q">{i === 0 ? "Berapa harga serabi?" : "How much is serabi?"}</div><div className="lp-kb-a">{i === 0 ? "Original Rp 5.000, Cokelat Rp 7.000, Keju Rp 8.000 per pcs." : "Original Rp 5,000, Chocolate Rp 7,000, Cheese Rp 8,000 each."}</div></div></div>
                <div className="lp-kb-item"><div className="lp-kb-ic"><Icon name="location" size={17} /></div><div><div className="lp-kb-q">{i === 0 ? "Area pengantaran?" : "Delivery area?"}</div><div className="lp-kb-a">{i === 0 ? "Bandung, Cimahi & sekitarnya. Luar kota via ekspedisi frozen." : "Bandung, Cimahi & nearby. Out-of-town via frozen courier."}</div></div></div>
                <div className="lp-kb-item" style={{ borderColor: "var(--violet-soft)", background: "var(--violet-soft)" }}><div className="lp-kb-ic" style={{ background: "var(--violet)", color: "white" }}><Icon name="sparkle" size={17} /></div><div><div className="lp-kb-q" style={{ color: "var(--violet)" }}>{i === 0 ? "AI menjawab dari sumber ini" : "AI answers from these sources"}</div><div className="lp-kb-a">{i === 0 ? "6 FAQ · 3 dokumen terindeks" : "6 FAQs · 3 indexed documents"}</div></div></div>
              </div>
            </div>
          </div>
        </div>

        {/* Show 2 — escalation */}
        <div className="lp-show rev lp-reveal">
          <div className="lp-show-text">
            <span className="lp-tag" style={{ background: "var(--red-soft)", color: "var(--red-600)" }}>{L.show2Tag[i]}</span>
            <h3>{L.show2H[i]}</h3>
            <p>{L.show2P[i]}</p>
            <ul className="lp-show-list">
              {L.show2List[i].map((t, k) => <li key={k}><span className="ck"><Icon name="check" size={14} /></span> {t}</li>)}
            </ul>
          </div>
          <div className="lp-show-visual">
            <div className="lp-mock">
              <div className="lp-mock-bar">
                <span className="tl" style={{ background: "#ff5f57" }} /><span className="tl" style={{ background: "#febc2e" }} /><span className="tl" style={{ background: "#28c840" }} />
                <span className="faint mono" style={{ fontSize: 12, marginLeft: 8 }}>Inbox · Pak Bambang</span>
              </div>
              <div className="lp-mock-body" style={{ display: "flex", flexDirection: "column", gap: 12 }}>
                <div className="lp-msg them" style={{ animation: "none", maxWidth: "82%" }}>{i === 0 ? "200 pax, tapi saya mau nego harga. Bisa bicara sama ownernya langsung?" : "200 pax, but I want to negotiate. Can I speak to the owner directly?"}<span className="mt">08:42</span></div>
                <div className="lp-escal">
                  <div className="lp-escal-ic"><Icon name="alert" size={18} /></div>
                  <div className="grow"><div style={{ fontWeight: 700, fontSize: 14 }}>{i === 0 ? "AI dijeda — perlu manusia" : "AI paused — needs a human"}</div><div className="faint" style={{ fontSize: 12.5 }}>{i === 0 ? "Admin dinotifikasi via WhatsApp" : "Admin notified via WhatsApp"}</div></div>
                  <span className="badge badge-red">{i === 0 ? "Perlu Manusia" : "Needs Human"}</span>
                </div>
                <button className="btn btn-soft btn-sm" style={{ alignSelf: "flex-start" }}><Icon name="refresh" size={15} /> {i === 0 ? "Ambil alih chat" : "Take over chat"}</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  );
}

function How({ i }) {
  return (
    <section className="lp-sec lp-how" id="cara-kerja">
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag">{L.howTag[i]}</span>
          <h2 className="lp-h2">{L.howH2[i]}</h2>
          <p className="lp-lead">{L.howLead[i]}</p>
        </div>
        <div className="lp-steps">
          {L.how.map((s, k) => (
            <div className="lp-step lp-reveal" key={k} style={{ transitionDelay: k * 0.1 + "s" }}>
              <div className="lp-step-num">{k + 1}</div>
              <h3>{s[i === 0 ? 0 : 2]}</h3>
              <p>{s[i === 0 ? 1 : 3]}</p>
              {k < 2 && <div className="lp-step-arrow"><Icon name="arrowRight" size={26} /></div>}
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function ShieldBand({ i }) {
  return (
    <section className="lp-sec">
      <div className="lp-wrap">
        <div className="lp-shield-band lp-reveal">
          <div className="glow" />
          <div>
            <span className="lp-shield-badge" style={{ marginBottom: 14 }}><Icon name="shieldCheck" size={15} /> Anti-ban</span>
            <h3>{L.shieldH[i]}</h3>
            <p>{L.shieldP[i]}</p>
            <div className="lp-shield-badges">
              {L.shieldBadges[i].map((b, k) => <span className="lp-shield-badge" key={k}><Icon name="check" size={14} /> {b}</span>)}
            </div>
          </div>
          <div className="lp-shield-ring center">
            <Ring pct={99} size={150} stroke={14} color="white" track="oklch(1 0 0 / 0.2)">
              <span className="tnum" style={{ fontSize: 34, fontWeight: 800, color: "white" }}>99%</span>
              <span style={{ fontSize: 12, color: "oklch(0.92 0.03 156)" }}>{L.shieldRingLabel[i]}</span>
            </Ring>
          </div>
        </div>
      </div>
    </section>
  );
}

function Pricing({ i }) {
  return (
    <section className="lp-sec" id="harga">
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag">{L.priceTag[i]}</span>
          <h2 className="lp-h2">{L.priceH2[i]}</h2>
          <p className="lp-lead">{L.priceLead[i]}</p>
        </div>
        <div className="lp-price-grid">
          {L.plans.map((p, k) => {
            const feat = k === 1;
            return (
              <div className={"lp-price lp-reveal" + (feat ? " feat" : "")} key={k} style={{ transitionDelay: k * 0.08 + "s" }}>
                {feat && <span className="lp-price-badge">{L.popular[i]}</span>}
                <h3>{p[i === 0 ? 0 : 6]}</h3>
                <div className="desc">{p[i === 0 ? 1 : 7]}</div>
                <div className="lp-price-amt">
                  <span className="n tnum" style={{ color: feat ? "var(--amber-700)" : "var(--green-700)" }}>{L.freeLabel[i]}</span>
                  <span className="lp-price-old">Rp {p[2]}{L.perMo[i]}</span>
                </div>
                <div className="lp-price-beta">{L.betaPill[i]}</div>
                <ul className="lp-price-list">
                  {p[i === 0 ? 3 : 8].map((f, j) => <li key={j}><span className={"ck" + (feat ? " amber" : "")}><Icon name="check" size={17} /></span> {f}</li>)}
                </ul>
                <a href="https://app.serabi.id" className={"btn btn-block btn-lg " + (feat ? "btn-amber" : "btn-primary")}>{p[i === 0 ? 4 : 9]}</a>
              </div>
            );
          })}
        </div>
        <p className="lp-price-note lp-reveal">{L.priceNote[i]}</p>
      </div>
    </section>
  );
}

function Testimonials({ i }) {
  return (
    <section className="lp-sec" style={{ background: "var(--surface-2)", borderTop: "1px solid var(--border)", borderBottom: "1px solid var(--border)" }}>
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag">{L.testTag[i]}</span>
          <h2 className="lp-h2">{L.testH2[i]}</h2>
        </div>
        <div className="lp-test-grid">
          {L.test.map((t, k) => (
            <div className="lp-test lp-reveal" key={k} style={{ transitionDelay: k * 0.08 + "s" }}>
              <div className="lp-test-stars">{Array.from({ length: 5 }).map((_, s) => <Icon key={s} name="star" size={16} fill />)}</div>
              <p className="lp-test-quote">"{t[i === 0 ? 0 : 3]}"</p>
              <div className="lp-test-author">
                <Avatar name={t[1]} size={42} />
                <div><div className="nm">{t[1]}</div><div className="biz">{t[2]}</div></div>
              </div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function FAQ({ i }) {
  const [open, setOpen] = useState(0);
  return (
    <section className="lp-sec" id="faq">
      <div className="lp-wrap">
        <div className="lp-sec-head lp-reveal">
          <span className="lp-tag">{L.faqTag[i]}</span>
          <h2 className="lp-h2">{L.faqH2[i]}</h2>
        </div>
        <div className="lp-faq">
          {L.faq.map((f, k) => (
            <div className={"lp-faq-item lp-reveal" + (open === k ? " open" : "")} key={k}>
              <button className="lp-faq-q" onClick={() => setOpen(open === k ? -1 : k)}>
                {f[i === 0 ? 0 : 2]}
                <span className="ic"><Icon name="plus" size={20} /></span>
              </button>
              <div className="lp-faq-a"><p>{f[i === 0 ? 1 : 3]}</p></div>
            </div>
          ))}
        </div>
      </div>
    </section>
  );
}

function FinalCTA({ i }) {
  return (
    <section className="lp-final">
      <div className="lp-wrap">
        <div className="lp-final-card lp-reveal">
          <div className="glow" />
          <h2>{L.finalH[i]}</h2>
          <p>{L.finalP[i]}</p>
          <div className="lp-final-cta">
            <a href="https://app.serabi.id" className="btn btn-lg btn-on-green"><Icon name="sparkle" /> {L.finalCta1[i]}</a>
            <a href="https://app.serabi.id" className="btn btn-lg btn-ghost-green">{L.finalCta2[i]}</a>
          </div>
        </div>
      </div>
    </section>
  );
}

function Footer({ i }) {
  const cols = [
    [L.footProduct[i], L.footLinks.product[i]],
    [L.footCompany[i], L.footLinks.company[i]],
    [L.footSupport[i], L.footLinks.support[i]],
  ];
  return (
    <footer className="lp-footer">
      <div className="lp-wrap">
        <div className="lp-foot-grid">
          <div className="lp-foot-brand">
            <Logo size={30} />
            <p>{L.footTagline[i]}</p>
          </div>
          {cols.map(([title, links], k) => (
            <div className="lp-foot-col" key={k}>
              <h4>{title}</h4>
              {links.map((l, j) => <a href="#top" key={j}>{l}</a>)}
            </div>
          ))}
        </div>
        <div className="lp-foot-bot">
          <span>{L.footRights[i]}</span>
        </div>
      </div>
    </footer>
  );
}

function Landing() {
  // SEO: Using semantic HTML with main landmark
  const [lang, setLang] = useState("id");
  const i = lang === "en" ? 1 : 0;
  useReveal();
  useEffect(() => { document.documentElement.lang = lang; }, [lang]);
  return (
    <main className="lp" role="main">
      <Nav lang={lang} setLang={setLang} i={i} />
      <Hero i={i} />
      <Strip i={i} />
      <Problem i={i} />
      <Features i={i} />
      <Showcase i={i} />
      <How i={i} />
      <ShieldBand i={i} />
      <Pricing i={i} />
      <Testimonials i={i} />
      <FAQ i={i} />
      <FinalCTA i={i} />
      <Footer i={i} />
    </main>
  );
}

ReactDOM.createRoot(document.getElementById("root")).render(<Landing />);
