/* =========================================================
   Best Finance Calculator — Calculator page styles
   Loaded AFTER css/style.css; only adds page-specific pieces.
   ========================================================= */

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--blue); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #c4cedb; }
.breadcrumb .current { color: var(--gray-600); }

/* ---------- Page hero band ---------- */
.calc-hero {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(105deg, #eaf3fc 0%, #e4f0fa 45%, #f3f9fd 100%);
  border: 1px solid #dbe9f6;
  min-height: 190px;
  display: flex;
  align-items: center;
}
.calc-hero-photo {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 42%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 38%);
  mask-image: linear-gradient(to right, transparent 0%, #000 38%);
}
.calc-hero-body {
  position: relative;
  z-index: 2;
  padding: 24px 26px;
  max-width: 64%;
}
.calc-hero-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.calc-hero-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.calc-hero h1 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.calc-hero-desc {
  font-size: 14px;
  color: #2b4a6f;
  line-height: 1.6;
  max-width: 470px;
  margin-bottom: 14px;
}
.trust-badges {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy);
}
.trust-badge .tb-ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.tb-green { background: #d9f2e5; color: var(--lime-dark); }
.tb-blue  { background: #dceaf9; color: var(--blue); }

@media (max-width: 760px) {
  .calc-hero-body { max-width: 100%; padding: 22px 18px; }
  .calc-hero-photo { display: none; }
  .calc-hero-head { flex-direction: column; text-align: center; gap: 10px; }
  .calc-hero-desc { margin-left: auto; margin-right: auto; text-align: center; }
  .trust-badges { justify-content: center; gap: 14px; }
}

/* ---------- Calculator + results row ---------- */
.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) { .calc-layout { grid-template-columns: 1fr; } }

/* ---------- Form card ---------- */
.form-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.card-head-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #dceaf9;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.card-head h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}
.card-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 16px;
  line-height: 1.5;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.1);
}
.input-affix {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 600;
  border-right: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.input-affix.suffix {
  border-right: none;
  border-left: 1px solid var(--gray-200);
}
.input-wrap input,
.input-wrap select {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: transparent;
}
.input-wrap select { cursor: pointer; }

/* Down-payment row: amount input + percent select */
.field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-row .input-wrap { flex: 1; min-width: 0; }
.pct-select-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: #fff;
  flex-shrink: 0;
  transition: border-color 0.18s;
}
.pct-select-wrap:focus-within { border-color: var(--blue); }
.pct-select-wrap select {
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 8px 10px 11px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}
.field-note {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 5px;
}

/* Standalone select (loan term) */
.select-wrap {
  position: relative;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.select-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.1);
}
.select-wrap select {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 10px 34px 10px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.select-wrap::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--gray-400);
  pointer-events: none;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn-calc {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 16px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-calc:hover { background: var(--blue-dark); }
.btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff;
  color: var(--gray-600);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 18px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.btn-reset:hover { background: var(--gray-50); color: var(--navy); }

/* ---------- Results card ---------- */
.result-card {
  background: linear-gradient(170deg, #eefaf3 0%, #f4fcf8 100%);
  border: 1px solid #cfeadd;
  border-radius: 10px;
  padding: 18px;
}
.result-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 8px;
}
.result-head-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #d3f0e0;
  color: var(--lime-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.result-head h2 {
  font-size: 14.5px;
  font-weight: 700;
  color: #18653f;
}
.result-amount {
  text-align: center;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  color: var(--lime-dark);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 18px;
}

.breakdown-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #dcefe6;
}
.breakdown-row:last-of-type { border-bottom: none; }
.bd-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
}
.bd-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-blue   { background: var(--blue); }
.dot-purple { background: var(--purple); }
.dot-orange { background: var(--orange); }
.bd-value { text-align: right; flex-shrink: 0; }
.bd-value strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}
.bd-value span {
  font-size: 11px;
  color: var(--gray-500);
}

