/* Loan Payoff Simulator */

#sim-app {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
}

.sim-body {
  flex: 1;
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  overflow-y: auto;
}

.sim-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sim-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

/* Loan Cards */
.loan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

.loan-card-row {
  display: flex;
  gap: 0.5rem;
}

.loan-card-row .sim-input {
  flex: 1;
}

.sim-input {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sim-input label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sim-input input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.sim-input input:focus {
  border-color: var(--accent);
}

.sim-input input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.btn-remove-loan {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.btn-remove-loan:hover {
  color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
}

.btn-add-loan {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-add-loan:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Strategy Toggle */
.strategy-toggle {
  display: flex;
  gap: 0.5rem;
}

.strategy-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.strategy-btn .strategy-hint {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
}

.strategy-btn.active {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
  color: var(--text);
}

.strategy-btn:hover:not(.active) {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.slider-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.sim-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
  cursor: pointer;
  transition: transform 0.15s;
}

.sim-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.sim-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
  cursor: pointer;
}

.slider-bounds {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Stats */
.sim-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.sim-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.sim-stat-card.highlight {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.05);
}

.sim-stat-card.highlight .stat-value {
  color: #4ade80;
}

/* Chart */
.sim-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
}

.sim-chart-wrap canvas {
  width: 100% !important;
  max-height: 300px;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.min-dot {
  background: rgba(160, 160, 176, 0.6);
}

.chosen-dot {
  background: var(--accent);
}

/* Savings Banner */
.savings-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04));
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: bannerPulse 0.4s ease-out;
}

.savings-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.savings-message {
  font-size: 0.95rem;
  font-weight: 600;
  color: #4ade80;
  line-height: 1.4;
}

@keyframes bannerPulse {
  0% { transform: scale(0.97); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* CTA Banner */
.cta-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.1), rgba(233, 69, 96, 0.03));
  border: 1px solid rgba(233, 69, 96, 0.3);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.cta-banner:hover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.12);
}

.cta-content {
  flex: 1;
}

.cta-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cta-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.cta-arrow {
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
  font-weight: 700;
}

/* Loan Breakdown Table */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.breakdown-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.breakdown-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.breakdown-table .loan-name {
  font-weight: 600;
}

.breakdown-table .paid-off-tag {
  display: inline-block;
  padding: 0.15em 0.5em;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 0.5em;
}

/* Mobile */
@media (max-width: 640px) {
  #sim-app {
    max-width: 100%;
  }

  .sim-body {
    padding: 1.25rem 1rem 3rem;
  }

  .loan-card-row {
    flex-direction: column;
  }

  .sim-stats {
    grid-template-columns: 1fr 1fr;
  }

  .strategy-toggle {
    flex-direction: column;
  }

  .sim-input input {
    font-size: 16px;
  }
}
