/* =============================================================
   Mortgage Calculator — mortgage-calculator.css
   Mobile-first. Scoped to .mc-wrap. Zero global pollution.
   ============================================================= */

/* ── Reset & base ─────────────────────────────────────────── */
.mc-wrap *, .mc-wrap *::before, .mc-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.mc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #1e293b;
  max-width: 1000px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────── */
.mc-header {
  padding: 24px 24px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}
.mc-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 4px;
}
.mc-subtitle {
  font-size: 13.5px;
  color: #64748b;
}

/* ── Body layout ──────────────────────────────────────────── */
.mc-body {
  display: flex;
  flex-direction: column;
}

/* Desktop: side by side */
@media (min-width: 720px) {
  .mc-body {
    flex-direction: row;
    align-items: flex-start;
  }
  .mc-inputs  { width: 55%; border-right: 1px solid #e2e8f0; }
  .mc-results { width: 45%; position: sticky; top: 0; }
}

/* ── Inputs panel ─────────────────────────────────────────── */
.mc-inputs {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mc-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mc-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.mc-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}
.mc-val-badge {
  font-size: 13px;
  font-weight: 700;
  color: #185FA5;
  background: #E6F1FB;
  padding: 2px 10px;
  border-radius: 20px;
}
.mc-val-hint {
  font-size: 11.5px;
  color: #94a3b8;
}
.mc-pmi-note {
  font-size: 11px;
  color: #E24B4A;
  font-weight: 400;
}

/* Slider */
.mc-slider {
  width: 100%;
  height: 5px;
  accent-color: #185FA5;
  cursor: pointer;
  border-radius: 4px;
}

/* Number inputs */
.mc-input-prefix-wrap,
.mc-input-suffix-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  transition: border-color .18s;
}
.mc-input-prefix-wrap:focus-within,
.mc-input-suffix-wrap:focus-within {
  border-color: #185FA5;
  background: #fff;
}
.mc-prefix, .mc-suffix {
  padding: 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  height: 42px;
  display: flex;
  align-items: center;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.mc-suffix {
  border-right: none;
  border-left: 1px solid #e2e8f0;
}
.mc-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 12px;
  height: 42px;
  font-size: 14px;
  color: #1e293b;
  outline: none;
  min-width: 0;
  -moz-appearance: textfield;
}
.mc-input::-webkit-outer-spin-button,
.mc-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Two-col input row */
.mc-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Term buttons */
.mc-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.mc-term-btn {
  padding: 10px 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: #f8fafc;
  color: #475569;
  transition: all .15s;
}
.mc-term-btn.active {
  background: #185FA5;
  border-color: #185FA5;
  color: #fff;
}
.mc-term-btn:hover:not(.active) {
  border-color: #185FA5;
  color: #185FA5;
}

/* Divider */
.mc-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.mc-divider::before,
.mc-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ── Results panel ────────────────────────────────────────── */
.mc-results {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}

/* Monthly payment card */
.mc-payment-card {
  background: #185FA5;
  border-radius: 12px;
  padding: 22px 20px;
  text-align: center;
  color: #fff;
}
.mc-payment-label {
  font-size: 13px;
  font-weight: 600;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.mc-payment-amount {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
}
.mc-payment-sub {
  font-size: 12px;
  opacity: .7;
  margin-top: 6px;
}

/* Breakdown */
.mc-breakdown {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}
.mc-breakdown-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 12px;
}
.mc-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.mc-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mc-bk-label {
  flex: 1;
  font-size: 13px;
  color: #475569;
}
.mc-bk-amount {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.mc-bar-wrap {
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-bottom: 10px;
  overflow: hidden;
}
.mc-bar {
  height: 6px;
  border-radius: 4px;
  transition: width .4s ease;
}

/* Stats grid */
.mc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mc-stat {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
.mc-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
  margin-bottom: 4px;
}
.mc-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
}

/* Extra payment */
.mc-extra-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.mc-extra-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: #185FA5;
  user-select: none;
}
.mc-extra-toggle:hover { background: #f1f5f9; }
.mc-extra-icon {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  transition: transform .2s;
}
.mc-extra-icon.open { transform: rotate(45deg); }
.mc-extra-body {
  padding: 0 16px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mc-extra-result {
  font-size: 13px;
  color: #1D9E75;
  font-weight: 600;
  background: #E1F5EE;
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.6;
}

/* Amortization button */
.mc-amort-btn {
  width: 100%;
  padding: 12px;
  border: 1.5px solid #185FA5;
  border-radius: 10px;
  background: transparent;
  color: #185FA5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.mc-amort-btn:hover {
  background: #185FA5;
  color: #fff;
}

/* ── Amortization Table ────────────────────────────────────── */
.mc-amort-section {
  border-top: 1px solid #e2e8f0;
  padding: 20px;
}
.mc-amort-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.mc-amort-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a5f;
}
.mc-amort-toggle-wrap {
  display: flex;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.mc-amort-view-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
}
.mc-amort-view-btn.active {
  background: #185FA5;
  color: #fff;
}
.mc-amort-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.mc-amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 320px;
}
.mc-amort-table th {
  background: #1e3a5f;
  color: #fff;
  padding: 10px 14px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.mc-amort-table th:first-child { text-align: left; }
.mc-amort-table td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.mc-amort-table td:first-child { text-align: left; font-weight: 600; }
.mc-amort-table tr:nth-child(even) td { background: #f8fafc; }
.mc-amort-table tr:last-child td { border-bottom: none; }

/* ── Mobile overrides ──────────────────────────────────────── */
@media (max-width: 480px) {
  .mc-header    { padding: 18px 16px 14px; }
  .mc-inputs, .mc-results { padding: 16px; }
  .mc-title     { font-size: 19px; }
  .mc-payment-amount { font-size: 34px; }
  .mc-stats     { grid-template-columns: 1fr 1fr; }
  .mc-btn-group { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .mc-term-btn  { font-size: 12px; padding: 9px 0; }
}

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .mc-inputs, .mc-amort-btn, .mc-extra-toggle { display: none !important; }
  .mc-body { display: block; }
  .mc-results { width: 100%; background: #fff; }
  .mc-wrap { border: none; }
}
