import type { Metadata } from "next";
import Image from "next/image";
import { Container } from "../components/layout/Container";
import { CheckIcon, SettingsIcon } from "lucide-react";
import Link from "next/link";
import { HandshakeIcon } from "../components/icons/HandshakeIcon";
import { OpenAccessIcon } from "../components/icons/OpenAccessIcon";
import { OpenIcon } from "../components/icons/OpenIcon";

import {
  heroContent,
  statsData,
  trustedExporterContent,
  missionContent,
  visionContent,
  storyContent,
  commitmentContent,
  achievementsData,
  timelineData,
  coreValuesData,
} from "./_data/about-data";
import paddyFieldCropImg from "./_assets/paddy-field-crop.png";
import stackedRiceSacksImg from "./_assets/stacked-rice-sacks.png";
import founderCeoSignatureImg from "./_assets/founder-ceo-signature.png";
import Heading from "../components/ui/Heading";

export const metadata: Metadata = {
  title: "About - Basmati Pakistan",
  description:
    "Basmati Rice A Taste of Pakistan's Heritage We take pride in exporting Basmati rice, renowned for its exceptional quality and unique aroma. Our rice embodies the rich agricultural heritage of Pakistan, ensuring each grain meets the highest standards. With every grain, we deliver a taste that reflects the rich heritage and tradition of Pakistani agriculture. […]",
  alternates: {
    canonical: "https://basmatipakistan.com/about/",
  },
  openGraph: {
    title: "About - Basmati Pakistan",
    description:
      "Basmati Rice A Taste of Pakistan's Heritage We take pride in exporting Basmati rice, renowned for its exceptional quality and unique aroma. Our rice embodies the rich agricultural heritage of Pakistan, ensuring each grain meets the highest standards. With every grain, we deliver a taste that reflects the rich heritage and tradition of Pakistani agriculture. […]",
    url: "https://basmatipakistan.com/about/",
    images: [
      {
        url: "https://basmatipakistan.com/wp-content/uploads/2024/10/istockphoto-458560823-612x612-1.jpg",
      },
    ],
    type: "website",
  },
  twitter: {
    card: "summary_large_image",
    title: "About - Basmati Pakistan",
    description:
      "Basmati Rice A Taste of Pakistan's Heritage We take pride in exporting Basmati rice, renowned for its exceptional quality and unique aroma. Our rice embodies the rich agricultural heritage of Pakistan, ensuring each grain meets the highest standards. With every grain, we deliver a taste that reflects the rich heritage and tradition of Pakistani agriculture. […]",
    images: [
      "https://basmatipakistan.com/wp-content/uploads/2024/10/istockphoto-458560823-612x612-1.jpg",
    ],
  },
};

