import { ArrowUpRight } from "lucide-react";
import Link from "next/link";
import Image, { StaticImageData } from "next/image";
import { Container } from "@/app/components/layout/Container";
import { featuresData } from "../_data/home-data";
import Heading from "@/app/components/ui/Heading";

interface OurFeatureCardProps {
  icon: StaticImageData;
  title: string;
  description: string;
  href: string;
}

function OurFeatureCard({
  icon,
  title,
  description,
  href,
}: OurFeatureCardProps) {
  return (
    <div className="group overflow-hidden hover:border-primary transition-all duration-500 transform hover:-translate-y-4  px-9 pt-6 pb-14 border border-gray-200 rounded-xl relative">
      <div className="mt-4 transform group-hover:-translate-y-17 transition-all duration-500">
        <div className="rounded-full bg-blue-100 p-2 flex items-center justify-center w-fit mb-8">
          <Image
            src={icon}
            alt={title}
            placeholder="blur"
            className="rounded-full w-11 h-11 object-contain"
          />
        </div>
        <Heading as="h4" variant="card" className="text-primary my-3">
          {title}
        </Heading>
        <p className="text-gray-600 leading-6">{description}</p>
        <Link
          href={href}
          className="absolute -bottom-22 opacity-0 group-hover:opacity-100 transition-all duration-500 right-0 rounded-full border border-gray-300 p-3"
        >
          <ArrowUpRight size={30} strokeWidth={0.5} className="text-black/80" />
        </Link>
      </div>
    </div>
  );
}

function ExportNetworkCard() {
  return (
    <div className="w-full px-9 pt-6 pb-14 rounded-xl bg-radial-[at_top_right] from-[#1b4319] to-50% to-[#1b3519]">
      <Heading as="h4" variant="card" className="text-white my-4">
        Strong Export Networks
      </Heading>
      <p className="text-white/60 leading-6">
        Our strong export networks enable us to supply rice to clients across
        the globe easily. We pride ourselves on fast, reliable exports to meet
        global demand.
      </p>
      <Link
        href="/global-reach-logistics"
        className="bg-accent px-8 py-4 mt-16 block w-fit text-white text-center font-medium rounded-full"
      >
        Don't miss out
      </Link>
    </div>
  );
}

export function OurFeatures() {
  return (
    <section className="mt-16 lg:mt-32 flex justify-center">
      <Container>
        <div className="flex flex-col gap-8 lg:gap-16">
          <div className="flex flex-col gap-2">
            <Heading
              as="h2"
              variant="section"
              className="text-primary text-center"
            >
              Why to Choose BasmatiPak?
            </Heading>
            <div className="mx-auto w-full lg:w-4/5">
              <p className="text-center text-gray-600">
                Being the largest Basmati rice exporter in the country, we
                proudly serve diverse international market demands. Our
                standards are well aligned with global quality benchmarks.
              </p>
            </div>
          </div>
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10">
            {featuresData.map((feature, index) => (
              <OurFeatureCard
                key={index}
                icon={feature.icon}
                title={feature.title}
                description={feature.description}
                href={feature.href}
              />
            ))}
            <ExportNetworkCard />
          </div>
        </div>
      </Container>
    </section>
  );
}
