import {
  IconAdjustments,
  IconFlame,
  IconGauge,
  IconLayout,
  IconRoute,
  IconShoppingCart,
} from "@tabler/icons-react";
import { getTranslations } from "next-intl/server";
import { FadeIn } from "@/components/ui/fade-in";

const pillarKeys = [
  { key: "speed", icon: IconGauge },
  { key: "uxUi", icon: IconLayout },
  { key: "checkout", icon: IconShoppingCart },
  { key: "abTesting", icon: IconAdjustments },
  { key: "heatmap", icon: IconFlame },
  { key: "funnel", icon: IconRoute },
] as const;

export async function CroSolutionEngine() {
  const t = await getTranslations("croSolutionEngine");

  return (
    <section className="py-12 sm:py-24 md:py-32">
      <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
        {/* Section Header */}
        <FadeIn className="mb-8 text-center md:mb-16" y={20}>
          <h2 className="mb-4 font-bold text-2xl text-white sm:text-3xl md:mb-6 md:text-5xl">
            {t("title")}{" "}
            <span className="text-[#FD105E]">{t("titleHighlight")}</span>
          </h2>
          <p className="mx-auto max-w-4xl text-base text-white/70 md:text-lg">
            {t("subtitle")}
          </p>
        </FadeIn>

        {/* Pillars Grid */}
        <div className="mx-auto grid max-w-7xl grid-cols-1 gap-4 md:grid-cols-2 md:gap-6 lg:grid-cols-3">
          {pillarKeys.map((pillar, index) => (
            <FadeIn
              className="group relative"
              delay={index * 0.08}
              duration={0.6}
              key={pillar.key}
              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">
                  <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">
                    <pillar.icon
                      className="h-6 w-6 text-[#FD105E]"
                      strokeWidth={1.5}
                    />
                  </div>
                </div>
                <h3 className="mb-3 font-bold text-lg text-white md:text-xl">
                  {t(`${pillar.key}Title`)}
                </h3>
                <p className="text-neutral-300 text-sm leading-relaxed">
                  {t(`${pillar.key}Desc`)}
                </p>
              </div>
            </FadeIn>
          ))}
        </div>
      </div>
    </section>
  );
}
