/* ============================================================
   Transfer Wizard — UI/UX enhancements (request.html)
   Self-contained styles; supports light theme and body.dark-theme
   ============================================================ */

/* ---------- Scoped design tokens ---------- */
.wizard {
  --wz-primary: #005d74;
  --wz-primary-soft: rgba(0, 93, 116, 0.12);
  --wz-success: #12a347;
  --wz-success-soft: rgba(18, 163, 71, 0.12);
  --wz-danger: #dc2626;
  --wz-danger-soft: rgba(220, 38, 38, 0.1);
  --wz-info: #0e7ceb;
  --wz-border: #e2e8f0;
  --wz-bg: #ffffff;
  --wz-bg-subtle: #f8fafc;
  --wz-text: #1e293b;
  --wz-muted: #64748b;
  --wz-radius: 12px;
}

body.dark-theme .wizard {
  --wz-primary: #38bdf8;
  --wz-primary-soft: rgba(56, 189, 248, 0.15);
  --wz-success: #34d399;
  --wz-success-soft: rgba(52, 211, 153, 0.15);
  --wz-danger: #f87171;
  --wz-danger-soft: rgba(248, 113, 113, 0.12);
  --wz-info: #60a5fa;
  --wz-border: rgba(148, 163, 184, 0.22);
  --wz-bg: #0f172a;
  --wz-bg-subtle: rgba(148, 163, 184, 0.08);
  --wz-text: #e2e8f0;
  --wz-muted: #94a3b8;
}

.wizard {
  max-width: 540px;
  margin: 0 auto;
}

/* ============================================================
   STEPPER (progress indicator)
   ============================================================ */
.wizard-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 0 0 1rem 0;
  user-select: none;
}

.wizard .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
  min-width: 72px;
  cursor: default;
  background: none;
  border: none;
  padding: 0;
}

/* Completed steps become clickable (navigates back) */
.wizard .step.completed {
  cursor: pointer;
}

.wizard .step-node {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wz-muted);
  background: var(--wz-bg);
  border: 2px solid var(--wz-border);
  transition: all 0.3s ease;
}

.wizard .step-label {
  font-size: 0.72rem;
  color: var(--wz-muted);
  text-align: center;
  line-height: 1.25;
  transition: color 0.3s ease;
}

/* Active step */
.wizard .step.active .step-node {
  background: var(--wz-primary);
  border-color: var(--wz-primary);
  color: #fff;
  box-shadow: 0 0 0 5px var(--wz-primary-soft);
}

.wizard .step.active .step-label {
  color: var(--wz-text);
  font-weight: 600;
}

/* Completed step */
.wizard .step.completed .step-node {
  background: var(--wz-success);
  border-color: var(--wz-success);
  color: #fff;
}

.wizard .step.completed .step-label {
  color: var(--wz-success);
}

.wizard .step .step-check {
  display: none;
}

.wizard .step.completed .step-check {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.wizard .step.completed .step-num {
  display: none;
}

.wizard .step.completed:hover .step-node {
  transform: scale(1.08);
}

/* Connectors between steps */
.wizard .step-connector {
  flex: 1;
  height: 3px;
  background: var(--wz-border);
  border-radius: 99px;
  margin-top: 20px; /* vertical center of the 42px node */
  overflow: hidden;
  position: relative;
}

.wizard .step-connector .fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--wz-success), var(--wz-primary));
  border-radius: 99px;
  transition: width 0.45s ease;
}

/* "Step X of Y" meta line under the stepper */
.wz-progress-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 1.4rem 0;
  font-size: 0.74rem;
  color: var(--wz-muted);
}

.wz-progress-meta #wzStepCounter {
  background: var(--wz-primary-soft);
  color: var(--wz-primary);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}

.wz-progress-meta #wzStepName {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

/* Hide step 4 (OTP) entirely when the account doesn't require it */
.wizard.hide-step4 .step[data-step="4"],
.wizard.hide-step4 #step4Connector {
  display: none;
}

/* When step 4 is hidden, meta says "of 3" - handled in JS via totalSteps.
   This keeps the rail clean when only 3 steps apply. */

@media (max-width: 420px) {
  .wizard .step { min-width: 56px; }
  .wizard .step-node { width: 36px; height: 36px; font-size: 0.85rem; }
  .wizard .step-connector { margin-top: 17px; }
  .wizard .step-label { font-size: 0.64rem; }
}

/* ============================================================
   STEP PANELS + transitions
   ============================================================ */
.wizard-step {
  animation: wzStepIn 0.35s ease;
}

@keyframes wzStepIn {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .wizard-step { animation: none; }
  .wz-spin { animation: none !important; }
}

.wizard .step-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.wizard .step-heading svg {
  flex-shrink: 0;
  color: var(--wz-primary);
}

.wizard .step-heading h6 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--wz-text);
}

.wizard .step-sub {
  font-size: 0.78rem;
  color: var(--wz-muted);
  margin: 0 0 1.1rem 0;
}

