/* Backentra — Privacy Policy and Terms of Service. Verbatim from the approved copy;
   headings and bullets carry the exact wording supplied. Do not paraphrase these.
   window.BackentraLegal */
const LG = window.BackentraDesignSystem_93cf3a;
const { Icon: LIcon } = LG;
const lgc = { maxWidth: 860, margin: "0 auto", padding: "0 32px" };

/* [heading, [paragraph | ["ul", [items]] ...]] */
const PRIVACY = [
  ["Information We Collect", [
    "Depending on how you interact with our website, we may collect:",
    ["ul", ["Name", "Company name", "Email address", "Phone number", "Business information", "Industry", "Company size", "Information submitted through contact forms", "Waitlist and founding member submissions", "Device information", "Browser type", "IP address", "Pages visited", "General website analytics"]],
    "We do not intentionally collect sensitive personal information unless you voluntarily provide it.",
  ]],
  ["How We Use Your Information", [
    "We use information to:",
    ["ul", ["Respond to inquiries", "Process waitlist submissions", "Contact you regarding Backentra", "Improve our website and services", "Analyze website performance", "Send launch updates", "Communicate important product announcements"]],
    "We do not sell your personal information.",
  ]],
  ["Marketing Communications", [
    "If you join our mailing list, we may send occasional emails regarding:",
    ["ul", ["Product updates", "Launch announcements", "Feature releases", "Founding Member information", "Company news"]],
    "You may unsubscribe at any time using the unsubscribe link included in our emails.",
  ]],
  ["Cookies", [
    "Our website may use cookies and similar technologies to:",
    ["ul", ["Improve website functionality", "Remember preferences", "Measure website performance", "Understand visitor behavior"]],
    "You can disable cookies through your browser settings, although some features may not function correctly.",
  ]],
  ["Third-Party Services", [
    "We may use trusted third-party providers for services including:",
    ["ul", ["Website hosting", "Analytics", "Email delivery", "Payment processing (after launch)", "Customer communication"]],
    "These providers may process information on our behalf under their own privacy policies.",
  ]],
  ["Data Security", [
    "We use commercially reasonable administrative, technical, and physical safeguards designed to protect the information we collect. While we strive to protect your information, no method of electronic transmission or storage can be guaranteed to be completely secure.",
  ]],
  ["Data Retention", [
    "We retain information only for as long as necessary to:",
    ["ul", ["Provide requested services", "Meet legal obligations", "Resolve disputes", "Improve our products"]],
    "When information is no longer needed, it will be securely deleted or anonymized where practical.",
  ]],
  ["Children's Privacy", [
    "Backentra is intended for business use and is not directed toward children under the age of 13. We do not knowingly collect personal information from children.",
  ]],
  ["Your Rights", [
    "Depending on your location, you may have the right to:",
    ["ul", ["Access your information", "Correct inaccurate information", "Request deletion of your information", "Request a copy of your information", "Withdraw consent where applicable"]],
    "Requests may be submitted using the contact information below.",
  ]],
  ["Changes to This Policy", [
    "We may update this Privacy Policy periodically. When significant changes are made, we will update the Effective Date shown above.",
  ]],
];

const TERMS = [
  ["Acceptance of Terms", [
    "By using Backentra, you acknowledge that you have read and agree to these Terms of Service.",
    "If you do not agree with these Terms, please do not use our website or services.",
  ]],
  ["Pre-Launch Notice", [
    "Backentra is currently under active development.",
    "Features, pricing, integrations, and functionality displayed on this website are subject to change before public launch.",
    "Nothing on this website constitutes a guarantee that any feature, integration, or pricing will be available at launch.",
  ]],
  ["Eligibility", [
    "You must be at least 18 years old and legally able to enter into binding agreements to use our services.",
  ]],
  ["Accounts", [
    "When the platform launches, you will be responsible for:",
    ["ul", ["Maintaining accurate account information", "Keeping your login credentials secure", "All activity occurring under your account"]],
    "You agree to notify us immediately if you believe your account has been compromised.",
  ]],
  ["Acceptable Use", [
    "You agree not to:",
    ["ul", ["Violate any laws or regulations", "Attempt unauthorized access to systems", "Disrupt or interfere with the platform", "Upload malicious software", "Reverse engineer the platform where prohibited by law", "Misuse the services in a manner that harms other users or Backentra"]],
  ]],
  ["Intellectual Property", [
    "All software, branding, designs, graphics, content, trademarks, logos, and intellectual property associated with Backentra remain the property of Backentra unless otherwise stated.",
    "You may not copy, distribute, reproduce, or create derivative works without written permission.",
  ]],
  ["Third-Party Integrations", [
    "Backentra may integrate with third-party services.",
    "We are not responsible for the availability, policies, security, or functionality of third-party providers.",
  ]],
  ["Service Availability", [
    "We strive to maintain reliable service but do not guarantee uninterrupted availability.",
    "Maintenance, updates, outages, and events beyond our control may temporarily affect access.",
  ]],
  ["Pricing", [
    "Pricing displayed before launch is subject to change.",
    "Subscription pricing, billing policies, refunds, and cancellation terms will be governed by the applicable customer agreement in effect when services are purchased.",
  ]],
  ["Limitation of Liability", [
    "To the fullest extent permitted by law, Backentra shall not be liable for indirect, incidental, consequential, special, or punitive damages arising from the use of our website or services.",
  ]],
  ["Disclaimer", [
    "The website and services are provided on an \u201cas is\u201d and \u201cas available\u201d basis without warranties of any kind, whether express or implied.",
  ]],
  ["Termination", [
    "We reserve the right to suspend or terminate access to our website or services if these Terms are violated or if necessary to protect the platform or its users.",
  ]],
  ["Governing Law", [
    "These Terms shall be governed by the laws of the State of Florida, without regard to conflict of law principles, unless otherwise required by applicable law.",
  ]],
  ["Changes to These Terms", [
    "We may update these Terms periodically. Continued use of the website or services after changes become effective constitutes acceptance of the updated Terms.",
  ]],
];

