/* ═══════════════════════════════════════════════════
   NumeralQ Financing Calculator Modal
   Two-step: estimate first, lender match second
═══════════════════════════════════════════════════ */

/* ── Overlay ────────────────────────────────────── */
#nqfm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  animation: nqfm-fade 0.2s ease forwards;
}

@keyframes nqfm-fade { to { opacity: 1; } }

/* ── Modal card ─────────────────────────────────── */
#nqfm-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.12),
    0 24px 80px rgba(0,0,0,0.38),
    0 4px 16px rgba(0,0,0,0.14);
  max-width: 560px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  transform: scale(0.93) translateY(12px);
  animation: nqfm-rise 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}
#nqfm-modal::-webkit-scrollbar { width: 5px; }
#nqfm-modal::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

@keyframes nqfm-rise { to { transform: scale(1) translateY(0); } }

/* ── Header (dark navy / indigo gradient) ────────── */
.nqfm-header {
  background: linear-gradient(140deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
  padding: 26px 28px 24px;
  border-radius: 14px 14px 0 0;
  position: relative;
}

.nqfm-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 7px;
  color: rgba(255,255,255,0.75);
  font-size: 1.15rem;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
}
.nqfm-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.nqfm-eyebrow {
  display: block;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a5b4fc;
  margin-bottom: 9px;
}

.nqfm-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 8px;
  letter-spacing: -0.3px;
  line-height: 1.25;
  padding-right: 36px;
}

.nqfm-sub {
  font-size: 0.84rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.55;
  margin: 0;
}

/* ── Body ───────────────────────────────────────── */
.nqfm-body {
  padding: 22px 28px 26px;
}

.nqfm-field {
  margin-bottom: 14px;
}

.nqfm-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 5px;
}

.nqfm-input,
.nqfm-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  font-size: 0.9rem;
  color: #1e293b;
  background: #f8fafc;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.nqfm-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.nqfm-input:focus,
.nqfm-select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.13);
  background: #fff;
}
.nqfm-input.nqfm-error { border-color: #f87171 !important; }

.nqfm-amount-wrap {
  position: relative;
}
.nqfm-amount-wrap::before {
  content: '$';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.9rem;
  pointer-events: none;
}
.nqfm-amount-wrap .nqfm-input { padding-left: 22px; }

.nqfm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}
.nqfm-row .nqfm-field { margin-bottom: 0; }

/* ── Calculate button ───────────────────────────── */
.nqfm-calc-btn {
  width: 100%;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  margin-top: 6px;
}
.nqfm-calc-btn:hover {
  background: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,0.3);
}
.nqfm-calc-btn:active { transform: none; box-shadow: none; }

/* ── Results card ───────────────────────────────── */
.nqfm-results {
  margin-top: 20px;
  background: linear-gradient(135deg, #f0f4ff 0%, #eef2ff 100%);
  border: 1.5px solid #c7d2fe;
  border-radius: 10px;
  padding: 18px 20px 16px;
  animation: nqfm-results-in 0.3s ease forwards;
}

@keyframes nqfm-results-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nqfm-results-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6366f1;
  margin-bottom: 8px;
  display: block;
}

.nqfm-payment-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}

.nqfm-payment-amount {
  font-size: 2.3rem;
  font-weight: 900;
  color: #1e1b4b;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.nqfm-payment-amount.nqfm-updating { color: #4f46e5; }

.nqfm-payment-label {
  font-size: 0.88rem;
  color: #6366f1;
  font-weight: 600;
}

.nqfm-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 18px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid #dde2ff;
}

.nqfm-detail-item {
  font-size: 0.76rem;
  color: #6b7280;
  line-height: 1.4;
}
.nqfm-detail-item strong {
  display: block;
  font-weight: 700;
  color: #1e293b;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

/* APR tooltip */
.nqfm-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e0e7ff;
  color: #4f46e5;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  margin-left: 2px;
  vertical-align: middle;
}
.nqfm-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 0.71rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 7px;
  width: 190px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 20;
  text-transform: none;
  letter-spacing: 0;
}
.nqfm-tip:hover::after,
.nqfm-tip:focus::after { opacity: 1; }

/* ── Trust chips ────────────────────────────────── */
.nqfm-trust-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}
.nqfm-trust-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: #4b5563;
}
.nqfm-trust-item::before {
  content: '✓';
  color: #059669;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ── Step 2 trigger (inside results) ────────────── */
.nqfm-s2-trigger-wrap { text-align: center; }

.nqfm-s2-trigger {
  width: 100%;
  background: #f0fdfa;
  border: 1.5px solid #6ee7b7;
  border-radius: 8px;
  color: #047857;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 11px 16px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  letter-spacing: 0.01em;
}
.nqfm-s2-trigger:hover {
  background: #d1fae5;
  border-color: #34d399;
  transform: translateY(-1px);
}

.nqfm-s2-trigger-note {
  font-size: 0.71rem;
  color: #94a3b8;
  margin: 7px 0 0;
}

/* ── Step 2 — Lender match form ──────────────────── */
.nqfm-step2 {
  border-top: 1px solid #e2e8f0;
  padding: 22px 28px 26px;
  background: linear-gradient(180deg, #fafffe 0%, #fff 100%);
  animation: nqfm-results-in 0.3s ease forwards;
}

.nqfm-step2-eyebrow {
  display: block;
  font-size: 0.61rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #0d9488;
  margin-bottom: 6px;
}

.nqfm-step2 h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 5px;
  letter-spacing: -0.2px;
}

.nqfm-step2-sub {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 18px;
  line-height: 1.5;
}

.nqfm-s2-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.nqfm-step2-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.nqfm-step2-fields .nqfm-field { margin-bottom: 0; }

.nqfm-s2-btn {
  width: 100%;
  background: #0f766e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s;
  margin-top: 4px;
  letter-spacing: 0.01em;
}
.nqfm-s2-btn:hover {
  background: #0d6b64;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13,118,110,0.28);
}
.nqfm-s2-btn:disabled {
  background: #94a3b8;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

.nqfm-s2-note {
  font-size: 0.71rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 9px;
}

.nqfm-s2-disclosure {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.55;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}
.nqfm-s2-disclosure a { color: #64748b; }

.nqfm-fin-note {
  font-size: 0.68rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 6px 0 0;
  text-align: center;
}

/* ── Success state ───────────────────────────────── */
.nqfm-success {
  text-align: center;
  padding: 30px 20px 10px;
}
.nqfm-success-icon { font-size: 2.6rem; margin-bottom: 12px; }
.nqfm-success-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}
.nqfm-success-sub {
  font-size: 0.84rem;
  color: #64748b;
  line-height: 1.6;
  max-width: 380px;
  margin: 0 auto;
}

/* ── Mobile ─────────────────────────────────────── */
@media (max-width: 600px) {
  #nqfm-overlay {
    padding: 0;
    align-items: flex-end;
  }
  #nqfm-modal {
    border-radius: 18px 18px 0 0;
    max-height: 96vh;
  }
  .nqfm-header {
    padding: 22px 20px 20px;
    border-radius: 18px 18px 0 0;
  }
  .nqfm-header h2 { font-size: 1.2rem; }
  .nqfm-body { padding: 18px 20px 22px; }
  .nqfm-step2 { padding: 18px 20px 22px; }
  .nqfm-row { grid-template-columns: 1fr; gap: 10px; }
  .nqfm-s2-row { grid-template-columns: 1fr; gap: 10px; }
  .nqfm-payment-amount { font-size: 2rem; }
  .nqfm-details { grid-template-columns: 1fr 1fr; }
}