.wizard .step-sub strong { color: var(--wz-text); }

/* ============================================================
   FORM FIELDS
   ============================================================ */
.wizard .form-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--wz-text);
  margin-bottom: 0.35rem;
}

.wizard .form-control {
  border-radius: 10px;
  border: 1px solid var(--wz-border);
  background: var(--wz-bg);
  color: var(--wz-text);
  padding: 0.6rem 0.85rem;
  font-size: 0.87rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wizard .form-control:focus {
  border-color: var(--wz-primary);
  box-shadow: 0 0 0 4px var(--wz-primary-soft);
  background: var(--wz-bg);
  color: var(--wz-text);
}

.wizard .form-control::placeholder {
  color: var(--wz-muted);
  opacity: 0.7;
}

/* Invalid state (set by wizard validation) */
.wizard .form-control.wz-invalid,
.wizard select.wz-invalid {
  border-color: var(--wz-danger) !important;
  box-shadow: 0 0 0 4px var(--wz-danger-soft) !important;
}

/* Custom select styling (account + request type dropdowns) */
.wizard select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.wizard label[for="accountSelect"],
.wizard label.mr-sm-2 {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--wz-text);
  margin-bottom: 0.35rem;
}

/* Inline error message under a field */
.wz-field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.4rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--wz-danger);
  animation: wzFadeIn 0.2s ease;
}

.wz-field-error i { font-size: 0.8rem; }

@keyframes wzFadeIn {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hint under the amount field */
.wz-field-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.45rem;
  font-size: 0.74rem;
  animation: wzFadeIn 0.2s ease;
}

.wz-field-hint.ok { color: var(--wz-success); }
.wz-field-hint.warn { color: #b45309; font-weight: 500; }

body.dark-theme .wz-field-hint.warn { color: #fbbf24; }

.wz-field-hint i { font-size: 0.8rem; }

/* Amount input with currency prefix — joined cell, no overlap possible */
.wz-amount-wrap {
  display: flex;
  align-items: stretch;
}

.wz-amount-wrap .wz-currency {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 12px;
  border: 1px solid var(--wz-border);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: var(--wz-bg-subtle);
  color: var(--wz-muted);
  font-weight: 600;
  font-size: 1rem;
  user-select: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.wz-amount-wrap .form-control {
  border-radius: 0 10px 10px 0;
  padding-left: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  flex: 1;
}

/* Focus / invalid states light up the whole group */
.wz-amount-wrap.focused .wz-currency {
  border-color: var(--wz-primary);
  color: var(--wz-primary);
  background: var(--wz-primary-soft);
}

.wz-amount-wrap.invalid .wz-currency {
  border-color: var(--wz-danger);
  color: var(--wz-danger);
  background: var(--wz-danger-soft);
}

/* Password with show/hide */
.wz-pw-wrap {
  position: relative;
}

.wz-pw-wrap .form-control {
  padding-right: 46px;
}

.wz-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--wz-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.wz-eye-btn:hover { color: var(--wz-primary); }

/* ============================================================
   ACCOUNT CARD (step 1)
   ============================================================ */
.wz-account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--wz-border);
  background: var(--wz-bg-subtle);
  border-radius: var(--wz-radius);
  padding: 0.85rem 1rem;
  margin-top: 0.75rem;
  animation: wzFadeIn 0.25s ease;
}

.wz-ac-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.wz-ac-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--wz-primary-soft);
  color: var(--wz-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.wz-ac-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wz-ac-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--wz-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wz-ac-number {
  font-size: 0.74rem;
  color: var(--wz-muted);
  font-variant-numeric: tabular-nums;
}

.wz-ac-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.wz-ac-balance-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wz-muted);
}

.wz-ac-balance-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--wz-success);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .wz-account-card { flex-direction: column; align-items: flex-start; }
  .wz-ac-balance { align-items: flex-start; flex-direction: row; gap: 8px; }
}

/* ============================================================
   REVIEW (receipt-style) card — step 3
   ============================================================ */
.review-card {
  border: 1px solid var(--wz-border);
  border-radius: var(--wz-radius);
  background: var(--wz-bg);
  overflow: hidden;
  margin-bottom: 1.1rem;
}

.review-card .rc-head {
  background: var(--wz-bg-subtle);
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--wz-text);
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--wz-border);
}

.review-card .rc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--wz-border);
  font-size: 0.82rem;
}

.review-card .rc-row:last-child { border-bottom: none; }

.review-card .rc-row .rc-k {
  color: var(--wz-muted);
  flex-shrink: 0;
}

.review-card .rc-row .rc-v {
  color: var(--wz-text);
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

/* Group header rows with edit buttons */
.review-card .rc-row.rc-group-head {
  background: var(--wz-bg-subtle);
  padding: 0.45rem 1rem 0.45rem 0.75rem;
}

.review-card .rc-row.rc-group-head .rc-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--wz-text);
  font-size: 0.76rem;
}

