import type { Metadata } from "next";
import type { ReactNode } from "react";
import Link from "next/link";
import Navbar from "../components/Navbar";
import Footer from "../components/Footer";
import Reveal from "../components/Reveal";
import WhatsAppFloatButton from "../components/WhatsAppFloatButton";
import {
  ChevronLeftIcon,
  ArrowRightIcon,
  HomeIcon,
  AlertIcon,
  CarIcon,
  QrIcon,
} from "../components/icons";

export const metadata: Metadata = {
  title: "For Businesses | VehCall",
  description:
    "VehCall for residential societies, hospitals, and vehicle dealerships — resolve blocked vehicles, clear emergency lanes, and add a safety feature to every car sold, without ever sharing personal phone numbers.",
  alternates: { canonical: "/for-business" },
  openGraph: {
    type: "website",
    url: "/for-business",
    title: "For Businesses | VehCall",
    description:
      "QR-based vehicle alerts for societies, hospitals, and dealerships — private, verified, instant.",
  },
};

type Segment = {
  icon: typeof HomeIcon;
  tag: string;
  tone: string;
  toneBg: string;
  title: ReactNode;
  desc: string;
  points: string[];
};

const SEGMENTS: Segment[] = [
  {
    icon: HomeIcon,
    tag: "Residential Societies & RWAs",
    tone: "text-brand",
    toneBg: "from-brand/25 to-brand/5",
    title: (
      <>
        A safer way for your society to{" "}
        <span className="text-gradient">reach vehicle owners</span>
      </>
    ),
    desc: "Blocked driveways, forgotten headlights, and unfamiliar vehicles are a daily reality in Indian housing societies. VehCall lets your security desk and residents reach any vehicle owner instantly — without exchanging personal phone numbers.",
    points: [
      "Security guards resolve blocked-vehicle complaints in minutes instead of paging over the intercom",
      "Bulk-register every resident and visitor vehicle under one society account",
      "Residents stay reachable without sharing their number with a stranger or the guard's register",
      "One RWA dashboard to manage vehicles and update residents as they move in and out",
    ],
  },
  {
    icon: AlertIcon,
    tag: "Hospitals & Healthcare Facilities",
    tone: "text-danger",
    toneBg: "from-danger/25 to-danger/5",
    title: (
      <>
        Clear ambulance bays{" "}
        <span className="text-gradient">without delay</span>
      </>
    ),
    desc: "In a hospital, a blocked ambulance bay or emergency exit costs real time. VehCall gives your front desk and security team a direct, verified line to any vehicle owner on the premises, so blocking vehicles get moved before it becomes a crisis.",
    points: [
      "Send an urgent alert the moment an ambulance bay, fire exit, or emergency lane is blocked",
      "Front-desk staff resolve parking complaints without overhead announcements or manual lookups",
      "Alerts reach verified vehicle owners, not random contacts",
      "Works alongside your existing visitor and staff parking setup — no extra hardware needed",
    ],
  },
  {
    icon: CarIcon,
    tag: "Vehicle Dealerships",
    tone: "text-electric",
    toneBg: "from-electric/25 to-electric/5",
    title: (
      <>
        Make VehCall part of{" "}
        <span className="text-gradient">every car you sell</span>
      </>
    ),
    desc: "Give customers a safety feature they'll actually use. Dealers can register VehCall for every vehicle at the point of sale, giving buyers a private, verified way to be reached from day one.",
    points: [
      "Register QR stickers for every vehicle sold, straight from your dealership dashboard",
      "Give customers an ongoing safety benefit that keeps your dealership top of mind after the sale",
      "Track activation status across your showroom or dealer chain from one place",
      "A simple handover step your sales team can walk customers through in under a minute",
    ],
  },
];

