import { GOLDEN_NIFTY_PATH } from "@/lib/routes";

export default function Footer() {
  const links: Record<string, { label: string; href: string; newTab?: boolean }[]> = {
    Product: [
      { label: "Strategies", href: GOLDEN_NIFTY_PATH, newTab: true },
      { label: "Pricing", href: "#" },
      { label: "How It Works", href: "#how-it-works" },
    ],
    Company: [
      { label: "About", href: "/about" },
      { label: "Blog", href: "/blog" },
    ],
    Legal: [
      { label: "Privacy", href: "/privacy" },
      { label: "Terms", href: "/terms" },
      { label: "Disclosures", href: "/disclosures" },
    ],
  };

  return (
    <footer className="py-16 px-6 border-t border-border" data-testid="footer">
      <div className="max-w-6xl mx-auto">
        <div className="grid md:grid-cols-4 gap-12 mb-12">
          <div>
            <a
              href="#"
              className="text-xl font-bold tracking-tight mb-4 block"
              data-testid="link-footer-logo"
            >
              QuantFortune
            </a>
            <p className="text-sm text-muted-foreground leading-relaxed">
              Simple, disciplined investment strategies for long-term wealth building.
            </p>
          </div>

          {Object.entries(links).map(([category, items]) => (
            <div key={category}>
              <h4 className="font-semibold mb-4 text-sm">{category}</h4>
              <ul className="space-y-3">
                {items.map((item) => (
                  <li key={item.label}>
                    <a
                      href={item.href}
                      target={item.newTab ? "_blank" : undefined}
                      rel={item.newTab ? "noreferrer" : undefined}
                      className="text-sm text-muted-foreground hover:text-foreground transition-colors"
                      data-testid={`link-footer-${item.label.toLowerCase()}`}
                    >
                      {item.label}
                    </a>
                  </li>
                ))}
              </ul>
            </div>
          ))}
        </div>

        <div className="pt-8 border-t border-border flex flex-col md:flex-row items-center justify-between gap-4">
          <p className="text-sm text-muted-foreground">
            2025 QuantFortune. All rights reserved.
          </p>
          <p className="text-xs text-muted-foreground max-w-md text-center md:text-right">
            Investment in securities market are subject to market risks. Read all related documents carefully before investing.
          </p>
        </div>
      </div>
    </footer>
  );
}
