import Image from "next/image";
import { InteractiveContainer } from "@/app/components/InteractiveContainer";
import { MillIcon, PackageIcon, ShippingIcon } from "@/app/components/icons";
import { Container } from "@/app/components/layout/Container";
import { featuredServicesData } from "../_data/home-data";
import Heading from "@/app/components/ui/Heading";

const ICON_MAP = {
  MillIcon,
  PackageIcon,
  ShippingIcon,
};

export function FeaturedServices() {
  return (
    <section className="flex justify-center mt-32">
      <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"
            >
              Our Featured Services
            </Heading>
            <div className="mx-auto w-full lg:w-4/5">
              <p className="text-center text-gray-500">
                We offer comprehensive services tailored for rice exporters,
                including meticulous packaging, reliable shipping, and expert
                milling to ensure the highest quality Basmati rice reaches our
                customers worldwide.
              </p>
            </div>
          </div>
          <div className="flex gap-16">
            <div className="lg:flex hidden gap-12 w-1/3 justify-center">
              <InteractiveContainer
                step={-3}
                boundry={24}
                className="flex flex-col gap-8"
              >
                <>
                  {featuredServicesData.map((service, index) => (
                    <div
                      key={index}
                      className={`w-64 border-12 rounded-xl drop-shadow-lg border-white${index === 1 ? " relative -right-20" : ""}`}
                    >
                      <Image
                        src={service.image}
                        alt={service.imageAlt}
                        placeholder="blur"
                        className="rounded-lg"
                      />
                    </div>
                  ))}
                </>
              </InteractiveContainer>
            </div>
            <div className="flex flex-col w-full lg:w-1/2 justify-start gap-4 lg:gap-12">
              {featuredServicesData.map((service, index) => {
                const Icon = ICON_MAP[service.iconName];
                return (
                  <div
                    key={index}
                    className={`flex gap-6 border border-gray-200 rounded-xl px-6 py-8 group transform hover:-translate-y-1 transition-all duration-500 hover:shadow-lg overflow-hidden ${index === 1 ? "relative lg:-right-20" : ""}`}
                  >
                    <div
                      className={`${service.iconBg} h-fit w-fit p-4 rounded-full`}
                    >
                      <Icon size={30} />
                    </div>
                    <div>
                      <Heading as="h4" variant="card" className="text-primary">
                        {service.title}
                      </Heading>
                      <p className="text-gray-600">{service.description}</p>
                    </div>
                    <span className="absolute bottom-2 font-light right-2 text-accent/50 -z-10 text-7xl translate-y-full group-hover:translate-y-0 transition-all duration-500">
                      {String(index + 1).padStart(2, "0")}
                    </span>
                  </div>
                );
              })}
            </div>
          </div>
        </div>
      </Container>
    </section>
  );
}
