/* صفحة التسجيل الذاتي — /register */

:root {
  --pr-font: "Readex Pro", system-ui, sans-serif;
  --pr-teal: #005b6f;
  --pr-teal-light: #0a7a94;
  --pr-gold: #c5b358;
  --pr-ink: #0f172a;
  --pr-muted: #64748b;
  --pr-border: #e2e8f0;
  --pr-bg: #f8fafc;
}

html:has(.pr-page),
html:has(.login-shell) {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body:has(.pr-page),
body:has(.login-shell) {
  margin: 0;
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: #fff;
  font-family: var(--pr-font);
}

.pr-page,
.pr-page * {
  font-family: var(--pr-font);
  box-sizing: border-box;
}

.pr-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Top bar: أزرار يسار — لغة وسط — logo يمين (مواقع ثابتة) ── */
.pr-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--pr-border);
  background: #fff;
}

.pr-topbar__nav,
.pr-topbar__lang-wrap,
.pr-topbar__brand {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.pr-topbar__nav {
  left: clamp(16px, 4vw, 40px);
  right: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(50% - 80px);
}

.pr-topbar__lang-wrap {
  left: 50%;
  transform: translate(-50%, -50%);
}

.pr-topbar__brand {
  right: clamp(16px, 4vw, 40px);
  left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: calc(50% - 80px);
}

.pr-topbar__logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: min(220px, 42vw);
  object-fit: contain;
}

.pr-topbar__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--pr-ink);
}

.pr-topbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--pr-border);
  background: #fff;
  color: var(--pr-teal);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.pr-topbar__btn:hover {
  background: var(--pr-bg);
  border-color: rgba(0, 91, 111, 0.25);
}

.pr-topbar__btn--primary {
  background: linear-gradient(135deg, var(--pr-teal), var(--pr-teal-light));
  border-color: transparent;
  color: #fff;
}

.pr-topbar__btn--primary:hover {
  background: linear-gradient(135deg, #004a5a, var(--pr-teal));
  color: #fff;
}

.pr-topbar__lang {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--pr-border);
  background: var(--pr-bg);
  color: var(--pr-ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

/* ── Main content ── */
.pr-main {
  flex: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 24px clamp(16px, 4vw, 48px) 88px;
}

.pr-main__inner {
  width: 100%;
  max-width: 920px;
  min-width: 0;
  margin: 0 auto;
}

.pr-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

.pr-badge--trainee {
  background: linear-gradient(135deg, rgba(0, 91, 111, 0.12), rgba(10, 122, 148, 0.08));
  color: var(--pr-teal);
  border: 1px solid rgba(0, 91, 111, 0.2);
}

.pr-badge--trainer {
  background: linear-gradient(135deg, rgba(197, 179, 88, 0.18), rgba(168, 148, 64, 0.1));
  color: #7c6b1e;
  border: 1px solid rgba(197, 179, 88, 0.35);
}

.pr-badge__icon {
  font-size: 15px;
  line-height: 1;
}

.pr-title {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 800;
  color: var(--pr-ink);
  line-height: 1.35;
  margin: 0 0 8px;
}

.pr-sub {
  font-size: 14px;
  color: var(--pr-muted);
  line-height: 1.65;
  margin: 0 0 22px;
  max-width: 720px;
}

.pr-alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.pr-alert--err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.pr-card {
  background: var(--pr-bg);
  border: 1px solid var(--pr-border);
  border-radius: 16px;
  padding: 20px 22px 22px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.pr-section {
  font-size: 12px;
  font-weight: 700;
  color: var(--pr-teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 16px;
}

.pr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  min-width: 0;
  max-width: 100%;
}

.pr-field--full {
  grid-column: 1 / -1;
}

.pr-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.pr-req {
  color: #dc2626;
}

.pr-input--file {
  padding: 8px 10px;
  font-size: 13px;
}

.pr-input,
.pr-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pr-textarea {
  min-height: 72px;
  resize: vertical;
}

.pr-input:focus,
.pr-textarea:focus {
  outline: none;
  border-color: var(--pr-teal-light);
  box-shadow: 0 0 0 3px rgba(0, 91, 111, 0.12);
}

.pr-hint {
  font-size: 11px;
  color: var(--pr-muted);
  margin-top: 4px;
}

.pr-actions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  padding: 12px 16px;
  border: none;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.pr-btn--primary {
  background: linear-gradient(135deg, var(--pr-teal), var(--pr-teal-light));
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 91, 111, 0.25);
}

.pr-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 91, 111, 0.3);
}