const lgP = { fontSize: 15.5, lineHeight: 1.7, color: "var(--text-body)", margin: "0 0 12px" };

function LegalPage({ kind, onNav }) {
  const priv = kind === "privacy";
  const rows = priv ? PRIVACY : TERMS;
  React.useEffect(() => {
    window.BackentraSetMeta && window.BackentraSetMeta({
      path: priv ? "/privacy" : "/terms",
      title: (priv ? "Privacy Policy" : "Terms of Service") + " — Backentra",
      description: priv ? "How Backentra collects, uses and protects your information." : "The terms that apply to using the Backentra website and, once available, the platform.",
    });
  }, [priv]);
  return (
    <div style={{ background: "var(--surface-card)", minHeight: "100vh" }}>
      <window.BackentraSiteHeader current={kind} onNav={onNav} />

      <section style={{ background: "var(--gray-100)", padding: "48px 0 40px" }}>
        <div style={lgc}>
          <div style={{ fontFamily: "var(--font-display)", fontWeight: 700, fontSize: 11, letterSpacing: ".08em", textTransform: "uppercase", color: "var(--text-muted)", marginBottom: 12 }}>Legal</div>
          <h1 style={{ fontSize: 40, lineHeight: 1.08, margin: "0 0 12px" }}>{priv ? "Privacy Policy" : "Terms of Service"}</h1>
          <p style={{ fontFamily: "var(--font-mono)", fontSize: 13.5, color: "var(--text-muted)", margin: 0 }}>
            <b style={{ fontFamily: "var(--font-display)", color: "var(--text-body)" }}>Effective Date:</b> [Launch Date]
          </p>
        </div>
      </section>

      <section style={{ padding: "40px 0 72px", background: "var(--surface-card)" }}>
        <div style={lgc}>
          {priv
            ? <p style={lgP}>Backentra (&ldquo;Backentra,&rdquo; &ldquo;we,&rdquo; &ldquo;our,&rdquo; or &ldquo;us&rdquo;) respects your privacy and is committed to protecting the information you share with us. This Privacy Policy explains what information we collect, how we use it, and the choices available to you.</p>
            : <React.Fragment>
                <p style={lgP}>Welcome to Backentra.</p>
                <p style={lgP}>These Terms of Service govern your use of the Backentra website and, once available, the Backentra software platform. By accessing or using our website or services, you agree to these Terms.</p>
              </React.Fragment>}

          {rows.map(([h, blocks], i) => (
            <div key={h} style={{ paddingTop: 26, marginTop: 26, borderTop: "1px solid var(--border)" }}>
              <h2 style={{ fontSize: 21, margin: "0 0 12px" }}>{h}</h2>
              {blocks.map((b, j) => Array.isArray(b)
                ? <ul key={j} style={{ margin: "0 0 12px", paddingLeft: 22 }}>
                    {b[1].map((li) => <li key={li} style={{ fontSize: 15.5, lineHeight: 1.7, color: "var(--text-body)", marginBottom: 3 }}>{li}</li>)}
                  </ul>
                : <p key={j} style={lgP}>{b}</p>)}
            </div>
          ))}

          <div style={{ paddingTop: 26, marginTop: 26, borderTop: "1px solid var(--border)" }}>
            <h2 style={{ fontSize: 21, margin: "0 0 12px" }}>Contact</h2>
            <p style={lgP}>{priv ? "Questions regarding this Privacy Policy may be sent to:" : "Questions regarding these Terms of Service may be directed to:"}</p>
            <div style={{ padding: "16px 20px", borderRadius: "var(--radius-lg)", background: "var(--gray-50)", border: "1px solid var(--border)" }}>
              <div style={{ fontFamily: "var(--font-display)", fontWeight: 800, fontSize: 15.5, color: "var(--text-strong)", marginBottom: 8 }}>Backentra</div>
              <div style={{ fontSize: 14.5, lineHeight: 1.7, color: "var(--text-body)" }}>
                Email: <a href="mailto:office@backentra.com" style={{ color: "var(--accent)", fontWeight: 600 }}>office@backentra.com</a><br />
                Website: <a href="https://backentra.com" style={{ color: "var(--accent)", fontWeight: 600 }}>https://backentra.com</a>
              </div>
            </div>
          </div>
        </div>
      </section>

      <window.BackentraSiteFooter onNav={onNav} />
    </div>
  );
}

window.BackentraLegal = LegalPage;
