import { useApp } from "@/pages/app/AppContext";
import { BackHeader } from "@/pages/app/components/ui";

function StatTile({ label, value }: { label: string; value: string }) {
  return (
    <div className="min-w-0 rounded-[16px] bg-background-100 border border-background-200 p-3">
      <p className="text-[10px] text-foreground-600 leading-snug h-[26px]">{label}</p>
      <p className="text-[15px] font-bold text-foreground-950 mt-1 leading-tight">{value}</p>
    </div>
  );
}

/** Earnings & withdrawal — empty state, no completed orders (section 2.23). */
export default function BizEarningsEmpty() {
  const { goBack } = useApp();

  return (
    <div className="min-h-full pb-6 bg-background-50">
      <BackHeader title="الأرباح والسحب" onBack={goBack} />

      <div className="px-4 py-5 space-y-4">
        <div className="grid grid-cols-3 gap-2">
          <StatTile label="مجموع الأرباح" value="0" />
          <StatTile label="الرصيد المتاح للسحب" value="0" />
          <StatTile label="مجموع الطلبات المكتملة" value="0" />
        </div>

        <button
          type="button"
          disabled
          className="w-full h-[52px] rounded-[14px] bg-foreground-950 text-background-50 text-[15px] font-semibold flex items-center justify-center gap-2 whitespace-nowrap opacity-40 cursor-not-allowed"
        >
          <i className="ri-hand-coin-line text-[19px] leading-none" />
          طلب سحب
        </button>

        <div className="flex gap-1 bg-background-100 border border-background-200 rounded-full p-1">
          <span className="flex-1 h-11 rounded-full text-[12.5px] font-medium flex items-center justify-center whitespace-nowrap bg-primary-500 text-background-50">
            الأرباح
          </span>
          <span className="flex-1 h-11 rounded-full text-[12.5px] font-medium flex items-center justify-center whitespace-nowrap text-foreground-500">
            طلبات السحب
          </span>
        </div>

        <div className="py-16 flex flex-col items-center text-center">
          <div className="w-16 h-16 rounded-full bg-background-100 border border-background-200 flex items-center justify-center mb-4">
            <i className="ri-wallet-3-line text-[28px] text-foreground-400 leading-none" />
          </div>
          <p className="text-[14px] font-medium text-foreground-700">لا توجد أرباح بعد</p>
          <p className="text-[12px] text-foreground-600 mt-1.5 max-w-[240px] leading-relaxed">
            ستظهر أرباحك هنا بعد اكتمال أول طلب.
          </p>
        </div>
      </div>
    </div>
  );
}