/*
 * Money Swap Engine — Interactive Tool Styles
 * swap.phoenixareahome.com/tools/money
 * Accent: cyan (#0891b2)
 */

/* === Tool Hero === */

.engine-hero {
  background: #fff;
  padding: 3.5rem 1.5rem 2.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.engine-hero-inner {
  max-width: 860px;
  margin: 0 auto;
}

.engine-hero-tag {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #0891b2;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.engine-hero-inner h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  color: #0f172a;
  margin: 0 0 1rem;
}

.engine-hero-inner .lead {
  font-size: 1.1875rem;
  color: #334155;
  line-height: 1.6;
  max-width: 640px;
  margin: 0;
}

/* === Input Panel === */

.engine-inputs {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 2.5rem 1.5rem;
}

.engine-inputs-inner {
  max-width: 700px;
  margin: 0 auto;
}

.engine-field {
  margin-bottom: 2rem;
}

.engine-field:last-child {
  margin-bottom: 0;
}

.engine-label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

/* City selector */

.engine-city-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.city-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 1rem 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
}

.city-btn:hover {
  border-color: #0891b2;
  background: #f0fdfa;
}

.city-btn.active {
  border-color: #0891b2;
  background: #ecfeff;
}

.city-btn-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.city-btn-state {
  font-size: 0.875rem;
  color: #64748b;
}

.city-btn.active .city-btn-name {
  color: #0891b2;
}

.city-btn.active .city-btn-state {
  color: #334155;
}

/* Income slider */

.engine-slider-wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

#income-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: #e2e8f0;
  border-radius: 4px;
  outline: none;
}

#income-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0891b2;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

#income-slider::-moz-range-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0891b2;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

#income-slider:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 4px;
}

.engine-slider-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  min-width: 120px;
  text-align: right;
}

/* Tenure toggle */

.engine-toggle-group {
  display: flex;
  gap: 0;
  margin-bottom: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.tenure-btn {
  padding: 0.625rem 1.5rem;
  border: none;
  background: #fff;
  font-size: 1rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}

.tenure-btn:first-child {
  border-right: 1px solid #e2e8f0;
}

.tenure-btn.active {
  background: #0891b2;
  color: #fff;
}

.tenure-btn:hover:not(.active) {
  background: #f1f5f9;
}

/* Home value input */

.engine-home-input {
  margin-top: 0.25rem;
}

.engine-input-wrap {
  display: flex;
  align-items: center;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  max-width: 280px;
  transition: border-color 0.15s;
}

.engine-input-wrap:focus-within {
  border-color: #0891b2;
}

.engine-input-prefix {
  padding: 0 0 0 0.875rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #475569;
}

#home-value {
  border: none;
  padding: 0.75rem 0.875rem 0.75rem 0.375rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  background: transparent;
  width: 100%;
  outline: none;
  font-family: inherit;
}

/* === Results Panel === */

.engine-results {
  padding: 3rem 1.5rem;
  background: #fff;
}

.engine-results-inner {
  max-width: 860px;
  margin: 0 auto;
}

/* Surplus hero */

.engine-result-hero {
  text-align: center;
  padding: 2rem 1rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.engine-result-hero:has(.negative),
.engine-result-hero.is-negative {
  background: #fef2f2;
  border-color: #fecaca;
}

.engine-result-label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.5rem;
}

.engine-result-amount {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.engine-result-amount.positive {
  color: #15803d;
}

.engine-result-amount.negative {
  color: #dc2626;
}

.engine-result-note {
  font-size: 1rem;
  color: #475569;
}

/* Cards grid */

.engine-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.engine-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.5rem;
}

.engine-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
}

/* Tax card */

.engine-tax-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.engine-tax-row:last-of-type {
  border-bottom: none;
}

.engine-tax-label {
  font-size: 0.9375rem;
  color: #475569;
}

.engine-tax-amount {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.engine-tax-delta-wrap {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid #e2e8f0;
}

.engine-tax-delta {
  display: block;
  font-size: 1.125rem;
  font-weight: 800;
  text-align: center;
}

.engine-tax-delta.positive {
  color: #15803d;
}

.engine-tax-delta.negative {
  color: #dc2626;
}

.engine-tax-warning {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  font-size: 1rem;
  color: #92400e;
  line-height: 1.5;
}

/* Equity card */

.engine-equity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.engine-equity-row:last-of-type {
  border-bottom: none;
}

.engine-equity-row--highlight {
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  border-top: 2px solid #e2e8f0;
  border-bottom: none;
}

.engine-equity-label {
  font-size: 0.9375rem;
  color: #475569;
}

.engine-equity-value {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.engine-equity-highlight {
  font-size: 1.25rem;
  font-weight: 800;
  color: #15803d;
}

.engine-equity-gap {
  font-size: 1.25rem;
  font-weight: 800;
  color: #dc2626;
}

.engine-equity-description {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.engine-equity-description p {
  font-size: 0.9375rem;
  color: #334155;
  line-height: 1.55;
  margin: 0;
}

/* Cost table */

.engine-cost-section {
  margin-bottom: 2rem;
}

.engine-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem;
}

.engine-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.engine-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  min-width: 520px;
}

.engine-table thead {
  background: #f1f5f9;
}

.engine-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.engine-table td,
.engine-table tbody th {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}

.engine-table tbody th {
  font-weight: 600;
  text-align: left;
}

.engine-table tbody tr:last-child td,
.engine-table tbody tr:last-child th {
  border-bottom: none;
}

.engine-table tbody tr:hover {
  background: #f8fafc;
}

.engine-total {
  border-top: 2px solid #e2e8f0;
  background: #f8fafc;
}

.engine-total th,
.engine-total td {
  font-weight: 800;
  font-size: 1rem;
  padding: 12px 14px;
}

.engine-diff.positive {
  color: #15803d;
  font-weight: 700;
}

.engine-diff.negative {
  color: #dc2626;
  font-weight: 700;
}

.engine-table-note {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.4;
}

/* Insight callout */

.engine-insight {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  padding: 1.5rem;
}

.engine-insight-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0891b2;
  margin: 0 0 0.5rem;
}

.engine-insight-text {
  font-size: 1rem;
  color: #334155;
  line-height: 1.6;
  margin: 0;
}

/* === Loading === */

.engine-loading {
  text-align: center;
  padding: 4rem 1.5rem;
  color: #64748b;
  font-size: 1.0625rem;
}

/* === CTA === */

.engine-cta-section {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 3rem 1.5rem;
}

.engine-cta-inner {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.engine-cta-inner h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.75rem;
}

.engine-cta-inner p {
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

/* === Responsive === */

@media (max-width: 767px) {
  .engine-hero-inner h1 {
    font-size: 1.875rem;
  }

  .engine-city-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .engine-slider-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .engine-slider-value {
    text-align: center;
  }

  .engine-cards {
    grid-template-columns: 1fr;
  }

  .engine-result-amount {
    font-size: 2.5rem;
  }

  .engine-results {
    padding: 2rem 1rem;
  }

  .engine-inputs {
    padding: 2rem 1rem;
  }

  .engine-hero {
    padding: 2.5rem 1rem 2rem;
  }
}

@media (max-width: 480px) {
  .city-btn {
    padding: 0.75rem 0.25rem;
  }

  .city-btn-name {
    font-size: 0.875rem;
  }

  .engine-input-wrap {
    max-width: 100%;
  }
}
