// Footer.jsx
function LDFooter() {
  const cols = [
    {
      title: "Solutions",
      links: [
        { l: "Florists", h: "industries.html#florists" },
        { l: "Food + meal kits", h: "industries.html#food" },
        { l: "Wine + alcohol", h: "industries.html#wine" },
        { l: "Grocery + pantry", h: "industries.html#grocery" },
        { l: "Furniture + bulky", h: "industries.html#furniture" },
        { l: "Pharmacy + health", h: "industries.html#pharmacy" },
      ],
    },
    {
      title: "Product",
      links: [
        { l: "Features", h: "features.html" },
        { l: "Integrations", h: "features.html#integrations" },
      ],
    },
    {
      title: "Integrations",
      links: [
        { l: "Shopify", h: "https://www.shopify.com" },
        { l: "Locate2u", h: "https://locate2u.com" },
        { l: "Twilio", h: "https://www.twilio.com" },
        { l: "Zapier", h: "https://zapier.com" },
      ],
    },
    {
      title: "Company",
      links: [
        { l: "About us", h: "about.html" },
        { l: "Pricing", h: "pricing.html" },
        { l: "Support", h: "support.html" },
      ],
    },
    {
      title: "Resources",
      links: [
        { l: "Product updates", h: "product-updates.html" },
      ],
    },
  ];

  const legal = [
    { l: "System Status", h: "coming-soon.html" },
    { l: "Privacy Policy", h: "privacy.html" },
    { l: "Terms & Conditions", h: "terms.html" },
    { l: "Cookie Policy", h: "cookies.html" },
    { l: "Sitemap", h: "sitemap.xml" },
  ];
  const socials = [
    { n: "Facebook", h: "https://www.facebook.com/locate2u", d: "M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z" },
    { n: "X", h: "https://x.com/locate2u", d: "M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z" },
    { n: "YouTube", h: "https://www.youtube.com/@locate2u", d: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" },
    { n: "LinkedIn", h: "https://www.linkedin.com/company/locate2u", d: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" },
  ];

  // Internal pages navigate in the same tab; only off-site links open a new tab.
  const isExternal = (h) => /^https?:\/\//i.test(h);
  const linkTarget = (h) => (isExternal(h) ? { target: "_blank", rel: "noopener noreferrer" } : {});

  return (
    <footer style={{ background: "var(--ld-dark)", color: "#fff", padding: "80px 0 32px", position: "relative", overflow: "hidden" }}>
      <div className="ld-container-wide" style={{ position: "relative" }}>
        <div className="ld-footer-grid" style={{ marginBottom: 64 }}>
          <div>
            <div style={{ display: "flex", alignItems: "center", gap: 12, marginBottom: 16 }}>
              <window.LDLogoMark size={36}/>
              <span style={{ fontWeight: 800, fontSize: 19, color: "#fff", letterSpacing: "-0.4px" }}>Local Delivery Premium</span>
            </div>
            <p style={{ fontSize: 14, lineHeight: 1.6, color: "rgba(255,255,255,0.6)", maxWidth: 280 }}>
              The Shopify app for stores that deliver locally. Built by the team behind Locate2u.
            </p>
          </div>
          {cols.map((c) => (
            <div key={c.title}>
              <div className="ld-mono" style={{ color: "rgba(255,255,255,0.5)", fontSize: 11, letterSpacing: "1.6px", textTransform: "uppercase", marginBottom: 18, fontWeight: 600 }}>{c.title}</div>
              <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 12 }}>
                {c.links.map((l) => (
                  <li key={l.l}><a href={l.h} {...linkTarget(l.h)} style={{ color: "rgba(255,255,255,0.78)", fontSize: 14 }}>{l.l}</a></li>
                ))}
              </ul>
            </div>
          ))}
        </div>

        <div style={{ paddingTop: 28, borderTop: "1px solid rgba(255,255,255,0.10)" }}>
          <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", flexWrap: "wrap", gap: 20 }}>
            <div style={{ display: "flex", flexWrap: "wrap", gap: 28, fontSize: 14 }}>
              {legal.map((x) => (
                <a key={x.l} href={x.h} {...linkTarget(x.h)} style={{ color: "rgba(255,255,255,0.7)" }}>{x.l}</a>
              ))}
            </div>
            <div style={{ display: "flex", gap: 12 }}>
              {socials.map((s) => (
                <a key={s.n} href={s.h} {...linkTarget(s.h)} aria-label={s.n} style={{
                  width: 38, height: 38, borderRadius: "50%",
                  border: "1px solid rgba(255,255,255,0.25)",
                  display: "inline-flex", alignItems: "center", justifyContent: "center",
                  color: "rgba(255,255,255,0.85)",
                }}>
                  <svg viewBox="0 0 24 24" width="15" height="15" fill="currentColor" aria-hidden="true"><path d={s.d}/></svg>
                </a>
              ))}
            </div>
          </div>
          <div style={{ marginTop: 24, fontSize: 13, color: "rgba(255,255,255,0.45)" }}>
            © 2026 Locate Technologies Limited. Local Delivery Premium is a product of Locate2u.
          </div>
        </div>
      </div>
    </footer>
  );
}
window.LDFooter = LDFooter;
