/* صفحة تسجيل المسوق الذاتي — /m/{token} */

.lp-main:has(.mk-reg-wrap),
.lp-main:has(.mk-reg-success-wrap) {
  padding: 14px max(14px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left));
}

.mk-reg-wrap,
.mk-reg-success-wrap {
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  min-width: 0;
  overflow-x: clip;
}

.mk-reg-topbar {
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.mk-reg-topbar__inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.mk-reg-topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  min-width: 0;
  flex: 1;
}

.mk-reg-topbar__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--lp-gold, #c5b358), #a89440);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.mk-reg-topbar__name {
  min-width: 0;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mk-reg-topbar__login {
  flex-shrink: 0;
  padding: 8px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  text-decoration: none !important;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mk-reg-topbar__login:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mk-reg-hero {
  margin-bottom: 14px;
  padding: 0 2px;
  text-align: center;
}

.mk-reg-hero .lp-hero-badge {
  margin-bottom: 8px;
}

.mk-reg-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  font-weight: 800;
  color: var(--lp-primary-dark, #004555);
  line-height: 1.35;
}

.mk-reg-hero__sub {
  margin: 0 auto;
  max-width: 440px;
  font-size: clamp(0.82rem, 2.8vw, 0.88rem);
  line-height: 1.55;
  color: var(--lp-muted, #5c6f7d);
}

.mk-reg-card {
  border-radius: 14px;
  overflow: hidden;
}

.mk-reg-card .lp-card-body {
  padding: 16px 14px 18px;
}

@media (min-width: 480px) {
  .mk-reg-card .lp-card-body {
    padding: 22px 24px 24px;
  }
}

.mk-reg-form {
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.mk-reg-form .lp-section-title {
  margin: 16px 0 10px;
  font-size: 0.86rem;
}

.mk-reg-form .lp-section-title:first-of-type {
  margin-top: 0;
}

.mk-reg-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.mk-reg-grid .mk-reg-span-2 {
  grid-column: 1 / -1;
}

@media (min-width: 480px) {
  .mk-reg-grid--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.mk-reg-form .lp-field label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: #3d5160;
  font-weight: 600;
}

.mk-reg-form .lp-field input,
.mk-reg-form .lp-field select,
.mk-reg-form .lp-field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 48px;
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.mk-reg-form .lp-field select {
  cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c6f7d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-inline-start: 14px;
  padding-inline-end: 36px;
}

[dir="ltr"] .mk-reg-form .lp-field select {
  background-position: right 14px center;
  padding-inline-start: 14px;
  padding-inline-end: 36px;
}

.mk-reg-form .lp-field textarea {
  min-height: 80px;
  resize: vertical;
}

.mk-reg-consent {
  margin: 14px 0 0;
  padding: 10px 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--lp-muted, #5c6f7d);
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e8eef2;
}

.mk-reg-form .lp-actions {
  margin-top: 16px;
  text-align: center;
}

.mk-reg-form .lp-btn {
  width: 100%;
  max-width: 100%;
  min-height: 50px;
  font-size: 1rem;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}

.mk-reg-alert {
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.mk-reg-form-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.mk-reg-form-status--info {
  background: #e8f4f8;
  color: #0a5b6f;
  border: 1px solid #b8dce6;
}

.mk-reg-form-status--err {
  background: #fff0f0;
  color: #b42318;
  border: 1px solid #ffd0d7;
}

.mk-reg-countdown {
  font-variant-numeric: tabular-nums;
}

/* صفحة النجاح / الحالات */
.mk-reg-success-card .lp-card-body,
.mk-reg-state-card .lp-card-body {
  padding: 24px 16px !important;
}

.mk-reg-success-icon {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 12px;
}

.mk-reg-success-title {
  margin: 0 0 12px;
  font-size: clamp(1.05rem, 4vw, 1.2rem);
  font-weight: 800;
  color: var(--lp-success, #0d6b4a);
  line-height: 1.35;
}

.mk-reg-success-msg {
  margin: 0 0 20px;
  color: var(--lp-muted, #5c6f7d);
  font-size: 0.9rem;
  line-height: 1.6;
}

.mk-reg-success-hint {
  margin: 14px 0 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--lp-muted, #5c6f7d);
}

.mk-reg-state-card .lp-btn {
  width: 100%;
  max-width: 280px;
  min-height: 48px;
}

.mk-reg-success-card .lp-success-actions {
  max-width: 100%;
  width: 100%;
}

.mk-reg-success-card .lp-success-actions .lp-btn {
  width: 100%;
  min-height: 48px;
}

/* ——— موبايل ——— */
@media (max-width: 599px) {
  .lp-main:has(.mk-reg-wrap),
  .lp-main:has(.mk-reg-success-wrap) {
    padding: 10px max(10px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left));
  }

  .mk-reg-wrap,
  .mk-reg-success-wrap {
    max-width: 100%;
  }

  .mk-reg-card {
    border-radius: 12px;
    border-left: none;
    border-right: none;
    box-shadow: 0 4px 20px rgba(0, 45, 55, 0.08);
  }

  .mk-reg-card .lp-card-body {
    padding: 14px 12px 16px;
  }

  .mk-reg-hero {
    margin-bottom: 12px;
    text-align: start;
  }

  .mk-reg-hero .lp-hero-badge {
    font-size: 0.68rem;
    padding: 4px 10px;
  }

  .mk-reg-hero h1 {
    text-align: start;
    font-size: 1.15rem;
  }

  .mk-reg-hero__sub {
    text-align: start;
    margin-inline: 0;
    max-width: none;
  }

  .mk-reg-grid--2 {
    grid-template-columns: 1fr;
  }

  .mk-reg-form .lp-section-title {
    font-size: 0.84rem;
  }

  /* منع تكبير iOS عند التركيز على الحقول */
  .mk-reg-form .lp-field input,
  .mk-reg-form .lp-field select,
  .mk-reg-form .lp-field textarea {
    font-size: 16px;
  }

  /* زر الإرسال ثابت أسفل الشاشة */
  .mk-reg-form {
    padding-bottom: 4px;
  }

  .mk-reg-form .lp-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-top: 14px;
    margin-inline: 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(238, 243, 246, 0) 0%, rgba(238, 243, 246, 0.92) 28%, #eef3f6 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }

  .mk-reg-form .lp-btn {
    min-height: 52px;
    font-size: 1.02rem;
    box-shadow: 0 6px 20px rgba(0, 91, 111, 0.35);
  }

  .mk-reg-topbar__inner {
    gap: 8px;
  }

  .mk-reg-topbar__name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 360px) {
  .mk-reg-topbar__login {
    padding: 8px 10px;
    font-size: 0.72rem;
  }

  .mk-reg-topbar__mark {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
}

/* مودال تحقق البريد — تسجيل المسوق */
body.pr-modal-open .mk-reg-form .lp-actions {
  z-index: 10;
}

.mk-reg-verify-modal.pr-modal {
  z-index: 10001;
}

.mk-reg-verify-modal .pr-modal__panel {
  font-family: var(--lp-font, 'Vazirmatn', Tahoma, Arial, sans-serif);
}

.mk-reg-verify-modal .pr-modal__title {
  color: var(--lp-primary-dark, #004555);
}

.mk-reg-verify-modal .pr-modal__email {
  color: var(--lp-primary, #005b6f);
}

.mk-reg-verify-modal .pr-otp__cell.is-active {
  border-color: var(--lp-primary, #005b6f);
  box-shadow: 0 0 0 3px rgba(0, 91, 111, 0.15);
}

.mk-reg-verify-modal .pr-btn--ghost {
  color: var(--lp-primary, #005b6f);
  border-color: rgba(0, 91, 111, 0.28);
  border-radius: 12px;
}

.mk-reg-verify-modal .pr-countdown {
  color: var(--lp-primary, #005b6f);
}

@media (min-width: 600px) {
  .mk-reg-verify-modal.pr-modal {
    align-items: center;
    padding: 24px;
  }

  .mk-reg-verify-modal .pr-modal__panel {
    border-radius: 16px;
    max-height: none;
  }

  .mk-reg-verify-modal .pr-modal__title,
  .mk-reg-verify-modal .pr-modal__text {
    text-align: center;
  }
}

/* Terms checkbox + modal */
.mk-reg-terms {
  margin: 16px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.mk-reg-terms__label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.5;
  cursor: pointer;
}

.mk-reg-terms__label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #005b6f;
}

.mk-reg-terms__link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 800;
  color: #005b6f;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.mk-reg-terms-modal .pr-modal__panel {
  max-width: 520px;
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
}

.mk-reg-terms-modal__body {
  flex: 1;
  overflow: auto;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #334155;
  text-align: start;
}

.mk-reg-terms-modal__empty {
  margin: 0;
  color: #64748b;
}

.mk-reg-terms-modal__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.mk-reg-terms-modal__foot .lp-btn {
  min-height: 42px;
  padding: 0 16px;
}

.mk-reg-terms-modal__foot .lp-btn--ghost {
  background: #fff;
  color: #005b6f;
  border: 1px solid #cbd5e1;
}
