import { investorCounterOffer } from "@/mocks/dshnInvestor";

function fmt(n: number) {
  return n.toLocaleString("en-US");
}

/**
 * Business header + the incoming counter-offer summary card.
 * Shared by the counter-offer screen and its confirmation popups.
 */
export default function CounterSummary() {
  const c = investorCounterOffer;

  return (
    <>
      <div className="rounded-[18px] bg-background-100 border border-background-200 p-4 flex items-center gap-3">
        <div className="w-12 h-12 rounded-full overflow-hidden bg-background-200 shrink-0">
          <img src={c.businessLogo} alt={c.businessName} className="w-full h-full object-cover object-top" />
        </div>
        <div className="flex-1 min-w-0">
          <h3 className="text-[14px] font-semibold text-foreground-950 truncate">{c.businessName}</h3>
          <p className="text-[11px] text-foreground-600 mt-0.5">{c.date}</p>
        </div>
      </div>

      <div className="rounded-[20px] bg-secondary-50 border border-secondary-300 p-4">
        <div className="flex items-center gap-2">
          <i className="ri-exchange-line text-[18px] text-secondary-800 leading-none" />
          <h3 className="text-[14px] font-bold text-foreground-950">عرض مقابل من {c.businessName}</h3>
        </div>
        <div className="grid grid-cols-2 gap-2.5 mt-3.5">
          <div className="rounded-[14px] bg-background-50/70 p-3">
            <p className="text-[10.5px] text-foreground-600">القيمة المطلوبة</p>
            <p className="text-[15px] font-bold text-foreground-950 mt-1">{fmt(c.counterAmount)} ر.س</p>
          </div>
          <div className="rounded-[14px] bg-background-50/70 p-3">
            <p className="text-[10.5px] text-foreground-600">النسبة المعروضة</p>
            <p className="text-[15px] font-bold text-secondary-900 mt-1">{c.counterEquity}%</p>
          </div>
        </div>
        <p className="text-[12px] text-foreground-700 mt-3 leading-relaxed">
          عرضك السابق: {fmt(c.originalAmount)} ر.س مقابل {c.originalEquity}%. هل توافق على العرض المقابل؟
        </p>
      </div>
    </>
  );
}