import Link from "next/link"
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator"
import { ArrowLeft, Shield } from "lucide-react"

export const metadata = {
  title: "Privacy Policy - Factor Sciences",
  description: "Privacy policy and data protection practices for Factor Sciences digital telehealth platform"
}

export default function PrivacyPolicy() {
  return (
    <div className="min-h-screen bg-background">
      {/* Header */}
      <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
        <div className="container flex h-16 items-center max-w-6xl mx-auto px-4">
          <Button asChild variant="ghost" size="sm">
            <Link href="/" className="gap-2">
              <ArrowLeft className="size-4" />
              Back to Home
            </Link>
          </Button>
        </div>
      </header>

      {/* Content */}
      <main className="py-12 md:py-20">
        <div className="container max-w-4xl mx-auto px-4">
          {/* Hero */}
          <div className="text-center mb-12">
            <div className="inline-flex items-center gap-2 text-primary mb-4">
              <Shield className="size-6 icon-glow-primary" />
            </div>
            <h1 className="text-4xl md:text-5xl font-bold tracking-tight text-foreground mb-4 font-[family-name:var(--font-display)]">
              Privacy Policy
            </h1>
            <p className="text-muted-foreground">
              Last Updated: December 30, 2024
            </p>
          </div>

          {/* Content Card */}
          <Card className="shadow-elevated border-gradient">
            <CardContent className="pt-8 pb-8">
              <div className="prose prose-sm max-w-none text-foreground space-y-8">

                {/* Introduction */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">Introduction</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    Factor Sciences ("we," "us," "our," or "Company") is committed to protecting your privacy and handling your
                    personal and health information with care and transparency. This Privacy Policy explains how we collect, use,
                    disclose, and safeguard your information when you use our digital telehealth services platform (the "Platform").
                  </p>
                  <p className="text-muted-foreground leading-relaxed">
                    By using the Platform, you consent to the data practices described in this Privacy Policy. If you do not agree
                    with this Privacy Policy, please do not access or use the Platform.
                  </p>
                </section>

                <Separator />

                {/* Section 1 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">1. Information We Collect</h2>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">1.1 Personal Information</h3>
                  <p className="text-muted-foreground leading-relaxed mb-3">
                    We collect personal information that you voluntarily provide when registering for our services:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Full name, date of birth, and contact information (email address, phone number)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Account credentials (username, password)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Billing and payment information (credit card details, billing address)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>State of residence and jurisdiction information for compliance purposes</span>
                    </li>
                  </ul>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">1.2 Health Information</h3>
                  <p className="text-muted-foreground leading-relaxed mb-3">
                    In connection with consultative services, we may collect:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Medical history, current health conditions, and wellness goals</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Information shared during telehealth consultations with healthcare professionals</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Health-related documentation you upload or share with providers</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Notes and records created by healthcare professionals during consultations</span>
                    </li>
                  </ul>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">1.3 Technical and Usage Information</h3>
                  <p className="text-muted-foreground leading-relaxed mb-3">
                    We automatically collect certain information when you use our Platform:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Device information (IP address, browser type, operating system)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Usage data (pages visited, time spent, features accessed)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Cookies and similar tracking technologies for session management and analytics</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Log files and error reports for platform maintenance and improvement</span>
                    </li>
                  </ul>
                </section>

                <Separator />

                {/* Section 2 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">2. How We Use Your Information</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We use the information we collect for the following purposes:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Service Delivery:</strong> To provide telehealth consultations, administrative services, and access to educational resources</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Account Management:</strong> To create and maintain your user account, authenticate access, and manage your preferences</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Payment Processing:</strong> To process transactions, prevent fraud, and maintain billing records</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Communication:</strong> To send service-related notifications, appointment reminders, and respond to inquiries</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Platform Improvement:</strong> To analyze usage patterns, improve functionality, and enhance user experience</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Legal Compliance:</strong> To comply with applicable laws, regulations, and professional healthcare standards</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Security:</strong> To protect against unauthorized access, maintain platform integrity, and ensure data security</span>
                    </li>
                  </ul>
                </section>

                <Separator />

                {/* Section 3 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">3. How We Share Your Information</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We do not sell your personal information. We may share your information only in the following circumstances:
                  </p>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">3.1 Healthcare Providers</h3>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    Your health information is shared with licensed healthcare professionals who provide consultative services
                    through our Platform. These providers are bound by professional confidentiality obligations and HIPAA standards.
                  </p>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">3.2 Service Providers</h3>
                  <p className="text-muted-foreground leading-relaxed mb-3">
                    We work with trusted third-party service providers who assist us with:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Payment processing (e.g., Stripe, payment gateway providers)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Cloud hosting and data storage services</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Communication platforms (email, SMS notifications)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Analytics and platform performance monitoring</span>
                    </li>
                  </ul>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    These service providers are contractually obligated to use your information only for the purposes we specify
                    and to maintain appropriate security measures.
                  </p>

                  <h3 className="text-xl font-semibold mb-3 text-foreground">3.3 Legal Requirements</h3>
                  <p className="text-muted-foreground leading-relaxed mb-3">
                    We may disclose your information when required to do so by law, including:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>In response to valid legal processes (subpoenas, court orders, government requests)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>To protect the rights, property, or safety of Factor Sciences, our users, or the public</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>To prevent or investigate fraud, security issues, or illegal activity</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>In connection with professional reporting obligations (e.g., mandatory reporting of harm)</span>
                    </li>
                  </ul>
                </section>

                <Separator />

                {/* Section 4 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">4. Data Security</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We implement administrative, technical, and physical security measures designed to protect your information,
                    aligned with HIPAA security standards:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Encryption:</strong> Data transmission over HTTPS/TLS protocols and encryption of sensitive data at rest</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Access Controls:</strong> Role-based access restrictions, multi-factor authentication, and password requirements</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Monitoring:</strong> Regular security assessments, intrusion detection, and audit logging</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Employee Training:</strong> Privacy and security training for all personnel with access to user data</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Incident Response:</strong> Procedures for detecting, responding to, and reporting security breaches</span>
                    </li>
                  </ul>
                  <div className="p-4 bg-primary/5 border-l-4 border-l-primary rounded-r-lg">
                    <p className="text-sm text-muted-foreground">
                      While we implement industry-standard security practices, no method of electronic storage or transmission is
                      100% secure. We cannot guarantee absolute security but are committed to protecting your information using
                      reasonable and appropriate safeguards.
                    </p>
                  </div>
                </section>

                <Separator />

                {/* Section 5 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">5. Data Retention</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We retain your personal and health information for as long as necessary to fulfill the purposes outlined in
                    this Privacy Policy, unless a longer retention period is required or permitted by law.
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Active Accounts:</strong> Information is retained while your account is active and for reasonable periods afterward</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Medical Records:</strong> Health information may be retained according to applicable healthcare record retention laws (typically 7-10 years)</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Financial Records:</strong> Payment and transaction records are retained as required by tax and financial regulations</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Legal Obligations:</strong> Certain information may be retained longer to comply with legal, regulatory, or professional requirements</span>
                    </li>
                  </ul>
                </section>

                <Separator />

                {/* Section 6 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">6. Your Privacy Rights</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    You have certain rights regarding your personal information:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Access:</strong> Request access to the personal information we hold about you</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Correction:</strong> Request correction of inaccurate or incomplete information</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Deletion:</strong> Request deletion of your personal information, subject to legal and regulatory retention requirements</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Data Portability:</strong> Request a copy of your information in a structured, commonly used format</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Opt-Out:</strong> Unsubscribe from marketing communications (service-related messages may still be sent)</span>
                    </li>
                  </ul>
                  <p className="text-muted-foreground leading-relaxed mt-4">
                    To exercise these rights, please contact us at <a href="mailto:privacy@factorysciences.com" className="text-primary hover:underline">privacy@factorysciences.com</a>.
                    We will respond to verified requests within 30 days.
                  </p>
                </section>

                <Separator />

                {/* Section 7 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">7. Cookies and Tracking Technologies</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We use cookies and similar technologies to enhance platform functionality and collect usage information:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Essential Cookies:</strong> Required for authentication, security, and basic platform operation</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Functional Cookies:</strong> Remember your preferences and settings</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span><strong className="text-foreground">Analytics Cookies:</strong> Collect aggregated usage statistics to improve the Platform</span>
                    </li>
                  </ul>
                  <p className="text-muted-foreground leading-relaxed">
                    You can control cookies through your browser settings. Disabling certain cookies may limit platform functionality.
                  </p>
                </section>

                <Separator />

                {/* Section 8 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">8. Children's Privacy</h2>
                  <p className="text-muted-foreground leading-relaxed">
                    Our Platform is not intended for individuals under 18 years of age. We do not knowingly collect personal
                    information from children. If we discover that we have collected information from a child under 18, we will
                    delete it promptly. Parents or guardians who believe we may have collected information from a minor should
                    contact us immediately.
                  </p>
                </section>

                <Separator />

                {/* Section 9 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">9. Third-Party Links</h2>
                  <p className="text-muted-foreground leading-relaxed">
                    Our Platform may contain links to third-party websites or services that are not operated by Factor Sciences.
                    We are not responsible for the privacy practices of these third parties. We encourage you to review the
                    privacy policies of any external sites you visit.
                  </p>
                </section>

                <Separator />

                {/* Section 10 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">10. Changes to This Privacy Policy</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    We may update this Privacy Policy from time to time to reflect changes in our practices, technologies, legal
                    requirements, or other factors. When we make material changes, we will:
                  </p>
                  <ul className="space-y-2 text-muted-foreground ml-6 mb-4">
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Update the "Last Updated" date at the top of this policy</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Notify you via email or platform notification</span>
                    </li>
                    <li className="flex items-start gap-2">
                      <span className="text-primary mt-1">•</span>
                      <span>Provide a reasonable period for you to review the changes before they take effect</span>
                    </li>
                  </ul>
                  <p className="text-muted-foreground leading-relaxed">
                    Your continued use of the Platform after changes are posted constitutes acceptance of the updated Privacy Policy.
                  </p>
                </section>

                <Separator />

                {/* Section 11 */}
                <section>
                  <h2 className="text-2xl font-bold mb-4 text-foreground font-[family-name:var(--font-display)]">11. Contact Information</h2>
                  <p className="text-muted-foreground leading-relaxed mb-4">
                    For questions, concerns, or requests regarding this Privacy Policy or our data practices, please contact:
                  </p>
                  <div className="p-4 bg-muted/30 rounded-lg">
                    <p className="text-foreground font-medium mb-2">Factor Sciences Privacy Team</p>
                    <p className="text-sm text-muted-foreground">Email: <a href="mailto:privacy@factorysciences.com" className="text-primary hover:underline">privacy@factorysciences.com</a></p>
                    <p className="text-sm text-muted-foreground">Phone: +1 (800) 555-1234</p>
                    <p className="text-sm text-muted-foreground">Address: Factor Sciences, 100 Healthcare Plaza, Suite 200, Wilmington, DE 19801</p>
                    <p className="text-sm text-muted-foreground mt-2">Response Time: We respond to privacy inquiries within 10 business days</p>
                  </div>
                </section>

              </div>
            </CardContent>
          </Card>

          {/* Footer Navigation */}
          <div className="mt-8 flex flex-col sm:flex-row gap-4 justify-between items-center">
            <Button asChild variant="outline">
              <Link href="/">Return to Home</Link>
            </Button>
            <div className="flex gap-4">
              <Button asChild variant="ghost" size="sm">
                <Link href="/terms">Terms of Service</Link>
              </Button>
              <Button asChild variant="ghost" size="sm">
                <Link href="/refund">Refund Policy</Link>
              </Button>
              <Button asChild variant="ghost" size="sm">
                <Link href="/hipaa">HIPAA Notice</Link>
              </Button>
            </div>
          </div>
        </div>
      </main>
    </div>
  )
}
