/* ==========================================================================
   صفحة تسجيل المستفيدين - مؤسسة سيماهم
   ملف تنسيقات مخصص ومعزول بالكامل
   ========================================================================== */

:root {
  --reg-teal: #224d4d;
  --reg-gold: #d4ac71;
  --reg-gold-hover: #c49a5b;
  --reg-deep: #172828;
  --reg-surface: #ffffff;
  --reg-bg-soft: #f7f9f9;
  --reg-border: rgba(23, 40, 40, 0.15);
  --reg-border-focus: #224d4d;
  --reg-muted: #6b7a7a;
  --reg-danger: #c93b2b;
  --reg-radius: 14px;
  --reg-radius-sm: 8px;
  --reg-shadow: 0 10px 30px rgba(23, 40, 40, 0.06);
}

.registration-page {
  padding: 40px 16px 80px;
  min-height: 480px;
  background-color: var(--reg-bg-soft);
}

.reg-container {
  max-width: 680px;
  margin: 0 auto;
}

/* شريط التبديل التجريبي المحلي */
.reg-preview-bar {
  background: #ffffff;
  border: 1px dashed var(--reg-gold);
  border-radius: var(--reg-radius);
  padding: 12px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--reg-shadow);
}

.reg-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--reg-teal);
  display: flex;
  align-items: center;
  gap: 6px;
}

.reg-preview-switcher {
  display: inline-flex;
  background: var(--reg-bg-soft);
  padding: 4px;
  border-radius: 50px;
  border: 1px solid var(--reg-border);
  gap: 4px;
}

.reg-preview-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 50px;
  cursor: pointer;
  color: var(--reg-muted);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reg-preview-btn:hover {
  color: var(--reg-deep);
}

.reg-preview-btn.active {
  background: var(--reg-teal);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(34, 77, 77, 0.25);
  font-weight: 500;
}

/* بطاقة المحتوى الرئيسية */
.reg-card {
  background: var(--reg-surface);
  border: 1px solid var(--reg-border);
  border-radius: var(--reg-radius);
  padding: 36px 32px;
  box-shadow: var(--reg-shadow);
}

.reg-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(23, 40, 40, 0.08);
}

.reg-title {
  font-family: var(--display, "DIN Next LT Arabic", sans-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--reg-deep);
  margin: 0 0 8px 0;
}

.reg-subtitle {
  color: var(--reg-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}

/* شبكة الحقول */
.reg-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.reg-col-full {
  grid-column: 1 / -1;
}

/* مجموعة الحقل الإدخالي */
.reg-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.reg-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--reg-deep);
  display: flex;
  align-items: center;
  gap: 4px;
}

.reg-label .required-mark {
  color: var(--reg-danger);
  font-size: 14px;
}

.reg-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.reg-input-icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--reg-muted);
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
}

textarea.reg-input {
  min-height: 110px;
  resize: vertical;
}

.reg-input-wrap:has(textarea) .reg-input-icon {
  top: 22px;
  transform: none;
}

.reg-input,
.reg-select {
  width: 100%;
  padding-block: 12px;
  padding-inline-start: 42px;
  padding-inline-end: 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--reg-deep);
  background-color: #ffffff;
  border: 1px solid var(--reg-border);
  border-radius: var(--reg-radius-sm);
  transition: all 0.2s ease;
  outline: none;
}

.reg-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-inline-end: 36px;
  cursor: pointer;
}

[dir="ltr"] .reg-select {
  background-position: right 14px center;
  padding-right: 38px;
  padding-left: 14px;
}

.reg-input:focus,
.reg-select:focus {
  border-color: var(--reg-border-focus);
  box-shadow: 0 0 0 3px rgba(34, 77, 77, 0.12);
}

.reg-input::placeholder {
  color: #a2afaf;
  font-size: 13px;
}

.reg-mobile-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--reg-deep);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  direction: ltr;
  pointer-events: none;
}

.reg-mobile-wrap .reg-input {
  direction: ltr;
  text-align: left;
  padding-left: 68px;
  padding-right: 42px;
}

.reg-field-error {
  display: block;
  margin-top: 6px;
  color: var(--reg-danger);
  font-size: 12px;
  line-height: 1.5;
}

.reg-field-error:empty {
  display: none;
}

.reg-tracking-number {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--reg-teal);
  margin: 0 0 16px;
}

