/* global React */

function MSMarkL({ size = 14 }) {
  return (
    <svg className="ms" width={size} height={size} viewBox="0 0 23 23" aria-hidden="true">
      <rect width="10" height="10" x="1" y="1" fill="#F25022" />
      <rect width="10" height="10" x="12" y="1" fill="#7FBA00" />
      <rect width="10" height="10" x="1" y="12" fill="#00A4EF" />
      <rect width="10" height="10" x="12" y="12" fill="#FFB900" />
    </svg>
  );
}

function LegalNavV6() {
  return (
    <header className="v4nav">
      <div className="v4nav-in">
        <a href="index.html" className="brand" aria-label="tcviz home">
          <window.Logo height={34} tone="pbi" />
        </a>
        <nav className="v4nav-links" aria-label="Primary">
          <a href="index.html#products">Catalog</a>
          <a href="gallery.html">Gallery</a>
          <a href="blog.html">Blog</a>
          <a href="index.html#specs">Why tcviz</a>
          <a href="about.html">About</a>
        </nav>
        <div className="v4nav-cta">
          <a href="contact.html" className="btn btn-ghost btn-sm">Contact</a>
          <a href="index.html#products" className="btn btn-sm">Browse visuals</a>
        </div>
      </div>
    </header>
  );
}

function LegalFooterV6() {
  return (
    <footer className="v4foot">
      <div className="wrap">
        <div className="v4foot-grid">
          <div>
            <window.Logo height={30} tone="pbi" />
            <p className="blurb">Enterprise-grade custom visuals for Power BI. Designed, documented and supported by TC.</p>
            <span className="pill" style={{ marginTop: 16 }}><MSMarkL /> Microsoft AppSource</span>
          </div>
          <div>
            <h5>Products</h5>
            <ul>
              <li><a href="index.html#products">All visuals</a></li>
              <li><a href="gallery.html">Gallery</a></li>
              <li><a href="blog.html">Blog</a></li>
            </ul>
          </div>
          <div>
            <h5>Company</h5>
            <ul>
              <li><a href="about.html">About TC</a></li>
              <li><a href="contact.html">Contact</a></li>
            </ul>
          </div>
          <div>
            <h5>Legal</h5>
            <ul>
              <li><a href="terms.html">Terms of Use</a></li>
              <li><a href="privacy.html">Privacy</a></li>
              <li><a href="mailto:support@tcviz.com">support@tcviz.com</a></li>
            </ul>
          </div>
        </div>
        <div className="v4foot-bottom">
          <span>© 2026 TC · tcviz.com</span>
          <span>All systems operational</span>
        </div>
      </div>
    </footer>
  );
}

function LegalShellV6({ title, effective, updated, children }) {
  return (
    <div>
      <LegalNavV6 />
      <section className="sec tight" style={{ paddingTop: 64, paddingBottom: 8 }}>
        <div className="wrap">
          <div style={{ display: "flex", gap: 8, fontFamily: "var(--font-mono)", fontSize: 12, color: "var(--muted)", marginBottom: 12 }}>
            <a href="index.html" style={{ color: "var(--muted)" }}>Home</a>
            <span>/</span>
            <span style={{ color: "var(--foreground)" }}>{title}</span>
          </div>
          <h1 style={{ fontFamily: "var(--font-sans)", fontWeight: 700, fontSize: "clamp(34px,4.6vw,54px)", lineHeight: 1.04, letterSpacing: "-0.03em", margin: 0 }}>{title}</h1>
          <p style={{ fontSize: 14.5, color: "var(--muted)", margin: "16px 0 0" }}>
            {effective && <span>Effective: {effective} · </span>}
            {updated && <span>Last updated: {updated}</span>}
          </p>
        </div>
      </section>
      <section className="sec" style={{ paddingTop: 24 }}>
        <div className="wrap">
          <div style={{ maxWidth: 760, color: "var(--muted)", fontSize: 15.5, lineHeight: 1.75 }}>
            {children}
          </div>
        </div>
      </section>
      <LegalFooterV6 />
    </div>
  );
}

function H2V6({ children }) {
  return <h2 style={{ fontSize: 18, color: "var(--foreground)", fontWeight: 700, marginTop: 32, marginBottom: 10 }}>{children}</h2>;
}

