/* ============================================================
   login.css - تنسيقات واجهة تسجيل الدخول الإدارية
   باللون الرسمي للشهادة الإلكترونية السعودية
   متجاوب مع شاشات الديسكتوب والموبايل والتابلت
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ====================== الخلفية الرئيسية ====================== */
.login-page-body {
  font-family: 'IBM Plex Sans Arabic', 'Tahoma', 'Arial', sans-serif;
  background: linear-gradient(135deg, #e9f6ec 0%, #d5eadd 50%, #f1f9f3 100%);
  color: #222;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  direction: rtl;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====================== الزخارف الخلفية (دوائر خضراء) ====================== */
.login-bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.decor-circle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 131, 82, 0.08), rgba(23, 131, 82, 0) 70%);
}
.decor-circle-1 { width: 520px; height: 520px; top: -160px; right: -160px; }
.decor-circle-2 { width: 620px; height: 620px; bottom: -220px; left: -200px; }
.decor-circle-3 { width: 240px; height: 240px; top: 38%; left: 8%;  background: radial-gradient(circle, rgba(15, 122, 73, 0.07), transparent 70%); }
.decor-circle-4 { width: 360px; height: 360px; top: 10%; right: 18%; background: radial-gradient(circle, rgba(44, 153, 98, 0.05), transparent 70%); }

/* ====================== الإطار الرئيسي (ال wrapper) ====================== */
.login-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 560px;
  padding: 28px 20px 18px 20px;
  margin: auto;
}

