"use client"

import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { AnimatedCard } from "@/components/ui/animated-card"
import { Header } from "@/components/ui/header"
import { Footer } from "@/components/ui/footer"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import {
  Shield,
  Calendar,
  Eye,
  Lock,
  Database,
  Users,
  Globe,
  Cookie,
  Settings,
  AlertTriangle,
  CheckCircle,
  Mail,
  Download,
  Printer as Print,
  UserCheck,
  FileText,
  Trash2
} from "lucide-react"
import Link from "next/link"
import { motion } from "framer-motion"

export default function PrivacyPolicyPage() {
  const lastUpdated = "January 15, 2024"
  const effectiveDate = "January 15, 2024"

  const sections = [
    {
      id: "overview",
      title: "1. Privacy Overview",
      icon: Shield,
      content: `At Geezer Guide, we take your privacy seriously. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you visit our website and use our services.

We are committed to:
• Protecting your personal information
• Being transparent about our data practices
• Giving you control over your data
• Complying with applicable privacy laws

By using our service, you agree to the collection and use of information in accordance with this policy.`
    },
    {
      id: "information-collected",
      title: "2. Information We Collect",
      icon: Database,
      content: `We collect several types of information from and about users of our service:

Personal Information:
• Name, email address, phone number
• Demographic information (age, location)
• Account credentials and preferences
• Payment information (processed by secure third parties)

Usage Information:
• Pages visited and time spent on our site
• Search queries and filters used
• Devices and browsers used
• IP address and location data

Facility Information (for facility owners):
• Business information and credentials
• Facility photos and descriptions
• Pricing and availability data
• Staff and certification information

We collect this information when you voluntarily provide it, through automated technologies, and from third-party sources where legally permitted.`
    },
    {
      id: "how-we-use",
      title: "3. How We Use Your Information",
      icon: Settings,
      content: `We use the information we collect to:

Provide Our Services:
• Facilitate searches and comparisons
• Connect families with facilities
• Process reviews and ratings
• Enable communication between users

Improve Our Platform:
• Analyze usage patterns and preferences
• Develop new features and services
• Personalize user experience
• Conduct research and analytics

Communication:
• Send service-related notifications
• Respond to inquiries and support requests
• Provide marketing communications (with consent)
• Send security alerts and updates

Legal and Safety:
• Comply with legal obligations
• Protect against fraud and abuse
• Enforce our terms of service
• Ensure platform safety and security`
    },
    {
      id: "information-sharing",
      title: "4. Information Sharing and Disclosure",
      icon: Users,
      content: `We may share your information in the following circumstances:

With Facility Partners:
• Contact information when you express interest in a facility
• Reviews and ratings (with your permission)
• Inquiry details for tour scheduling

Service Providers:
• Payment processors for subscription services
• Email and communication services
• Analytics and advertising partners
• Technical infrastructure providers

Legal Requirements:
• To comply with legal processes
• To protect our rights and property
• To ensure user safety and security
• In connection with business transfers

We do not sell personal information to third parties for their marketing purposes. All sharing is conducted with appropriate safeguards and contractual protections.`
    },
    {
      id: "data-security",
      title: "5. Data Security",
      icon: Lock,
      content: `We implement appropriate technical and organizational measures to protect your personal information:

Technical Safeguards:
• Encryption of data in transit and at rest
• Secure server infrastructure
• Regular security assessments
• Access controls and authentication

Organizational Measures:
• Employee training on data protection
• Strict access controls and permissions
• Regular security policy updates
• Incident response procedures

While we strive to protect your personal information, no method of transmission over the Internet or electronic storage is 100% secure. We cannot guarantee absolute security but continuously work to maintain the highest standards.`
    },
    {
      id: "data-retention",
      title: "6. Data Retention",
      icon: Calendar,
      content: `We retain your information for different periods depending on the type of data and purpose:

Account Information:
• Retained while your account is active
• Deleted within 30 days of account closure
• Some information may be retained for legal compliance

Usage Data:
• Typically retained for 24 months
• Aggregated data may be retained longer
• Personal identifiers are removed from historical data

Communication Records:
• Customer service communications: 3 years
• Marketing communications: Until unsubscribed
• Legal notices: As required by law

You can request deletion of your data at any time, subject to legal and contractual obligations.`
    },
    {
      id: "your-rights",
      title: "7. Your Privacy Rights",
      icon: UserCheck,
      content: `Depending on your location, you may have the following rights:

Access and Portability:
• Request a copy of your personal data
• Receive data in a portable format
• Understand how your data is processed

Correction and Deletion:
• Correct inaccurate information
• Request deletion of your data
• Withdraw consent where applicable

Control and Objection:
• Opt out of marketing communications
• Object to certain data processing
• Restrict processing in specific circumstances

To exercise these rights, contact us using the information provided below. We will respond to your request within the timeframe required by applicable law.`
    },
    {
      id: "cookies",
      title: "8. Cookies and Tracking",
      icon: Cookie,
      content: `We use cookies and similar technologies to enhance your experience:

Essential Cookies:
• Required for basic site functionality
• Remember your preferences and settings
• Maintain your session while browsing

Analytics Cookies:
• Track site usage and performance
• Help us understand user behavior
• Improve our services and features

Marketing Cookies:
• Personalize advertisements
• Measure advertising effectiveness
• Provide relevant content recommendations

You can control cookie settings through your browser preferences. Disabling certain cookies may affect site functionality. Our cookie banner provides options to manage your preferences.`
    },
    {
      id: "children-privacy",
      title: "9. Children's Privacy",
      icon: Shield,
      content: `Our services are not intended for children under 13 years of age. We do not knowingly collect personal information from children under 13.

If we learn that we have collected personal information from a child under 13 without parental consent, we will:
• Delete the information immediately
• Terminate any associated account
• Notify the parents if contact information is available

Parents who believe their child has provided information to us should contact us immediately at privacy@geezerguide.com.`
    },
    {
      id: "international",
      title: "10. International Data Transfers",
      icon: Globe,
      content: `Our services may involve transferring your information to countries outside your residence:

Data Transfer Safeguards:
• Standard contractual clauses
• Adequacy decisions where available
• Your explicit consent when required
• Necessary for contract performance

If you are in the European Economic Area (EEA), we ensure that transfers outside the EEA have appropriate safeguards in place to protect your personal information according to GDPR standards.`
    },
    {
      id: "california-rights",
      title: "11. California Privacy Rights (CCPA)",
      icon: FileText,
      content: `If you are a California resident, you have additional rights under the California Consumer Privacy Act (CCPA):

Right to Know:
• Categories of personal information collected
• Purposes for collection and use
• Categories of third parties we share with
• Specific pieces of information we have about you

Right to Delete:
• Request deletion of personal information
• Exceptions for legal compliance and security

Right to Opt-Out:
• Opt out of the sale of personal information
• We do not sell personal information

Right to Non-Discrimination:
• Equal service regardless of privacy choices
• No penalties for exercising privacy rights

To exercise these rights, contact us at privacy@geezerguide.com or call (555) 123-PRIVACY.`
    },
    {
      id: "updates",
      title: "12. Policy Updates",
      icon: AlertTriangle,
      content: `We may update this Privacy Policy periodically to reflect changes in our practices or legal requirements:

Notification of Changes:
• Email notification for material changes
• Website banner for 30 days after updates
• Updated "Last Modified" date at the top

Your Choices:
• Review changes when notified
• Contact us with questions or concerns
• Discontinue use if you disagree with changes

Continued use of our service after policy updates constitutes acceptance of the revised terms.`
    },
    {
      id: "contact",
      title: "13. Contact Information",
      icon: Mail,
      content: `For privacy-related questions, concerns, or requests, please contact us:

Privacy Officer
Email: privacy@geezerguide.com
Phone: (555) 123-PRIVACY
Address: 123 Business Center Dr, Springfield, IL 62701

General Support:
Email: support@geezerguide.com
Help Center: /help

We will respond to privacy requests within 30 days (or as required by applicable law) and provide assistance in multiple languages where possible.`
    }
  ]

  return (
    <div className="min-h-screen bg-gradient-to-br from-slate-50 via-white to-blue-50/30">
      <Header />

      <div className="container mx-auto px-4 py-8">
        <div className="max-w-4xl mx-auto">
          {/* Header */}
          <motion.div
            initial={{ opacity: 0, y: 20 }}
            animate={{ opacity: 1, y: 0 }}
            transition={{ duration: 0.6 }}
            className="text-center mb-12"
          >
            <h1 className="font-primary text-3xl md:text-4xl font-bold text-gray-900 mb-4">
              Privacy Policy
            </h1>
            <p className="font-body text-lg text-gray-600 max-w-2xl mx-auto mb-6">
              We value your privacy and are committed to protecting your personal information.
              Learn how we collect, use, and safeguard your data.
            </p>

            <div className="flex flex-col sm:flex-row items-center justify-center gap-4 mb-8">
              <div className="flex items-center gap-2">
                <Calendar className="h-5 w-5 text-gray-500" />
                <span className="font-body text-sm text-gray-600">
                  Last updated: {lastUpdated}
                </span>
              </div>
              <div className="flex items-center gap-2">
                <Shield className="h-5 w-5 text-gray-500" />
                <span className="font-body text-sm text-gray-600">
                  Effective: {effectiveDate}
                </span>
              </div>
            </div>

            <div className="flex gap-3 justify-center">
              <Button variant="outline" className="border-gray-300 text-gray-700 hover:bg-gray-50">
                <Download className="h-4 w-4 mr-2" />
                Download PDF
              </Button>
              <Button variant="outline" className="border-gray-300 text-gray-700 hover:bg-gray-50">
                <Print className="h-4 w-4 mr-2" />
                Print
              </Button>
            </div>
          </motion.div>

          {/* Privacy Highlights */}
          <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
            <AnimatedCard className="bg-gradient-to-br from-blue-50 to-indigo-50 border-blue-200">
              <CardContent className="p-6 text-center">
                <div className="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center mx-auto mb-4">
                  <Shield className="h-6 w-6 text-blue-600" />
                </div>
                <h3 className="font-body font-semibold text-blue-900 mb-2">Data Protection</h3>
                <p className="font-body text-sm text-blue-700">
                  We use industry-standard encryption and security measures to protect your information
                </p>
              </CardContent>
            </AnimatedCard>

            <AnimatedCard className="bg-gradient-to-br from-green-50 to-emerald-50 border-green-200">
              <CardContent className="p-6 text-center">
                <div className="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mx-auto mb-4">
                  <UserCheck className="h-6 w-6 text-green-600" />
                </div>
                <h3 className="font-body font-semibold text-green-900 mb-2">Your Control</h3>
                <p className="font-body text-sm text-green-700">
                  You have full control over your data with options to access, correct, or delete
                </p>
              </CardContent>
            </AnimatedCard>

            <AnimatedCard className="bg-gradient-to-br from-purple-50 to-pink-50 border-purple-200">
              <CardContent className="p-6 text-center">
                <div className="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mx-auto mb-4">
                  <Eye className="h-6 w-6 text-purple-600" />
                </div>
                <h3 className="font-body font-semibold text-purple-900 mb-2">Transparency</h3>
                <p className="font-body text-sm text-purple-700">
                  We're transparent about what data we collect and how we use it
                </p>
              </CardContent>
            </AnimatedCard>
          </div>

          {/* Quick Navigation */}
          <AnimatedCard className="mb-8">
            <CardHeader>
              <CardTitle className="font-primary text-xl text-gray-900">Quick Navigation</CardTitle>
            </CardHeader>
            <CardContent>
              <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
                {sections.map((section) => (
                  <a
                    key={section.id}
                    href={`#${section.id}`}
                    className="flex items-center gap-2 p-3 rounded-lg hover:bg-gray-50 transition-colors group"
                  >
                    <section.icon className="h-4 w-4 text-[#3F5CEA] group-hover:text-[#09183D]" />
                    <span className="font-body text-sm text-gray-700 group-hover:text-gray-900">
                      {section.title}
                    </span>
                  </a>
                ))}
              </div>
            </CardContent>
          </AnimatedCard>

          {/* Privacy Sections */}
          <div className="space-y-8">
            {sections.map((section, index) => (
              <motion.div
                key={section.id}
                initial={{ opacity: 0, y: 20 }}
                animate={{ opacity: 1, y: 0 }}
                transition={{ duration: 0.6, delay: index * 0.1 }}
                id={section.id}
              >
                <AnimatedCard>
                  <CardHeader>
                    <div className="flex items-center gap-3">
                      <div className="w-10 h-10 bg-[#3F5CEA]/10 rounded-lg flex items-center justify-center">
                        <section.icon className="h-5 w-5 text-[#3F5CEA]" />
                      </div>
                      <CardTitle className="font-primary text-xl text-gray-900">
                        {section.title}
                      </CardTitle>
                    </div>
                  </CardHeader>
                  <CardContent>
                    <div className="prose prose-gray max-w-none">
                      {section.content.split('\n').map((paragraph, pIndex) => {
                        if (paragraph.trim() === '') return null

                        if (paragraph.endsWith(':') && !paragraph.includes('•')) {
                          return (
                            <h4 key={pIndex} className="font-body font-semibold text-gray-900 mt-6 mb-3">
                              {paragraph}
                            </h4>
                          )
                        }

                        if (paragraph.startsWith('•')) {
                          return (
                            <div key={pIndex} className="flex items-start gap-2 mb-2">
                              <div className="w-2 h-2 bg-[#3F5CEA] rounded-full mt-2"></div>
                              <span className="font-body text-gray-700">{paragraph.slice(1).trim()}</span>
                            </div>
                          )
                        }

                        return (
                          <p key={pIndex} className="font-body text-gray-700 leading-relaxed mb-4">
                            {paragraph}
                          </p>
                        )
                      })}
                    </div>
                  </CardContent>
                </AnimatedCard>
              </motion.div>
            ))}
          </div>

          {/* Data Subject Rights */}
          <AnimatedCard className="mt-12 bg-gradient-to-r from-green-50 to-emerald-50 border-green-200">
            <CardHeader>
              <CardTitle className="flex items-center gap-3 font-primary text-xl text-gray-900">
                <CheckCircle className="h-6 w-6 text-green-600" />
                Exercise Your Privacy Rights
              </CardTitle>
            </CardHeader>
            <CardContent className="space-y-4">
              <p className="font-body text-green-800">
                You have the right to control your personal information. Here's how you can exercise your rights:
              </p>

              <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
                <div className="flex items-center gap-3 p-4 bg-white/60 rounded-lg">
                  <Eye className="h-5 w-5 text-green-600" />
                  <div>
                    <p className="font-body font-medium text-green-900">Access Your Data</p>
                    <p className="font-body text-sm text-green-700">Request a copy of your information</p>
                  </div>
                </div>

                <div className="flex items-center gap-3 p-4 bg-white/60 rounded-lg">
                  <Settings className="h-5 w-5 text-green-600" />
                  <div>
                    <p className="font-body font-medium text-green-900">Correct Information</p>
                    <p className="font-body text-sm text-green-700">Update inaccurate data</p>
                  </div>
                </div>

                <div className="flex items-center gap-3 p-4 bg-white/60 rounded-lg">
                  <Trash2 className="h-5 w-5 text-green-600" />
                  <div>
                    <p className="font-body font-medium text-green-900">Delete Your Data</p>
                    <p className="font-body text-sm text-green-700">Request data removal</p>
                  </div>
                </div>

                <div className="flex items-center gap-3 p-4 bg-white/60 rounded-lg">
                  <Mail className="h-5 w-5 text-green-600" />
                  <div>
                    <p className="font-body font-medium text-green-900">Manage Communications</p>
                    <p className="font-body text-sm text-green-700">Control email preferences</p>
                  </div>
                </div>
              </div>

              <div className="pt-4">
                <Button className="bg-gradient-to-r from-green-600 to-emerald-600 hover:from-green-700 hover:to-emerald-700 text-white">
                  Contact Privacy Team
                </Button>
              </div>
            </CardContent>
          </AnimatedCard>

          {/* Footer Actions */}
          <div className="mt-12 text-center">
            <div className="space-y-4">
              <p className="font-body text-gray-600">
                Questions about our privacy practices?
              </p>
              <div className="flex flex-col sm:flex-row gap-4 justify-center">
                <Link href="/help">
                  <Button variant="outline" className="border-[#3F5CEA] text-[#3F5CEA] hover:bg-[#3F5CEA] hover:text-white">
                    Visit Help Center
                  </Button>
                </Link>
                <Link href="/terms">
                  <Button variant="outline" className="border-gray-300 text-gray-700 hover:bg-gray-50">
                    View Terms of Service
                  </Button>
                </Link>
                <Button className="bg-gradient-to-r from-[#3F5CEA] to-[#5B73F0] hover:from-[#09183D] hover:to-[#3F5CEA] text-white">
                  <Mail className="h-4 w-4 mr-2" />
                  Contact Privacy Team
                </Button>
              </div>
            </div>
          </div>
        </div>
      </div>

      <Footer />
    </div>
  )
}
