/* ============================================================
   LOANS N STUFF — Component Styles
   ============================================================ */

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-primary);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition:
    background-color var(--duration-base) var(--ease-default),
    box-shadow var(--duration-base) var(--ease-default),
    transform var(--duration-fast) var(--ease-spring),
    color var(--duration-fast) var(--ease-default);
  position: relative;
  overflow: hidden;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0px); }

.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-text-on-primary);
  padding: 13px var(--space-6);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
  background-color: var(--color-primary-dark);
  box-shadow: 0 12px 40px rgba(116,68,245,0.35), 0 4px 12px rgba(116,68,245,0.2);
  text-decoration: none;
  color: var(--color-text-on-primary);
}

.btn-primary-lg {
  padding: 16px var(--space-8);
  font-size: var(--text-md);
  border-radius: var(--radius-full);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  padding: 13px var(--space-6);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border-strong);
}
.btn-secondary:hover {
  background-color: var(--color-hover-warm);
  border-color: var(--color-primary);
  color: var(--color-primary);
  text-decoration: none;
}

.btn-secondary-lg {
  padding: 16px var(--space-8);
  font-size: var(--text-md);
}

.btn-ghost {
  color: var(--color-primary);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--duration-fast) var(--ease-default);
  text-decoration: none;
}
.btn-ghost:hover {
  border-bottom-color: var(--color-primary);
  text-decoration: none;
}

/* ── CARDS ── */
.card {
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition:
    background-color var(--duration-base) var(--ease-default),
    box-shadow var(--duration-base) var(--ease-default),
    border-color var(--duration-base) var(--ease-default),
    transform var(--duration-base) var(--ease-out);
}
.card:hover {
  background: var(--color-hover-warm);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-primary);
  transform: translateY(-2px);
}

.card-xl {
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}

/* ── SCREENSHOT PLACEHOLDER ── */
.screenshot-placeholder {
  position: relative;
  width: 100%;
  background: var(--color-bg-secondary);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  overflow: hidden;
  transition: border-color var(--duration-base) var(--ease-default);
}
.screenshot-placeholder:hover {
  border-color: var(--color-primary);
}

