﻿/* =======================================================
   Nexora Registration Wizard — Responsive, No-Scroll
   Viewport-height design: fills screen minus header
======================================================= */

/* -- Shell: fills viewport minus measured header -- */
.onboard-shell {
  --ob-accent:   #0d77d8;
  --ob-accent-2: #1dbf8f;
  --ob-border:   #dbe8f7;
  --ob-ink:      #0e253f;
  --ob-muted:    #58708e;
  --ob-shadow:   0 24px 64px rgba(16, 48, 84, 0.13);

  height: calc(100dvh - var(--hdr-h, 68px));
  display: flex;
  align-items: stretch;
  padding: 14px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 0% 0%, #e7f3ff 0, #f7fbff 45%, #fff 100%);
  overflow: hidden;
}

/* -- Card: full height flex column -- */
.onboard-card {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--ob-border);
  border-radius: 20px;
  box-shadow: var(--ob-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* -- Head: compact, never shrinks -- */
.onboard-head {
  padding: 16px 24px 12px;
  background: linear-gradient(130deg, #f3faff 0%, #fff 60%);
  border-bottom: 1px solid var(--ob-border);
  flex-shrink: 0;
}

.onboard-head h1 {
  margin: 0;
  font-size: clamp(17px, 2.4vw, 24px);
  color: var(--ob-ink);
  line-height: 1.2;
}

.onboard-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ob-muted);
}

/* -- Progress Pills -- */
.progress-row {
  margin-top: 10px;
  display: flex;
  gap: 7px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.progress-row::-webkit-scrollbar { display: none; }

.progress-pill {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--ob-border);
  font-size: 11px;
  color: #5f7894;
  background: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
}
.progress-pill.active {
  color: #fff;
  background: linear-gradient(135deg, var(--ob-accent), #1f9be8);
  border-color: transparent;
}
.progress-pill.done {
  color: #0f6248;
  background: #dff8ef;
  border-color: #c6eddd;
}

/* -- Body: flex column, internal scroll -- */
.onboard-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 14px;
  scrollbar-width: thin;
  scrollbar-color: #c5d8f0 transparent;
  display: flex;
  flex-direction: column;
}
.onboard-body::-webkit-scrollbar { width: 5px; }
.onboard-body::-webkit-scrollbar-thumb { background: #c5d8f0; border-radius: 4px; }

/* Each step fills the body height */
.onboard-body > section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Push last action-row to bottom of each step */
.onboard-body > section > .action-row:last-child {
  margin-top: auto;
  padding-top: 12px;
}

/* -- Wizard message -- */
.wizard-message {
  min-height: 16px;
  margin-top: 6px;
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 600;
}
.wizard-message.error   { color: #b2262d; }
.wizard-message.success { color: #197a53; }
.wizard-message.info    { color: #16569b; }

.id-check-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(244, 249, 255, 0.82);
  backdrop-filter: blur(3px);
  z-index: 20;
}

.onboarding-processing-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 25, 49, 0.58);
  backdrop-filter: blur(3px);
  z-index: 2500;
}

.onboarding-processing-overlay.is-visible {
  display: flex;
}

.onboarding-processing-card {
  width: min(460px, 92vw);
  border-radius: 16px;
  border: 1px solid #d8e6f7;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 58px rgba(5, 28, 56, 0.24);
  padding: 24px 22px;
  text-align: center;
}

.onboarding-processing-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 4px solid #d7e6f8;
  border-top-color: #0d77d8;
  border-radius: 50%;
  animation: onboarding-processing-spin 0.85s linear infinite;
}

.onboarding-processing-message {
  margin: 0;
  color: #173b64;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

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

.id-check-loader-dialog {
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid #d6e6f8;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 46px rgba(16, 48, 84, 0.16);
}

.id-check-loader-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d6e6f8;
  border-top-color: #0d77d8;
  border-radius: 50%;
  animation: id-check-loader-spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.id-check-loader-copy {
  display: grid;
  gap: 4px;
}

.id-check-loader-copy strong {
  font-size: 14px;
  color: #113a63;
}

.id-check-loader-copy span {
  font-size: 12px;
  color: #58708e;
}

@keyframes id-check-loader-spin {
  to { transform: rotate(360deg); }
}

/* -- Step Titles -- */
.step-title {
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
  color: var(--ob-ink);
  font-weight: 700;
}
.step-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ob-muted);
}

