import type { Metadata } from "next";
import Link from "next/link";
import { FileText, ArrowLeft } from "lucide-react";

export const metadata: Metadata = {
  title: "Terms of Service — DriveHub",
  description:
    "DriveHub's terms of service. Read our terms and conditions before using DriveHub.",
  robots: { index: true, follow: true },
};

const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://drivehub.in";
const LAST_UPDATED = "June 2026";

function Section({ title, children }: { title: string; children: React.ReactNode }) {
  return (
    <section className="mb-8">
      <h2 className="text-lg font-black text-gray-900 mb-3">{title}</h2>
      <div className="text-gray-600 leading-relaxed space-y-3">{children}</div>
    </section>
  );
}

export default function TermsPage() {
  return (
    <div className="min-h-screen bg-[#f6f8fc]">
      {/* Hero */}
      <div className="bg-gradient-to-br from-[#0f172a] via-[#172554] to-[#0f766e] py-14">
        <div className="max-w-3xl mx-auto px-4 text-center">
          <div className="w-14 h-14 rounded-2xl bg-white/10 border border-white/20 flex items-center justify-center mx-auto mb-4">
            <FileText className="w-7 h-7 text-cyan-300" />
          </div>
          <h1 className="text-3xl md:text-4xl font-black text-white mb-2">
            Terms of Service
          </h1>
          <p className="text-blue-200 text-sm">Last updated: {LAST_UPDATED}</p>
        </div>
      </div>

      {/* Content */}
      <div className="max-w-3xl mx-auto px-4 py-12">
        <div className="bg-white rounded-[28px] shadow-sm border border-gray-100 p-8 md:p-10">
          <Section title="1. Acceptance of Terms">
            <p>
              By accessing or using DriveHub at{" "}
              <a href={SITE_URL} className="text-blue-600 hover:underline">
                {SITE_URL}
              </a>{" "}
              (&ldquo;the Service&rdquo;), you agree to be bound by these Terms of
              Service. If you do not agree, please do not use the Service.
            </p>
          </Section>

          <Section title="2. Description of Service">
            <p>
              DriveHub is an informational car marketplace that provides car prices,
              specifications, comparisons, expert reviews, and dealer enquiry
              facilitation for new cars in India. We do not sell cars directly.
            </p>
          </Section>

          <Section title="3. Pricing &amp; Data Accuracy">
            <p>
              All prices displayed are ex-showroom indicative prices. On-road prices
              vary by city, applicable taxes, insurance, and dealership charges.
              DriveHub makes no warranty as to the accuracy or completeness of
              pricing information. Always confirm prices directly with an authorised
              dealership.
            </p>
            <p>
              Specifications, features, and availability are subject to change by
              manufacturers without notice.
            </p>
          </Section>

          <Section title="4. User Conduct">
            <p>When using DriveHub, you agree not to:</p>
            <ul className="list-disc pl-5 space-y-1.5 text-sm">
              <li>
                Submit false or misleading information in enquiry forms
              </li>
              <li>
                Attempt to scrape, crawl, or automate requests to our platform
                without written permission
              </li>
              <li>
                Use the Service for any unlawful purpose or in violation of
                applicable laws
              </li>
              <li>
                Interfere with or disrupt the integrity or performance of the
                Service
              </li>
              <li>Attempt to gain unauthorised access to any part of the Service</li>
            </ul>
          </Section>

          <Section title="5. Enquiries &amp; Leads">
            <p>
              When you submit an on-road price or test-drive enquiry, you consent to
              DriveHub sharing your contact details with relevant authorised
              dealerships in your chosen city. Dealerships may contact you via phone,
              SMS, or email regarding your enquiry.
            </p>
          </Section>

          <Section title="6. Intellectual Property">
            <p>
              All content on DriveHub — including text, editorial reviews, design,
              graphics, and software — is the property of DriveHub or its content
              suppliers and is protected by applicable intellectual property laws.
            </p>
            <p>
              Car images, brand logos, and manufacturer data remain the property of
              the respective manufacturers.
            </p>
          </Section>

          <Section title="7. Limitation of Liability">
            <p>
              DriveHub provides the Service on an &ldquo;as is&rdquo; basis without
              warranties of any kind. To the fullest extent permitted by law,
              DriveHub shall not be liable for any indirect, incidental, or
              consequential damages arising out of your use of the Service.
            </p>
            <p>
              DriveHub is not liable for any transactions, agreements, or disputes
              that arise between users and dealerships.
            </p>
          </Section>

          <Section title="8. Links to Third Parties">
            <p>
              DriveHub may contain links to external websites. We are not responsible
              for the content, privacy practices, or services of those sites.
            </p>
          </Section>

          <Section title="9. Changes to Terms">
            <p>
              We reserve the right to modify these Terms at any time. Updated terms
              will be posted on this page. Continued use after changes constitutes
              acceptance.
            </p>
          </Section>

          <Section title="10. Governing Law">
            <p>
              These Terms are governed by the laws of India. Any disputes shall be
              subject to the exclusive jurisdiction of courts in India.
            </p>
          </Section>

          <Section title="11. Contact">
            <p>
              For any questions about these Terms, contact us at{" "}
              <a
                href="mailto:legal@drivehub.in"
                className="text-blue-600 hover:underline"
              >
                legal@drivehub.in
              </a>
              .
            </p>
          </Section>
        </div>

        {/* Back link */}
        <div className="mt-8 text-center">
          <Link
            href="/"
            className="inline-flex items-center gap-2 text-sm text-gray-500 hover:text-blue-600 transition-colors"
          >
            <ArrowLeft className="w-4 h-4" />
            Back to DriveHub
          </Link>
        </div>

        <div className="mt-6 flex flex-wrap justify-center gap-4 text-xs text-gray-400">
          <Link href="/privacy" className="hover:text-blue-600 transition-colors">
            Privacy Policy
          </Link>
          <Link href="/cookies" className="hover:text-blue-600 transition-colors">
            Cookie Policy
          </Link>
          <Link href="/disclaimer" className="hover:text-blue-600 transition-colors">
            Disclaimer
          </Link>
        </div>
      </div>
    </div>
  );
}
