import Link from 'next/link';
import { ArrowRight } from 'lucide-react';

import { Container } from '@/components/layout/container';
import { Reveal } from '@/components/motion/reveal';
import { buttonVariants } from '@/components/ui/button';
import { cn } from '@/lib/utils';

export function FinalCta() {
  return (
    <section className="py-14 md:py-24">
      <Container>
        <Reveal>
          <div className="relative isolate overflow-hidden rounded-3xl bg-brand-gradient px-6 py-14 text-center shadow-lg sm:px-10 md:p-20">
            {/* Decorative layers. The dark-only tint keeps white text readable on the lighter dark-theme gradient. */}
            <div className="pointer-events-none absolute inset-0 -z-10 hidden bg-[rgb(var(--ink-from)/0.35)] dark:block" aria-hidden="true" />
            <div className="pointer-events-none absolute inset-0 -z-10 bg-mesh opacity-60 [--accent:255_255_255] [--primary:255_255_255]" aria-hidden="true" />
            <div className="pointer-events-none absolute inset-0 -z-10 bg-grid opacity-25 [--border:255_255_255]" aria-hidden="true" />
            <div className="pointer-events-none absolute -left-12 top-6 -z-10 h-44 w-44 animate-float rounded-full bg-primary-foreground/10 [animation-duration:7s]" aria-hidden="true" />
            <div className="pointer-events-none absolute -bottom-10 -right-6 -z-10 h-36 w-36 animate-float rounded-full border border-primary-foreground/20 bg-primary-foreground/5 [animation-delay:-3s] [animation-duration:5s]" aria-hidden="true" />
            <div className="pointer-events-none absolute inset-0 -z-10 overflow-hidden" aria-hidden="true">
              <div className="animate-sweep absolute inset-y-0 -left-1/3 w-1/3 -translate-x-[120%] bg-gradient-to-r from-transparent via-primary-foreground/15 to-transparent motion-reduce:hidden" />
            </div>

            <h2 className="text-balance font-display text-[2rem] font-extrabold leading-tight tracking-[-0.03em] text-primary-foreground md:text-display-lg">Ready to ship smarter?</h2>
            <p className="mx-auto mt-4 max-w-lg text-pretty text-[18px] leading-7 text-primary-foreground/80">
              Create a workspace, top up once, and buy labels at the rate you already compared.
            </p>
            <div className="mt-9 flex flex-col items-stretch justify-center gap-3 sm:flex-row sm:items-center">
              <Link href="/register" className={cn(buttonVariants({ variant: 'white', size: 'lg' }), 'group bg-primary-foreground text-[rgb(var(--ink-from))] hover:bg-primary-foreground/90')}>
                Get started free
                <ArrowRight className="h-4 w-4 transition-transform duration-180 ease-brand group-hover:translate-x-[3px]" aria-hidden="true" />
              </Link>
              <Link href="/contact" className={buttonVariants({ variant: 'outline', size: 'lg' })}>
                Talk to us
              </Link>
            </div>
          </div>
        </Reveal>
      </Container>
    </section>
  );
}
