"use client";

import { KeyRound, ShieldCheck, RefreshCw, ScrollText } from "lucide-react";
import { useLanguage } from "@/components/language-provider";
import { Section, SectionHeading } from "@/components/ui/section";

const ICONS: Record<string, React.ComponentType<{ className?: string }>> = {
  "RS256 signing": KeyRound,
  "امضای RS256": KeyRound,
  "Verify with public key": ShieldCheck,
  "تأیید با کلید عمومی": ShieldCheck,
  "Session & token revocation": RefreshCw,
  "لغو نشست و توکن": RefreshCw,
  "Audit log & service credentials": ScrollText,
  "لاگ حسابرسی و اعتبار سرویس": ScrollText,
};

export function Security() {
  const { t } = useLanguage();
  return (
    <Section id="security" className="bg-slate-50 dark:bg-ink-soft/40">
      <div className="container-x">
        <SectionHeading
          eyebrow={t.security.eyebrow}
          title={t.security.title}
          subtitle={t.security.subtitle}
        />

        <div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
          {t.security.points.map((p) => {
            const Icon = ICONS[p.title] ?? KeyRound;
            return (
              <div key={p.title} className="card">
                <span className="flex h-11 w-11 items-center justify-center rounded-xl bg-brand-500/10 text-brand-600 dark:bg-brand-500/15 dark:text-brand-200">
                  <Icon className="h-5 w-5" />
                </span>
                <h3 className="mt-4 text-base font-semibold text-slate-900 dark:text-white">
                  {p.title}
                </h3>
                <p className="mt-2 text-sm leading-relaxed text-slate-600 dark:text-slate-400">
                  {p.body}
                </p>
              </div>
            );
          })}
        </div>
      </div>
    </Section>
  );
}
