import { checkCurrentLicense } from '@/lib/license/validator';

export default async function LicenseInvalidPage() {
  const result = await checkCurrentLicense().catch(() => ({ valid: false, error: 'Failed to read license' }));

  return (
    <div className="w-full max-w-lg text-center">
      <div className="bg-slate-800 rounded-2xl shadow-2xl border border-red-800/50 p-10">
        <div className="inline-flex items-center justify-center w-20 h-20 rounded-full bg-red-900/40 border border-red-700 mb-6">
          <svg className="w-10 h-10 text-red-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
          </svg>
        </div>

        <h1 className="text-2xl font-bold text-white mb-2">ترخيص غير صالح</h1>
        <p className="text-slate-400 text-sm mb-6">
          {result.error ?? 'الترخيص المرتبط بهذا التطبيق غير صالح أو منتهي الصلاحية.'}
        </p>

        <div className="bg-slate-900/60 rounded-xl p-4 text-sm text-slate-400 space-y-2 mb-8 text-right" dir="rtl">
          <p className="flex gap-2"><span className="text-red-400">●</span> قد يكون الترخيص منتهي الصلاحية</p>
          <p className="flex gap-2"><span className="text-red-400">●</span> قد يكون الترخيص مرتبطًا بجهاز آخر</p>
          <p className="flex gap-2"><span className="text-red-400">●</span> قد يكون ملف الترخيص تالفًا أو محذوفًا</p>
          <p className="flex gap-2"><span className="text-red-400">●</span> قد يكون الترخيص غير صالح أصلاً</p>
        </div>

        <div className="bg-blue-900/20 border border-blue-700/40 rounded-xl p-4 text-sm text-blue-300">
          <p className="font-medium mb-1">للحصول على مساعدة:</p>
          <p className="text-blue-300/80">تواصل مع مورد النظام وأحضر معك رقم الجهاز وبيانات الترخيص الحالية.</p>
        </div>
      </div>
    </div>
  );
}
