<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>نسيت كلمة المرور — Artal CRM</title>
  <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Rounded" rel="stylesheet">
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
    .card { background: white; border-radius: 18px; padding: 36px 32px; max-width: 420px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.08); }
    .logo { text-align: center; margin-bottom: 28px; }
    .logo-icon { width: 52px; height: 52px; background: linear-gradient(135deg,#4f6bed,#1a3c6e); border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; }
    .logo-icon .material-symbols-rounded { font-size: 28px; color: white; }
    h1 { color: #0f1a30; font-size: 22px; text-align: center; margin-bottom: 8px; }
    .subtitle { text-align: center; color: #64748b; font-size: 14px; margin-bottom: 24px; }
    .field { margin-bottom: 16px; }
    label { display: block; font-size: 14px; font-weight: 500; color: #334155; margin-bottom: 6px; }
    input { width: 100%; padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 15px; font-family: inherit; background: #fafbfc; }
    input:focus { outline: none; border-color: #4f6bed; background: white; box-shadow: 0 0 0 3px rgba(79,107,237,0.1); }
    .btn { width: 100%; padding: 13px; background: linear-gradient(135deg,#4f6bed,#1a3c6e); color: white; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; }
    .btn:hover { transform: translateY(-1px); }
    .alert { padding: 12px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
    .alert.error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
    .alert.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
    .back-link { text-align: center; margin-top: 18px; font-size: 14px; }
    .back-link a { color: #4f6bed; text-decoration: none; }
  </style>
</head>
<body>
  <div class="card">
    <div class="logo">
      <div class="logo-icon"><span class="material-symbols-rounded">lock_reset</span></div>
      <h1>نسيت كلمة المرور؟</h1>
      <p class="subtitle">أدخل بريدك الإلكتروني وسنرسل لك رابط إعادة تعيين</p>
    </div>

    <% if (error) { %>
      <div class="alert error">
        <span class="material-symbols-rounded">error</span><%= error %>
      </div>
    <% } %>

    <% if (success) { %>
      <div class="alert success">
        <span class="material-symbols-rounded">check_circle</span>
        إذا كان البريد مسجَّلاً، سيصلك رابط إعادة التعيين خلال دقائق. تحقّق من بريدك (بما في ذلك مجلد Spam).
      </div>
      <div class="back-link"><a href="/admin/login">→ العودة لصفحة الدخول</a></div>
    <% } else { %>
      <form method="post" action="/admin/forgot-password">
        <div class="field">
          <label>البريد الإلكتروني</label>
          <input type="email" name="username" required autofocus placeholder="you@company.com">
        </div>
        <button class="btn">إرسال رابط الإعادة</button>
      </form>
      <div class="back-link">
        تذكّرت كلمة المرور؟ <a href="/admin/login">سجّل دخولك</a>
      </div>
    <% } %>
  </div>
</body>
</html>