button.reg-state-action {
  border: 0;
  cursor: pointer;
}

/* زر إظهار/إخفاء كلمة المرور */
.reg-input-wrap:has(.reg-toggle-pwd) .reg-input {
  padding-inline-end: 42px;
}

.reg-toggle-pwd {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--reg-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  font-size: 16px;
  line-height: 1;
  transition: color 0.2s ease;
  z-index: 2;
}

.reg-toggle-pwd:hover {
  color: var(--reg-deep);
}

.reg-field-hint {
  font-size: 11.5px;
  color: var(--reg-muted);
  margin-top: 2px;
}

/* فاصل الأقسام */
.reg-section-divider {
  grid-column: 1 / -1;
  margin: 10px 0 4px;
  padding-top: 16px;
  border-top: 1px dashed rgba(23, 40, 40, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reg-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--reg-teal);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reg-section-tag {
  font-size: 11px;
  background: rgba(34, 77, 77, 0.08);
  color: var(--reg-teal);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* شروط وسياسة الخصوصية */
.reg-terms-row {
  grid-column: 1 / -1;
  margin-top: 10px;
}

.reg-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--reg-deep);
  user-select: none;
}

.reg-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--reg-teal);
  cursor: pointer;
}

.reg-link-modal {
  color: var(--reg-teal);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.reg-link-modal:hover {
  color: var(--reg-gold);
}

/* زر الإرسال */
.reg-submit-wrap {
  grid-column: 1 / -1;
  margin-top: 12px;
}

.reg-submit-btn {
  width: 100%;
  background: var(--reg-gold);
  color: var(--reg-deep);
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(212, 172, 113, 0.35);
  transition: all 0.25s ease;
}

.reg-submit-btn:hover {
  background: var(--reg-gold-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(212, 172, 113, 0.45);
}

.reg-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* رسائل الحالات (لم يبدأ / مغلق) */
.reg-state-box {
  text-align: center;
  padding: 48px 24px;
}

.reg-state-icon-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.reg-state-not-started .reg-state-icon-wrap {
  background: rgba(212, 172, 113, 0.16);
  color: #9e7529;
}

.reg-state-closed .reg-state-icon-wrap {
  background: rgba(201, 59, 43, 0.1);
  color: var(--reg-danger);
}

.reg-state-title {
  font-family: var(--display, "DIN Next LT Arabic", sans-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--reg-deep);
  margin: 0 0 10px 0;
}

.reg-state-desc {
  color: var(--reg-muted);
  font-size: 14.5px;
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 24px;
}

.reg-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--reg-teal);
  background: rgba(34, 77, 77, 0.08);
  transition: all 0.2s ease;
}

.reg-state-action:hover {
  background: rgba(34, 77, 77, 0.16);
  color: var(--reg-deep);
}

/* نافذة سياسة الخصوصية (Modal) */
.reg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 40, 40, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.reg-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.reg-modal-dialog {
  background: #ffffff;
  border-radius: var(--reg-radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.reg-modal-backdrop.is-open .reg-modal-dialog {
  transform: translateY(0);
}

.reg-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(23, 40, 40, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reg-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--reg-deep);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.reg-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--reg-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.reg-modal-close:hover {
  color: var(--reg-danger);
}

.reg-modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: #3b4d4d;
}

.reg-modal-body h4 {
  color: var(--reg-teal);
  font-size: 15px;
  margin: 16px 0 8px;
}

.reg-modal-body h4:first-child {
  margin-top: 0;
}

.reg-modal-body p {
  margin: 0 0 12px;
}

.reg-modal-body ul {
  padding-inline-start: 20px;
  margin: 0 0 14px;
}

.reg-modal-body li {
  margin-bottom: 6px;
}

.reg-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(23, 40, 40, 0.08);
  display: flex;
  justify-content: flex-end;
  background: #fafbfb;
}

.reg-modal-accept-btn {
  background: var(--reg-teal);
  color: #ffffff;
  border: none;
  padding: 10px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s ease;
}

.reg-modal-accept-btn:hover {
  background: #193838;
}

/* إشعار محلي للمعاينة */
.reg-toast {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--reg-deep);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reg-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   التوافق مع الجوال (Mobile Responsiveness)
   ========================================================================== */
