/* ============================================
   BillsHappen Form Styles
   ============================================ */

:root {
  --bh-orange: #ff8a0b;
  --bh-orange-hover: #e07a00;
  --bh-teal: #5dc4d6;
  --bh-teal-dark: #4ab4c6;
  --bh-blue: #0078b1;
  --bh-dark: #292d32;
  --bh-gray: #565d63;
  --bh-gray-light: #999;
  --bh-border: #ddd;
  --bh-bg: #f5f7fa;
  --bh-white: #ffffff;
  --bh-green: #27ae60;
  --bh-red: #e74c3c;
  --bh-radius: 5px;
  --bh-radius-pill: 1000px;
  --bh-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bh-bg);
  color: var(--bh-dark);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-wrapper {
  width: 100%;
  max-width: 560px;
  margin: 40px auto;
  position: relative;
}

.step-card {
  background: var(--bh-white);
  border-radius: var(--bh-radius);
  box-shadow: var(--bh-shadow);
  overflow: hidden;
}

.step {
  display: none;
}

@keyframes bh-slide-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step.step-anim {
  animation: bh-slide-in 0.32s ease forwards;
}

.step-heading {
  background: var(--bh-orange);
  color: var(--bh-white);
  text-align: center;
  padding: 12px 35px;
  font-size: 14px;
  font-weight: 700;
}
.step-topbar {
  height: 5px;
  background: #FF8A0B;
  width: 100%;
}

.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px 35px 0;
}
.progress-percent {
  font-size: 12px;
  font-weight: 700;
  color: var(--bh-blue);
  min-width: 28px;
}
.progress-bar-track {
  flex: 1;
  height: 15px;
  background: var(--bh-dark);
  border-radius: var(--bh-radius-pill);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--bh-blue);
  border-radius: var(--bh-radius-pill) 0 0 var(--bh-radius-pill);
  transition: width 0.5s ease;
  min-width: 8px;
}

/* ─── Step content ───────────────────────── */
.step-content {
  padding: 0 35px 35px;
}

/* ─── Applying For block ─────────────────── */
.applying-for {
  text-align: center;
  padding: 15px 0;
}
.applying-for-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--bh-gray);
  text-transform: uppercase;
}
.applying-for-amount {
  font-size: 28px;
  font-weight: 900;
  color: var(--bh-blue);
  margin-top: 4px;
}

/* ─── Step title ─────────────────────────── */
.step-title {
  font-size: 28px;
  font-weight: 400;
  color: #000;
  text-align: center;
  padding: 20px 0 25px;
}

/* ─── Field groups ───────────────────────── */
.fields-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}
.fields-row .field-group {
  flex: 1;
}
.field-group {
  margin-bottom: 15px;
  background: rgba(0, 0, 0, 0.03);
    padding: 0.6rem;
    border-radius: 15px;
}
.field-group:last-child {
 
}
.field-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--bh-gray);
  margin-bottom: 10px;
}

/* ─── Inputs ─────────────────────────────── */
.input-field,
.select-field {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--bh-dark);
  background: var(--bh-white);
  border: 1px solid var(--bh-border);
  border-radius: var(--bh-radius);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.06);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.input-field::placeholder {
  color: rgba(0, 0, 0, 0.35);
}
.input-field:focus,
.select-field:focus {
  border-color: var(--bh-blue);
  box-shadow:
    0 0 0 2px rgba(0, 120, 177, 0.15),
    inset 0 1px 5px rgba(0, 0, 0, 0.06);
}
.select-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23565d63' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

