/* Every color below resolves through Tailwind's indigo ramp so that
   LoanApplicationsHelper#vendor_theme_styles can re-theme the whole page for a
   vendor by overriding those vars. The defaults are Tailwind's own indigo, so an
   unbranded vendor renders exactly the original palette. */

* { font-family: 'DM Sans', sans-serif; }
h1, h2 { font-family: 'DM Serif Display', serif; }

body {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--color-indigo-500) 5%, white) 0%,
    var(--color-indigo-50) 50%,
    var(--color-indigo-100) 100%);
  min-height: 100vh;
}

/* Floating Label */
.field-wrap {
  position: relative;
  margin-bottom: 0;
}
.field-wrap input,
.field-wrap select {
  width: 100%;
  padding: 1.375rem 0.875rem 0.5rem;
  border: 1.5px solid var(--color-indigo-200);
  border-radius: 0.625rem;
  background: white;
  font-size: 0.9375rem;
  color: var(--color-indigo-950);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.field-wrap input:focus,
.field-wrap select:focus {
  border-color: var(--color-indigo-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-indigo-500) 12%, transparent);
}
.field-wrap label {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9375rem;
  color: var(--color-indigo-400);
  pointer-events: none;
  transition: all 0.2s;
  background: transparent;
}
.field-wrap input:focus ~ label,
.field-wrap input:not(:placeholder-shown) ~ label,
.field-wrap select:focus ~ label,
.field-wrap select.has-value ~ label {
  top: 0.55rem;
  transform: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-indigo-500);
  text-transform: uppercase;
}
.field-wrap input::placeholder { color: transparent; }
.field-wrap select { color: transparent; cursor: pointer; }
.field-wrap select.has-value { color: var(--color-indigo-950); }
.field-wrap select option { color: var(--color-indigo-950); }

/* Section card */
.section-card {
  background: white;
  border-radius: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--color-indigo-500) 12%, transparent);
  box-shadow: 0 2px 20px color-mix(in srgb, var(--color-indigo-500) 7%, transparent);
  padding: 2rem;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.75rem;
}
.section-badge {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, var(--color-indigo-400), var(--color-indigo-500));
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}

/* Toggle buttons */
.toggle-group {
  display: flex;
  border: 1.5px solid var(--color-indigo-200);
  border-radius: 0.625rem;
  overflow: hidden;
  background: white;
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 0.65rem 0.5rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-indigo-500);
  transition: all 0.18s;
  border-right: 1px solid var(--color-indigo-200);
  user-select: none;
}
.toggle-group label:last-of-type { border-right: none; }
.toggle-group input[type="radio"]:checked + label {
  background: linear-gradient(135deg, var(--color-indigo-400), var(--color-indigo-500));
  color: white;
}
.toggle-group label:hover:not(:has(+ input:checked)) {
  background: var(--color-indigo-50);
}

/* Checkbox */
.check-wrap { display: flex; align-items: center; gap: 0.625rem; }
.check-wrap input[type="checkbox"] {
  width: 1.1rem; height: 1.1rem;
  accent-color: var(--color-indigo-500);
  cursor: pointer;
  flex-shrink: 0;
}
.check-wrap label { font-size: 0.875rem; color: var(--color-indigo-700); font-weight: 500; cursor: pointer; }

/* Sliding mailing panel */
.mailing-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.3s;
  opacity: 0;
}
.mailing-panel.open {
  max-height: 800px;
  opacity: 1;
}

/* Add borrower button */
.add-btn {
  border: 2px dashed var(--color-indigo-300);
  border-radius: 0.75rem;
  padding: 0.875rem;
  width: 100%;
  background: var(--color-indigo-50);
  color: var(--color-indigo-500);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.add-btn:hover { background: var(--color-indigo-50); border-color: var(--color-indigo-500); }

/* Submit button */
.submit-btn {
  background: linear-gradient(135deg, var(--color-indigo-400) 0%, var(--color-indigo-500) 50%, var(--color-indigo-600) 100%);
  color: white;
  border: none;
  padding: 1.125rem 3rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--color-indigo-500) 40%, transparent);
  letter-spacing: 0.02em;
  width: 100%;
}
.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px color-mix(in srgb, var(--color-indigo-500) 50%, transparent);
}
.submit-btn:active { transform: translateY(0); }

