/**
 * WiseIQ UX Features v130
 * Behavioral UX Audit Implementation — All 12 Fixes
 *
 * Fixes included:
 * P0-1: Soft-pull microcopy + anxiety reducers adjacent to every CTA
 * P0-2: Mobile card-stack layout (replaces table on <768px)
 * P1-3: Credit score qualifier prompt (above-fold funnel)
 * P1-4: Sticky bottom CTA bar (mobile only)
 * P1-5: "Why ranked here?" transparency modal
 * P1-6: Interactive APR-to-monthly-payment calculator
 * P2-7: Inline jargon tooltips
 * P2-8: Trust bar above H1 + editorial badge row
 * P2-9: Filter bar with credit score + loan amount sliders
 * P3-10: Swipe-to-dismiss card gesture + haptic feedback
 */

/* ══════════════════════════════════════════════════════════════
 * P0-1: SOFT-PULL MICROCOPY & ANXIETY REDUCERS
 * ══════════════════════════════════════════════════════════════ */
.wiq-cta-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.wiq-anxiety-reducer {
  font-size: 10px;
  color: #6B7280;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  margin-top: 2px;
}
.wiq-soft-pull-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #059669;
  font-weight: 600;
  white-space: nowrap;
}
.wiq-soft-pull-badge svg {
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
 * P2-8: TRUST BAR (above H1)
 * ══════════════════════════════════════════════════════════════ */
.wiq-trust-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  margin-bottom: 10px;
}
.wiq-trust-bar-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wiq-trust-bar-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* Editorial badge row (below hero, above table) */
.wiq-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0 14px;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 16px;
}
.wiq-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #374151;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
  font-weight: 500;
}
.wiq-badge svg {
  flex-shrink: 0;
  color: #059669;
}
.wiq-badge.wiq-badge-primary {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}
.wiq-badge.wiq-badge-primary svg {
  color: #1D4ED8;
}

/* ══════════════════════════════════════════════════════════════
 * P1-3: CREDIT SCORE QUALIFIER PROMPT
 * ══════════════════════════════════════════════════════════════ */
.wiq-qualifier {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 20px 24px;
  margin: 0 0 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wiq-qualifier-label {
  font-size: 13px;
  font-weight: 700;
  color: #0B1F3A;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wiq-qualifier-label svg {
  color: #1A6FD4;
  flex-shrink: 0;
}
.wiq-qualifier-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wiq-qualifier-btn {
  flex: 1;
  min-width: 110px;
  padding: 10px 8px;
  border: 1.5px solid #D1D5DB;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.08s;
  line-height: 1.3;
}
.wiq-qualifier-btn:hover {
  border-color: #1A6FD4;
  color: #1A6FD4;
  background: #EFF6FF;
}
.wiq-qualifier-btn.active {
  border-color: #1A6FD4;
  background: #1A6FD4;
  color: #fff;
}
.wiq-qualifier-btn:active {
  transform: scale(0.97);
}
.wiq-qualifier-hint {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 8px;
}
/* Score band labels */
.wiq-qualifier-btn .wiq-score-range {
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 2px;
}
.wiq-qualifier-btn .wiq-score-label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.8;
}

/* ══════════════════════════════════════════════════════════════
 * P2-9: FILTER BAR (credit score + loan amount sliders)
 * ══════════════════════════════════════════════════════════════ */