/* === Step 1 — Country === */
.country-grid {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}
.country-option {
  width: 100%;
  border: 1px solid var(--ob-border);
  background: #fff;
  border-radius: 12px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.country-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(17,64,112,.1);
  border-color: #a8c8ef;
}
.country-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #10365c;
  font-weight: 600;
  font-size: 15px;
}
.country-flag { line-height: 1; }

/* === Step 2 — Eligibility === */
.eligibility-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
/* Keep the last action-row glued to the bottom, but don't stretch the grid */
#step-2-eligibility .eligibility-grid {
  flex-shrink: 0;
}
.eligibility-grid .eligibility-box:last-child {
  grid-column: 1 / -1;
}
.eligibility-box {
  border: 1px solid var(--ob-border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfdff;
}
.eligibility-box h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #1c3d63;
}
.eligibility-box ul {
  margin: 0; padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.eligibility-box li {
  font-size: 13px;
  color: #26496f;
  display: flex;
  align-items: center;
  gap: 6px;
}
.eligibility-box li i {
  color: var(--ob-accent-2);
  font-size: 14px;
  flex-shrink: 0;
}

/* === Step 3 — Form & OTP === */
.form-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  align-content: start;
}
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 11px;
  font-weight: 700;
  color: #54708f;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.field input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cfe0f4;
  border-radius: 10px;
  background: #f7fbff;
  padding: 9px 12px;
  font-size: 13px;
  color: #163758;
  transition: border-color .15s, background .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--ob-accent);
  background: #fff;
}
.phone-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
}
.otp-hint {
  margin-top: 4px;
  font-size: 11px;
  color: #355b84;
  min-height: 14px;
}

/* === Step 4 — ID Scan === */
.id-scan-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.id-scan-panel {
  border: 1px solid var(--ob-border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 10px;
}

.id-scan-panel h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #1c3d63;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.id-scan-area {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 200px;
  overflow: hidden;
}

/* Make the second (ID Back) image area centered and slightly larger */

#idCameraPreview,
#idBackCameraPreview {
  width: 100%;
  max-width: 400px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #1a4c9f;
  background: #000;
}

#idPreviewImg,
#idBackPreviewImg {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #28a745;
  display: block;
}

/* OCR result panel */
.ocr-result-panel {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f0f8ff;
  border: 1px solid #bfd4ee;
  border-radius: 12px;
}
.ocr-result-header {
  font-size: 13px;
  font-weight: 700;
  color: #1a4c9f;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ocr-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #bfd4ee;
  border-top-color: #1a4c9f;
  border-radius: 50%;
  animation: ocr-spin 0.7s linear infinite;
}
@keyframes ocr-spin { to { transform: rotate(360deg); } }
.ocr-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.ocr-result-item {
  background: #fff;
  border: 1px solid #dde8f7;
  border-radius: 8px;
  padding: 8px 10px;
}
.ocr-result-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  margin-bottom: 4px;
}
.ocr-result-value {
  font-size: 13px;
  font-weight: 700;
  color: #1a3a6e;
  word-break: break-all;
}
.ocr-raw-lines {
  margin-top: 10px;
  padding: 8px 10px;
  background: #e8f0fb;
  border-radius: 8px;
  font-size: 11px;
  color: #355b84;
  white-space: pre-wrap;
  max-height: 90px;
  overflow-y: auto;
}

#idPlaceholder,
#idBackPlaceholder {
  padding: 22px 20px;
  border: 2px dashed #b0bec5;
  border-radius: 10px;
  background: #f8faff;
  color: #6c757d;
  text-align: center;
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
}
#idPlaceholder i,
#idBackPlaceholder i { font-size: 40px; color: #1a4c9f; display: block; }

#idPlaceholder p,
#idBackPlaceholder p { margin: 8px 0 0; font-size: 13px; }

#idScanMsg { font-size: 12px; color: #6c757d; text-align: center; }

/* === Step 5 — Face Verification === */
.face-verify-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 12px;
  align-items: start;
}

.face-card {
  border: 1px solid var(--ob-border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 10px;
}

.face-card h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #1c3d63;
  text-transform: uppercase;
  letter-spacing: .3px;
}

#faceIdRefImg,
#faceCameraPreview,
#facePreviewImg {
  width: 100%;
  height: 165px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #bdd6f2;
  background: #eaf3ff;
}

.face-id-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.face-id-meta-item {
  background: #fff;
  border: 1px solid #dde8f7;
  border-radius: 8px;
  padding: 6px 8px;
}

