import type { Metadata } from "next";

export const metadata: Metadata = {
  title: "Privacy Policy — Vib'n",
  description: "How Vib'n collects, uses, and protects your personal information.",
};

export default function PrivacyPage() {
  const lastUpdated = "February 19, 2026";

  return (
    <div className="container max-w-3xl mx-auto py-16 px-6">
      <h1 className="text-3xl font-bold mb-2">Privacy Policy</h1>
      <p className="text-sm text-muted-foreground mb-10">Last updated: {lastUpdated}</p>

      <div className="prose prose-neutral dark:prose-invert max-w-none space-y-8">

        <section>
          <p>
            Vib&apos;n (&quot;we&quot;, &quot;us&quot;, or &quot;our&quot;) is operated by Mark Henderson,
            located in Victoria, British Columbia, Canada. We are committed to protecting your
            personal information in accordance with the <em>Personal Information Protection Act</em> (BC PIPA)
            and Canada&apos;s <em>Personal Information Protection and Electronic Documents Act</em> (PIPEDA).
          </p>
          <p className="mt-4">
            This policy explains what information we collect when you use vibnai.com, how we use
            it, and what rights you have over it.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">1. Information We Collect</h2>
          <h3 className="font-medium mb-2">Information you provide</h3>
          <ul className="list-disc pl-6 space-y-1 text-muted-foreground">
            <li>Your name and email address when you sign in with Google</li>
            <li>Project names, descriptions, and content you create on the platform</li>
            <li>Code and files stored in your Vib&apos;n repositories</li>
            <li>Conversations with the AI assistant</li>
          </ul>

          <h3 className="font-medium mt-4 mb-2">Information collected automatically</h3>
          <ul className="list-disc pl-6 space-y-1 text-muted-foreground">
            <li>Session tokens to keep you signed in</li>
            <li>Basic usage data (pages visited, features used) for product improvement</li>
            <li>Server logs including IP address and browser type for security and debugging</li>
          </ul>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">2. How We Use Your Information</h2>
          <ul className="list-disc pl-6 space-y-1 text-muted-foreground">
            <li>To provide, operate, and improve the Vib&apos;n platform</li>
            <li>To authenticate you and maintain your session</li>
            <li>To power AI features — your project context is sent to the Gemini API to generate responses</li>
            <li>To send transactional emails (account, billing) when necessary</li>
            <li>To detect and prevent fraud, abuse, or security incidents</li>
          </ul>
          <p className="mt-3 text-muted-foreground">
            We do not sell your personal information to third parties. We do not use your data
            to train AI models.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">3. Third-Party Services</h2>
          <p className="text-muted-foreground mb-3">We use the following third-party services to operate Vib&apos;n:</p>
          <div className="overflow-x-auto">
            <table className="w-full text-sm border-collapse">
              <thead>
                <tr className="border-b">
                  <th className="text-left py-2 pr-4 font-medium">Service</th>
                  <th className="text-left py-2 pr-4 font-medium">Purpose</th>
                  <th className="text-left py-2 font-medium">Location</th>
                </tr>
              </thead>
              <tbody className="text-muted-foreground">
                <tr className="border-b">
                  <td className="py-2 pr-4">Google OAuth</td>
                  <td className="py-2 pr-4">Sign-in authentication</td>
                  <td className="py-2">USA</td>
                </tr>
                <tr className="border-b">
                  <td className="py-2 pr-4">Google Gemini API</td>
                  <td className="py-2 pr-4">AI chat and code assistance</td>
                  <td className="py-2">USA</td>
                </tr>
                <tr className="border-b">
                  <td className="py-2 pr-4">Google Cloud Run</td>
                  <td className="py-2 pr-4">IDE workspace hosting</td>
                  <td className="py-2">Canada</td>
                </tr>
                <tr>
                  <td className="py-2 pr-4">PostgreSQL (self-hosted)</td>
                  <td className="py-2 pr-4">User and project data storage</td>
                  <td className="py-2">Canada</td>
                </tr>
              </tbody>
            </table>
          </div>
          <p className="mt-3 text-muted-foreground text-sm">
            By using Vib&apos;n, you consent to your data being processed in these jurisdictions.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">4. Data Retention</h2>
          <p className="text-muted-foreground">
            We retain your account and project data for as long as your account is active.
            If you delete your account, we will delete your personal information within 30 days,
            except where we are required to retain it by law (e.g. billing records for 7 years
            under Canadian tax regulations).
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">5. Your Rights</h2>
          <p className="text-muted-foreground mb-3">Under BC PIPA and PIPEDA, you have the right to:</p>
          <ul className="list-disc pl-6 space-y-1 text-muted-foreground">
            <li>Access the personal information we hold about you</li>
            <li>Correct inaccurate information</li>
            <li>Request deletion of your account and associated data</li>
            <li>Withdraw consent for non-essential data processing</li>
            <li>Lodge a complaint with the Office of the Information and Privacy Commissioner for BC</li>
          </ul>
          <p className="mt-3 text-muted-foreground">
            To exercise any of these rights, email us at{" "}
            <a href="mailto:privacy@vibnai.com" className="underline underline-offset-4">
              privacy@vibnai.com
            </a>.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">6. Cookies</h2>
          <p className="text-muted-foreground">
            We use a single session cookie to keep you signed in. We do not use advertising
            cookies or third-party tracking pixels. You can clear cookies in your browser at any
            time, which will sign you out of Vib&apos;n.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">7. Security</h2>
          <p className="text-muted-foreground">
            We use HTTPS for all data in transit, encrypted storage for sensitive credentials,
            and session-based authentication. No system is 100% secure — if you discover a
            security issue please contact us at{" "}
            <a href="mailto:security@vibnai.com" className="underline underline-offset-4">
              security@vibnai.com
            </a>.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">8. Changes to This Policy</h2>
          <p className="text-muted-foreground">
            We may update this policy from time to time. We will notify you of material changes
            by posting the new policy on this page with an updated date. Continued use of Vib&apos;n
            after changes constitutes acceptance of the updated policy.
          </p>
        </section>

        <section>
          <h2 className="text-xl font-semibold mb-3">9. Contact</h2>
          <p className="text-muted-foreground">
            For any privacy questions or concerns:
          </p>
          <address className="not-italic mt-2 text-muted-foreground">
            Mark Henderson<br />
            Vib&apos;n<br />
            Victoria, British Columbia, Canada<br />
            <a href="mailto:privacy@vibnai.com" className="underline underline-offset-4">
              privacy@vibnai.com
            </a>
          </address>
        </section>

      </div>
    </div>
  );
}
