import type { Metadata } from "next";
import { InteractiveContainer } from "@/app/components/InteractiveContainer";
import { ContainerSm } from "@/app/components/layout/ContainerSm";
import Image from "next/image";
import { MillingCard } from "./_components/MillingCard";

import {
  textCopy,
  advantagesData,
  machineComponentsData,
  millingComparisonCards,
  millingStepsData,
  stepColors,
} from "./_data/milling-data";
import heroImg from "./_assets/milling-hero-banner.png";
import paddyMillImg from "./_assets/paddy-mill-machine.png";
import Heading from "@/app/components/ui/Heading";

export const metadata: Metadata = {
  title: "Modern Basmati Rice Milling Services for Export Quality Rice",
  description:
    "Our Basmati rice milling services provide advanced processing, polishing, and grading to maintain the natural aroma and quality of premium rice.",
  alternates: {
    canonical: "https://basmatipakistan.com/milling/",
  },
  openGraph: {
    title: "Modern Basmati Rice Milling Services for Export Quality Rice",
    description:
      "Our Basmati rice milling services provide advanced processing, polishing, and grading to maintain the natural aroma and quality of premium rice.",
    url: "https://basmatipakistan.com/milling/",
    images: [
      {
        url: "https://basmatipakistan.com/wp-content/uploads/2024/10/Introduction-to-Paddy-Milling.png",
      },
    ],
    type: "website",
  },
  twitter: {
    card: "summary_large_image",
    title: "Modern Basmati Rice Milling Services for Export Quality Rice",
    description:
      "Our Basmati rice milling services provide advanced processing, polishing, and grading to maintain the natural aroma and quality of premium rice.",
    images: [
      "https://basmatipakistan.com/wp-content/uploads/2024/10/Introduction-to-Paddy-Milling.png",
    ],
  },
};

export default function MillingServicePage() {
  return (
    <>
      <section className="relative h-[65vh] w-full">
        <Image
          src={heroImg}
          alt="Milling Service Hero"
          fill
          placeholder="blur"
          className="absolute top-0 left-0 w-full h-full object-cover object-top"
          priority
          fetchPriority="high"
          loading="eager"
        />
        <div className="relative bg-black/60 w-full h-full flex items-center">
          <ContainerSm>
            <Heading as="h1" variant="title" className="text-white">
              {textCopy.heroTitle}
            </Heading>
          </ContainerSm>
        </div>
        <div className="absolute z-10 bottom-0 w-full bg-white h-24 [clip-path:polygon(100%_100%,100%_0,0_100%)]"></div>
      </section>
      <section className="mt-16 lg:mt-32">
        <ContainerSm>
          <div className="flex flex-col lg:flex-row gap-8 justify-between">
            <div className="w-full lg:w-1/2">
              <InteractiveContainer step={3} boundry={24}>
                <Image
                  src={paddyMillImg}
                  alt="Paddy Mill processing machinery"
                  placeholder="blur"
                  className="rounded-xl w-full object-contain"
                />
              </InteractiveContainer>
            </div>
            <div className="w-full lg:w-1/2 flex flex-col gap-4">
              <Heading as="h2" variant="section" className="text-primary">
                {textCopy.introHeadline}
              </Heading>
              <p className="text-gray-600 leading-7">
                {textCopy.introDescription}
              </p>
              <div>
                {advantagesData.map((adv, index) => {
                  const isLast = index === advantagesData.length - 1;
                  return (
                    <div key={index} className="mt-4 relative">
                      <div className="flex items-center">
                        <div className="flex flex-col items-center">
                          <div className="w-4 h-4 bg-white rounded-full border border-primary/25"></div>
                          {!isLast && (
                            <div className="absolute top-4 bottom-0 -z-10 w-px bg-primary/25" />
                          )}
                        </div>
                        <Heading
                          as="h4"
                          variant="card"
                          className="text-primary ml-6"
                        >
                          {adv.title}
                        </Heading>
                      </div>
                      <p className="ml-10 mt-2 text-gray-600">
                        {adv.description}
                      </p>
                    </div>
                  );
                })}
              </div>
            </div>
          </div>
        </ContainerSm>
      </section>
      <section className="mt-16 lg:mt-32">
        <ContainerSm>
          <div className="flex flex-col gap-16">
            <div className="flex flex-col gap-2">
              <Heading
                as="h2"
                variant="section"
                className="text-primary text-center"
              >
                {textCopy.modernHeadline}
              </Heading>
              <p className="text-gray-500 text-center">
                {textCopy.modernDesc1}+{textCopy.modernDesc2}
              </p>
            </div>
            <div className="flex justify-center">
              <div className="grid grid-cols-1 lg:w-2/3 gap-14 lg:grid-cols-3 items-center justify-items-center">
                {machineComponentsData.map((comp, idx) => {
                  const cardStyle =
                    comp.theme === "filled"
                      ? "bg-primary text-white"
                      : "text-primary border-[#273c07]";
                  return (
                    <div
                      key={idx}
                      className={`h-fit flex flex-col items-center hover:scale-90 transition-all duration-500 border py-6 px-4 rounded-xl ${cardStyle}`}
                    >
                      <Heading as="h4" variant="card">
                        {comp.title}
                      </Heading>
                      <p className="text-center">{comp.description}</p>
                    </div>
                  );
                })}
              </div>
            </div>
          </div>
        </ContainerSm>
      </section>
      <section className="mt-16 lg:mt-32">
        <ContainerSm>
          <div className="flex flex-col gap-16">
            <div className="flex flex-col gap-2">
              <Heading
                as="h2"
                variant="section"
                className="text-primary text-center"
              >
                {textCopy.comparisonHeadline}
              </Heading>
              <div className="w-full lg:w-4/5 mx-auto">
                <p className="text-gray-600 text-center">
                  {textCopy.comparisonDescription}
                </p>
              </div>
            </div>
            <div className="flex flex-col lg:flex-row gap-12">
              {millingComparisonCards.map((card, index) => (
                <MillingCard
                  key={index}
                  title={card.title}
                  description={card.description}
                  img={card.img}
                  translation={card.translation}
                />
              ))}
            </div>
          </div>
        </ContainerSm>
      </section>
      <section className="mt-16 lg:mt-32">
        <ContainerSm>
          <div className="flex flex-col gap-16">
            <div className="flex flex-col gap-2">
              <Heading
                as="h2"
                variant="section"
                className="text-primary text-center"
              >
                {textCopy.chartHeadline}
              </Heading>
              <div className="w-full lg:w-4/5 mx-auto">
                <p className=" text-gray-600 text-center">
                  {textCopy.chartDescription}
                </p>
              </div>
            </div>
            <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-16">
              {millingStepsData.map((service, index) => {
                const colorSet = stepColors[index % 4];
                return (
                  <div key={index}>
                    <div className="flex gap-6 items-center">
                      <div
                        className={`flex items-center justify-center w-12 h-12 p-5 text-primary font-semibold text-lg rounded-full border-[0.05px] ${colorSet.border} ${colorSet.bg}`}
                      >{`0${index + 1}`}</div>
                      <div className="w-full bg-primary h-[0.08px]" />
                    </div>
                    <div className="mt-8">
                      <Heading as="h4" variant="card" className="text-primary">
                        {service}
                      </Heading>
                    </div>
                  </div>
                );
              })}
            </div>
          </div>
        </ContainerSm>
      </section>
    </>
  );
}
