"use client";

import { useTranslations } from "next-intl";

const mediaLogos = [
  { name: "VOGUE", style: "serif" },
  { name: "Allure", style: "sans" },
  { name: "ELLE", style: "serif" },
  { name: "COSMOPOLITAN", style: "serif" },
  { name: "Bazaar", style: "serif" },
  { name: "GLAMOUR", style: "serif" },
  { name: "WOMEN'S HEALTH", style: "sans" },
  { name: "Shape", style: "sans" },
];

function LogoItem({ name }: { name: string }) {
  const isSerif = name === "VOGUE" || name === "ELLE" || name === "COSMOPOLITAN" || name === "Bazaar" || name === "GLAMOUR";

  return (
    <div className="flex items-center justify-center px-10 py-4 grayscale opacity-40 hover:grayscale-0 hover:opacity-100 transition-all duration-500 flex-shrink-0">
      <span
        className={`
          text-xl md:text-2xl tracking-[0.15em] text-white font-bold
          ${isSerif ? 'font-serif italic' : 'font-sans uppercase'}
        `}
        style={{
          textShadow: '0 0 20px rgba(255,255,255,0.1)',
        }}
      >
        {name}
      </span>
    </div>
  );
}

export default function AsSeenIn() {
  const t = useTranslations("AsSeenIn");

  return (
    <section className="py-12 bg-[#1a1a1a] overflow-hidden border-y border-white/10">
      <div className="container mx-auto px-4 mb-8">
        <p className="text-center text-[10px] uppercase tracking-[0.4em] text-[#c9a962] font-bold animate-fade-in">
          {t("title")}
        </p>
      </div>

      <div className="relative">
        <div className="absolute left-0 top-0 bottom-0 w-32 bg-gradient-to-r from-[#1a1a1a] to-transparent z-10 pointer-events-none" />
        <div className="absolute right-0 top-0 bottom-0 w-32 bg-gradient-to-l from-[#1a1a1a] to-transparent z-10 pointer-events-none" />

        <div className="flex overflow-hidden">
          <div className="flex items-center gap-16 animate-marquee">
            {[...mediaLogos, ...mediaLogos].map((logo, index) => (
              <LogoItem key={`${logo.name}-${index}`} name={logo.name} />
            ))}
          </div>
        </div>
      </div>

      <style>{`
        @keyframes marquee {
          0% { transform: translateX(0); }
          100% { transform: translateX(-50%); }
        }
        .animate-marquee {
          animation: marquee 30s linear infinite;
        }
        @keyframes fade-in {
          from { opacity: 0; }
          to { opacity: 1; }
        }
        .animate-fade-in {
          animation: fade-in 0.6s ease-out forwards;
        }
      `}</style>
    </section>
  );
}