.review-card .rc-row.rc-group-head .rc-k i {
  color: var(--wz-primary);
  font-size: 0.85rem;
}

.review-card .rc-edit {
  border: none;
  background: transparent;
  color: var(--wz-primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.review-card .rc-edit:hover {
  background: var(--wz-primary-soft);
}

/* Amount hero row */
.review-card .rc-row.rc-amount {
  background: var(--wz-success-soft);
  padding: 0.85rem 1rem;
}

.review-card .rc-row.rc-amount .rc-k { color: var(--wz-muted); }

.review-card .rc-row.rc-amount .rc-v {
  color: var(--wz-success);
  font-size: 1.3rem;
  font-weight: 700;
}

/* ============================================================
   OTP (step 4)
   ============================================================ */
.otp-panel {
  text-align: center;
}

.otp-mail-icon {
  width: 64px;
  height: 64px;
  margin: 0.25rem auto 1rem;
  border-radius: 50%;
  background: var(--wz-primary-soft);
  color: var(--wz-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.otp-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 1rem 0 0.5rem;
}

.otp-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--wz-border);
  border-radius: 10px;
  background: var(--wz-bg);
  color: var(--wz-text);
  outline: none;
  caret-color: var(--wz-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.otp-box:focus {
  border-color: var(--wz-primary);
  box-shadow: 0 0 0 4px var(--wz-primary-soft);
  transform: translateY(-2px);
}

.otp-box.filled {
  border-color: var(--wz-primary);
}

.otp-boxes.success .otp-box {
  border-color: var(--wz-success);
  background: var(--wz-success-soft);
  color: var(--wz-success);
}

.otp-boxes.error .otp-box {
  border-color: var(--wz-danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
  animation: wzShake 0.4s ease;
}

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

.otp-timer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--wz-muted);
  font-variant-numeric: tabular-nums;
}

.otp-timer.danger { color: var(--wz-danger); font-weight: 600; }

.otp-resend {
  border: none;
  background: transparent;
  color: var(--wz-primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.otp-resend:hover { text-decoration: underline; }

.otp-hint {
  font-size: 0.74rem;
  color: var(--wz-muted);
  margin-top: 0.85rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.wizard .wz-btn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 1.5rem;
}

.wizard .btn { border-radius: 10px; font-weight: 600; font-size: 0.85rem; }

.wizard .btn-secondary {
  background: transparent;
  color: var(--wz-muted);
  border: 1px solid var(--wz-border);
}

.wizard .btn-secondary:hover {
  color: var(--wz-text);
  border-color: var(--wz-muted);
  background: var(--wz-bg-subtle);
}

.wizard .btn-primary {
  background: var(--wz-primary);
  border-color: var(--wz-primary);
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wizard .btn-primary:hover {
  filter: brightness(1.12);
  background: var(--wz-primary);
  border-color: var(--wz-primary);
}

.wizard .btn-success {
  background: var(--wz-success);
  border-color: var(--wz-success);
  min-width: 130px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.wizard .btn-success:hover {
  filter: brightness(1.08);
  background: var(--wz-success);
  border-color: var(--wz-success);
}

.wizard .btn-light-send {
  background: var(--wz-primary-soft);
  color: var(--wz-primary);
  border: none;
  font-weight: 600;
  min-width: 170px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.55rem 1rem;
}

.wizard .btn-light-send:hover { filter: brightness(0.97); }

/* Spinner used in loading button states */
.wz-spin {
  display: inline-block;
  animation: wzSpin 0.8s linear infinite;
}

@keyframes wzSpin {
  to { transform: rotate(360deg); }
}

/* Status message area */
.wz-status {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  text-align: center;
  transition: color 0.2s ease;
}

.wz-status.info { color: var(--wz-info); }
.wz-status.success { color: var(--wz-success); font-weight: 600; }
.wz-status.error { color: var(--wz-danger); font-weight: 600; }

/* ============================================================
   SUCCESS SCREEN
   ============================================================ */
.wz-success {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.wz-success-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.wz-success-icon .wz-check-circle {
  stroke: var(--wz-success);
  stroke-width: 2.5;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: wzCircleDraw 0.6s ease-out forwards;
}

.wz-success-icon .wz-check-mark {
  stroke: var(--wz-success);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: wzCheckDraw 0.35s ease-out 0.45s forwards;
}

@keyframes wzCircleDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes wzCheckDraw {
  to { stroke-dashoffset: 0; }
}

.wz-success-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--wz-text);
  margin: 0 0 0.4rem;
}

.wz-success-sub {
  font-size: 0.85rem;
  color: var(--wz-muted);
  margin: 0 0 0.25rem;
}

.wz-success-sub strong { color: var(--wz-text); }

.wz-success-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .wz-success-icon .wz-check-circle,
  .wz-success-icon .wz-check-mark {
    animation: none;
    stroke-dashoffset: 0;
  }
}