/* ─── Validation states ──────────────────── */
.form-error {
  border: 2px solid var(--bh-red) !important;
  background-color: #fdf2f2 !important;
}
.form-success {
  border: 2px solid var(--bh-green) !important;
  background-color: #f2fff5 !important;
}
.field-error-msg {
  color: var(--bh-red);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* ─── Helper / consent text ──────────────── */
.safety-text {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1.45;
  margin-top: 10px;
}
.safety-text strong {
  color: var(--bh-green);
}
.consent-text {
  font-size: 14px;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1.45;
  margin-top: 10px;
}
.consent-text a {
  color: var(--bh-blue);
}

/* ─── Question blocks ────────────────────── */
.question-block {
  margin-bottom: 20px;
      background: rgba(0, 0, 0, 0.03);
    padding: 0.6rem;
    border-radius: 15px;
}
.question-block:last-child {
  margin-bottom: 0;
}
.question-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--bh-dark);
  margin-bottom: 10px;
}

/* Tooltip icon */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bh-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
}
.tooltip-box {
  display: none;
  position: absolute;
  top: 28px;
  right: -10px;
  width: 260px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  font-weight: 400;
  color: #555;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 50;
}
.tooltip-icon:hover .tooltip-box {
  display: block;
}

/* ─── Buttons row ────────────────────────── */
.buttons-row {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 145px;
  height: 50px;
  padding: 0 30px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--bh-radius-pill);
  cursor: pointer;
  border: none;
  user-select: none;
  outline: none;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s,
    opacity 0.15s,
    transform 0.1s;
}
.btn:active {
  transform: scale(0.97);
}

/* Back */
.btn-back {
  background: transparent;
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.15);
  opacity: 0.5;
}
.btn-back:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.04);
}

.btn-next,
.btn-continue {
  background: var(--bh-orange);
  color: var(--bh-white);
}
.btn-next:hover,
.btn-continue:hover {
  background: var(--bh-orange-hover);
}
.btn-next:active,
.btn-continue:active {
  background: #c86c00;
}
.btn-next:disabled,
.btn-continue:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-submit {
  background: var(--bh-orange);
  color: var(--bh-white);
  min-width: 200px;
}
.btn-submit:hover {
  background: var(--bh-orange-hover);
}
.btn-submit:active {
  background: #c86c00;
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-amount {
  width: 100%;
  height: 50px;
  background: var(--bh-orange);
  color: var(--bh-white);
  border: none;
  border-radius: var(--bh-radius-pill);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn-amount:hover {
  background: var(--bh-orange-hover);
}
.btn-amount:active {
  background: #c86c00;
  transform: scale(0.97);
}

.choice-group {
  display: flex;
  gap: 5px;
}
.choice-group.vertical {
  flex-direction: column;
}

.btn-choice,
.choice-btn {
  flex: 1;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  color: var(--bh-orange);
  background: var(--bh-white);
  border: 2px solid var(--bh-orange);
  border-radius: var(--bh-radius-pill);
  cursor: pointer;
  padding: 10px 16px;
  text-align: center;
  user-select: none;
  outline: none;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.1s;
}
.btn-choice:hover,
.choice-btn:hover {
  background: rgba(255, 138, 11, 0.08);
  border-color: var(--bh-orange-hover);
  color: var(--bh-orange-hover);
}
.btn-choice:active,
.choice-btn:active {
  transform: scale(0.97);
}

.btn-choice.active,
.choice-btn.active {
  background: var(--bh-orange);
  border-color: var(--bh-orange);
  color: var(--bh-white);
}
.btn-choice.active:hover,
.choice-btn.active:hover {
  background: var(--bh-orange-hover);
  border-color: var(--bh-orange-hover);
}

.btn-choice.sm,
.choice-btn.sm {
  min-height: 42px;
  font-size: 14px;
  padding: 8px 4px;
  min-width: 0;
}

.input-date-wrap {
  position: relative;
}
.input-date-wrap .input-field {
  padding-right: 38px;
}
.input-date-wrap .calendar-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--bh-gray-light);
  pointer-events: none;
}

.disclosure-text {
  font-size: 11px;
  color: var(--bh-gray-light);
  line-height: 1.5;
  margin-top: 15px;
}
.disclosure-text a {
  color: var(--bh-blue);
  text-decoration: underline;
}

/* ─── SSL badge ──────────────────────────── */
.ssl-badge {
  text-align: center;
  padding: 20px 0;
}
.ssl-badge img {
  height: 55px;
}

