/* =========================================================
   كبسولة شرعية — Authentication CSS (Redesigned)
   ========================================================= */

/* ─── Section wrapper ─────────────────────────────────── */
.auth-section {
  position: relative;
  /* mobile-first: padding مرن يحسب ارتفاع الناڤبار */
  padding: calc(var(--header-h, 64px) + 24px) 0 48px;
  min-height: 100svh;
  display: flex;
  align-items: center;
  background: var(--bg-courses-tint);
  overflow: hidden;
  transition: background-color 0.35s var(--ease);
}
@media (min-width: 768px) {
  .auth-section {
    padding-top: calc(var(--header-h, 70px) + 32px);
  }
}
@media (min-width: 992px) {
  .auth-section {
    padding-top: calc(var(--header-h, 84px) + 40px);
    padding-bottom: 60px;
  }
}

/* ─── Decorative blobs ────────────────────────────────── */
.auth-decor-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 1;
}

.auth-blob-1 {
  width: 380px;
  height: 380px;
  top: -60px;
  right: -120px;
  background: radial-gradient(circle, rgba(91, 53, 213, 0.16), transparent 70%);
  animation: blobDrift 12s ease-in-out infinite alternate;
}

.auth-blob-2 {
  width: 320px;
  height: 320px;
  bottom: -40px;
  left: -80px;
  background: radial-gradient(
    circle,
    rgba(255, 111, 94, 0.14),
    transparent 70%
  );
  animation: blobDrift 16s ease-in-out infinite alternate-reverse;
}

.auth-blob-3 {
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(91, 53, 213, 0.07), transparent 70%);
  animation: blobDrift 20s ease-in-out infinite;
}

@keyframes blobDrift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(30px, 20px) scale(1.06);
  }
}

/* ─── Row container fix ───────────────────────────────── */
.auth-section .container {
  position: relative;
  z-index: 2;
}

.auth-section .row {
  border-radius: var(--radius-lg, 20px);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

/* ========================================================
   Side Panel (Left decorative column)
   ======================================================== */
.auth-side-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 48px 40px;
  background: linear-gradient(
    145deg,
    var(--brand-primary, #5b35d5) 0%,
    rgba(91, 53, 213, 0.75) 100%
  );
  color: #fff;
  position: relative;
  overflow: hidden;
}

/* Subtle geometric overlay */
.auth-side-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(
      circle at 20% 80%,
      rgba(255, 255, 255, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 10%,
      rgba(255, 255, 255, 0.06) 0%,
      transparent 40%
    );
  pointer-events: none;
}

.auth-side-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.auth-side-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.auth-side-logo span {
  font-family: "Cairo", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.auth-side-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.auth-side-content h3 {
  font-family: "Cairo", sans-serif;
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 14px;
  color: #fff;
}

.auth-side-content p {
  font-size: 0.97rem;
  opacity: 0.85;
  line-height: 1.75;
  color: #fff;
}

/* Feature list */
.auth-side-features {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-side-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.93rem;
  opacity: 0.9;
  color: #fff;
}

.auth-feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

/* Stats row */
.auth-side-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm, 12px);
  padding: 16px 20px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(6px);
}

.auth-stat-item {
  flex: 1;
  text-align: center;
}

.auth-stat-item strong {
  display: block;
  font-family: "Cairo", sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.2;
}

.auth-stat-item span {
  font-size: 0.75rem;
  opacity: 0.8;
  color: #fff;
}

.auth-stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0 4px;
}

/* ========================================================
   Auth Card (Right form column)
   ======================================================== */
.auth-card {
  background: var(--card-bg);
  /* mobile-first: padding أصغر في الموبايل */
  padding: 28px 18px 24px;
  height: 100%;
  transition: background-color 0.35s var(--ease);
}
@media (min-width: 576px) {
  .auth-card {
    padding: 36px 28px 32px;
  }
}
@media (min-width: 992px) {
  .auth-card {
    padding: 48px 44px 40px;
  }
}

