/* ============================================
   SMZ Group - صفحات المصادقة (تسجيل / دخول)
   ============================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--color-bg);
}

/* --- الجانب الأيسر: النموذج --- */
.auth-form-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
}

.auth-form-container {
  width: 100%;
  max-width: 480px;
}

/* --- الشعار --- */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 40px;
  text-decoration: none;
}

.auth-logo__icon {
  width: 42px;
  height: 42px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
}

/* --- العنوان --- */
.auth-header {
  margin-bottom: 32px;
}

.auth-header__title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 8px;
}

.auth-header__desc {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* --- اختيار نوع الحساب --- */
.auth-role-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-role-option {
  flex: 1;
  position: relative;
}

.auth-role-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-role-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--color-surface);
  text-align: center;
}

.auth-role-card:hover {
  border-color: var(--color-primary-light);
  background: rgba(12,74,110,0.02);
}

.auth-role-option input:checked + .auth-role-card {
  border-color: var(--color-primary);
  background: rgba(12,74,110,0.04);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.auth-role-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(12,74,110,0.07);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-role-option input:checked + .auth-role-card .auth-role-card__icon {
  background: var(--color-primary);
  color: #fff;
}

.auth-role-card__label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

.auth-role-card__desc {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* --- حقول النموذج --- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.form-label .required {
  color: #ef4444;
  margin-right: 2px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: all var(--transition);
  direction: rtl;
  outline: none;
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(12,74,110,0.08);
}

.form-input--error {
  border-color: #ef4444;
}

.form-input--error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.form-input--success {
  border-color: var(--color-success);
}

/* --- حقل كلمة المرور مع زر الإظهار --- */
.form-input-wrapper {
  position: relative;
}

.form-input-wrapper .form-input {
  padding-left: 48px;
}

.form-toggle-password {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.form-toggle-password:hover {
  color: var(--color-primary);
}

/* --- مقياس قوة كلمة المرور --- */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.password-strength__bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--color-border);
  transition: background var(--transition);
}

.password-strength__bar--active-1 { background: #ef4444; }
.password-strength__bar--active-2 { background: #f97316; }
.password-strength__bar--active-3 { background: #eab308; }
.password-strength__bar--active-4 { background: var(--color-success); }

.password-strength__text {
  font-size: 0.75rem;
  margin-top: 4px;
  font-weight: 500;
}

.password-strength__text--1 { color: #ef4444; }
.password-strength__text--2 { color: #f97316; }
.password-strength__text--3 { color: #eab308; }
.password-strength__text--4 { color: var(--color-success); }

/* --- رسالة الخطأ تحت الحقل --- */
.form-error {
  font-size: 0.78rem;
  color: #ef4444;
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.form-error--visible {
  display: flex;
}

/* --- شروط كلمة المرور --- */
.password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 4px;
}

.password-rule {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color var(--transition);
}

.password-rule svg {
  flex-shrink: 0;
}

.password-rule--pass {
  color: var(--color-success);
}

/* --- Checkbox (الموافقة على الشروط) --- */
.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.form-checkbox__text {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.form-checkbox__text a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-checkbox__text a:hover {
  color: var(--color-primary-light);
}

/* --- زر الإرسال --- */
.auth-submit-btn {
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-submit-btn:hover {
  background: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit-btn:disabled:hover {
  background: var(--color-primary);
  box-shadow: none;
}

/* --- spinner التحميل --- */
.auth-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
  display: none;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* --- رسالة النجاح / الخطأ العامة --- */
.auth-alert {
  display: none;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.auth-alert--visible {
  display: flex;
}

.auth-alert--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.auth-alert--success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.auth-alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* --- قسم وثائق المالك --- */
.owner-documents-section {
  margin-top: 24px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.form-section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.form-section-divider::before,
.form-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.form-section-divider span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0c4a6e;
  white-space: nowrap;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.form-alert--info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.form-alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.owner-documents-section .form-group {
  margin-bottom: 16px;
}

.owner-documents-section .form-group:last-child {
  margin-bottom: 0;
}

.form-hint {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 6px;
}

/* --- حقول رفع الملفات --- */
.file-upload-wrapper {
  position: relative;
}

.file-upload-input {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.file-upload-label:hover,
.file-upload-wrapper:focus-within .file-upload-label {
  border-color: var(--color-primary);
  background: #f0f9ff;
}

.file-upload-label svg {
  color: #94a3b8;
  transition: color 0.2s;
}

.file-upload-wrapper:hover .file-upload-label svg,
.file-upload-wrapper:focus-within .file-upload-label svg {
  color: var(--color-primary);
}

.file-upload-text {
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
}

.file-upload-hint {
  font-size: 0.78rem;
  color: #94a3b8;
}

.file-preview {
  margin-top: 12px;
  display: none;
}

.file-preview.has-file {
  display: block;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
}

.file-preview-item svg {
  color: #22c55e;
  flex-shrink: 0;
}

.file-preview-name {
  flex: 1;
  font-size: 0.85rem;
  color: #166534;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-size {
  font-size: 0.75rem;
  color: #15803d;
}

.file-preview-remove {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #dc2626;
  border-radius: 4px;
  transition: background 0.2s;
}

.file-preview-remove:hover {
  background: #fee2e2;
}

/* --- رابط تسجيل الدخول --- */
.auth-footer-text {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-top: 24px;
}

.auth-footer-text a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-footer-text a:hover {
  text-decoration: underline;
}

/* --- الجانب الأيمن: الصورة والمحتوى الترويجي --- */
.auth-promo-side {
  flex: 1;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}

.auth-promo-side::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -20%;
  width: 500px;
  height: 500px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}

.auth-promo-side::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 350px;
  height: 350px;
  background: rgba(217,119,6,0.08);
  border-radius: 50%;
}

.auth-promo-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 420px;
}

.auth-promo-content__icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  backdrop-filter: blur(4px);
}

.auth-promo-content__title {
  font-size: 1.65rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
  line-height: 1.35;
}

.auth-promo-content__desc {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.7;
  margin-bottom: 36px;
}

/* --- إحصائيات الجانب الترويجي --- */
.auth-promo-stats {
  display: flex;
  gap: 32px;
  justify-content: center;
}

.auth-promo-stat {
  text-align: center;
}

.auth-promo-stat__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.auth-promo-stat__label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

/* --- الفاصل بين الإحصائيات --- */
.auth-promo-stats .divider {
  width: 1px;
  background: rgba(255,255,255,0.15);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .auth-promo-side {
    padding: 48px 32px;
  }
  
  .auth-promo-content__title {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  .auth-page {
    flex-direction: column-reverse;
  }

  .auth-promo-side {
    padding: 40px 24px;
    min-height: auto;
  }

  .auth-promo-stats {
    gap: 20px;
  }

  .auth-promo-stat__value {
    font-size: 1.2rem;
  }

  .auth-form-side {
    padding: 32px 20px;
  }

  .auth-header__title {
    font-size: 1.45rem;
  }

  .form-row {
    flex-direction: column;
    gap: 20px;
  }

  .auth-role-selector {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .auth-form-side {
    padding: 24px 16px;
  }

  .auth-logo {
    margin-bottom: 28px;
  }

  .auth-header__title {
    font-size: 1.3rem;
  }

  .auth-promo-content__title {
    font-size: 1.2rem;
  }

  .auth-promo-content__desc {
    font-size: 0.85rem;
  }
}

/* ============================================
   صفحة تسجيل الدخول - إضافات
   ============================================ */

/* --- حقل بأيقونة --- */
.form-input-icon-wrapper {
  position: relative;
}

.form-input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}

.form-input--with-icon {
  padding-right: 44px;
}

.form-input-icon-wrapper .form-toggle-password--with-icon {
  left: 14px;
}

/* --- صف Label + رابط نسيت كلمة المرور --- */
.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.form-forgot-link {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.form-forgot-link:hover {
  color: var(--color-primary-light);
  text-decoration: underline;
}

/* --- صف تذكرني --- */
.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- فاصل "أو" --- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-divider__line {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-divider__text {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

/* --- أزرار تسجيل دخول اجتماعية --- */
.auth-social-btns {
  display: flex;
  gap: 12px;
}

.auth-social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
}

.auth-social-btn:hover:not(:disabled) {
  border-color: var(--color-primary-light);
  background: rgba(12, 74, 110, 0.02);
  box-shadow: var(--shadow-sm);
}

.auth-social-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-social-btn svg {
  flex-shrink: 0;
}

/* --- قائمة المميزات في الجانب الترويجي --- */
.auth-promo-features {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 36px;
  text-align: right;
}

.auth-promo-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.auth-promo-feature__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.auth-promo-feature__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.auth-promo-feature__desc {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

@media (max-width: 768px) {
  .auth-social-btns {
    flex-direction: column;
  }

  .auth-promo-features {
    display: none;
  }
}

@media (max-width: 480px) {
  .auth-social-btns {
    flex-direction: column;
  }
}
