import React from 'react';
import Link from 'next/link';
import { ObfuscatedMailto } from '@/components/ui/ObfuscatedMailto';

export const metadata = {
  title: 'Privacy Policy | QR Master',
  description: 'Read our Privacy Policy to understand how QR Master collects, uses, and protects your data. We are GDPR compliant and committed to user privacy and security.',
  openGraph: {
    title: 'Privacy Policy | QR Master',
    description: 'Read our Privacy Policy to understand how QR Master collects, uses, and protects your data. We are GDPR compliant and committed to user privacy and security.',
    url: 'https://www.qrmaster.net/privacy',
    type: 'website',
    images: ['/og-image.png'],
  },
};

export default function PrivacyPage() {
  return (
    <div className="min-h-screen bg-white py-12">
      <div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-4xl">
        <div className="mb-8">
          <Link href="/" className="text-primary-600 hover:text-primary-700 font-medium">
            ← Back to Home
          </Link>
        </div>

        <h1 className="text-4xl font-bold text-gray-900 mb-4">Privacy Policy</h1>
        <p className="text-gray-600 mb-8">Last updated: January 2025</p>

        <div className="prose prose-lg max-w-none">
          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">1. Introduction</h2>
            <p className="text-gray-700 mb-4">
              Welcome to QR Master ("we," "our," or "us"). We respect your privacy and are committed to protecting your personal data.
              This privacy policy explains how we collect, use, and protect your information when you use our services.
            </p>
            <p className="text-gray-700 mb-4">
              We implement appropriate security measures including secure HTTPS transmission, password hashing, database access controls,
              and CSRF protection to keep your data safe.
            </p>
          </section>

          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">2. Information We Collect</h2>

            <h3 className="text-xl font-semibold text-gray-900 mb-3">Information You Provide</h3>
            <ul className="list-disc pl-6 mb-4 text-gray-700 space-y-2">
              <li><strong>Account Information:</strong> Name, email address, and password</li>
              <li><strong>Payment Information:</strong> Processed securely through Stripe (we do not store credit card information)</li>
              <li><strong>QR Code Content:</strong> URLs, text, and customization settings for your QR codes</li>
            </ul>

            <h3 className="text-xl font-semibold text-gray-900 mb-3">Information Collected Automatically</h3>
            <ul className="list-disc pl-6 mb-4 text-gray-700 space-y-2">
              <li><strong>Usage Data:</strong> QR code scans and analytics</li>
              <li><strong>Technical Data:</strong> IP address, browser type, and device information</li>
              <li><strong>Cookies:</strong> Essential cookies for authentication and optional analytics cookies (PostHog) with your consent</li>
            </ul>
          </section>

          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">3. How We Use Your Information</h2>
            <p className="text-gray-700 mb-4">We use your data to:</p>
            <ul className="list-disc pl-6 mb-4 text-gray-700 space-y-2">
              <li>Provide and maintain our QR code services</li>
              <li>Process payments and manage subscriptions</li>
              <li>Provide customer support</li>
              <li>Improve our services and develop new features</li>
              <li>Detect and prevent fraud</li>
            </ul>
            <p className="text-gray-700 mb-4">
              We retain your data while your account is active. Upon account deletion, most data is removed immediately,
              though some may be retained for legal compliance. Aggregated, anonymized analytics may be kept indefinitely.
            </p>
          </section>

          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">4. Data Sharing</h2>
            <p className="text-gray-700 mb-4">We may share your data with:</p>
            <ul className="list-disc pl-6 mb-4 text-gray-700 space-y-2">
              <li><strong>Stripe:</strong> Payment processing</li>
              <li><strong>PostHog:</strong> Analytics (only with your consent, respects Do Not Track)</li>
              <li><strong>Vercel:</strong> Cloud hosting provider</li>
              <li><strong>Legal Requirements:</strong> When required by law</li>
            </ul>
            <p className="text-gray-700 mb-4">
              We do not sell your personal data. Analytics are only activated if you accept optional cookies.
            </p>
          </section>

          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">5. Your Rights (GDPR)</h2>
            <p className="text-gray-700 mb-4">You have the right to:</p>
            <ul className="list-disc pl-6 mb-4 text-gray-700 space-y-2">
              <li><strong>Access:</strong> Request a copy of your personal data</li>
              <li><strong>Rectification:</strong> Correct inaccurate data (update in account settings)</li>
              <li><strong>Erasure:</strong> Delete your data (account deletion available in settings)</li>
              <li><strong>Data Portability:</strong> Receive your data in a portable format</li>
              <li><strong>Object:</strong> Object to processing based on legitimate interests</li>
              <li><strong>Withdraw Consent:</strong> Withdraw cookie consent at any time</li>
            </ul>
            <p className="text-gray-700 mb-4">
              To exercise these rights, contact us at{' '}
              <a href="mailto:support@qrmaster.net" className="text-primary-600 hover:text-primary-700">
                support@qrmaster.net
              </a>
            </p>
            <p className="text-gray-700 mb-4">
              Our service is for users 16 years and older. If you're in the EEA and have concerns,
              you may lodge a complaint with your local data protection authority.
            </p>
          </section>

          <section className="mb-8">
            <h2 className="text-2xl font-bold text-gray-900 mb-4">6. Contact Us</h2>
            <p className="text-gray-700 mb-4">
              If you have questions about this privacy policy, please contact us:
            </p>
            <div className="bg-gray-50 p-6 rounded-lg">
              <p className="text-gray-700 mb-2">
                <strong>Email:</strong>{' '}
                <ObfuscatedMailto email="support@qrmaster.net" className="text-primary-600 hover:text-primary-700" />
              </p>
              <p className="text-gray-700 mb-2"><strong>Website:</strong> <a href="/" className="text-primary-600 hover:text-primary-700">qrmaster.net</a></p>
            </div>
          </section>
        </div>

        <div className="mt-12 pt-8 border-t border-gray-200">
          <p className="text-gray-600 text-center">
            <Link href="/" className="text-primary-600 hover:text-primary-700">
              Back to Home
            </Link>
          </p>
        </div>
      </div>
    </div>
  );
}