function SegmentBlock({ segment, index }: { segment: Segment; index: number }) {
  const reversed = index % 2 === 1;
  return (
    <div className="grid grid-cols-1 items-center gap-10 lg:grid-cols-2 lg:gap-16">
      {/* Emblem */}
      <Reveal className={reversed ? "lg:order-2" : ""}>
        <div className="glass relative overflow-hidden rounded-3xl p-8 sm:p-10">
          <div
            className={`pointer-events-none absolute -right-10 -top-10 h-48 w-48 rounded-full bg-gradient-to-br ${segment.toneBg} blur-3xl`}
          />
          <span
            className={`relative flex h-16 w-16 items-center justify-center rounded-2xl bg-white/5 ring-1 ring-white/10 ${segment.tone}`}
          >
            <segment.icon width={30} height={30} />
          </span>
          <p className={`relative mt-6 text-sm font-semibold ${segment.tone}`}>
            {segment.tag}
          </p>
          <ul className="relative mt-6 space-y-3">
            {segment.points.map((point) => (
              <li key={point} className="flex gap-3 text-sm leading-relaxed text-white/70">
                <span className="mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-white/30" />
                <span>{point}</span>
              </li>
            ))}
          </ul>
        </div>
      </Reveal>

      {/* Text */}
      <Reveal delay={80} className={reversed ? "lg:order-1" : ""}>
        <h2 className="text-2xl font-bold leading-tight text-white sm:text-3xl">
          {segment.title}
        </h2>
        <p className="mt-4 text-base leading-relaxed text-white/60 sm:text-lg">
          {segment.desc}
        </p>
      </Reveal>
    </div>
  );
}

export default function ForBusinessPage() {
  return (
    <>
      <Navbar />

      <main className="pb-20 md:pb-0">
        {/* Header */}
        <section className="relative overflow-hidden px-5 pt-32 pb-16 sm:px-8 sm:pt-36">
          <div className="pointer-events-none absolute inset-0 bg-glow-radial" />
          <div className="relative mx-auto max-w-7xl">
            <Link
              href="/"
              className="inline-flex items-center gap-1.5 text-sm font-medium text-white/55 transition-colors hover:text-white"
            >
              <ChevronLeftIcon width={16} height={16} />
              Back to home
            </Link>

            <Reveal className="mt-8 max-w-2xl">
              <span className="eyebrow">
                <QrIcon width={14} height={14} />
                For Businesses
              </span>
              <h1 className="mt-4 text-4xl font-extrabold leading-tight sm:text-5xl">
                Built for societies, hospitals,{" "}
                <span className="text-gradient">and dealerships</span>
              </h1>
              <p className="mt-4 text-base leading-relaxed text-white/60 sm:text-lg">
                Wherever vehicles and people cross paths, VehCall gives your
                team a private, verified way to reach the right owner in
                seconds — without ever handing out a phone number.
              </p>
            </Reveal>
          </div>
        </section>

        {/* Segments */}
        <div className="mx-auto max-w-7xl space-y-24 px-5 pb-24 sm:px-8 sm:space-y-28">
          {SEGMENTS.map((segment, i) => (
            <SegmentBlock key={segment.tag} segment={segment} index={i} />
          ))}
        </div>

        {/* CTA */}
        <section className="px-5 pb-24 sm:px-8">
          <Reveal className="mx-auto max-w-6xl">
            <div className="relative overflow-hidden rounded-[2.5rem] border border-white/10 bg-gradient-to-br from-electric/25 via-bg to-brand/20 px-6 py-16 text-center sm:px-12">
              <div className="pointer-events-none absolute inset-0 bg-grid opacity-30 [mask-image:radial-gradient(ellipse_at_center,black,transparent_75%)]" />
              <div className="pointer-events-none absolute -left-10 -top-10 h-48 w-48 rounded-full bg-brand/30 blur-3xl" />
              <div className="pointer-events-none absolute -bottom-12 -right-8 h-56 w-56 rounded-full bg-electric/30 blur-3xl" />

              <div className="relative mx-auto max-w-2xl">
                <h2 className="text-3xl font-extrabold leading-tight sm:text-[2.75rem]">
                  Want VehCall for your{" "}
                  <span className="text-gradient">organisation?</span>
                </h2>
                <p className="mx-auto mt-4 max-w-xl text-lg text-white/70">
                  Tell us about your society, hospital, or dealership and
                  we&apos;ll help you get set up.
                </p>

                <div className="mt-9 flex flex-col items-center justify-center gap-3 sm:flex-row">
                  <a
                    href="mailto:info@vehcall.com?subject=Business%20Partnership%20Enquiry"
                    className="btn-primary w-full sm:w-auto"
                  >
                    Talk to Our Team
                    <ArrowRightIcon width={18} height={18} />
                  </a>
                  <Link href="/register" className="btn-ghost w-full sm:w-auto">
                    Get Started
                  </Link>
                </div>

                <p className="mt-6 text-sm text-white/50">
                  info@vehcall.com · We usually respond within 1–2 business days
                </p>
              </div>
            </div>
          </Reveal>
        </section>
      </main>

      <Footer />
      <WhatsAppFloatButton />
    </>
  );
}
