import {
  IconBan,
  IconChartArrowsVertical,
  IconDatabaseOff,
  IconMoodSad,
  IconRefreshAlert,
  IconTrendingDown,
} from "@tabler/icons-react";
import { getTranslations } from "next-intl/server";
import { FadeIn } from "@/components/ui/fade-in";

const problemKeys = [
  "revenueLoss",
  "blacklist",
  "dataBreach",
  "seoDrop",
  "reputation",
  "reinfection",
] as const;

const problemIcons = [
  IconTrendingDown,
  IconBan,
  IconDatabaseOff,
  IconChartArrowsVertical,
  IconMoodSad,
  IconRefreshAlert,
];

export async function WpMalwareProblems() {
  const t = await getTranslations("wpMalwareProblems");

  const problems = problemKeys.map((key, index) => ({
    icon: problemIcons[index],
    title: t(`${key}Title`),
    description: t(`${key}Desc`),
    stat: t(`${key}Stat`),
  }));

  return (
    <section className="relative overflow-hidden py-12 md:py-24 lg:py-32">
      <div className="container relative z-10 mx-auto px-4 sm:px-6 lg:px-8">
        <div className="mx-auto mb-8 max-w-4xl text-center md:mb-16">
          <FadeIn>
            <h2 className="mb-4 font-bold text-2xl text-white sm:text-3xl md:mb-6 md:text-5xl">
              {t("headingLine1")}
              <br />
              <span className="text-[#FD105E]">{t("headingLine2")}</span>
            </h2>
            <p className="mx-auto max-w-3xl text-base text-neutral-200 md:text-xl">
              {t("subtitle")}
            </p>
          </FadeIn>
        </div>

        <div className="mx-auto grid max-w-7xl grid-cols-1 gap-4 md:grid-cols-2 md:gap-6 lg:grid-cols-3">
          {problems.map((problem, index) => (
            <FadeIn
              className="group relative"
              delay={index * 0.08}
              duration={0.5}
              ease={[0.21, 0.47, 0.32, 0.98]}
              key={problemKeys[index]}
              scale={0.95}
              viewportAmount={0.2}
              y={20}
            >
              <div className="relative h-full rounded-2xl border border-[#333333] bg-[#1a1a1a]/80 p-4 backdrop-blur-sm transition-all duration-300 hover:border-[#FD105E]/50 hover:bg-[#1a1a1a] sm:p-6 md:p-8">
                <div className="mb-4 flex items-center justify-between md:mb-6">
                  <div className="flex h-12 w-12 items-center justify-center rounded-xl border border-[#FD105E]/20 bg-[#FD105E]/10 transition-transform duration-300 group-hover:scale-110">
                    <problem.icon
                      className="h-6 w-6 text-[#FD105E]"
                      strokeWidth={1.5}
                    />
                  </div>
                  <span className="rounded-xl bg-[#FD105E]/10 px-3 py-1 font-semibold text-[#FD105E] text-xs">
                    {problem.stat}
                  </span>
                </div>
                <h3 className="mb-3 font-bold text-lg text-white md:text-xl">
                  {problem.title}
                </h3>
                <p className="text-neutral-200 text-sm leading-relaxed">
                  {problem.description}
                </p>
              </div>
            </FadeIn>
          ))}
        </div>
      </div>
    </section>
  );
}