/* ─── Auth Header ─────────────────────────────────────── */
.auth-header {
  margin-bottom: 28px;
}

.auth-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(91, 53, 213, 0.1);
  color: var(--brand-primary);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 12px;
  border: 1px solid rgba(91, 53, 213, 0.2);
}

.auth-header h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: var(--text-dark);
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.3;
}

.auth-header p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ─── Multi-step indicator ────────────────────────────── */
.auth-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.auth-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  cursor: default;
  position: relative;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-soft, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Cairo", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--card-bg);
  transition: all 0.3s ease;
}

.auth-step span {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.3s ease;
}

/* Active step */
.auth-step.active .step-circle {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(91, 53, 213, 0.18);
}

.auth-step.active span {
  color: var(--brand-primary);
  font-weight: 700;
}

/* Completed step */
.auth-step.done .step-circle {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.auth-step.done .step-circle::before {
  content: "✓";
}

.auth-step.done span {
  color: #22c55e;
}

/* Connector lines */
.auth-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-soft, #e0e0e0);
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.auth-step-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s ease;
}

.auth-step-line.done::after {
  transform: scaleX(1);
}

/* ─── Step panel label ────────────────────────────────── */
.step-panel-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-soft, #e5e7eb);
}

/* ─── Form step panels ────────────────────────────────── */
.form-step-panel {
  animation: panelFadeIn 0.35s ease;
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Required star ───────────────────────────────────── */
.required-star {
  color: var(--brand-coral, #ff6f5e);
  margin-right: 3px;
  font-size: 0.85rem;
}

/* ─── Form Labels ─────────────────────────────────────── */
.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 7px;
  display: block;
}

/* ─── Input wrapper ───────────────────────────────────── */
.form-floating-custom {
  position: relative;
  display: flex;
  align-items: center;
}

/* Main icon (right side for RTL) */
.form-floating-custom > i.bi:first-child {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--brand-primary);
  font-size: 1.05rem;
  z-index: 4;
  pointer-events: none;
  transition: color 0.25s ease;
}

.form-floating-custom .form-control,
.form-floating-custom .form-select {
  padding-right: 44px;
  padding-left: 16px;
  height: 52px;
  font-size: 0.93rem;
  background: var(--input-bg);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm, 10px);
  color: var(--text-dark);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
  width: 100%;
}

/* With password toggle — add right padding for toggle button */
.form-floating-custom.has-toggle .form-control {
  padding-left: 46px;
}

.form-floating-custom .form-control:focus,
.form-floating-custom .form-select:focus {
  background: var(--input-bg-focus);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(91, 53, 213, 0.1);
  outline: none;
}

.form-floating-custom:focus-within > i.bi:first-child {
  color: var(--brand-orange, #f97316);
}

/* Invalid state */
.form-floating-custom .form-control.is-invalid,
.form-floating-custom .form-select.is-invalid {
  border-color: var(--brand-coral, #ff6f5e);
  background-image: none; /* إزالة أيقونة Bootstrap الافتراضية */
}

.form-floating-custom .form-control.is-invalid:focus,
.form-floating-custom .form-select.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(255, 111, 94, 0.12);
}

/* Dark mode selects */
[data-theme="dark"] .form-floating-custom .form-select option {
  background: var(--card-bg);
  color: var(--text-dark);
}

/* ─── Password Toggle button ──────────────────────────── */
.password-toggle {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-muted);
  z-index: 5;
  font-size: 1rem;
  transition: color 0.25s var(--ease);
  background: none;
  border: none;
  padding: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover,
.password-toggle:focus {
  color: var(--brand-primary);
  outline: none;
}

/* ─── Phone field with prefix ─────────────────────────── */
.form-floating-custom.phone-field .form-control {
  padding-right: 44px;
  padding-left: 52px; /* space for prefix */
}

.phone-prefix {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  border-left: 1.5px solid var(--border-soft);
  z-index: 4;
  pointer-events: none;
  user-select: none;
}

/* ─── Password strength ───────────────────────────────── */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
}