.pr-btn--ghost {
  background: #fff;
  color: var(--pr-teal);
  border: 1px solid rgba(0, 91, 111, 0.25);
}

.pr-btn--ghost:hover {
  background: rgba(0, 91, 111, 0.04);
}

.pr-switch {
  text-align: center;
  font-size: 13px;
  color: var(--pr-muted);
  margin-top: 18px;
  line-height: 1.55;
}

.pr-switch a {
  color: var(--pr-teal);
  font-weight: 700;
  text-decoration: none;
}

.pr-switch a:hover {
  text-decoration: underline;
}

.pr-login-link {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
}

.pr-login-link a {
  color: var(--pr-muted);
  text-decoration: none;
  font-weight: 600;
}

.pr-login-link a:hover {
  color: var(--pr-teal);
}

.pr-support {
  position: fixed;
  bottom: 16px;
  inset-inline-start: 16px;
  z-index: 20;
  max-width: min(280px, calc(100% - 32px));
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--pr-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-size: 11px;
  color: var(--pr-muted);
  line-height: 1.55;
  backdrop-filter: blur(6px);
}

.pr-support strong {
  display: block;
  font-size: 11px;
  color: var(--pr-ink);
  margin-bottom: 4px;
}

.pr-support a {
  color: var(--pr-teal);
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}

.pr-support a:hover {
  text-decoration: underline;
}

.pr-success-wrap {
  text-align: center;
  max-width: 520px;
}

.pr-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.pr-success-wrap .pr-actions {
  align-items: center;
}

.pr-hp {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  .pr-topbar {
    position: sticky;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: auto;
    padding:
      12px
      max(14px, env(safe-area-inset-right))
      14px
      max(14px, env(safe-area-inset-left));
  }

  .pr-topbar__nav,
  .pr-topbar__lang-wrap,
  .pr-topbar__brand {
    position: static;
    transform: none;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    max-width: 100%;
    width: 100%;
  }

  .pr-topbar__brand {
    display: flex;
    justify-content: center;
    order: 1;
  }

  .pr-topbar__lang-wrap {
    display: flex;
    justify-content: center;
    order: 2;
  }

  .pr-topbar__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    order: 3;
  }

  .pr-topbar__btn {
    white-space: normal;
    text-align: center;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 11px;
    padding: 8px 10px;
    line-height: 1.35;
  }

  .pr-topbar__logo {
    height: 44px;
    max-width: min(200px, 72vw);
  }

  .pr-grid {
    grid-template-columns: 1fr;
  }

  .pr-card {
    padding: 16px 14px 18px;
  }

  .pr-main {
    padding:
      20px
      max(14px, env(safe-area-inset-right))
      32px
      max(14px, env(safe-area-inset-left));
  }

  .pr-support {
    position: static;
    margin: 20px 0 0;
    max-width: 100%;
    width: 100%;
  }

  .pr-input,
  .pr-textarea {
    font-size: 16px;
  }
}

@media (max-width: 400px) {
  .pr-topbar__btn {
    flex: 1 1 100%;
  }
}

/* ── موديول رمز التحقق ── */
.pr-form-status {
  margin-top: 12px;
  font-size: 0.92rem;
}

.pr-form-status--err {
  color: #b91c1c;
}

.pr-form-status--info {
  color: var(--pr-muted);
}

body.pr-modal-open,
html.pr-modal-open {
  overflow: hidden;
}

.pr-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pr-modal[hidden] {
  display: none !important;
}

.pr-modal.pr-modal--open {
  display: flex !important;
  visibility: visible;
}

.pr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.pr-modal__panel {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  text-align: center;
}

.pr-modal__title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: var(--pr-ink);
}