@media (max-width: 640px) {
  .registration-page {
    padding: 20px 12px 60px;
  }

  .reg-card {
    padding: 24px 18px;
    border-radius: 12px;
  }

  .reg-title {
    font-size: 21px;
  }

  .reg-form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .reg-preview-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .reg-preview-switcher {
    justify-content: center;
  }

  .reg-preview-btn {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 12px;
  }

  .reg-card.is-success {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .reg-card.is-success .reg-header {
    display: none;
  }

  .reg-modal-dialog {
    max-height: 90vh;
  }

  .reg-pass-qr {
    width: 80px;
    height: 80px;
  }

  .reg-pass-body {
    padding: 20px 16px 0;
  }

  .reg-pass-number {
    letter-spacing: 0.03em;
  }
}

.reg-card.is-success {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.reg-card.is-success .reg-header {
  display: none;
}

.reg-pass-wrap {
  width: min(100%, 374px);
  margin: 0 auto;
}

.reg-pass {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background: #ffffff;
  border: 1px solid rgba(212, 172, 113, 0.35);
  box-shadow: 0 18px 40px rgba(23, 40, 40, 0.12);
}

.reg-pass-body {
  position: relative;
  z-index: 1;
  padding: 22px 16px 0;
  text-align: center;
}

.reg-pass-logo {
  display: block;
  width: min(168px, 64%);
  height: auto;
  margin: 0 auto 12px;
}

.reg-pass-check {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #224d4d;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 8px rgba(34, 77, 77, 0.12);
}

.reg-pass-title {
  margin: 0 0 8px;
  color: #224d4d;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
}

.reg-pass-desc {
  margin: 0 auto;
  max-width: 28em;
  color: #172828;
  font-size: 13px;
  line-height: 1.7;
}

.reg-pass-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #d4ac71;
  border-radius: 22px;
  background: #ffffff;
  text-align: initial;
}

.reg-pass-meta {
  flex: 1;
  min-width: 0;
}

.reg-pass-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #172828;
  font-size: 14px;
  font-weight: 700;
}

.reg-pass-copy {
  border: 0;
  background: transparent;
  color: #d4ac71;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
}

.reg-pass-copy.is-copied {
  color: #224d4d;
}

.reg-pass-number {
  margin: 8px 0 0;
  padding: 10px 8px;
  border-radius: 999px;
  background: #224d4d;
  color: #f4eee5;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: center;
}

.reg-pass-qr-frame {
  position: relative;
  flex: 0 0 100px;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reg-pass-qr-frame span {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #d4ac71;
}

.reg-pass-qr-frame span:nth-child(1) {
  top: 0;
  inset-inline-start: 0;
  border-inline-end: 0;
  border-bottom: 0;
}

.reg-pass-qr-frame span:nth-child(2) {
  top: 0;
  inset-inline-end: 0;
  border-inline-start: 0;
  border-bottom: 0;
}

.reg-pass-qr-frame span:nth-child(3) {
  bottom: 0;
  inset-inline-start: 0;
  border-inline-end: 0;
  border-top: 0;
}

.reg-pass-qr-frame span:nth-child(4) {
  bottom: 0;
  inset-inline-end: 0;
  border-inline-start: 0;
  border-top: 0;
}

.reg-pass-qr {
  width: 80px;
  height: 80px;
  border-radius: 4px;
}

.reg-pass-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: #172828;
  font-weight: 700;
  font-size: 12px;
}

.reg-pass-date-label,
.reg-pass-date-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #224d4d;
  font-weight: 700;
}

.reg-pass-date time {
  color: #172828;
}

.reg-pass-wave {
  display: block;
  width: 100%;
  height: 80px;
  margin-top: 10px;
}

.reg-pass-download {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: #224d4d;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.reg-pass-download:disabled,
.reg-pass-download[data-busy="1"] {
  opacity: 0.7;
  cursor: wait;
}

@media (max-width: 380px) {
  .reg-pass {
    border-radius: 22px;
  }

  .reg-pass-qr-frame {
    flex-basis: 88px;
    width: 88px;
    height: 88px;
  }

  .reg-pass-qr {
    width: 70px;
    height: 70px;
  }

  .reg-pass-body {
    padding: 18px 14px 0;
  }

  .reg-pass-number {
    letter-spacing: 0.02em;
    padding: 8px 6px;
  }
}