.face-id-meta-item-name {
  grid-column: 1 / -1;
}

.face-id-meta-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  margin-bottom: 4px;
}

.face-id-meta-value {
  font-size: 12px;
  font-weight: 700;
  color: #1a3a6e;
  word-break: break-word;
}

.face-id-crops {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.face-id-crop-card {
  background: #fff;
  border: 1px solid #dde8f7;
  border-radius: 8px;
  padding: 8px;
}

.face-id-crop-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6c757d;
  margin-bottom: 6px;
}

#faceIdPhotoImg,
#faceIdSignatureImg {
  width: 100%;
  height: 64px;
  object-fit: contain;
  border: 1px solid #d6e6f8;
  border-radius: 6px;
  background: #f8fbff;
}

.face-id-crop-placeholder {
  height: 64px;
  display: grid;
  place-content: center;
  border: 1px dashed #c7d9ee;
  border-radius: 6px;
  background: #f8fbff;
  color: #7a8ea7;
  font-size: 11px;
}

.face-camera-wrap {
  position: relative;
}

#step-5-face .face-verify-grid .face-card:last-child {
  position: sticky;
  top: 2px;
}

.face-placeholder {
  height: 165px;
  border-radius: 10px;
  border: 2px dashed #b0bec5;
  background: #f8faff;
  color: #6c757d;
  display: grid;
  place-content: center;
  text-align: center;
}

.face-placeholder i {
  font-size: 36px;
  color: #1a4c9f;
}

.face-placeholder p {
  margin: 8px 0 0;
  font-size: 12px;
}

.liveness-box {
  margin-top: 12px;
  border: 1px solid var(--ob-border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
}

.liveness-box h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: #1c3d63;
}

.liveness-prompt {
  margin: 6px 0 0;
  font-size: 13px;
  color: #26496f;
}

.face-scan-msg {
  min-height: 16px;
  margin-top: 8px;
  font-size: 12px;
  text-align: center;
  color: #355b84;
}

/* === Action Row & Buttons === */
.action-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.btnx {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  transition: opacity .15s, transform .13s;
}
.btnx:hover  { opacity: .88; transform: translateY(-1px); }
.btnx:active { transform: translateY(0); }
.btnx:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}
.btnx-primary   { color: #fff; background: linear-gradient(135deg, var(--ob-accent), #23a2ec); }
.btnx-secondary { color: #17466f; background: #eaf2fb; }
.btnx-ghost     { color: #1e4f7a; background: #fff; border: 1px solid #c9ddf1; }

/* === Success === */
.success-panel {
  border: 1px solid #caeadb;
  background: linear-gradient(145deg, #f2fff8, #ecfbf4);
  border-radius: 14px;
  padding: 20px;
  margin-top: 10px;
}
.success-panel h2 { margin: 0; color: #145a3b; font-size: 20px; }
.success-panel p  { margin: 8px 0 0; color: #33684f; }

/* === Responsive — Tablet === */
@media (max-width: 760px) {
  .onboard-shell { padding: 8px; }
  .onboard-head  { padding: 12px 16px 10px; }
  .onboard-body  { padding: 14px 16px 12px; }
  .form-grid         { grid-template-columns: 1fr; }
  .eligibility-grid  { grid-template-columns: 1fr; }
  .id-scan-grid      { grid-template-columns: 1fr; }
  .ocr-result-grid   { grid-template-columns: 1fr; }
  .face-verify-grid  { grid-template-columns: 1fr; }
  .face-id-meta      { grid-template-columns: 1fr; }
  .face-id-crops     { grid-template-columns: 1fr; }
  #step-5-face .face-verify-grid .face-card:last-child {
    position: static;
  }
  .eligibility-grid .eligibility-box:last-child { grid-column: auto; }
  .phone-row         { grid-template-columns: 78px 1fr; }
}

/* === Responsive — Small phones === */
@media (max-width: 480px) {
  .onboard-head h1 { font-size: 16px; }
  .step-title      { font-size: 16px; }
  .country-left    { font-size: 14px; }
  .action-row      { justify-content: stretch; }
  .btnx            { flex: 1; justify-content: center; }
  #idCameraPreview,
  #idBackCameraPreview,
  #idPreviewImg,
  #idBackPreviewImg,
  #idPlaceholder,
  #idBackPlaceholder,
  #faceIdRefImg,
  #faceCameraPreview,
  #facePreviewImg,
  .face-placeholder { max-height: 140px; }
}