/* ====================== بطاقة تسجيل الدخول (الكارت الأبيض) ====================== */
.login-card {
  background-color: #ffffff;
  border-radius: 22px;
  box-shadow:
    0 20px 60px rgba(15, 122, 73, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(23, 131, 82, 0.12);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-card:hover {
  box-shadow:
    0 26px 72px rgba(15, 122, 73, 0.22),
    0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ====================== شريط الهيدر الأخضر الأعلى ====================== */
.login-header-strip {
  background: linear-gradient(135deg, #0f7a49 0%, #138d56 60%, #17a663 100%);
  color: #ffffff;
  padding: 28px 28px 30px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-header-strip::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 6px;
  background: linear-gradient(90deg, #2cb474, #1b8c54, #6fd4a0, #2cb474);
  background-size: 200% 100%;
  animation: stripShine 6s linear infinite;
}
@keyframes stripShine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === اللوجوهات في الهيدر === */
.login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-bottom: 18px;
}
.login-logos img {
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}
.login-logo-momrah   { height: 54px; width: auto; background: #fff; padding: 6px 8px; border-radius: 10px; }
.login-logo-tanzeem  { height: 54px; width: auto; background: #fff; padding: 6px 8px; border-radius: 10px; }
.login-logo-org      { height: 62px; width: auto; background: #fff; padding: 6px 10px; border-radius: 10px; }

.login-title {
  font-size: 23px;
  font-weight: 700;
  margin: 0 0 6px 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.login-subtitle {
  font-size: 14.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
  line-height: 1.5;
}

/* ====================== محتوى النموذج ====================== */
.login-form-container {
  padding: 34px 40px 28px 40px;
  background: #ffffff;
}

.form-field {
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 15px;
  font-weight: 600;
  color: #0f7a49;
  padding-right: 2px;
}

/* ===== حقول الإدخال ===== */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrapper.has-toggle {
  padding-left: 108px; /* مساحة لزر إظهار كلمة المرور */
}

.form-input {
  width: 100%;
  padding: 15px 18px 15px 14px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  direction: rtl;
  color: #1b1b1b;
  background: #f7fcf9;
  border: 2px solid #d6e8dc;
  border-radius: 12px;
  outline: none;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    transform 0.15s ease;
}
.input-wrapper.has-toggle .form-input {
  padding-left: 106px; /* دفع النص عن زر إخفاء كلمة المرور */
}

.form-input::placeholder {
  color: #8eb29c;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.form-input:hover {
  border-color: #9dcbae;
  background: #f1faf4;
}

.form-input:focus {
  border-color: #178352;
  background: #ffffff;
  box-shadow:
    0 0 0 4px rgba(23, 131, 82, 0.16),
    0 3px 10px rgba(23, 131, 82, 0.08);
  transform: translateY(-1px);
}

/* ===== زر إظهار / إخفاء كلمة المرور ===== */
.toggle-password-btn {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1.5px solid #d4e6db;
  background: #ffffff;
  color: #0f7a49;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s ease;
  z-index: 3;
  white-space: nowrap;
}
.toggle-password-btn:hover {
  background: #0f7a49;
  color: #fff;
  border-color: #0f7a49;
}
.toggle-password-btn:active {
  transform: translateY(-50%) scale(0.96);
}

/* ====================== رسائل النجاح والخطأ ====================== */
.login-message {
  min-height: 36px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  margin: 4px 0 16px 0;
  border: 1.5px solid transparent;
  text-align: center;
  transition: all 0.22s ease;
  opacity: 0;
  visibility: hidden;
}
.login-message.show {
  opacity: 1;
  visibility: visible;
}
.login-message.error {
  opacity: 1;
  visibility: visible;
  background: #fff1f1;
  color: #c0392b;
  border-color: #f4c7c2;
}
.login-message.success {
  opacity: 1;
  visibility: visible;
  background: #eefbf3;
  color: #0f7a49;
  border-color: #b9e2c8;
}

/* ====================== زر تسجيل الدخول الرئيسي ====================== */
.login-submit-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(135deg, #0f7a49 0%, #178352 45%, #1ea365 100%);
  background-size: 200% 100%;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(23, 131, 82, 0.30),
    0 2px 6px rgba(23, 131, 82, 0.15);
  transition: all 0.26s ease;
  letter-spacing: 0.1px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.login-submit-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.login-submit-btn:hover {
  background-position: 100% 0;
  transform: translateY(-2px);
  box-shadow:
    0 14px 32px rgba(23, 131, 82, 0.35),
    0 3px 8px rgba(23, 131, 82, 0.18);
}
.login-submit-btn:hover::before { transform: translateX(100%); }
.login-submit-btn:active {
  transform: translateY(0) scale(0.99);
  box-shadow:
    0 6px 14px rgba(23, 131, 82, 0.28),
    0 2px 4px rgba(23, 131, 82, 0.18);
}
.login-submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
  filter: saturate(0.85);
  transform: none;
}

/* ====================== ملاحظة أسفل النموذج ====================== */
.login-footer-note {
  padding: 16px 18px;
  background: linear-gradient(135deg, #f3faf5 0%, #eaf6ef 100%);
  border: 1.5px dashed #b8d9c4;
  border-radius: 12px;
}
.login-footer-note p {
  font-size: 13.5px;
  color: #2b5a3e;
  line-height: 1.7;
  margin: 0;
  font-weight: 500;
}
.login-footer-note p + p {
  margin-top: 6px;
}
.login-footer-note code {
  display: inline-block;
  direction: ltr;
  background: #ffffff;
  border: 1px solid #c6e1cf;
  color: #0f7a49;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12.5px;
  font-weight: 700;
  margin: 0 2px;
}
.footer-note-default {
  padding-top: 6px;
  border-top: 1px dashed #c6e1cf;
  margin-top: 10px !important;
}

/* ====================== حقوق النشر أسفل الصفحة ====================== */
.login-footer {
  text-align: center;
  margin-top: 18px;
  padding: 0 6px;
}
.login-footer p {
  font-size: 12.5px;
  color: #4a6e59;
  font-weight: 500;
  line-height: 1.7;
}
.login-footer a {
  color: #0f7a49;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.login-footer a:hover {
  color: #178352;
  text-shadow: 0 0 6px rgba(23, 131, 82, 0.18);
  text-decoration: underline;
}

/* ============================================================
   ===== Media Queries (متجاوب مع أحجام مختلفة) =====
   ============================================================ */

/* --- آيفون 15 برو ماكس وأصغر من 768px --- */
@media (max-width: 767px) {
  .login-wrapper { max-width: 100%; padding: 22px 16px 14px 16px; }
  .login-card    { border-radius: 18px; }

  .login-header-strip { padding: 22px 18px 24px 18px; }
  .login-logos        { gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
  .login-logo-momrah  { height: 44px; }
  .login-logo-tanzeem { height: 44px; }
  .login-logo-org     { height: 52px; }

  .login-title    { font-size: 19.5px; }
  .login-subtitle { font-size: 13.5px; }

  .login-form-container { padding: 26px 22px 22px 22px; }

  .form-label  { font-size: 14.5px; }
  .form-input  { font-size: 15.5px; padding: 14px 16px; }

  .input-wrapper.has-toggle { padding-left: 0; }
  .input-wrapper.has-toggle .form-input { padding-left: 100px; }
  .toggle-password-btn { font-size: 12px; padding: 5.5px 9px; left: 6px; }

  .login-submit-btn { font-size: 16px; padding: 14px 20px; margin-bottom: 18px; }
  .login-footer-note { padding: 14px 14px; }
  .login-footer-note p { font-size: 13px; }
  .login-footer p { font-size: 12px; }
}

/* --- آيفون SE وأصغر من 480px --- */
@media (max-width: 480px) {
  .login-wrapper { padding: 18px 12px 12px 12px; }
  .login-card    { border-radius: 16px; }

  .login-header-strip { padding: 20px 14px 22px 14px; }
  .login-logos        { gap: 10px; margin-bottom: 12px; }
  .login-logo-momrah  { height: 40px; padding: 5px 7px; }
  .login-logo-tanzeem { height: 40px; padding: 5px 7px; }
  .login-logo-org     { height: 48px; padding: 5px 8px; }

  .login-title    { font-size: 17.5px; }
  .login-subtitle { font-size: 12.5px; }

  .login-form-container { padding: 22px 16px 20px 16px; }

  .form-field  { margin-bottom: 18px; gap: 6px; }
  .form-label  { font-size: 14px; }
  .form-input  { font-size: 15px; padding: 13px 14px; border-radius: 10px; }

  .input-wrapper.has-toggle .form-input { padding-left: 96px; }
  .toggle-password-btn { font-size: 11.5px; padding: 5px 8px; left: 5px; }

  .login-message { padding: 9px 12px; font-size: 13px; }

  .login-submit-btn { font-size: 15.5px; padding: 13.5px 18px; border-radius: 10px; }
  .login-footer-note { padding: 12px 12px; border-radius: 10px; }
  .login-footer-note p { font-size: 12.5px; line-height: 1.6; }
  .login-footer-note code { font-size: 12px; }
  .login-footer { margin-top: 14px; }
  .login-footer p { font-size: 11.5px; }
}

/* --- شاشات صغيرة جداً (أقل من 360px) --- */
@media (max-width: 359px) {
  .login-logos { flex-direction: column; }
  .login-logo-momrah, .login-logo-tanzeem, .login-logo-org { height: 46px !important; }
  .input-wrapper.has-toggle .form-input { padding-left: 12px; padding-top: 38px; }
  .toggle-password-btn {
    top: 6px;
    left: 6px;
    right: auto;
    transform: none;
  }
}