.total-loan-box {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #ddf3e7;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0 12px;
}
.total-loan-box .tl-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  color: var(--lime-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.total-loan-box .tl-label {
  font-size: 12px;
  color: #2f6b4d;
  font-weight: 500;
}
.total-loan-box .tl-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--lime-dark);
  line-height: 1.2;
}

/* Collapsible payment breakdown */
.breakdown-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #cfeadd;
  border-radius: 7px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.18s;
}
.breakdown-toggle:hover { background: var(--gray-50); }
.breakdown-toggle i { font-size: 10px; transition: transform 0.25s; }
.breakdown-toggle.open i { transform: rotate(180deg); }

.breakdown-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.breakdown-panel-inner {
  padding-top: 12px;
}
.bd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.bd-table th,
.bd-table td {
  padding: 8px 6px;
  text-align: right;
  border-bottom: 1px solid #dcefe6;
}
.bd-table th {
  font-weight: 700;
  color: #18653f;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.bd-table th:first-child,
.bd-table td:first-child { text-align: left; }
.bd-table td { color: var(--gray-700); }
.bd-table tr:last-child td { border-bottom: none; }

.result-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.5;
}
.result-note i { color: var(--blue); font-size: 12px; margin-top: 1px; flex-shrink: 0; }

/* ---------- Horizontal inline ad ---------- */
.inline-ad {
  position: relative;
  border-radius: 9px;
  overflow: hidden;
  background: linear-gradient(100deg, #e8f2fc 0%, #dfeefa 55%, #eff7fd 100%);
  border: 1px solid #dbe9f6;
  min-height: 92px;
  display: flex;
  align-items: center;
}
.inline-ad img {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 34%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 40%);
  mask-image: linear-gradient(to right, transparent 0%, #000 40%);
}
.inline-ad-body {
  position: relative;
  z-index: 2;
  padding: 16px 20px;
  max-width: 66%;
  display: flex;
  align-items: center;
  gap: 13px;
}
.inline-ad-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #fff;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.inline-ad h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 3px;
  line-height: 1.25;
}
.inline-ad p { font-size: 12px; color: var(--gray-600); }
.inline-ad-btn {
  position: absolute;
  right: 36%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.inline-ad-btn:hover { background: var(--blue-dark); }
@media (max-width: 760px) {
  .inline-ad { flex-direction: column; align-items: stretch; }
  .inline-ad img { opacity: 0.16; width: 100%; -webkit-mask-image: none; mask-image: none; }
  .inline-ad-body { max-width: 100%; flex-direction: column; text-align: center; }
  .inline-ad-btn {
    position: static;
    transform: none;
    margin: 0 20px 16px;
    justify-content: center;
  }
}

/* ---------- Content article blocks ---------- */
.content-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 18px;
}
.content-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.content-card > p {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.7;
}
.content-card .lead-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 15px;
}

/* Four component cards */
.component-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}
@media (max-width: 760px) { .component-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .component-grid { grid-template-columns: 1fr; } }

