import { useWeb } from "../WebContext";
import { Container, cn } from "../WebUI";
import { BrandLogo } from "@/components/base/BrandLogo";
import type { WebScreen } from "../types";

const QUICK: { key: string; screen: WebScreen }[] = [
  { key: "navHome", screen: "home" },
  { key: "navBusinesses", screen: "businesses" },
  { key: "navProducts", screen: "products" },
  { key: "navOpportunities", screen: "invOpps" },
];

export default function WebFooter() {
  const { t, jump, lang } = useWeb();
  return (
    <footer className="bg-primary-950 text-background-50 border-t-[3px] border-secondary-500">
      <Container className="py-12">
        <div className="grid grid-cols-1 md:grid-cols-4 gap-8">
          <div className="md:col-span-2 max-w-md">
            <div className="flex items-center gap-2.5 mb-4">
              <BrandLogo className="w-[50px] h-[36px] text-background-50" />
              <span className="font-heading font-bold text-[18px] text-background-50">
                {t("brand")}
              </span>
            </div>
            <p className="text-[13.5px] text-background-50/70 leading-relaxed">{t("footerAbout")}</p>
            <div className="flex items-center gap-2 mt-5">
              {["ri-twitter-x-line", "ri-instagram-line", "ri-linkedin-line", "ri-whatsapp-line"].map(
                (ic) => (
                  <a
                    key={ic}
                    href="#"
                    onClick={(e) => e.preventDefault()}
                    aria-label={ic}
                    className="w-9 h-9 rounded-full bg-background-50/10 flex items-center justify-center text-background-50/90 hover:bg-background-50/20 transition-colors cursor-pointer"
                  >
                    <i className={cn(ic, "text-[17px] leading-none")} />
                  </a>
                ),
              )}
            </div>
          </div>

          <div>
            <h4 className="text-[14px] font-bold text-background-50 mb-3">{t("footerQuick")}</h4>
            <ul className="space-y-2">
              {QUICK.map((q) => (
                <li key={q.key}>
                  <button
                    type="button"
                    onClick={() => jump(q.screen)}
                    className="text-[13.5px] text-background-50/70 hover:text-background-50 cursor-pointer transition-colors"
                  >
                    {t(q.key)}
                  </button>
                </li>
              ))}
            </ul>
          </div>

          <div>
            <h4 className="text-[14px] font-bold text-background-50 mb-3">{t("footerContact")}</h4>
            <ul className="space-y-2.5 text-[13.5px] text-background-50/70">
              <li className="flex items-center gap-2">
                <i className="ri-phone-line text-[15px] leading-none" />
                <span dir="ltr">+966 800 123 4567</span>
              </li>
              <li className="flex items-center gap-2">
                <i className="ri-mail-line text-[15px] leading-none" />
                <span dir="ltr">hello@dshn.sa</span>
              </li>
              <li className="flex items-center gap-2">
                <i className="ri-map-pin-line text-[15px] leading-none" />
                <span>الرياض، المملكة العربية السعودية</span>
              </li>
            </ul>
          </div>
        </div>

        <div className="flex flex-col sm:flex-row items-center justify-between gap-3 mt-10 pt-6 border-t border-background-50/15">
          <p className="text-[12.5px] text-background-50/60">
            © 2025 {t("brand")} — {t("footerRights")}
          </p>
          <div className="flex items-center gap-2 text-[12.5px] text-background-50/60">
            <i className="ri-global-line text-[15px] leading-none" />
            {lang === "ar" ? "المملكة العربية السعودية" : "Saudi Arabia"} · ر.س
          </div>
        </div>
      </Container>
    </footer>
  );
}