'use client'

import Link from 'next/link'
import { businessConfig } from '@/lib/seo-config'

function Section({ title, children }: { title: string; children: React.ReactNode }) {
  return (
    <section className="space-y-4 rounded-[1.5rem] border border-border/70 bg-background/85 p-6 shadow-sm">
      <h2 className="text-2xl font-semibold text-foreground">{title}</h2>
      <div className="space-y-4 text-sm leading-7 text-muted-foreground">{children}</div>
    </section>
  )
}

export function PrivacyPolicyPage() {
  return (
    <div className="container mx-auto px-4 py-16 md:py-24">
      <div className="mx-auto max-w-4xl space-y-6">
        <div className="space-y-3">
          <p className="text-xs font-semibold uppercase tracking-[0.18em] text-primary/80">Privacy</p>
          <h1 className="text-4xl font-bold tracking-tight text-balance text-foreground">Privacy Policy</h1>
          <p className="text-sm text-muted-foreground">Last updated: March 26, 2026</p>
          <p className="max-w-3xl text-base leading-7 text-muted-foreground">
            This Privacy Policy explains how {businessConfig.legalName} collects, uses, and protects the information you share with us through this website, our forms, and our text messaging program.
          </p>
        </div>

        <Section title="Information We Collect">
          <p>We may collect the information you provide directly, including your name, phone number, email address, company or location name, service intent, machine details, messages, and any other details you choose to submit.</p>
          <p>We also collect limited technical information such as IP address, browser details, page path, and timestamps to help operate the site, prevent abuse, and troubleshoot issues.</p>
        </Section>

        <Section title="How We Use Information">
          <ul className="list-disc space-y-2 pl-5">
            <li>Respond to your inquiries and route them to the right team member.</li>
            <li>Schedule service, repairs, moving requests, free placement consultations, and follow-up communications.</li>
            <li>Send conversational text messages related to your request when you provide the required service SMS consent.</li>
            <li>Send marketing or promotional text messages only when you separately opt in.</li>
            <li>Improve site functionality, audit performance, and prevent spam or abusive use.</li>
          </ul>
        </Section>

        <Section title="SMS Messaging Privacy">
          <p>When you opt in to conversational or marketing SMS, we store the consent status you selected, the consent version shown on the page, when consent was captured, and which page captured it.</p>
          <p>Service or conversational SMS may include scheduling updates, support follow-up, repair coordination, moving coordination, and related status messages. Message frequency varies. Message and data rates may apply. Reply STOP to opt out and HELP for help.</p>
          <p>Marketing SMS is optional and separate from service SMS. If you opt in, we may send occasional promotional or informational messages. Message frequency varies. Message and data rates may apply. Reply STOP to opt out and HELP for help.</p>
          <p>Consent to receive SMS is not a condition of purchase.</p>
          <p>Mobile information is not shared with third parties or affiliates for marketing or promotional purposes.</p>
        </Section>

        <Section title="Sharing Information">
          <p>We may share information with vendors or service providers that help us operate our website, forms, messaging workflows, analytics, hosting, and CRM intake systems, but only as needed to provide our services.</p>
          <p>We may disclose information if required by law, to protect rights or safety, or as part of a business transfer such as a merger or asset sale.</p>
          <p>We do not sell your personal information.</p>
        </Section>

        <Section title="Cookies And Analytics">
          <p>We may use cookies, local storage, session identifiers, and similar technologies to keep the site working, remember form or chat state, measure performance, and understand how visitors use the site.</p>
          <p>You can control cookies through your browser settings, but some features may not work as expected if they are disabled.</p>
        </Section>

        <Section title="Data Retention And Security">
          <p>We retain information only as long as reasonably needed for inquiry handling, service follow-up, operational records, compliance, and dispute resolution.</p>
          <p>We use reasonable safeguards to protect information, but no internet transmission or storage system is guaranteed to be completely secure.</p>
        </Section>

        <Section title="Your Choices">
          <ul className="list-disc space-y-2 pl-5">
            <li>You can request updates to your contact information by contacting us directly.</li>
            <li>You can opt out of SMS at any time by replying STOP.</li>
            <li>You can request help for our SMS program by replying HELP.</li>
            <li>You can contact us if you want us to review or delete information, subject to any legal or operational retention requirements.</li>
          </ul>
        </Section>

        <Section title="Contact Us">
          <p>If you have questions about this Privacy Policy or our SMS practices, contact us using any of the options below.</p>
          <ul className="space-y-2 text-foreground">
            <li>Email: <a href={`mailto:${businessConfig.email}`} className="underline underline-offset-4 hover:text-primary">{businessConfig.email}</a></li>
            <li>Phone: <a href={businessConfig.publicCallUrl} className="underline underline-offset-4 hover:text-primary">{businessConfig.publicCallNumber}</a></li>
            <li>Terms: <Link href="/terms-and-conditions" className="underline underline-offset-4 hover:text-primary">Terms and Conditions</Link></li>
          </ul>
        </Section>
      </div>
    </div>
  )
}