/* Image inside placeholder — replaces the icon/label pattern */
.ph-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  border-radius: inherit;
  display: block;
  position: relative;
  z-index: 1;
}
.screenshot-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--color-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.5;
}
.screenshot-placeholder .ph-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  background: var(--color-primary-tint);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}
.screenshot-placeholder .ph-label {
  position: relative;
  z-index: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.screenshot-placeholder .ph-sublabel {
  position: relative;
  z-index: 1;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  opacity: 0.7;
}

.ph-hero    { aspect-ratio: 16/10; min-height: 340px; }
.ph-feature { aspect-ratio: 16/10; min-height: 280px; }
.ph-dashboard { aspect-ratio: 16/9; min-height: 360px; }

@media (max-width: 600px) {
  .ph-hero, .ph-feature, .ph-dashboard {
    min-height: auto;
    aspect-ratio: auto;
  }
  .screenshot-placeholder {
    display: block;
  }
  .ph-img {
    height: auto;
  }
}

/* ── ICON PILL ── */
.icon-pill {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-pill-purple { background: var(--color-primary-tint); color: var(--color-primary); }
.icon-pill-green  { background: #E6F9EE; color: #1F9A00; }
.icon-pill-blue   { background: #E8F0FE; color: #118AE0; }
.icon-pill-orange { background: #FEF0E6; color: #E07B18; }
.icon-pill-red    { background: #FEE9E7; color: #FC3A27; }

/* ── SECTION EYEBROW ── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
  background: var(--color-primary-tint);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-4);
}

/* ── BADGE ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-full);
  padding: 3px var(--space-3);
}
.badge-purple { background: var(--color-primary-tint); color: var(--color-primary); }
.badge-green  { background: #E6F9EE; color: #1F9A00; }
.badge-red    { background: #FEE9E7; color: #FC3A27; }

/* ── WORDMARK ── */
.wordmark {
  font-size: 1.3rem;
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.wordmark-loans { color: var(--color-primary); }
.wordmark-n     { color: var(--color-accent-red); }
.wordmark-space { display: inline; }
.wordmark-stuff { color: var(--color-text); }

/* ── CHIP ROW (for team features) ── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}
.chip svg { color: var(--color-primary); flex-shrink: 0; }

/* ── AI INSIGHT CARD ── */
.ai-insight-card {
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.ai-insight-row {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  align-items: flex-start;
}
.ai-insight-row:last-child { border-bottom: none; }
.ai-insight-row-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  min-width: 90px;
  padding-top: 2px;
}
.ai-insight-row-content {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  flex: 1;
}
.ai-insight-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ai-insight-header span {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: rgba(255,255,255,0.9);
}

/* ── WORKFLOW STEP ── */
.workflow-step {
  flex: 1;
  min-width: 0;
  position: relative;
}
.workflow-step-inner {
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  height: 100%;
  transition:
    border-color var(--duration-base) var(--ease-default),
    box-shadow var(--duration-base) var(--ease-default),
    transform var(--duration-base) var(--ease-out);
}
.workflow-step-inner:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-alpha), var(--shadow-md);
  transform: translateY(-3px);
}
.workflow-step-number {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.workflow-step-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
}
.workflow-step-desc {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* ── DIVIDER ── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  margin: 0;
}

/* ── GRADIENT TEXT ── */
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, var(--color-primary-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── SECTION TITLE BLOCK ── */
.section-title-block {
  text-align: center;
  max-width: 680px;
  margin: 0 auto var(--space-16);
}
.section-title-block h2 {
  margin-bottom: var(--space-4);
}
.section-title-block p {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* ── PROBLEM BULLETS ── */
.problem-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}
.problem-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  box-shadow: var(--shadow-sm);
}
.problem-item::before {
  content: '—';
  color: var(--color-accent-red);
  font-weight: var(--weight-bold);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── THEME TOGGLE BUTTON ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--color-hover-warm);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.theme-toggle svg { pointer-events: none; }

/* ── MODAL ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: visibility var(--duration-base) var(--ease-default), opacity var(--duration-base) var(--ease-default);
}

.modal.open {
  visibility: visible;
  opacity: 1;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--color-bg-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--duration-base) var(--ease-out);
}

.modal.open .modal-content {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

.modal-close:hover {
  background-color: var(--color-hover-warm);
  color: var(--color-primary);
}

.modal-header {
  text-align: center;
  margin-bottom: var(--space-6);
}

.modal-header h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
}

.modal-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}

/* ── FORM ── */
.form-row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}
.form-group {
  margin-bottom: var(--space-4);
  text-align: left;
}
.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.form-group .required {
  color: var(--color-accent-red);
}
.form-control {
  width: 100%;
  padding: 12px var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.form-control::placeholder {
  color: var(--color-text-tertiary);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-alpha);
}

.was-validated .form-control:invalid {
  border-color: var(--color-accent-red);
}
.was-validated .form-control:invalid:focus {
  box-shadow: 0 0 0 3px rgba(252, 58, 39, 0.2);
}
.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--color-accent-red);
}
.was-validated .form-control:invalid ~ .invalid-feedback {
  display: block;
}
.btn-block {
  width: 100%;
}
.form-actions {
  margin-top: var(--space-6);
}
.form-message {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  text-align: center;
}
.form-message.success {
  background-color: #E6F9EE;
  color: #1F9A00;
  border: 1px solid #1F9A00;
}
.form-message.error {
  background-color: #FEE9E7;
  color: #FC3A27;
  border: 1px solid #FC3A27;
}

/* Loader spinner */
.loader {
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-left: 8px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
    gap: var(--space-4);
  }
}

/* ── TOAST NOTIFICATION ── */
.toast {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  transform: translateY(-20px);
  background: var(--color-bg-paper);
  color: var(--color-text);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-weight: var(--weight-medium);
  font-size: var(--text-base);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: transform var(--duration-base) var(--ease-spring), opacity var(--duration-base) var(--ease-default), visibility var(--duration-base) var(--ease-default);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast.success {
  border-left: 4px solid #1F9A00;
}
.toast.success::before {
  content: '✓';
  color: #1F9A00;
  font-weight: bold;
}

/* ── SAMPLE COMPARE MODAL ── */
.modal-content-large {
  max-width: 900px;
  background-color: var(--color-bg);
  padding: var(--space-4);
}
.sample-modal-header {
  text-align: left;
  margin-bottom: var(--space-3);
}
.sample-modal-title {
  font-size: 13px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.scenarios-container {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.scenario-card {
  flex: 1;
  min-width: 320px;
  background: var(--color-bg-paper);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
}

.scenario-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  padding: var(--space-2) 0 var(--space-1);
}

.scenario-border {
  height: 4px;
  border-radius: 4px 4px 0 0;
  margin-bottom: var(--space-3);
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
}
.scenario-card:nth-child(2) .scenario-border {
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
}
.scenario-card:nth-child(1) .scenario-title { color: #3b82f6 !important; }
.scenario-card:nth-child(2) .scenario-title { color: #8b5cf6 !important; }

.scenario-inner {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--color-bg-paper);
}

.dti-box {
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  gap: var(--space-3);
}
.dti-badge {
  background: var(--color-primary-tint);
  color: var(--color-primary);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  padding: 2px 6px;
  border-radius: var(--radius-md);
}
.dti-stats {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
}
.dti-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dti-label {
  font-size: 10px;
  color: var(--color-text-secondary);
  line-height: 1.2;
}
.dti-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}
.dti-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  padding: 2px 6px;
  border-radius: 12px;
  margin-top: 2px;
}
.dti-strong {
  color: #1F9A00;
  background: #E6F9EE;
}
.dti-high {
  color: #FC3A27;
  background: #FEE9E7;
}
.dti-divider {
  width: 1px;
  height: 40px;
  background: var(--color-border);
  margin: 0 var(--space-2);
}

.scenario-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-4);
}
.scenario-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.scenario-row strong {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
}

.highlight-row {
  background: var(--color-bg);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  margin-top: 4px;
}
.highlight-row span, .highlight-row strong {
  color: var(--color-text);
  font-size: 14px;
}

.total-row {
  background: var(--color-primary-tint);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  margin-top: 4px;
}
.total-row span, .total-row strong {
  color: var(--color-primary);
  font-size: 14px;
  font-weight: var(--weight-bold);
}

.transaction-summary {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-title {
  font-size: 10px;
  color: var(--color-text-tertiary);
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

.cash-to-borrower {
  background: #E6F9EE;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  margin-top: 4px;
  border: 1px solid #10b981;
}
.cash-to-borrower span, .cash-to-borrower strong {
  color: #1F9A00;
  font-size: 14px;
  font-weight: var(--weight-bold);
}

@media (max-width: 768px) {
  .modal-content.modal-content-large {
    padding: var(--space-3) var(--space-2);
  }
  .scenarios-container {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-2);
    gap: var(--space-3);
    -webkit-overflow-scrolling: touch;
  }
  .scenario-card {
    min-width: 88vw;
    scroll-snap-align: center;
  }
  .scenario-inner {
    padding: var(--space-3);
  }
  .scenario-row {
    font-size: 12px;
  }
  .highlight-row span, .highlight-row strong,
  .total-row span, .total-row strong,
  .cash-to-borrower span, .cash-to-borrower strong {
    font-size: 13px;
  }
}