.component-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  padding: 14px 12px;
  text-align: center;
}
.component-card .comp-ico {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.component-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 5px;
}
.component-card p { font-size: 11px; color: var(--gray-500); line-height: 1.5; }
/* Pale tints — used for the sidebar "Related Calculators" icons */
.comp-green  { background: #d9f2e5; color: var(--lime-dark); }
.comp-blue   { background: #dceaf9; color: var(--blue); }
.comp-purple { background: #e6e0f8; color: var(--purple-dark); }
.comp-orange { background: #fde4d6; color: var(--orange-dark); }

/* Inside the payment-component cards the badges are solid and vibrant,
   with white glyphs, matching the reference design. */
.component-card .comp-green  { background: var(--lime);   color: #fff; }
.component-card .comp-blue   { background: var(--blue);   color: #fff; }
.component-card .comp-purple { background: var(--purple); color: #fff; }
.component-card .comp-orange { background: var(--orange); color: #fff; }

/* ---------- Guide banner ---------- */
.guide-banner {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(100deg, #e9f3fc 0%, #e3effa 50%, #f2f9fd 100%);
  border: 1px solid #dbe9f6;
  min-height: 118px;
  display: flex;
  align-items: center;
}
.guide-banner img {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 46%;
  object-fit: cover;
  /* Fade in quickly so most of the strip actually shows the photo. */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%);
  mask-image: linear-gradient(to right, transparent 0%, #000 22%);
}
.guide-body {
  position: relative;
  z-index: 2;
  padding: 18px 20px;
  max-width: 62%;
}
.guide-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.guide-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #dceaf9;
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.guide-body h2 { font-size: 15.5px; font-weight: 700; color: var(--navy); }
.guide-body p {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.55;
  margin-bottom: 13px;
}
.guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 17px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.guide-btn:hover { background: var(--blue-dark); }
@media (max-width: 620px) {
  .guide-body { max-width: 100%; text-align: center; }
  .guide-head { justify-content: center; }
  .guide-banner img { opacity: 0.16; width: 100%; -webkit-mask-image: none; mask-image: none; }
  .guide-btn { margin: 0 auto; }
}

/* ---------- Related calculators sidebar card ---------- */
.related-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.related-card > h3 {
  padding: 14px 16px 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}
.related-card > h3 i { color: var(--blue); font-size: 13px; }
.related-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.18s;
}
.related-item:last-child { border-bottom: none; }
.related-item:hover { background: var(--gray-50); }
.related-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.related-text { flex: 1; min-width: 0; }
.related-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}
.related-text span {
  font-size: 11px;
  color: var(--gray-500);
  line-height: 1.4;
}
.related-item .chevron { color: #c4cedb; font-size: 11px; flex-shrink: 0; }

/* ---------- Sidebar ads with photo backdrop ---------- */
.photo-ad {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  min-height: 182px;
  display: flex;
  align-items: flex-start;
  padding: 16px;
  color: #fff;
}
.photo-ad img.pa-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.photo-ad .pa-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.photo-ad .pa-body { position: relative; z-index: 2; }
.photo-ad h4 {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.22;
  margin-bottom: 7px;
}
.photo-ad p { font-size: 11.5px; opacity: 0.94; line-height: 1.5; margin-bottom: 13px; }
.photo-ad-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 17px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
/* Overlays are weighted to the top-left so the text stays readable while
   the house photo still shows through the lower-right of each ad. */
.pa-dark .pa-overlay {
  background: linear-gradient(155deg,
    rgba(10,32,58,0.94) 0%,
    rgba(11,38,68,0.86) 34%,
    rgba(13,48,88,0.4) 60%,
    rgba(15,56,102,0.05) 88%);
}
.pa-dark .photo-ad-btn { background: #fff; color: var(--blue); }
.pa-mid .pa-overlay {
  background: linear-gradient(155deg,
    rgba(26,111,212,0.93) 0%,
    rgba(24,100,195,0.85) 36%,
    rgba(21,88,171,0.38) 62%,
    rgba(21,88,171,0.04) 88%);
}
.pa-mid .photo-ad-btn { background: #fff; color: var(--blue); }
.pa-light .pa-overlay {
  background: linear-gradient(155deg,
    rgba(236,245,253,0.96) 0%,
    rgba(228,240,251,0.9) 38%,
    rgba(219,235,249,0.48) 64%,
    rgba(214,233,249,0.1) 90%);
}
.pa-light { color: var(--navy); }
.pa-light p { color: var(--gray-600); opacity: 1; }
.pa-light .photo-ad-btn { background: var(--blue); color: #fff; }

/* ---------- Mobile centring for this page ---------- */
@media (max-width: 760px) {
  .breadcrumb { justify-content: center; }
  .card-head { justify-content: center; }
  .card-sub { text-align: center; }
  .content-card h2 { justify-content: center; }
  .content-card > p,
  .content-card .lead-sub { text-align: center; }
  .related-card > h3 { justify-content: center; }
  .related-item { text-align: center; }
  .photo-ad { justify-content: center; }
  .photo-ad .pa-body { text-align: center; }
  .field label { text-align: center; }
  .field-note { text-align: center; }
}