.wiq-filter-bar {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 0 20px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.wiq-filter-group {
  flex: 1;
  min-width: 160px;
}
.wiq-filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wiq-filter-value {
  font-size: 13px;
  font-weight: 700;
  color: #1A6FD4;
}
.wiq-filter-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #1A6FD4 var(--pct, 50%), #E5E7EB var(--pct, 50%));
  outline: none;
  cursor: pointer;
}
.wiq-filter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1A6FD4;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.08s;
}
.wiq-filter-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
}
.wiq-filter-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1A6FD4;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.wiq-filter-purpose {
  flex: 1;
  min-width: 160px;
}
.wiq-filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #D1D5DB;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  cursor: pointer;
  outline: none;
}
.wiq-filter-select:focus {
  border-color: #1A6FD4;
}
.wiq-filter-reset {
  font-size: 11px;
  color: #9CA3AF;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}
.wiq-filter-reset:hover {
  color: #374151;
}

/* ══════════════════════════════════════════════════════════════
 * P0-2: MOBILE CARD-STACK LAYOUT
 * ══════════════════════════════════════════════════════════════ */
.wiq-card-stack {
  display: none; /* shown only on mobile via media query */
}
.wiq-lender-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  position: relative;
  overflow: hidden;
}
.wiq-lender-card.wiq-card-top {
  border-color: #BFDBFE;
  background: #F0F7FF;
}
.wiq-lender-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wiq-lender-logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wiq-lender-logo-wrap img {
  height: 22px;
  width: auto;
  object-fit: contain;
}
.wiq-lender-name {
  font-size: 15px;
  font-weight: 700;
  color: #0B1F3A;
}
.wiq-top-pick-badge {
  background: #1A6FD4;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.wiq-card-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.wiq-card-pill {
  background: #F3F4F6;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: #374151;
  line-height: 1.3;
}
.wiq-card-pill strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0B1F3A;
}
.wiq-card-best-for {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 12px;
  line-height: 1.5;
}
.wiq-card-cta {
  display: block;
  width: 100%;
  padding: 14px;
  background: #1A6FD4;
  color: #fff;
  text-align: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.08s, opacity 0.08s;
  box-sizing: border-box;
}
.wiq-card-cta:active {
  transform: scale(0.97);
  opacity: 0.9;
}
.wiq-card-cta-secondary {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #1A6FD4;
  text-align: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid #1A6FD4;
  transition: transform 0.08s, background 0.12s;
  box-sizing: border-box;
}
.wiq-card-cta-secondary:active {
  transform: scale(0.97);
  background: #EFF6FF;
}
.wiq-card-soft-pull {
  text-align: center;
  font-size: 10px;
  color: #059669;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
/* Swipe dismiss animation */
.wiq-lender-card.wiq-swipe-left {
  transform: translateX(-110%) !important;
  opacity: 0 !important;
}
.wiq-dismiss-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  gap: 3px;
}
/* "Why ranked here?" link on card */
.wiq-why-link {
  font-size: 11px;
  color: #1A6FD4;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  background: none;
  border: none;
  padding: 0;
}
.wiq-why-link:hover {
  text-decoration: underline;
}

/* Show cards on mobile, hide desktop table */
@media (max-width: 767px) {
  .wiq-card-stack {
    display: block;
  }
  .wiq-desktop-table {
    display: none !important;
  }
  .wiq-filter-bar {
    flex-direction: column;
    gap: 16px;
  }
  .wiq-qualifier-btns {
    flex-direction: column;
  }
  .wiq-qualifier-btn {
    flex-direction: row;
    justify-content: space-between;
    padding: 12px 14px;
  }
  .wiq-qualifier-btn .wiq-score-range {
    display: inline;
    margin-bottom: 0;
    margin-right: 6px;
  }
}

/* ══════════════════════════════════════════════════════════════
 * P1-4: STICKY BOTTOM CTA BAR (mobile only)
 * ══════════════════════════════════════════════════════════════ */
.wiq-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  padding: 10px 16px 14px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  transform: translateY(100%);
  transition: transform 0.2s ease-out;
}
.wiq-sticky-bar.wiq-bar-visible {
  transform: translateY(0);
}
.wiq-sticky-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}
.wiq-sticky-bar-text {
  flex: 1;
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
}
.wiq-sticky-bar-text strong {
  display: block;
  font-size: 13px;
  color: #0B1F3A;
}
.wiq-sticky-bar-cta {
  flex-shrink: 0;
  background: #1A6FD4;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.08s, opacity 0.08s;
}
.wiq-sticky-bar-cta:active {
  transform: scale(0.97);
  opacity: 0.9;
}
.wiq-sticky-bar-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9CA3AF;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
@media (max-width: 767px) {
  .wiq-sticky-bar {
    display: block;
  }
}

/* ══════════════════════════════════════════════════════════════
 * P1-5: "WHY RANKED HERE?" TRANSPARENCY MODAL
 * ══════════════════════════════════════════════════════════════ */
.wiq-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.wiq-modal-overlay.wiq-modal-open {
  display: flex;
}
.wiq-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: wiqModalIn 0.2s ease-out;
}
@keyframes wiqModalIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.wiq-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #F3F4F6;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6B7280;
  transition: background 0.1s;
}
.wiq-modal-close:hover {
  background: #E5E7EB;
}
.wiq-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: #0B1F3A;
  margin-bottom: 4px;
  padding-right: 36px;
}
.wiq-modal-subtitle {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 20px;
}
.wiq-score-row {
  margin-bottom: 14px;
}
.wiq-score-row-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.wiq-score-row-score {
  font-size: 12px;
  font-weight: 700;
  color: #1A6FD4;
}
.wiq-score-bar-track {
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
}
.wiq-score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #1A6FD4, #0ea5e9);
  transition: width 0.4s ease-out;
}
.wiq-modal-strength {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #166534;
  margin-top: 16px;
  line-height: 1.6;
}
.wiq-modal-weakness {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #92400E;
  margin-top: 10px;
  line-height: 1.6;
}
.wiq-modal-strength strong,
.wiq-modal-weakness strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  opacity: 0.75;
}
/* "Why ranked here?" link in desktop table */
.wiq-why-ranked {
  font-size: 11px;
  color: #1A6FD4;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  display: block;
  margin-top: 3px;
}