.pr-modal__text {
  margin: 0 0 8px;
  color: var(--pr-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.pr-modal__email {
  margin: 0 0 12px;
  font-weight: 700;
  color: var(--pr-teal);
  word-break: break-all;
}

.pr-modal__hint {
  margin: 0 0 18px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--pr-muted);
}

.pr-otp-wrap {
  position: relative;
  direction: ltr;
  unicode-bidi: isolate;
  margin: 0 auto 16px;
  max-width: 280px;
}

.pr-otp__boxes {
  display: flex;
  flex-direction: row;
  direction: ltr;
  justify-content: center;
  gap: 10px;
}

.pr-otp__cell {
  flex: 0 0 56px;
  width: 56px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--pr-border);
  border-radius: 12px;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--pr-font);
  color: var(--pr-ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  pointer-events: none;
}

.pr-otp__cell.is-active {
  border-color: var(--pr-teal);
  box-shadow: 0 0 0 3px rgba(0, 91, 111, 0.15);
}

.pr-otp__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  letter-spacing: 0.55em;
  text-indent: 0.65em;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  outline: none;
  cursor: text;
}

.pr-otp-wrap.pr-otp--shake .pr-otp__cell {
  animation: prOtpShake 0.45s ease;
}

.pr-otp {
  display: flex;
  flex-direction: row;
  direction: ltr;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.pr-otp__digit {
  width: 56px;
  height: 58px;
  border: 2px solid var(--pr-border);
  border-radius: 12px;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--pr-font);
  color: var(--pr-ink);
  transition: border-color 0.15s ease;
}

.pr-otp__digit:focus {
  outline: none;
  border-color: var(--pr-teal);
  box-shadow: 0 0 0 3px rgba(0, 91, 111, 0.15);
}

.pr-otp--shake {
  animation: prOtpShake 0.45s ease;
}

@keyframes prOtpShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.pr-modal__status {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.9rem;
}

.pr-modal__status--err {
  color: #b91c1c;
}

.pr-modal__status--info {
  color: var(--pr-muted);
}

.pr-modal__status--ok {
  color: #047857;
}

.pr-modal__close {
  position: absolute;
  top: 10px;
  inset-inline-start: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--pr-muted);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.pr-modal__close:hover {
  background: var(--pr-bg);
  color: var(--pr-ink);
}

.pr-modal__resend-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.pr-btn--resend-code {
  min-width: 180px;
}

.pr-countdown {
  display: inline-block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pr-teal);
  direction: ltr;
  unicode-bidi: isolate;
}

.pr-form-status .pr-countdown {
  margin-inline-start: 4px;
}

/* ——— مودال رمز البريد — موبايل وأجهزة صغيرة ——— */
@media (max-width: 599px) {
  body.pr-modal-open {
    overflow: hidden;
    touch-action: none;
  }

  .pr-modal {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .pr-modal__panel {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding:
      22px 18px
      calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    max-height: min(92dvh, 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.2);
  }

  .pr-modal__title {
    font-size: 1.15rem;
    padding-inline-end: 36px;
    text-align: start;
  }

  .pr-modal__text {
    font-size: 0.88rem;
    text-align: start;
    line-height: 1.55;
  }

  .pr-modal__email {
    font-size: 0.92rem;
    margin-bottom: 16px;
    text-align: center;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .pr-otp-wrap {
    max-width: 100%;
    width: 100%;
    margin-bottom: 14px;
    padding: 0 4px;
  }

  .pr-otp__boxes {
    gap: clamp(6px, 2.5vw, 10px);
    justify-content: center;
  }

  .pr-otp__cell {
    flex: 1 1 0;
    width: auto;
    min-width: 44px;
    max-width: 60px;
    height: clamp(48px, 12vw, 56px);
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    border-radius: 10px;
  }

  .pr-otp__input {
    font-size: 16px;
    letter-spacing: 0.45em;
  }

  .pr-modal__status {
    font-size: 0.84rem;
    text-align: center;
    line-height: 1.45;
  }

  .pr-modal__resend-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
  }

  .pr-btn--resend-code {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .pr-countdown {
    text-align: center;
    font-size: 0.88rem;
  }
}

@media (max-width: 360px) {
  .pr-modal__panel {
    padding-inline: 14px;
  }

  .pr-otp__cell {
    min-width: 40px;
    max-width: 52px;
  }
}
