"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 TermsAndConditionsPage() {
  return (
    <div className="container mx-auto max-w-4xl px-4 py-16 md:py-24">
      <div className="space-y-6">
        <div className="space-y-3">
          <p className="text-xs font-semibold uppercase tracking-[0.18em] text-primary/80">
            Legal
          </p>
          <h1 className="text-4xl font-bold tracking-tight text-balance text-foreground">
            Terms and Conditions
          </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">
            These Terms and Conditions govern your use of the{" "}
            {businessConfig.name} website, our contact and request forms, and
            our messaging program.
          </p>
        </div>

        <Section title="Use Of This Website">
          <p>
            By using this website, you agree to use it only for lawful purposes
            and in a way that does not interfere with the site, our operations,
            or other users.
          </p>
          <p>
            You agree not to misuse forms, submit false information, attempt to
            bypass rate limits, or interfere with any security or technical
            protections on the site.
          </p>
        </Section>

        <Section title="Informational Content">
          <p>
            Website content is provided for general informational purposes.
            Availability, service coverage, scheduling, machine inventory, and
            final service details may require direct confirmation from our team.
          </p>
          <p>
            Nothing on this site creates a guarantee of service, timeline, or
            commercial term unless confirmed directly by{" "}
            {businessConfig.legalName}.
          </p>
        </Section>

        <Section title="Form And Inquiry Submissions">
          <p>
            When you submit a form or start chat, you agree to provide accurate
            information so we can respond to your inquiry.
          </p>
          <p>
            Submitting a form or chat request does not create a binding service
            contract by itself. Our team may contact you to confirm details
            before moving forward.
          </p>
        </Section>

        <Section title="SMS Messaging Program">
          <p>
            {businessConfig.legalName} offers conversational SMS related to
            inquiries, scheduling, support, repairs, moving requests, and
            follow-up. Marketing SMS is separate and optional.
          </p>
          <p>
            Message frequency varies. Message and data rates may apply. Reply
            STOP to opt out and HELP for help. Consent to receive text messages
            is not a condition of purchase.
          </p>
          <p>
            Your opt-in method is the website forms and chat gate where you
            provide your phone number and check the required service SMS consent
            box, with a separate optional box for marketing SMS consent.
          </p>
          <p>
            If you opt out of SMS, we may still contact you by phone or email
            when needed to respond to your request, subject to your preferences
            and applicable law.
          </p>
        </Section>

        <Section title="Intellectual Property">
          <p>
            All text, branding, graphics, layout, and other site content are
            owned by or licensed to {businessConfig.legalName} unless otherwise
            stated. You may not copy, redistribute, or reuse site materials for
            commercial purposes without permission.
          </p>
        </Section>

        <Section title="Links To Other Sites">
          <p>
            This website may link to third-party services or websites. We are
            not responsible for their content, policies, uptime, or practices.
          </p>
        </Section>

        <Section title="Disclaimer And Limitation Of Liability">
          <p>
            The website is provided on an “as is” and “as available” basis. To
            the fullest extent permitted by law, {businessConfig.legalName}{" "}
            disclaims warranties of any kind regarding the website and its
            content.
          </p>
          <p>
            To the fullest extent permitted by law, {businessConfig.legalName}{" "}
            will not be liable for indirect, incidental, special, or
            consequential damages arising from your use of the website.
          </p>
        </Section>

        <Section title="Updates To These Terms">
          <p>
            We may update these Terms and Conditions from time to time. Updates
            are effective when posted on this page.
          </p>
        </Section>

        <Section title="Contact">
          <p>
            If you have questions about these Terms and Conditions or our
            messaging program, contact us 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>
              Privacy:{" "}
              <Link
                href="/privacy-policy"
                className="underline underline-offset-4 hover:text-primary"
              >
                Privacy Policy
              </Link>
            </li>
          </ul>
        </Section>
      </div>
    </div>
  )
}