.strength-bars {
  display: flex;
  gap: 4px;
  flex: 1;
}

.strength-bars .bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--border-soft, #e5e7eb);
  transition: background-color 0.3s ease;
}

/* Levels: weak / fair / good / strong */
.strength-bars[data-strength="1"] .bar:nth-child(1) {
  background: #ef4444;
}
.strength-bars[data-strength="2"] .bar:nth-child(-n + 2) {
  background: #f97316;
}
.strength-bars[data-strength="3"] .bar:nth-child(-n + 3) {
  background: #eab308;
}
.strength-bars[data-strength="4"] .bar {
  background: #22c55e;
}

.strength-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: left;
}

/* ─── Error messages ──────────────────────────────────── */
.invalid-feedback {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--brand-coral, #ff6f5e);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.invalid-feedback::before {
  content: "\F33A"; /* bi-exclamation-circle-fill */
  font-family: "bootstrap-icons";
  font-size: 0.85em;
}

/* ─── Alert box ───────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm, 10px);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 18px;
  margin-bottom: 20px;
  border: none;
}

/* ─── Review card (step 3) ────────────────────────────── */
.review-card {
  background: var(--bg-courses-tint);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm, 12px);
  overflow: hidden;
}

.review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-soft);
  transition: background-color 0.2s;
}

.review-row:last-child {
  border-bottom: none;
}
.review-row:hover {
  background: rgba(91, 53, 213, 0.04);
}

.review-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

.review-label i {
  color: var(--brand-primary);
}

.review-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: left;
  word-break: break-all;
}

/* ─── Agree checkbox ──────────────────────────────────── */
.auth-agree-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.auth-agree-check .form-check-input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  border: 2px solid var(--border-soft);
  cursor: pointer;
}

.auth-agree-check .form-check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.auth-agree-check .form-check-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* ─── Footer link ─────────────────────────────────────── */
.auth-footer-link {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-soft);
}

.auth-footer-link p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 991.98px) {
  .auth-section {
    /* يحسب ارتفاع الناڤبار تلقائياً */
    padding-top: calc(var(--header-h, 70px) + 20px);
    padding-bottom: 40px;
  }

  .auth-section .row {
    border-radius: var(--radius-md, 16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  }

  .auth-card {
    padding: 32px 22px 28px;
  }

  .auth-decor-blob {
    display: none;
  }

  .auth-steps {
    gap: 0;
  }

  .auth-step span {
    font-size: 0.65rem;
    display: block; /* نبقّيها بس أصغر */
  }

  /* الناڤبار على الموبايل */
  #navMenu.show,
  #navMenu.collapsing {
    background: var(--card-bg, #fff);
    border-top: 1px solid var(--border-soft);
    margin: 0 -12px;
    padding: 12px 16px 16px;
    border-radius: 0 0 var(--radius-md, 16px) var(--radius-md, 16px);
  }
  #navMenu .navbar-nav {
    width: 100%;
    gap: 2px !important;
    margin-top: 0 !important;
  }
  #navMenu .navbar-nav .nav-link {
    padding: 11px 14px !important;
    border-radius: 8px;
  }
  #navMenu .navbar-nav .nav-link:hover {
    background: rgba(91, 53, 213, 0.06);
    color: var(--brand-primary, #5b35d5);
  }
  #navMenu > div.d-flex {
    width: 100%;
    margin-top: 12px !important;
    margin-bottom: 0 !important;
    gap: 10px !important;
  }
  #navMenu > div.d-flex .btn {
    flex: 1;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 575.98px) {
  .auth-header h2 {
    font-size: 1.4rem;
  }

  .auth-card {
    padding: 24px 16px;
  }

  .auth-section {
    padding-top: calc(var(--header-h, 64px) + 16px);
  }

  /* خطوات التسجيل على الشاشات الصغيرة جداً */
  .step-circle {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }

  .auth-step span {
    display: none; /* عند < 576px نخفي النص تماماً */
  }
}
