import { StaticLink } from '@/components/ui/static-link';
import Image from 'next/image';
import { Mail, MapPin } from 'lucide-react';
import { COMPANY_INFO, NAVIGATION_V2, MEGA_DROPDOWN_DATA } from '@/lib/constants';

export function Footer() {
  return (
    <footer className="bg-[#1C1C1C] text-white py-16" data-testid="footer" role="contentinfo">
      <div className="container-wide">
        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-10 lg:gap-12">
          <div data-testid="card-brand">
            <div className="mb-6">
              <Image
                src="/logo-light.svg"
                alt={COMPANY_INFO.name}
                width={160}
                height={40}
                loading="eager"
                priority
              />
            </div>
            <p className="text-[#A0A0A0] text-sm leading-relaxed mb-6">
              {COMPANY_INFO.description}
            </p>
            <div className="pt-6 border-t border-[#333]">
              <p className="text-sm text-[#A0A0A0] mb-3">关注公众号</p>
              <div className="inline-block p-2 rounded-lg border border-[#333]">
                <Image
                  src="/images/qrcode_for_gh_a297181ff548_258.jpg"
                  alt="微信公众号二维码"
                  width={100}
                  height={100}
                  className="w-25 h-25"
                  loading="lazy"
                />
              </div>
            </div>
          </div>

          <div data-testid="card-navigation">
            <h3 className="font-semibold text-base mb-5 text-white">快速导航</h3>
            <ul className="space-y-3">
              {NAVIGATION_V2.map((item) => (
                <li key={item.id}>
                  <StaticLink
                    href={item.href}
                    className="text-[#A0A0A0] hover:text-white transition-colors duration-200 text-sm"
                  >
                    {item.label}
                  </StaticLink>
                </li>
              ))}
            </ul>
          </div>

          <div data-testid="card-products">
            <h3 className="font-semibold text-base mb-5 text-white">产品</h3>
            <ul className="space-y-3">
              {(MEGA_DROPDOWN_DATA.products ?? []).map((item) => (
                <li key={item.id}>
                  <StaticLink
                    href={item.href}
                    className="text-[#A0A0A0] hover:text-white transition-colors duration-200 text-sm"
                  >
                    {item.title}
                  </StaticLink>
                </li>
              ))}
            </ul>
            <h3 className="font-semibold text-base mb-5 mt-8 text-white">解决方案</h3>
            <ul className="space-y-3">
              {(MEGA_DROPDOWN_DATA.solutions ?? []).map((item) => (
                <li key={item.id}>
                  <StaticLink
                    href={item.href}
                    className="text-[#A0A0A0] hover:text-white transition-colors duration-200 text-sm"
                  >
                    {item.title}
                  </StaticLink>
                </li>
              ))}
            </ul>
          </div>

          <div data-testid="card-contact">
            <h3 className="font-semibold text-base mb-5 text-white">联系方式</h3>
            <ul className="space-y-4">
              <li className="flex items-start gap-3">
                <MapPin className="w-4 h-4 text-[#C41E3A] mt-0.5 shrink-0" />
                <span className="text-[#A0A0A0] text-sm">{COMPANY_INFO.address}</span>
              </li>
              <li className="flex items-center gap-3">
                <Mail className="w-4 h-4 text-[#C41E3A] shrink-0" />
                <span className="text-[#A0A0A0] text-sm">{COMPANY_INFO.email}</span>
              </li>
            </ul>
            <div className="mt-6 pt-6 border-t border-[#333]">
              <p className="text-sm text-[#A0A0A0] mb-3">企业微信业务咨询</p>
              <div className="inline-block p-2 rounded-lg border border-[#333]">
                <Image
                  src="/images/149A1D2F-D9FD-49C7-B139-142C50C5FE8B_1_201_a.jpeg"
                  alt="企业微信业务咨询二维码"
                  width={100}
                  height={100}
                  className="w-25 h-25"
                  loading="lazy"
                />
              </div>
            </div>
          </div>
        </div>

        <div className="border-t border-[#333] mt-12 pt-8 pb-24 md:pb-8">
          <div className="flex flex-col md:flex-row justify-between items-center gap-4">
            <p className="text-[#666] text-sm">
              © {new Date().getFullYear()} {COMPANY_INFO.name}. All rights reserved.
            </p>
            <div className="flex gap-6">
              <StaticLink href="/privacy" className="text-[#666] hover:text-white text-sm transition-colors duration-200">
                隐私政策
              </StaticLink>
              <StaticLink href="/terms" className="text-[#666] hover:text-white text-sm transition-colors duration-200">
                服务条款
              </StaticLink>
            </div>
          </div>

          <div className="text-center mt-6 pt-6 border-t border-[#333]">
            <div className="flex flex-col sm:flex-row justify-center items-center gap-2 sm:gap-4 text-xs">
              <a
                href="https://beian.miit.gov.cn/"
                target="_blank"
                rel="noopener noreferrer"
                className="text-[#E0E0E0] hover:text-white transition-colors duration-200"
              >
                {COMPANY_INFO.icp}
              </a>
              <span className="hidden sm:inline text-[#999]">|</span>
              <a
                href="https://beian.mps.gov.cn/#/query/webSearch?code=51010602003285"
                target="_blank"
                rel="noreferrer"
                className="text-[#E0E0E0] hover:text-white transition-colors duration-200 inline-flex items-center gap-1.5"
              >
                <Image
                  src="/images/beian-icon.png"
                  alt="公安备案"
                  width={16}
                  height={16}
                  className="w-4 h-4"
                  loading="lazy"
                />
                {COMPANY_INFO.police}
              </a>
            </div>
          </div>
        </div>
      </div>
    </footer>
  );
}