/* ══════════════════════════════════════════════════════════════
 * P1-6: APR-TO-MONTHLY-PAYMENT CALCULATOR
 * ══════════════════════════════════════════════════════════════ */
.wiq-calc-widget {
  background: linear-gradient(135deg, #F0F7FF 0%, #EFF6FF 100%);
  border: 1px solid #BFDBFE;
  border-radius: 14px;
  padding: 20px 24px;
  margin: 0 0 24px;
}
.wiq-calc-title {
  font-size: 14px;
  font-weight: 700;
  color: #0B1F3A;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wiq-calc-title svg {
  color: #1A6FD4;
}
.wiq-calc-inputs {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 16px;
}
.wiq-calc-group {
  flex: 1;
  min-width: 140px;
}
.wiq-calc-group label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  margin-bottom: 6px;
}
.wiq-calc-group label span {
  font-size: 13px;
  font-weight: 700;
  color: #1A6FD4;
  text-transform: none;
  letter-spacing: 0;
}
.wiq-calc-term-btns {
  display: flex;
  gap: 6px;
}
.wiq-term-btn {
  flex: 1;
  padding: 8px 4px;
  border: 1.5px solid #D1D5DB;
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.wiq-term-btn.active {
  border-color: #1A6FD4;
  background: #1A6FD4;
  color: #fff;
}
.wiq-calc-result {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid #BFDBFE;
}
.wiq-calc-monthly {
  font-size: 28px;
  font-weight: 800;
  color: #0B1F3A;
  line-height: 1;
}
.wiq-calc-monthly-label {
  font-size: 11px;
  color: #6B7280;
  margin-top: 3px;
}
.wiq-calc-breakdown {
  font-size: 11px;
  color: #6B7280;
  line-height: 1.7;
  text-align: right;
}
.wiq-calc-breakdown strong {
  color: #374151;
}
.wiq-calc-note {
  font-size: 10px;
  color: #9CA3AF;
  margin-top: 10px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
 * P2-7: INLINE JARGON TOOLTIPS
 * ══════════════════════════════════════════════════════════════ */
.wiq-tooltip-trigger {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
}
.wiq-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #6B7280;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.1s;
  vertical-align: middle;
}
.wiq-tooltip-trigger:hover .wiq-tooltip-icon,
.wiq-tooltip-trigger.wiq-tt-open .wiq-tooltip-icon {
  background: #1A6FD4;
  color: #fff;
}
.wiq-tooltip-box {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0B1F3A;
  color: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  width: 240px;
  font-size: 12px;
  line-height: 1.6;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  pointer-events: none;
}
.wiq-tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #0B1F3A;
}
.wiq-tooltip-trigger.wiq-tt-open .wiq-tooltip-box,
.wiq-tooltip-trigger:hover .wiq-tooltip-box {
  display: block;
  animation: wiqFadeIn 0.15s ease-out;
}
@keyframes wiqFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.wiq-tooltip-def {
  margin-bottom: 6px;
}
.wiq-tooltip-example {
  font-size: 11px;
  opacity: 0.75;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 6px;
  margin-top: 4px;
}
.wiq-tooltip-benchmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  margin-top: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
}

/* Tooltip on mobile: position below trigger */
@media (max-width: 767px) {
  .wiq-tooltip-box {
    bottom: auto;
    top: calc(100% + 8px);
    font-size: 11px;
    width: 200px;
  }
  .wiq-tooltip-box::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #0B1F3A;
  }
}

/* ══════════════════════════════════════════════════════════════
 * CTA HIERARCHY — single primary per viewport
 * ══════════════════════════════════════════════════════════════ */
/* Ensure only the first Check Rate button in a table is primary blue;
   subsequent ones become ghost buttons */
.wiq-cta-secondary-style {
  background: transparent !important;
  color: #1A6FD4 !important;
  border: 1.5px solid #1A6FD4 !important;
  padding: 7px 12px !important;
}
.wiq-cta-secondary-style:hover {
  background: #EFF6FF !important;
}

/* ══════════════════════════════════════════════════════════════
 * GENERAL BUTTON PRESS FEEDBACK
 * ══════════════════════════════════════════════════════════════ */
a[href*="upstart"], a[href*="avant"], a[href*="sofi"],
a[href*="bestegg"], a[href*="lending"], a[href*="discover"],
a[href*="marcus"], a[href*="lightstream"], a[href*="prosper"] {
  transition: transform 0.08s ease-in, opacity 0.08s ease-in;
}
a[href*="upstart"]:active, a[href*="avant"]:active, a[href*="sofi"]:active,
a[href*="bestegg"]:active, a[href*="lending"]:active, a[href*="discover"]:active,
a[href*="marcus"]:active, a[href*="lightstream"]:active, a[href*="prosper"]:active {
  transform: scale(0.97);
  opacity: 0.85;
}