/* ─── No bank link ───────────────────────── */
.other-bank-name {
  display: none;
  margin-top: 12px;
}
.no-bank-link {
  display: block;
  font-size: 12px;
  color: var(--bh-blue);
  margin-top: 8px;
  text-decoration: none;
}
.no-bank-link:hover {
  text-decoration: underline;
}

.bank-image {
  margin: 15px 0;
  text-align: center;
}
.bank-image img {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════
   POPUP OVERLAYS
══════════════════════════════════════════ */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 500;
}

/* Suggestion popups (Checking / Direct Deposit) */
.popup-card {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bh-white);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  padding: 30px 28px;
  width: 90%;
  max-width: 380px;
  z-index: 600;
}
.popup-card .step-title {
  font-size: 20px;
  padding: 0 0 14px;
  text-align: left;
}
.popup-card p {
  font-size: 14px;
  color: var(--bh-gray);
  line-height: 1.5;
}
.popup-card .popup-actions {
  text-align: center;
  margin-top: 22px;
}
.popup-card .btn-popup-cta {
  display: block;
  width: 100%;
  background: var(--bh-orange);
  color: var(--bh-white);
  border: none;
  border-radius: var(--bh-radius-pill);
  height: 50px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s;
}
.popup-card .btn-popup-cta:hover {
  background: var(--bh-orange-hover);
}
.popup-card .btn-popup-keep {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--bh-gray);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
}
.popup-card .btn-popup-keep:hover {
  text-decoration: underline;
}

/* Marketing Partners popup */
#marketing-partners-popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 700;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}
#marketing-partners-popup-overlay .mp-inner {
  background: var(--bh-white);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
}
#marketing-partners-popup-overlay h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--bh-dark);
}
#marketing-partners-popup-overlay p {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 10px;
}
#marketing-partners-popup-overlay ul {
  font-size: 11px;
  color: #555;
  columns: 2;
  gap: 12px;
  padding-left: 16px;
  line-height: 1.8;
}
#marketing-partners-close {
  position: sticky;
  top: 0;
  float: right;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #555;
  line-height: 1;
  padding: 4px 0;
  z-index: 1;
}
#marketing-partners-close:hover {
  color: var(--bh-dark);
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATION
══════════════════════════════════════════ */
#bh-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bh-white);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 14px 20px 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 420px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  border-left: 4px solid var(--bh-red);
}
#bh-toast.bh-toast-show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
#bh-toast .bh-toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--bh-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
#bh-toast .bh-toast-msg {
  font-size: 14px;
  font-weight: 600;
  color: var(--bh-dark);
  flex: 1;
}
#bh-toast .bh-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bh-gray-light);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
#bh-toast .bh-toast-close:hover {
  color: var(--bh-dark);
}

/* ══════════════════════════════════════════
   MATCHING ANIMATION  (step-match overlay)
══════════════════════════════════════════ */
#step-match {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
  width: 90%;
  max-width: 420px;
  z-index: 600;
  animation: none !important;
}
#step-match .step-card {
  padding: 0;
  overflow: hidden;
}
#step-match .match-top-bar {
  height: 5px;
  background: var(--bh-orange);
  width: 100%;
}

.matching-container,
.congrats-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 35px 35px;
}

/* Spinner */
.spinner-ring {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  display: inline-block;
}
.spinner-ring svg {
  width: 100%;
  height: 100%;
  animation: spin 2s linear infinite;
}
@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}
.spinner-ring .track {
  fill: none;
  stroke: var(--bh-dark);
  stroke-width: 8;
}
.spinner-ring .fill {
  fill: none;
  stroke: var(--bh-teal);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 165;
}

.matching-title {
  font-size: 24px;
  font-weight: 400;
  color: #000;
  line-height: 1.3;
}

/* Congrats check */
.congrats-check {
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  animation: scale-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes scale-in {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.congrats-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--bh-green);
  line-height: 1.3;
}
.congrats-subtitle {
  font-size: 20px;
  font-weight: 400;
  color: #000;
}

