import Image from "next/image";
import { Accordion } from "@/components/Accordion";
import { Footer } from "@/components/Footer";
import { Header } from "@/components/Header";
import { PageHero } from "@/components/PageShared";
import { f300Blocks, f300Intro } from "@/data/f300";
import type { Metadata } from "next";
import { pageMetadata } from "@/lib/seo";

export const metadata: Metadata = pageMetadata({
  title: "فن تخلیه دود F300",
  description: "فن تخلیه دود F300 با بهترین قیمت و کیفیت مناسب",
  path: "/products/f300",
  image: "/images/pages/f300/hero.jpg",
});

export default function F300Page() {
  return (
    <>
      <Header />
      <main>
        <PageHero
          title="فـن تخلیه دود F300"
          titleEn="F300 Smoke Exhaust Fan"
          breadcrumb={[
            { label: "صفحه اصلی", href: "/" },
            { label: "محصولات", href: "/products" },
            { label: "فن تخلیه دود F300", href: "/products/f300" },
          ]}
        />

        <section className="section">
          <div className="container-page grid items-center gap-8 md:grid-cols-2">
            <div className="relative aspect-[16/10] overflow-hidden">
              <Image
                src={f300Intro.image}
                alt={f300Intro.title}
                fill
                className="object-cover"
                sizes="(max-width: 768px) 100vw, 50vw"
                priority
              />
            </div>
            <div>
              <h2 className="mb-4 text-xl font-bold text-[#232323]">
                {f300Intro.title}
              </h2>
              <div className="mb-5 space-y-3">
                {f300Intro.text.map((paragraph) => (
                  <p
                    key={paragraph.slice(0, 40)}
                    className="text-sm leading-8 text-[#666] text-justify"
                  >
                    {paragraph}
                  </p>
                ))}
              </div>
              <ul className="space-y-2">
                {f300Intro.benefits.map((item) => (
                  <li
                    key={item}
                    className="flex gap-2 text-sm leading-7 text-[#555]"
                  >
                    <span className="mt-2 h-1.5 w-1.5 shrink-0 rounded-full bg-accent-green" />
                    <span>{item}</span>
                  </li>
                ))}
              </ul>
            </div>
          </div>
        </section>

        {f300Blocks.map((block, index) => (
          <section
            key={block.id}
            className={`section ${index % 2 === 0 ? "section-gray" : ""}`}
          >
            <div className="container-page grid items-start gap-8 lg:grid-cols-2">
              <div className={index % 2 === 1 ? "lg:order-2" : ""}>
                <h2 className="mb-4 text-lg font-bold leading-8 text-[#232323] sm:text-xl">
                  {block.title}
                </h2>
                <div className="space-y-3">
                  {block.intro.map((paragraph) => (
                    <p
                      key={paragraph.slice(0, 40)}
                      className="text-sm leading-8 text-[#666] text-justify"
                    >
                      {paragraph}
                    </p>
                  ))}
                </div>
                {block.accordion ? <Accordion items={block.accordion} /> : null}
              </div>

              <div
                className={`relative flex min-h-[280px] items-center justify-center ${
                  index % 2 === 1 ? "lg:order-1" : ""
                } ${block.isPng ? "" : "overflow-hidden bg-[#f7f7f7]"}`}
              >
                <Image
                  src={block.image}
                  alt={block.imageAlt}
                  width={560}
                  height={420}
                  className={`h-auto w-full max-w-lg object-contain ${
                    block.isPng ? "" : "object-cover"
                  }`}
                  sizes="(max-width: 1024px) 100vw, 50vw"
                />
              </div>
            </div>
          </section>
        ))}
      </main>
      <Footer />
    </>
  );
}
