/* ============================================
   AUTH PAGE — Nawafid
   auth.css — Login & Register styles
   ============================================ */

/* ── Body ── */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

/* ── Layout: split 2 panel ── */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* ============================================
   LEFT PANEL
   ============================================ */
.auth-panel--left {
  background: linear-gradient(145deg, #0d1f3c 0%, #0A1628 60%, #08111f 100%);
  padding: var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Decorative corner pattern */
.auth-panel--left::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 300px; height: 300px;
  border: 1px solid rgba(29, 78, 216, 0.08);
  border-radius: 50%;
}
.auth-panel--left::after {
  content: '';
  position: absolute;
  bottom: -60px; right: -60px;
  width: 200px; height: 200px;
  border: 1px solid rgba(29, 78, 216, 0.06);
  border-radius: 50%;
}

.auth-panel__inner {
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

/* Brand on left */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--brand-primary);
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
}
.auth-brand__name {
  letter-spacing: 1px;
}

/* ── Quote ── */
.auth-quote {
  border-left: 3px solid var(--brand-primary);
  padding-left: var(--space-lg);
}
.auth-quote__ar {
  font-family: var(--font-arabic);
  font-size: 1.4rem;
  direction: rtl;
  line-height: 2;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.auth-quote__id {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-xs);
}
.auth-quote__source {
  font-size: 0.8rem;
  color: var(--brand-primary);
  font-weight: 500;
}

/* ── Feature list ── */
.auth-features {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}
.auth-feature__icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: rgba(29, 78, 216, 0.12);
  border: 1px solid rgba(29, 78, 216, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.auth-feature__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.auth-feature__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Big decorative Arabic text ── */
.auth-panel__deco {
  font-family: var(--font-arabic);
  font-size: 8rem;
  color: rgba(37, 99, 235, 0.04);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

/* ============================================
   RIGHT PANEL
   ============================================ */
.auth-panel--right {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vh, 4rem) var(--space-lg);
  min-height: 100vh;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Mobile logo (hidden on desktop) */
.auth-brand--mobile {
  display: none;
  margin-bottom: var(--space-sm);
}

/* ── Tab switcher ── */
.auth-tabs {
  display: flex;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 4px;
  position: relative;
}
.auth-tab {
  flex: 1;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  transition: color var(--transition-base);
  position: relative;
  z-index: 1;
}
.auth-tab.active {
  color: var(--primary);
}
.auth-tabs__indicator {
  position: absolute;
  top: 4px; left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: #1D4ED8;
  border-radius: var(--radius-full);
  transition: transform var(--transition-base);
  z-index: 0;
}

/* ── Form panels ── */
.auth-form-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-md);
  animation: fadeInUp 0.4s ease both;
}
.auth-form-panel.active {
  display: flex;
}

.auth-form-header__title {
  font-size: 1.4rem;
  font-family: var(--font-heading);
  margin-bottom: var(--space-xs);
}
.auth-form-header__sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.auth-form-header__sub span {
  font-family: var(--font-arabic);
  direction: rtl;
  display: inline;
}

/* ── Form overrides for auth ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* Input wrapper with icon */
.form-input-wrap {
  position: relative;
}
.form-input-wrap .form-input {
  padding-right: 2.5rem;
}
.form-input-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  pointer-events: none;
}
.form-input-icon svg, .form-toggle-pass svg { width: 16px; height: 16px; }

.form-input-wrap.focused .form-input {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* Password toggle button */
.form-toggle-pass {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color var(--transition-fast);
}
.form-toggle-pass:hover { color: var(--brand-primary); }

/* Select */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  cursor: pointer;
}
.form-select option {
  background: var(--primary-mid);
  color: var(--text-primary);
}

/* Label with icon */
.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-label__icon { width: 14px; height: 14px; opacity: 0.6; }

/* Error message */
.form-error {
  display: none;
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
}

/* Input error state */
.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1);
}

/* Full-width button */
.btn--full {
  width: 100%;
  justify-content: center;
  margin-top: var(--space-sm);
}

/* Auth meta row */
.auth-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.checkbox-label input { display: none; }
.checkbox-custom {
  width: 18px; height: 18px;
  border: 1.5px solid var(--glass-border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.checkbox-label input:checked + .checkbox-custom {
  background: #1D4ED8;
  border-color: #1D4ED8;
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓';
  font-size: 12px;
  color: white;
  font-weight: 700;
}

/* Auth link */
.auth-link {
  font-size: 0.85rem;
  color: var(--brand-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
.auth-link:hover { opacity: 0.75; }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* Role buttons */
.auth-role-btns {
  display: flex;
  gap: var(--space-md);
}
.auth-role-btn {
  flex: 1;
  justify-content: center;
  font-size: 0.85rem;
}

/* Password strength */
.password-strength {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: 6px;
}
.password-strength__bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.password-strength__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background 0.4s ease;
  width: 0%;
}
.password-strength__fill.weak   { background: #EF4444; }
.password-strength__fill.fair   { background: #F97316; }
.password-strength__fill.good   { background: #FBBF24; }
.password-strength__fill.strong { background: #10B981; }
.password-strength__label {
  font-size: 0.75rem;
  min-width: 70px;
  text-align: right;
  color: var(--text-muted);
}

/* Switch text */
.auth-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Back link */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  justify-content: center;
  transition: color var(--transition-fast);
}
.auth-back:hover { color: var(--brand-primary); }
.auth-back svg { width: 14px; height: 14px; }

/* Button loader spin */
.spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Success state ── */
.auth-success {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
  animation: fadeInUp 0.5s ease both;
}
.auth-success__icon { font-size: 3rem; }
.auth-success__title {
  font-size: 1.4rem;
  color: var(--success);
}
.auth-success__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── Admin Mode Banner ── */
.admin-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg,
    rgba(29, 78, 216, 0.1),
    rgba(245, 158, 8, 0.05));
  border: 1px solid rgba(29, 78, 216, 0.25);
  border-radius: var(--radius-md);
  animation: fadeInUp 0.3s ease both;
}
.admin-mode-banner__inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-primary);
}
.admin-mode-banner__inner svg {
  width: 16px; height: 16px;
}
.admin-mode-banner__cancel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.admin-mode-banner__cancel:hover {
  color: var(--danger);
  background: rgba(231, 76, 60, 0.08);
}
.admin-mode-banner__cancel svg { width: 12px; height: 12px; }

/* ── Admin mode: highlight the form title ── */
#login-title.admin-title {
  background: linear-gradient(135deg, #1D4ED8, #0E9FD9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-panel--left {
    display: none;
  }
  .auth-brand--mobile {
    display: inline-flex;
  }
  .auth-panel--right {
    padding: var(--space-xl) var(--space-md);
    min-height: 100vh;
    align-items: flex-start;
    padding-top: var(--space-2xl);
  }
  .auth-form-wrapper {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .auth-role-btns {
    flex-direction: column;
  }
}

.auth-brand .brand-logo { max-height: 60px; }
