/* ============================================
   CALCULATOR STYLES – Enhanced
   ============================================ */

/* ---- Form ---- */
.calc-page { min-height: calc(100vh - 200px); }

.calc-page__hero {
  max-width: 1400px; margin: 0 auto;
  padding: 2rem 2rem 1.5rem; text-align: center;
  border-bottom: 1px solid #f3f4f6;
}
.calc-page__hero h1 { font-size: 2.25rem; font-weight: 800; color: #1a365d; margin-bottom: .5rem; }
.calc-page__hero p  { color: #6b7280; font-size: 1.125rem; }

.calc-layout {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 320px;
  gap: 2rem; padding: 2rem;
}

/* FORM CARD */
.calc-card {
  background: #fff; border-radius: 16px;
  border: 1px solid #e5e7eb; padding: 2rem;
  box-shadow: 0 4px 6px rgba(0,0,0,.07);
}
.calc-card__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.75rem; padding-bottom: 1.25rem;
  border-bottom: 2px solid #f3f4f6;
}
.calc-card__title { font-size: 1.5rem; font-weight: 700; color: #1a365d; }

.reset-btn {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border: 1.5px solid #d1d5db;
  border-radius: 8px; background: transparent;
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: all .2s;
}
.reset-btn:hover { border-color: #1a365d; color: #1a365d; background: #f9fafb; }

/* SECTION HEADERS */
.section-head {
  font-size: 1rem; font-weight: 700; color: #1a365d;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: .75rem; margin: 1.5rem 0 1.25rem;
}
.section-head:first-of-type { margin-top: 0; }

/* FIELD */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field-row .field { margin-bottom: 0; }

label.field-label { font-size: .9rem; font-weight: 600; color: #111827; }
.field-hint       { font-size: .78rem; color: #6b7280; margin-top: .2rem; }

.input-wrap {
  display: flex; align-items: center;
  border: 2px solid #e5e7eb; border-radius: 10px;
  background: #fff; transition: all .2s; overflow: hidden;
}
.input-wrap:focus-within { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.input-wrap--error { border-color: #f43f5e !important; }
.input-wrap--prefix { padding-left: 1rem; }
.input-wrap--suffix { padding-right: 1rem; }
.input-affix { font-size: .95rem; font-weight: 600; color: #6b7280; flex-shrink: 0; }

.field-input {
  flex: 1; padding: .75rem 1rem;
  border: none; background: transparent;
  font-size: 1rem; color: #111827; font-family: inherit;
}
.field-input::placeholder { color: #9ca3af; }
.field-input:focus { outline: none; }

/* RADIO */
.radio-group { display: flex; flex-direction: column; gap: .75rem; }
.radio-item  { display: flex; align-items: flex-start; gap: .75rem; cursor: pointer; }
.radio-item input[type="radio"] {
  margin-top: 3px; accent-color: #10b981;
  width: 18px; height: 18px; flex-shrink: 0;
}
.radio-label strong { display: block; font-weight: 600; color: #111827; font-size: .95rem; }
.radio-label small  { color: #6b7280; font-size: .82rem; }

/* SUBMIT */
.calc-submit {
  display: flex; align-items: center; justify-content: center;
  gap: .75rem; width: 100%; padding: 1rem 2rem; margin-top: 1.5rem;
  background: linear-gradient(135deg, #10b981, #6ee7b7);
  color: #fff; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: all .2s; box-shadow: 0 4px 12px rgba(16,185,129,.3);
}
.calc-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,185,129,.4); }
.calc-submit:active { transform: translateY(0); }

/* ---- SIDEBAR ---- */
.calc-sidebar {
  background: linear-gradient(135deg, #1a365d 0%, #2d5a8c 100%);
  border-radius: 16px; padding: 1.75rem;
  color: #fff; height: fit-content; position: sticky; top: 90px;
}
.sidebar-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1.25rem; }
.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-section-title {
  font-size: .9rem; font-weight: 600; opacity: .9;
  border-bottom: 1px solid rgba(255,255,255,.2);
  padding-bottom: .6rem; margin-bottom: .75rem;
}
.sidebar-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.sidebar-list li {
  font-size: .85rem; opacity: .9; display: flex; align-items: flex-start;
  gap: .5rem; line-height: 1.5;
}
.sidebar-list li::before { content: '✓'; color: #6ee7b7; font-weight: 700; flex-shrink: 0; }
.sidebar-tip {
  background: rgba(255,255,255,.1); border-radius: 8px;
  padding: .875rem; font-size: .8rem; line-height: 1.6;
}
.sidebar-tip strong { display: block; color: #6ee7b7; margin-bottom: .3rem; }

/* ---- RESULTS SECTION ---- */
.results { margin-top: 2rem; }

.results-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 3rem; gap: 1rem;
  background: #f9fafb; border-radius: 12px;
  border: 2px dashed #e5e7eb;
}
.results-empty svg { color: #d1d5db; }
.results-empty h3 { font-size: 1.125rem; color: #374151; }
.results-empty p  { color: #6b7280; font-size: .9rem; max-width: 320px; }

/* MONTHLY HERO */
.results-hero {
  background: #fff; border-radius: 12px;
  border: 2px solid #10b981; text-align: center; padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.results-hero__label { font-size: .8rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; }
.results-hero__amount { font-size: 2.75rem; font-weight: 800; color: #10b981; line-height: 1.2; }
.results-hero__sub { font-size: .85rem; color: #6b7280; margin-top: .25rem; }

/* STATS ROW */
.results-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff; padding: 1rem; border-radius: 10px;
  border: 1px solid #e5e7eb; transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.stat-card__label { font-size: .8rem; color: #6b7280; margin-bottom: .3rem; }
.stat-card__value { font-size: 1.15rem; font-weight: 700; color: #1a365d; }
.stat-card__value--red   { color: #f43f5e; }
.stat-card__value--green { color: #10b981; }

/* CHART BAR */
.results-chart { background: #fff; padding: 1.25rem; border-radius: 10px; border: 1px solid #e5e7eb; margin-bottom: 1.5rem; }
.results-chart__title { font-size: .9rem; font-weight: 600; color: #111827; margin-bottom: .75rem; }
.chart-bar { display: flex; height: 36px; border-radius: 8px; overflow: hidden; gap: 2px; }
.chart-bar__segment {
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 600; color: #fff; transition: width .6s ease;
}
.chart-bar__segment--principal { background: #10b981; }
.chart-bar__segment--interest  { background: #f43f5e; }
.chart-legend { display: flex; gap: 1.5rem; margin-top: .75rem; }
.chart-legend__item { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: #374151; }
.chart-legend__dot  { width: 12px; height: 12px; border-radius: 3px; }
.chart-legend__dot--principal { background: #10b981; }
.chart-legend__dot--interest  { background: #f43f5e; }

/* ---- TABS ---- */
.tabs { margin-top: .5rem; }
.tab-list {
  display: flex; gap: .5rem; border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1.5rem; overflow-x: auto; flex-wrap: nowrap;
}
.tab-btn {
  padding: .75rem 1rem; background: none; border: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  font-weight: 600; font-size: .9rem; color: #6b7280;
  cursor: pointer; white-space: nowrap; transition: all .2s;
}
.tab-btn:hover     { color: #10b981; }
.tab-btn--active   { color: #10b981; border-bottom-color: #10b981; }
.tab-panel         { display: none; }
.tab-panel--active { display: block; }

/* AMORTIZATION TABLE */
.amort-wrap  { overflow-x: auto; }
#amort-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
#amort-table th {
  background: #f3f4f6; padding: .75rem 1rem; text-align: left;
  font-weight: 600; color: #1a365d; border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
#amort-table td { padding: .65rem 1rem; border-bottom: 1px solid #f3f4f6; color: #374151; }
#amort-table tr:hover td { background: #f9fafb; }
#amort-table .num           { text-align: right; font-variant-numeric: tabular-nums; }
#amort-table .principal-col { color: #10b981; }
#amort-table .interest-col  { color: #f43f5e; }

/* EXTRA PAYMENTS PANEL */
.extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.extra-card {
  padding: 1.25rem; border-radius: 10px; text-align: center;
  background: #f9fafb; border: 1px solid #e5e7eb;
}
.extra-card--green  { background: rgba(16,185,129,.1);  border-color: #10b981; }
.extra-card--blue   { background: rgba(26,54,93,.07);    border-color: #1a365d; }
.extra-card--teal   { background: rgba(20,184,166,.1);   border-color: #14b8a6; }
.extra-card--purple { background: rgba(139,92,246,.1);   border-color: #8b5cf6; }
.extra-card__label  { font-size: .8rem; font-weight: 600; color: #6b7280; margin-bottom: .4rem; }
.extra-card__value  { font-size: 1.35rem; font-weight: 800; color: #111827; }
.extra-tip {
  background: rgba(16,185,129,.08); border-left: 4px solid #10b981;
  padding: 1rem 1.25rem; border-radius: 0 8px 8px 0;
  font-size: .9rem; color: #374151; line-height: 1.6;
}
.empty-state { text-align: center; color: #6b7280; padding: 2rem; font-size: .9rem; }

/* AFFORDABILITY TABLE */
.afford-intro { color: #374151; margin-bottom: 1rem; font-size: .95rem; }
.afford-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.afford-table th {
  background: #f3f4f6; padding: .75rem 1rem; text-align: left;
  font-weight: 600; color: #1a365d; border-bottom: 2px solid #e5e7eb;
}
.afford-table td { padding: .65rem 1rem; border-bottom: 1px solid #f3f4f6; color: #374151; }
.afford-table .income-col { font-weight: 700; color: #10b981; text-align: right; }
.afford-note { margin-top: 1rem; font-size: .82rem; color: #6b7280; font-style: italic; }

/* SUMMARY PANEL */
.summary-grid { display: flex; flex-direction: column; gap: .1rem; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 0; border-bottom: 1px solid #f3f4f6; font-size: .9rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .val { font-weight: 700; color: #1a365d; }
.summary-row .interest-val { color: #f43f5e; }
.summary-row .ltv { color: #8b5cf6; }
.total-row .val { font-size: 1.05rem; }
.total-row { background: #f9fafb; padding: .75rem; border-radius: 8px; margin: .25rem 0; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-sidebar { position: static; }
}
@media (max-width: 768px) {
  .calc-layout { padding: 1rem; gap: 1.25rem; }
  .calc-card   { padding: 1.25rem; }
  .field-row   { grid-template-columns: 1fr; }
  .results-stats { grid-template-columns: 1fr 1fr; }
  .extra-grid { grid-template-columns: 1fr; }
  .results-hero__amount { font-size: 2.25rem; }
}
@media (max-width: 480px) {
  .results-stats { grid-template-columns: 1fr; }
  .tab-btn { font-size: .8rem; padding: .6rem .75rem; }
  .results-hero__amount { font-size: 1.9rem; }
  .calc-page__hero h1 { font-size: 1.75rem; }
}