/* ══════════════════════════════════════════
   FINAL PROCESSING  (step-final)
══════════════════════════════════════════ */
.processing-container {
  text-align: center;
  padding: 30px 35px 40px;
}
.processing-ring {
  width: 100px;
  height: 100px;
  margin: 0 auto 10px;
}
.processing-ring svg {
  width: 100%;
  height: 100%;
}
.final-spinner {
  animation: spin 2s linear infinite;
}
.processing-ring .track {
  fill: none;
  stroke: var(--bh-dark);
  stroke-width: 8;
}
.processing-ring .progress-arc {
  fill: none;
  stroke: var(--bh-teal);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251;
  stroke-dashoffset: 251;
  transition: stroke-dashoffset 0.5s ease;
  transform-origin: center;
  transform: rotate(-90deg);
}
.processing-ring .percent-text {
  font-size: 22px;
  font-weight: 900;
  fill: var(--bh-blue);
  dominant-baseline: central;
  text-anchor: middle;
}
.processing-timer {
  font-size: 16px;
  font-weight: 700;
  color: var(--bh-blue);
  margin-bottom: 2px;
}
.processing-subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--bh-dark);
  margin-bottom: 4px;
}
.processing-title {
  font-size: 24px;
  font-weight: 400;
  color: #000;
  margin-bottom: 20px;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
}
.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--bh-dark);
}
.status-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.status-item.done .check-bg { fill: #27ae60; }
.status-item.done .check-mark { opacity: 1; }
.status-item:not(.done) .check-mark { opacity: 0; }

/* Lookup loader overlay */
.lookup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--bh-radius);
}
.lookup-overlay .spinner-ring {
  width: 80px;
  height: 80px;
}

/* Masked input with edit icon */
.masked-field-wrapper {
  position: relative;
}
.masked-field-wrapper .input-field {
  padding-right: 40px;
}
.masked-field-wrapper .input-field[readonly] {
  background: #f5f5f5;
  color: #999;
  cursor: default;
  pointer-events: none;
}
.edit-mask-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.disclosure-section {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
.disclosure-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.disclosure-section p {
  font-size: 11px;
  color: var(--bh-gray-light);
  line-height: 1.6;
}
.disclosure-section a {
  color: var(--bh-blue);
}

footer {
  background: var(--bh-dark);
  padding: 20px;
  text-align: center;
  width: 100%;
}
footer nav {
  margin-bottom: 10px;
}
footer nav a {
  color: var(--bh-gray-light);
  font-size: 12px;
  margin: 0 8px;
  text-decoration: none;
}
footer nav a:hover {
  text-decoration: underline;
}
footer p {
  color: #666;
  font-size: 11px;
}

@media (max-width: 600px) {
  .form-wrapper {
    margin: 16px auto;
    padding: 0 12px;
  }
  .step-content {
    padding: 0 20px 25px;
  }
  .progress-wrapper {
    padding: 16px 20px 0;
  }
  .step-title {
    font-size: 22px;
  }
  .fields-row {
    flex-direction: column;
    gap: 0;
  }
  .choice-group {
    flex-wrap: wrap;
  }
  .btn-choice,
  .choice-btn {
    min-height: 44px;
    font-size: 13px;
  }
  .buttons-row {
    flex-direction: column;
    gap: 10px;
  }
  .btn {
    width: 100%;
    min-width: unset;
  }
  .matching-title,
  .processing-title,
  .congrats-title {
    font-size: 20px;
  }

  .credit-score-group {
    flex-wrap: wrap !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .address-length-group {
    flex-wrap: wrap !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }
  .address-length-group .choice-btn:nth-child(4),
  .address-length-group .choice-btn:nth-child(5) {
    grid-column: auto;
  }

  .debt-row {
    flex-direction: column !important;
    gap: 15px !important;
  }
  .debt-row > div {
    width: 100%;
  }
}
