/* ============================================
   صفحة الدخول والتسجيل — تعتمد على متغيرات style.css
   ============================================ */

.auth-body {
  display: flex;
  flex-direction: column;
}

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Reem Kufi', sans-serif;
  font-size: 1.6rem;
  color: #FFFFFF;
  text-decoration: none;
}

.auth-brand .brand-mark {
  color: var(--gold);
  display: flex;
}

/* ============================================
   البطاقة الرئيسية
   ============================================ */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(2, 30, 25, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid #14b8a0;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 8px 28px 32px;
  overflow: hidden;
  backdrop-filter: blur(16px);
}

/* ============================================
   مفاتيح التبديل (تسجيل الدخول / حساب جديد)
   ============================================ */
.auth-tabs {
  position: relative;
  display: flex;
  margin: 16px 0 28px;
  border-bottom: none;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: 1px solid #4a6b62;
  border-radius: 999px;
  box-shadow: none;
  padding: 14px 8px;
  min-height: 48px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.auth-tab.is-active {
  background: #c9a227;
  border-color: #c9a227;
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.auth-tab-indicator {
  display: none !important;
}

/* ============================================
   الفورمات
   ============================================ */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn 0.25s ease;
}

.auth-form.is-active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.field label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
}

.field input {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  min-height: 48px;
  border: 1px solid #2a5a4a;
  border-radius: 999px;
  background: rgba(1, 15, 12, 0.5);
  color: var(--ink);
  caret-color: #ffffff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: #14b8a0;
  background: rgba(2, 25, 20, 0.7);
  caret-color: #ffffff;
}

.field input:focus-visible {
  outline: 3px solid rgba(77, 168, 255, 0.3);
  outline-offset: 1px;
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.45);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.45);
  opacity: 1;
}

/* Neutralize browser autofill light-blue background and preserve dark style */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active,
.field input:autofill,
.field input:autofill:hover,
.field input:autofill:focus,
.field input:autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #03110c inset !important;
  box-shadow: 0 0 0 1000px #03110c inset !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
  transition: background-color 5000s ease-in-out 0s;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-left: 44px;
}

.toggle-visibility {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 6px;
}

.toggle-visibility:hover {
  background: var(--teal-tint);
  color: #fff;
}

/* ============================================
   اختيار الدور (طالب / شيخ)
   ============================================ */
.role-field {
  border: none;
  padding: 0;
}

.role-field legend {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  padding: 0;
}

.role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border: 1px solid #4a6b62;
  border-radius: 22px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}

.role-card input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.role-icon {
  color: #fff;
  transition: color 0.15s ease;
}

.role-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  transition: color 0.15s ease;
}

.role-card.is-selected,
.role-card:has(input:checked) {
  border-color: #c9a227;
  background: #c9a227;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.role-card.is-selected .role-icon,
.role-card.is-selected .role-name,
.role-card:has(input:checked) .role-icon,
.role-card:has(input:checked) .role-name {
  color: #fff;
}

.role-card input:focus-visible {
  outline: 3px solid rgba(201, 162, 39, 0.4);
  outline-offset: 2px;
}

/* ============================================
   زرار الإرسال والروابط المساعدة
   ============================================ */
.auth-submit {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  color: #fff;
  background: #c9a227;
  border: none;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  padding: 14px;
  min-height: 50px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}

.auth-submit:hover {
  background: #b89220;
}

.auth-submit:active {
  transform: scale(0.98);
}

.form-hint {
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.link-btn {
  background: none;
  border: none;
  color: #c9a227;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ============================================
   تنسيقات نموذج استعادة كلمة المرور
   ============================================ */
.forgot-info-box {
  border: 1px solid #14b8a0;
  border-radius: 22px;
  padding: 12px 16px;
  background: rgba(20, 184, 160, 0.08);
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.6;
  text-align: center;
  margin-bottom: 16px;
}

#forgotForm .auth-submit {
  background: #fff;
  color: #a07d12;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  border: none;
}

#forgotForm .auth-submit:hover {
  background: #fdfaf0;
}

#forgotForm .link-btn {
  color: #c9a227;
}

/* ============================================
   حالة الخطأ (هتتفعل لاحقًا مع الـ Backend)
   ============================================ */
.field.has-error input,
.field.has-error input:focus {
  border-color: #E53935 !important;
}

.field-error {
  color: #ff7d7d;
  font-size: 0.82rem;
  line-height: 1.4;
  margin-top: 6px;
}

/* ============================================
   الشاشات الصغيرة
   ============================================ */
@media (max-width: 480px) {
  .auth-card {
    padding: 8px 20px 28px;
  }
}
