/* ============================================
   صفحة الدخول والتسجيل — تعتمد على متغيرات 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: var(--font-display);
  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-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: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 14px 8px;
  min-height: 48px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink-soft);
  cursor: pointer;
  touch-action: manipulation;
  transition: color 0.15s ease;
}

.auth-tab.is-active {
  color: var(--teal-deep);
}

.auth-tab-indicator {
  position: absolute;
  bottom: -1px;
  right: 0;
  width: 50%;
  height: 3px;
  background: var(--gold);
  border-radius: 3px 3px 0 0;
  transition: transform 0.25s ease;
}

/* لما نبدل لتاب التسجيل، نحرك المؤشر لليسار (لأن الصفحة RTL) */
.auth-tabs[data-active="register"] .auth-tab-indicator {
  transform: translateX(-100%);
}

/* ============================================
   الفورمات
   ============================================ */
.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: var(--ink);
}

.field input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 14px;
  min-height: 48px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(1, 15, 12, 0.5);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--teal-deep);
  background: rgba(2, 25, 20, 0.7);
}

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

.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: var(--teal-deep);
}

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

.role-field legend {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  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: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  touch-action: manipulation;
}

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

.role-icon {
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.role-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.role-card.is-selected {
  border-color: var(--teal-deep);
  background: var(--teal-tint);
}

.role-card.is-selected .role-icon,
.role-card.is-selected .role-name {
  color: var(--teal-deep);
}

.role-card input:focus-visible {
  outline: 3px solid var(--teal-tint);
  outline-offset: 2px;
}

/* ============================================
   زرار الإرسال والروابط المساعدة
   ============================================ */
.auth-submit {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.02rem;
  color: white;
  background: var(--teal-deep);
  border: none;
  border-radius: 8px;
  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: var(--teal-darker);
}

.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: var(--gold);
  font-weight: 700;
  font-family: var(--font-body);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 4px;
}

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

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

.field-error {
  color: #B3261E;
  font-size: 0.8rem;
}

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