export default function AboutPage() {
  return (
    <>
      <section className="relative h-[80vh] w-full">
        <Image
          src={paddyFieldCropImg}
          alt="Paddy field crop"
          fill
          placeholder="blur"
          className="absolute top-0 left-0 w-full h-full object-cover object-center"
          priority
          fetchPriority="high"
          loading="eager"
        />
        <div className="relative bg-black/60 w-full h-full flex items-center">
          <Container>
            <div className="flex flex-col gap-2">
              <Heading
                as="h1"
                variant="title"
                className="text-white text-center"
              >
                {heroContent.headline}
              </Heading>
              <p className="text-base lg:text-lg mx-auto w-full lg:w-4/5 text-white/70 text-center">
                {heroContent.description}
              </p>
            </div>
          </Container>
        </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">
        <Container>
          <div className="flex flex-col lg:flex-row gap-12 lg:gap-24">
            <div className="w-full lg:w-1/2">
              <Image
                src={stackedRiceSacksImg}
                alt="Sacks of premium basmati rice stacked high in a clean storage warehouse"
                placeholder="blur"
                className="rounded-xl w-full h-auto"
              />
              <div className="grid grid-cols-3 mt-12">
                {statsData.map((stat, index) => (
                  <div key={index} className="flex flex-col">
                    <Heading as="h4" variant="section" className="text-primary">
                      {stat.value}
                      <span className="text-3xl">{stat.suffix}</span>
                    </Heading>
                    <p className="text-gray-600">{stat.label}</p>
                  </div>
                ))}
              </div>
            </div>
            <div className="w-full lg:w-1/2">
              <Heading as="h2" variant="section" className="text-primary">
                {trustedExporterContent.headline}
              </Heading>
              <p className="mt-6 text-gray-600">
                {trustedExporterContent.description}
              </p>
              <div className="flex justify-between mt-8 gap-4">
                <div>
                  <div className="flex items-center gap-4">
                    <div className="bg-[#198A2121] h-fit w-fit p-2 rounded-full text-primary">
                      <CheckIcon size={16} strokeWidth={2.5} />
                    </div>
                    <Heading as="h3" variant="card" className="text-primary">
                      {missionContent.title}
                    </Heading>
                  </div>
                  <p className="text-gray-600 mt-4">
                    {missionContent.description}
                  </p>
                </div>
                <div>
                  <div className="flex items-center gap-4">
                    <div className="bg-[#FFE3CA] text-[#feb779] h-fit w-fit p-1.5 rounded-full">
                      <SettingsIcon size={18} strokeWidth={2.5} />
                    </div>
                    <Heading as="h3" variant="card" className="text-primary">
                      {visionContent.title}
                    </Heading>
                  </div>
                  <p className="text-gray-600 mt-4">
                    {visionContent.description}
                  </p>
                </div>
              </div>
              <div className="w-full border-t mt-8 lg:mt-16 border-black/5" />
              <div>
                <Image
                  src={founderCeoSignatureImg}
                  alt="Founder and CEO signature"
                  placeholder="blur"
                  className="mt-6 opacity-30 w-48 h-auto"
                />
                <p className="text-gray-500 ">
                  {trustedExporterContent.ceoRole}
                </p>
              </div>
            </div>
          </div>
        </Container>
      </section>
      <section className="mt-16 lg:mt-32">
        <Container>
          <div className="flex flex-col lg:flex-row gap-12 lg:gap-24">
            <div className="h-fit lg:sticky lg:top-24 w-full lg:w-1/2">
              <Heading as="h2" variant="section" className="text-primary">
                {storyContent.headline}
              </Heading>
              <p className="mt-8 text-gray-500">{storyContent.description}</p>
            </div>
            <div className="w-full lg:w-1/2">
              {timelineData.map((milestone, index) => {
                const isLast = index === timelineData.length - 1;
                return (
                  <div
                    key={index}
                    className={isLast ? "relative" : "pb-8 relative"}
                  >
                    <div className="flex items-center">
                      <div className="flex flex-col items-center">
                        <div className="w-6 h-6 bg-white hover:bg-primary transition-all duration-500 rounded-full border border-primary/25"></div>
                        {!isLast && (
                          <div className="absolute top-0 bottom-0 -z-10 w-px bg-primary/15" />
                        )}
                      </div>
                      <Heading
                        as="h4"
                        variant="card"
                        className="text-primary ml-6"
                      >
                        {milestone.title}
                      </Heading>
                    </div>
                    <p className="ml-12 mt-2 text-gray-500">
                      {milestone.description}
                    </p>
                  </div>
                );
              })}
            </div>
          </div>
        </Container>
      </section>
      <section className="mt-16 lg:mt-32">
        <Container>
          <div className="flex flex-col lg:flex-row gap-24">
            <div className="w-full lg:w-1/2">
              <Heading as="h4" variant="card" className="text-primary">
                Our Core Values
              </Heading>
              <ul className="mt-8 flex flex-col gap-8">
                {coreValuesData.map((value, index) => {
                  let iconBg = "bg-[#198A2121]";
                  let icon = <HandshakeIcon size={30} fill="#467302" />;
                  if (value.colorTheme === "orange") {
                    iconBg = "bg-[#FF983C21]";
                    icon = <OpenAccessIcon size={28} />;
                  } else if (value.colorTheme === "mint") {
                    iconBg = "bg-[#DDFFED]";
                    icon = <OpenIcon size={28} />;
                  }
                  return (
                    <li
                      key={index}
                      className="flex gap-6 border border-gray-200 rounded-xl p-6 group transform hover:-translate-y-1 transition-all duration-500 hover:shadow-lg overflow-hidden"
                    >
                      <div className={`${iconBg} h-fit w-fit p-3 rounded-full`}>
                        {icon}
                      </div>
                      <div>
                        <Heading
                          as="h4"
                          variant="card"
                          className="text-primary"
                        >
                          {value.title}
                        </Heading>
                        <p className="text-gray-600">{value.description}</p>
                      </div>
                    </li>
                  );
                })}
              </ul>
              <div className="w-full border-t border-black/10 my-12" />
              <Heading as="h4" variant="card" className="text-gray-600">
                Our Achievements Reflect
              </Heading>
              <div className="flex flex-col gap-6 mt-8">
                {achievementsData.map((achievement, index) => (
                  <div key={index}>
                    <div className="flex items-center text-accent font-bold justify-between mb-2">
                      <Heading as="h6" variant="card-sm">
                        {achievement.label}
                      </Heading>
                      <span>{achievement.value}</span>
                    </div>
                    <div className="w-full bg-gray-200 rounded-full h-2">
                      <div
                        className="bg-accent h-2 rounded-full"
                        style={{ width: achievement.value }}
                      ></div>
                    </div>
                  </div>
                ))}
              </div>
            </div>
            <div className="lg:sticky lg:top-24 h-fit w-full lg:w-1/2">
              <Heading as="h2" variant="section" className="text-primary">
                {commitmentContent.headline}
              </Heading>
              <p className="mt-18 text-gray-500">
                {commitmentContent.description}
              </p>
              <Link
                href={commitmentContent.ctaHref}
                className="mt-10 text-white bg-accent px-7 py-3.5 font-semibold rounded-full inline-block hover:bg-accent/95 transition-all duration-500"
              >
                {commitmentContent.ctaLabel}
              </Link>
            </div>
          </div>
        </Container>
      </section>
    </>
  );
}