function TermsV6() {
  return (
    <LegalShellV6 title="Terms of Use" effective="1 January 2025" updated="1 June 2025">
      <H2V6>1. Acceptance</H2V6>
      <p>By installing or using any TC visual ("the Visual"), you agree to be bound by these Terms of Use. If you do not agree, do not install or use the Visual.</p>

      <H2V6>2. License Grant</H2V6>
      <p>TCViz grants you a non-exclusive, non-transferable, revocable license to use the Visual within Microsoft Power BI, subject to these Terms and any applicable AppSource subscription terms.</p>
      <ul style={{ paddingLeft: 20 }}>
        <li><strong style={{ color: "var(--foreground)" }}>Free tier:</strong> Available at no cost. Includes the documented Free feature set.</li>
        <li><strong style={{ color: "var(--foreground)" }}>Pro tier:</strong> Available via Microsoft AppSource subscription. Unlocks all Pro features.</li>
      </ul>

      <H2V6>3. Restrictions</H2V6>
      <p>You may not:</p>
      <ul style={{ paddingLeft: 20 }}>
        <li>Reverse-engineer, decompile, or disassemble the Visual (except where permitted by law).</li>
        <li>Redistribute, resell, sublicense, or transfer the Visual to any third party.</li>
        <li>Remove or alter any proprietary notices, branding, or watermarks.</li>
        <li>Use the Visual in any way that violates applicable laws or regulations.</li>
      </ul>

      <H2V6>4. Intellectual Property</H2V6>
      <p>The Visual, including all source code, design and documentation, is the intellectual property of TCViz. Publishing source for transparency does not grant rights to create competing commercial products.</p>

      <H2V6>5. Disclaimer of Warranties</H2V6>
      <p>The Visual is provided "as is" without warranty of any kind. TCViz does not warrant that the Visual will be error-free or uninterrupted.</p>

      <H2V6>6. Limitation of Liability</H2V6>
      <p>To the maximum extent permitted by law, TCViz shall not be liable for any indirect, incidental, special, consequential or punitive damages arising from your use of the Visual.</p>

      <H2V6>7. Updates and Modifications</H2V6>
      <p>TCViz may update the Visual and these Terms at any time. Continued use after updates constitutes acceptance.</p>

      <H2V6>8. Governing Law</H2V6>
      <p>These Terms are governed by the laws of Spain. Any disputes shall be resolved in the competent courts of Tarragona, Spain.</p>

      <H2V6>9. Contact</H2V6>
      <p>For questions, contact <strong style={{ color: "var(--foreground)" }}>TCViz</strong> · <a href="mailto:support@tcviz.com" style={{ color: "var(--primary)" }}>support@tcviz.com</a> · <a href="https://tcviz.com" style={{ color: "var(--primary)" }}>tcviz.com</a></p>
    </LegalShellV6>
  );
}

function PrivacyV6() {
  return (
    <LegalShellV6 title="Privacy Policy" effective="1 January 2025" updated="1 June 2025">
      <H2V6>1. Overview</H2V6>
      <p>Each TC visual ("the Visual") is a Power BI custom visual developed and published by TCViz. This policy explains what data the Visual processes and your rights regarding that data.</p>

      <H2V6>2. Data Collected</H2V6>
      <p>The Visual does <strong style={{ color: "var(--foreground)" }}>not</strong> collect, store, transmit or share any personal data. Specifically:</p>
      <ul style={{ paddingLeft: 20 }}>
        <li>No data is sent to external servers or third-party services.</li>
        <li>No telemetry, analytics or usage metrics are gathered.</li>
        <li>No cookies or persistent identifiers are used.</li>
        <li>No network requests are made by the Visual during normal operation.</li>
      </ul>

      <H2V6>3. Data Processing</H2V6>
      <p>All data processing occurs within the Power BI runtime environment on your device or tenant. The Visual reads data provided through its field wells solely to render the visualization. This data never leaves the Power BI sandbox.</p>

      <H2V6>4. License Verification</H2V6>
      <p>To determine whether a user holds a Pro license, the Visual uses Microsoft's official <code>IVisualLicenseManager</code> API. TCViz does not receive or store personal data as part of this process. See <a href="https://privacy.microsoft.com/en-us/privacystatement" target="_blank" rel="noopener noreferrer" style={{ color: "var(--primary)" }}>Microsoft's Privacy Statement</a> for details.</p>

      <H2V6>5. Third-Party Services</H2V6>
      <p>The Visual does not integrate with any third-party analytics, advertising or data-processing services.</p>

      <H2V6>6. Children's Privacy</H2V6>
      <p>The Visual is intended for business use and is not directed at children under 13.</p>

      <H2V6>7. Changes to This Policy</H2V6>
      <p>We may update this policy from time to time. Continued use after changes constitutes acceptance.</p>

      <H2V6>8. Contact</H2V6>
      <p><strong style={{ color: "var(--foreground)" }}>TCViz</strong> · <a href="mailto:support@tcviz.com" style={{ color: "var(--primary)" }}>support@tcviz.com</a> · <a href="https://tcviz.com" style={{ color: "var(--primary)" }}>tcviz.com</a></p>
    </LegalShellV6>
  );
}

window.TermsV6 = TermsV6;
window.PrivacyV6 = PrivacyV6;
