import Link from "next/link";
import { ArrowRight, Check, Sparkles } from "lucide-react";
import RevealText from "@/components/immersive/RevealText";
import Reveal from "@/components/immersive/Reveal";

type Plan = {
  name: string;
  description: string;
  price: string;
  priceLabel: string;
  /** Puts Flexi (per client) on the same annual footing as the flat plans. */
  annualHint: string;
  features: string[];
  cta: string;
  href: string;
  highlighted: boolean;
};

const PLANS: Plan[] = [
  {
    name: "Flexi",
    description: "For firms getting started",
    price: "AED 5K",
    priceLabel: "per client / year",
    annualHint: "From AED 5K / year · AED 125K at 25 clients",
    features: ["Up to 25 clients", "Pay as you grow", "Core reporting suite"],
    cta: "Get started",
    href: "/register",
    highlighted: false,
  },
  {
    name: "Growth",
    description: "For growing firms",
    price: "AED 125K",
    priceLabel: "per year",
    annualHint: "Flat annual · up to 50 clients",
    features: ["Up to 50 clients", "Predictable as you grow", "Full platform access"],
    cta: "Talk to sales",
    href: "/contact",
    highlighted: true,
  },
  {
    name: "Professional",
    description: "For scaling teams",
    price: "AED 225K",
    priceLabel: "per year",
    annualHint: "Flat annual · up to 100 clients",
    features: ["Up to 100 clients", "Built to scale", "Priority support"],
    cta: "Talk to sales",
    href: "/contact",
    highlighted: false,
  },
  {
    name: "Enterprise",
    description: "For established firms",
    price: "Custom",
    priceLabel: "tailored pricing",
    annualHint: "Scoped to the book you run",
    features: ["100+ clients", "Tailored to your requirements", "Dedicated onboarding"],
    cta: "Contact us",
    href: "/contact",
    highlighted: false,
  },
];

export default function Pricing() {
  return (
    <section
      id="pricing"
      className="immersive-section scroll-mt-28 px-6 py-20 lg:px-12 lg:py-28"
    >
      <div className="mx-auto w-full max-w-[88rem]">
        <div className="immersive-section-head">
          <span className="immersive-label">Pricing</span>
          <span className="immersive-label">[ 07 ]</span>
        </div>

        <div className="grid gap-8 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-6">
            <RevealText as="h2" className="immersive-heading">
              Invest in growth, not in rising technology costs.
            </RevealText>
          </div>
          <Reveal delay={0.1} className="lg:col-span-5 lg:col-start-8">
            <p className="text-base leading-relaxed text-[hsl(var(--muted-foreground))]">
              Oxyfinz is built to scale with your business, without taking a share of
              its success. Your data remains yours, and our pricing is not tied to your
              AUM — so as your assets grow, your technology costs do not have to.
            </p>
          </Reveal>
        </div>

        <Reveal
          stagger={0.07}
          className="mt-14 grid gap-4 sm:grid-cols-2 lg:mt-16 lg:grid-cols-4 lg:gap-5"
        >
          {PLANS.map((plan) => (
            <article
              key={plan.name}
              data-reveal
              className={
                plan.highlighted
                  ? "relative flex flex-col rounded-lg border-2 border-[hsl(var(--primary))]/60 bg-[hsl(var(--primary))]/[0.04] p-7 shadow-[0_0_40px_-12px_hsl(var(--primary)/0.3)]"
                  : "immersive-card flex flex-col p-7"
              }
            >
              {plan.highlighted ? (
                <span className="absolute -top-3.5 left-7 inline-flex items-center gap-1.5 rounded-full bg-[hsl(var(--primary))] px-4 py-1.5 text-xs font-semibold text-[hsl(var(--primary-foreground))]">
                  <Sparkles className="size-3" aria-hidden />
                  Most popular
                </span>
              ) : null}

              <h3 className="font-heading text-sm font-semibold uppercase tracking-[0.14em] text-[hsl(var(--primary))]">
                {plan.name}
              </h3>
              <p className="mt-2 text-sm text-[hsl(var(--muted-foreground))]">
                {plan.description}
              </p>

              <div className="mt-7 border-t border-white/10 pt-6">
                <p className="font-heading text-3xl font-medium tracking-tight">
                  {plan.price}
                </p>
                <p className="immersive-label mt-1.5">{plan.priceLabel}</p>
                <p className="mt-2 text-[13px] leading-snug text-[hsl(var(--muted-foreground))]">
                  {plan.annualHint}
                </p>
              </div>

              <ul className="mt-6 flex flex-1 flex-col gap-3">
                {plan.features.map((feature) => (
                  <li key={feature} className="flex items-start gap-2.5">
                    <Check
                      className="mt-0.5 size-4 shrink-0 text-[hsl(var(--primary))]"
                      aria-hidden
                    />
                    <span className="text-sm leading-snug text-[hsl(var(--muted-foreground))]">
                      {feature}
                    </span>
                  </li>
                ))}
              </ul>

              <Link
                href={plan.href}
                className={
                  plan.highlighted
                    ? "group mt-8 inline-flex items-center justify-center gap-2 rounded-lg bg-[hsl(var(--primary))] px-5 py-3 text-sm font-semibold text-[hsl(var(--primary-foreground))] transition-colors hover:bg-[hsl(var(--primary-hover))]"
                    : "group mt-8 inline-flex items-center justify-center gap-2 rounded-lg border border-white/15 px-5 py-3 text-sm font-semibold transition-colors hover:border-white/35 hover:bg-white/[0.03]"
                }
              >
                {plan.cta}
                <ArrowRight className="size-4 transition-transform group-hover:translate-x-0.5" />
              </Link>
            </article>
          ))}
        </Reveal>

        <Reveal delay={0.1}>
          <p className="mt-8 text-center text-sm text-[hsl(var(--muted-foreground))]">
            All plans include the full security and compliance stack. Pricing is never
            tied to assets under management.
          </p>
        </Reveal>
      </div>
    </section>
  );
}