/* Divider */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-indigo-200), transparent);
  margin: 1.5rem 0;
}

/* Vendor identity, shown above the form so the applicant can confirm whose
   page they are on before typing anything sensitive. The mark leads at the
   left and the name/tagline sit beside it, so the row reads left-to-right
   the same way the rest of the page does. */
.vendor-mark {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}
.vendor-logo {
  height: 3rem;
  max-width: 9rem;
  object-fit: contain;
  flex-shrink: 0;
}
.vendor-monogram {
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  background: linear-gradient(135deg, var(--color-indigo-400), var(--color-indigo-600));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Serif Display', serif;
  font-size: 1.375rem;
  line-height: 1;
  flex-shrink: 0;
}
.vendor-identity {
  min-width: 0;
}
.vendor-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-indigo-900);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.vendor-tagline {
  font-size: 0.8125rem;
  color: var(--color-indigo-400);
  margin-top: 0.1875rem;
  line-height: 1.35;
}

/* Compliance strip. NMLS ID and regulator membership are the identifiers a
   borrower can verify against the lender's own website or the NMLS registry. */
.trust-footer {
  max-width: 48rem;
  margin: 2.5rem auto 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--color-indigo-200);
  text-align: center;
}
.trust-line {
  font-size: 0.75rem;
  color: var(--color-indigo-700);
  line-height: 1.7;
}
.trust-muted {
  font-size: 0.6875rem;
  color: var(--color-indigo-400);
  line-height: 1.7;
  margin-top: 0.5rem;
}
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}
.trust-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-indigo-600);
  background: var(--color-indigo-50);
  border: 1px solid var(--color-indigo-100);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}
.trust-badge a { color: inherit; text-decoration: none; }
.trust-badge a:hover { text-decoration: underline; }

/* Hide native number spinners */
input[type=number].no-spinner::-webkit-inner-spin-button,
input[type=number].no-spinner::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number].no-spinner { -moz-appearance: textfield; }

/* Custom stacked spinner */
.spin-wrap {
  position: relative;
}
.spin-wrap input {
  padding-right: 2.25rem !important;
}
.spin-wrap input:focus ~ label,
.spin-wrap input:not(:placeholder-shown) ~ label {
  top: 0.55rem;
  transform: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--color-indigo-500);
  text-transform: uppercase;
}
.spin-buttons {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2rem;
  display: flex;
  flex-direction: column;
  border-left: 1.5px solid var(--color-indigo-300);
  border-radius: 0 0.625rem 0.625rem 0;
  overflow: hidden;
}
.spin-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-indigo-50);
  border: none;
  cursor: pointer;
  color: var(--color-indigo-500);
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.spin-btn:first-child {
  border-bottom: 1.5px solid var(--color-indigo-300);
}
.spin-btn:hover {
  background: var(--color-indigo-100);
  color: var(--color-indigo-700);
}
.spin-btn:active {
  background: var(--color-indigo-200);
}
/* Keep border radius in sync when input is focused */
.spin-wrap input:focus ~ .spin-buttons {
  border-left-color: var(--color-indigo-500);
}
.spin-wrap input:focus ~ .spin-buttons .spin-btn:first-child {
  border-bottom-color: var(--color-indigo-500);
}

/* Borrowers 2, 3, 4 hidden by default */
#borrower2-section, #borrower3-section, #borrower4-section { display: none; }
#borrower2-section.visible, #borrower3-section.visible, #borrower4-section.visible { display: block; }

/* Remove borrower btn */
.remove-btn {
  color: #f87171;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.remove-btn:hover { color: #ef4444; text-decoration: underline; }

/* Format currency */
.currency-prefix {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-indigo-500);
  font-weight: 600;
  pointer-events: none;
  font-size: 0.9375rem;
  z-index: 2;
  transition: top 0.2s;
}
.field-wrap input:focus ~ .currency-prefix,
.field-wrap input:not(:placeholder-shown) ~ .currency-prefix {
  top: 63%;
}
.currency-field { padding-left: 1.5rem !important; }

/* Small field label above */
.field-sublabel {
  font-size: 0.72rem;
  color: var(--color-indigo-500);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}
