/* =============================================================================
   Mortgage calculator (/ipoteka) — JobHub-styled.
   Inputs on the left, the live payment + summary on the right, then insurance,
   the two amortization schedules, the early-repayment scenarios and the
   programme reference tables. Colours derive from --hb-* so both themes work.
   ============================================================================= */

/* hero formula chip */
.ip-hero-formula {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin-top: 24px; padding: 10px 20px; background: rgba(151, 119, 250, 0.10); border-radius: 999px;
}
.ip-hero-formula span { color: var(--hb-muted); font-weight: 600; font-size: 14px; }
.ip-hero-formula code { font-family: "Montserrat", monospace; color: var(--hb-brand); font-weight: 600; font-size: 15px; }

/* ── Input panel ── */
.ip-panel { padding: 30px; }
.ip-panel-title {
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 20px;
  color: var(--hb-heading); margin-bottom: 24px;
}

.ip-field { margin-bottom: 22px; }
.ip-field[hidden] { display: none; }
.ip-label {
  display: block; font-weight: 600; font-size: 14px;
  color: var(--hb-heading); margin-bottom: 8px;
}
.ip-hint { font-size: 12px; line-height: 1.5; color: var(--hb-muted); margin: 6px 0 0; }

.ip-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--hb-border); border-radius: 10px;
  background: var(--hb-surface); color: var(--hb-heading);
  font-family: "Open Sans", sans-serif; font-size: 15px; height: auto;
}
.ip-input:focus { outline: none; border-color: var(--hb-brand); box-shadow: 0 0 0 3px rgba(151, 119, 250, 0.15); }
.ip-input::placeholder { color: var(--hb-muted); }
.ip-input.is-hidden { display: none; }
select.ip-input { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--hb-muted) 50%), linear-gradient(135deg, var(--hb-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.ip-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* type switch */
.ip-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ip-type-btn {
  padding: 13px 14px; border: 1px solid var(--hb-border); border-radius: 12px;
  background: var(--hb-surface); text-align: left; cursor: pointer; transition: all 0.18s ease;
}
.ip-type-btn:hover { border-color: var(--hb-brand); }
.ip-type-btn.is-active {
  border-color: var(--hb-brand); background: rgba(151, 119, 250, 0.10);
  box-shadow: 0 0 0 2px rgba(151, 119, 250, 0.22);
}
.ip-type-name {
  display: block; font-family: "Montserrat", sans-serif; font-size: 14px; font-weight: 600;
  color: var(--hb-heading); margin-bottom: 2px;
}
.ip-type-desc { display: block; font-size: 11.5px; line-height: 1.4; color: var(--hb-muted); }

/* programme switch */
.ip-programmes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.ip-prog-btn {
  padding: 12px 10px; border: 1px solid var(--hb-border); border-radius: 12px;
  background: var(--hb-surface); color: var(--hb-muted);
  font-family: "Montserrat", sans-serif; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all 0.18s ease;
}
.ip-prog-btn:hover { border-color: var(--hb-blue); color: var(--hb-heading); }
.ip-prog-btn.is-active { border-color: var(--hb-blue); background: rgba(81, 146, 255, 0.12); color: var(--hb-blue); }
.ip-prog-btn[data-programme="subsidized"].is-active {
  border-color: #12b76a; background: rgba(18, 183, 106, 0.12); color: #0a8f51;
}

/* programme conditions card */
.ip-conditions {
  padding: 16px; border-radius: 12px;
  background: rgba(81, 146, 255, 0.07); border: 1px solid rgba(81, 146, 255, 0.26);
}
.ip-conditions.is-hidden { display: none; }
.ip-conditions--subsidized { background: rgba(18, 183, 106, 0.07); border-color: rgba(18, 183, 106, 0.26); }
.ip-conditions h4 {
  font-family: "Montserrat", sans-serif; font-size: 14px; font-weight: 700;
  color: var(--hb-heading); margin-bottom: 12px;
}
.ip-conditions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ip-conditions-grid > div {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 9px;
  background: var(--hb-card); border: 1px solid var(--hb-border);
  font-size: 12.5px; color: var(--hb-muted);
}
.ip-conditions-grid strong { color: var(--hb-heading); text-align: right; }
.ip-conditions-link {
  display: inline-block; margin-top: 12px;
  font-size: 13px; font-weight: 700; color: #0a8f51; text-decoration: underline;
}
:root[data-theme="dark"] .ip-conditions-link { color: #38d98a; }

/* down payment pair */
.ip-down-row { display: flex; gap: 10px; }
.ip-input-wrap { position: relative; flex: 1; }
.ip-input-wrap--pct { flex: 0 0 96px; }
.ip-input-wrap .ip-input { padding-right: 46px; }
.ip-input-unit {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-size: 12.5px; color: var(--hb-muted); pointer-events: none;
}

/* rate presets */
.ip-rate-presets { display: flex; gap: 8px; }
.ip-rate-presets.is-hidden { display: none; }
.ip-rate-btn {
  flex: 1; padding: 12px 4px; border: 1px solid var(--hb-border); border-radius: 10px;
  background: var(--hb-surface); color: var(--hb-heading);
  font-family: "Montserrat", sans-serif; font-size: 13.5px; font-weight: 700;
  cursor: pointer; transition: all 0.15s ease;
}
.ip-rate-btn:hover { border-color: var(--hb-brand); }
.ip-rate-btn.is-active { border-color: var(--hb-brand); background: var(--hb-brand); color: #fff; }

/* warnings */
.ip-warnings {
  margin-bottom: 20px; padding: 14px 16px; border-radius: 12px;
  background: rgba(245, 179, 1, 0.10); border: 1px solid rgba(245, 179, 1, 0.34);
}
.ip-warnings[hidden] { display: none; }
.ip-warnings ul { margin: 0; padding-left: 18px; list-style: disc; }
.ip-warnings li { font-size: 13px; line-height: 1.55; color: var(--hb-heading); }
.ip-warnings .ip-hint { margin-top: 8px; }

.ip-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* ── Result column ── */
.ip-result {
  position: sticky; top: 96px;
  padding: 24px; border-radius: 16px;
  background: var(--hb-card); border: 1px solid var(--hb-border);
}
.ip-result-placeholder { text-align: center; padding: 30px 10px; color: var(--hb-muted); }
.ip-result-icon { font-size: 44px; margin-bottom: 12px; }
.ip-result-placeholder p { font-size: 14px; line-height: 1.6; margin: 0; }

.ip-card { padding: 18px 16px; border-radius: 14px; text-align: center; }
.ip-card-main { background: linear-gradient(135deg, #9777fa, #6d4bd3); color: #fff; }
.ip-card-plain { background: var(--hb-surface); border: 1px solid var(--hb-border); }
.ip-card-amber { background: rgba(245, 179, 1, 0.10); border: 1px solid rgba(245, 179, 1, 0.30); }
.ip-cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.ip-card-label { font-size: 12px; line-height: 1.4; margin: 0 0 6px; opacity: 0.9; }
.ip-card-plain .ip-card-label, .ip-card-amber .ip-card-label { color: var(--hb-muted); opacity: 1; }
.ip-card-value {
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 32px; line-height: 1.1;
  margin: 0; word-break: break-word;
}
.ip-card-value-sm {
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 20px; line-height: 1.15;
  margin: 0; color: var(--hb-heading); word-break: break-word;
}
.ip-card-amber .ip-card-value-sm { color: #b47500; }
:root[data-theme="dark"] .ip-card-amber .ip-card-value-sm { color: #f5c451; }
.ip-card-unit { font-size: 11px; margin: 4px 0 0; opacity: 0.8; }
.ip-card-plain .ip-card-unit, .ip-card-amber .ip-card-unit { color: var(--hb-muted); opacity: 1; }

/* principal vs interest split */
.ip-split {
  margin-top: 16px; padding: 16px; border-radius: 12px;
  background: var(--hb-surface); border: 1px solid var(--hb-border);
}
.ip-split-head, .ip-split-foot { display: flex; justify-content: space-between; font-size: 12.5px; }
.ip-split-head { color: var(--hb-muted); margin-bottom: 8px; }
.ip-split-foot { margin-top: 8px; }
.ip-split-foot strong { font-family: "Montserrat", sans-serif; font-size: 13px; color: var(--hb-heading); }
.ip-split-bar { height: 14px; border-radius: 999px; overflow: hidden; background: rgba(245, 179, 1, 0.45); }
.ip-split-fill { height: 100%; border-radius: 999px; background: var(--hb-brand); transition: width 0.25s ease; }
.is-amber { color: #b47500 !important; }
:root[data-theme="dark"] .is-amber { color: #f5c451 !important; }
.is-brand { color: var(--hb-brand) !important; }

/* ── Shared block ── */
.ip-block {
  margin-top: 18px; border: 1px solid var(--hb-border); border-radius: 14px; overflow: hidden;
  background: var(--hb-card);
}
.ip-block-flat { margin-top: 0; }
.ip-block-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--hb-surface); border-bottom: 1px solid var(--hb-border);
  font-family: "Montserrat", sans-serif; font-weight: 700; font-size: 14.5px; color: var(--hb-heading);
}
.ip-block-head.is-emerald { background: rgba(18, 183, 106, 0.10); }
.ip-block-head.is-violet { background: rgba(151, 119, 250, 0.12); }
.ip-block-head small {
  flex: 1 1 100%; font-family: "Open Sans", sans-serif; font-weight: 400;
  font-size: 12px; line-height: 1.5; color: var(--hb-muted);
}

.ip-rows { display: block; }
.ip-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 10px 16px; font-size: 13.5px; color: var(--hb-muted);
}
.ip-row + .ip-row { border-top: 1px solid var(--hb-border); }
.ip-row-value { flex-shrink: 0; font-weight: 600; color: var(--hb-heading); white-space: nowrap; }
.ip-row.is-total { background: rgba(151, 119, 250, 0.10); color: var(--hb-brand); font-weight: 700; }
.ip-row.is-total .ip-row-value { color: var(--hb-brand); font-weight: 700; }

/* tiles */
.ip-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; padding: 16px; }
/* Four tiles never fit one row at half-width — lay them out 2×2 instead of 3+1. */
#ip-li-tiles { grid-template-columns: repeat(2, 1fr); }
.ip-tiles-2 { grid-template-columns: 1fr 1fr; padding: 0; }
.ip-tiles-3 { grid-template-columns: repeat(3, 1fr); padding: 0; }
.ip-tile {
  padding: 14px 12px; border-radius: 12px; text-align: center;
  background: var(--hb-surface); border: 1px solid var(--hb-border);
}
.ip-tile strong {
  display: block; font-family: "Montserrat", sans-serif; font-size: 18px; line-height: 1.2;
  color: var(--hb-heading); word-break: break-word;
}
.ip-tile-label { display: block; font-size: 11.5px; line-height: 1.4; color: var(--hb-muted); margin-bottom: 6px; }
.ip-tile small { display: block; margin-top: 5px; font-size: 10.5px; color: var(--hb-muted); }
.ip-tile.is-emerald { background: rgba(18, 183, 106, 0.09); border-color: rgba(18, 183, 106, 0.28); }
.ip-tile.is-emerald strong { color: #0a8f51; }
.ip-tile.is-blue { background: rgba(81, 146, 255, 0.09); border-color: rgba(81, 146, 255, 0.28); }
.ip-tile.is-blue strong { color: #2f6fd0; }
.ip-tile.is-violet { background: rgba(151, 119, 250, 0.10); border-color: rgba(151, 119, 250, 0.30); }
.ip-tile.is-violet strong { color: var(--hb-brand); }
.ip-tile.is-green { background: rgba(18, 183, 106, 0.09); border-color: rgba(18, 183, 106, 0.28); }
.ip-tile.is-green strong { color: #0a8f51; }
.ip-tile.is-purple { background: rgba(151, 119, 250, 0.10); border-color: rgba(151, 119, 250, 0.30); }
.ip-tile.is-purple strong { color: var(--hb-brand); }
:root[data-theme="dark"] .ip-tile.is-emerald strong,
:root[data-theme="dark"] .ip-tile.is-green strong { color: #38d98a; }
:root[data-theme="dark"] .ip-tile.is-blue strong { color: #7fb0ff; }

.ip-unavailable { margin: 0; padding: 0 16px 16px; font-size: 13px; color: var(--hb-muted); }

/* ── Tables ── */
.ip-table-scroll { overflow-x: auto; }
.ip-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ip-table th, .ip-table td { padding: 10px 14px; white-space: nowrap; }
.ip-table thead th {
  background: var(--hb-surface); border-bottom: 1px solid var(--hb-border);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--hb-muted); text-align: left;
}
.ip-table tbody tr + tr td { border-top: 1px solid var(--hb-border); }
.ip-table tbody td { color: var(--hb-text); }
.ip-table tbody tr:hover td { background: var(--hb-surface); }
.ip-ta-right { text-align: right; }

.ip-table-foot { display: flex; justify-content: center; padding: 12px 16px; border-top: 1px solid var(--hb-border); }
.ip-link-btn {
  padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--hb-brand); text-decoration: underline;
}
.ip-link-btn:hover { color: var(--hb-brand-hover); }
.ip-link-btn[hidden] { display: none; }

/* ── Scenarios ── */
.ip-scenario-inputs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  max-width: 720px; margin: 0 auto 34px;
}
.ip-scenario {
  padding: 22px 24px; border-radius: 16px; margin-bottom: 18px;
  background: var(--hb-card); border: 1px solid var(--hb-border);
}
.ip-scenario[hidden] { display: none; }
.ip-scenario h3 {
  font-family: "Montserrat", sans-serif; font-size: 16px; font-weight: 700;
  color: var(--hb-heading); margin-bottom: 4px;
}
.ip-scenario-desc { font-size: 13px; color: var(--hb-muted); margin-bottom: 16px; }
.ip-interval { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ip-interval-btn {
  padding: 8px 16px; border: 1px solid var(--hb-border); border-radius: 9px;
  background: var(--hb-surface); color: var(--hb-muted);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s ease;
}
.ip-interval-btn:hover { border-color: var(--hb-brand); color: var(--hb-heading); }
.ip-interval-btn.is-active { border-color: var(--hb-brand); background: var(--hb-brand); color: #fff; }
.mt-20 { margin-top: 20px; }

/* ── Programme reference ── */
.ip-compare { max-width: 860px; margin: 0 auto; }
.ip-compare .ip-table-scroll {
  border: 1px solid var(--hb-border); border-radius: 14px; background: var(--hb-card);
}
.ip-table-compare th.is-standard { color: var(--hb-blue); }
.ip-table-compare th.is-subsidized { color: #0a8f51; }
:root[data-theme="dark"] .ip-table-compare th.is-subsidized { color: #38d98a; }
.ip-table-compare td:first-child { color: var(--hb-muted); }
.ip-table-compare td:not(:first-child) { font-weight: 600; color: var(--hb-heading); }
.ip-compare-note {
  margin-top: 14px; font-size: 12.5px; line-height: 1.7; color: var(--hb-muted);
}

.ip-eligibility { margin-top: 40px; }
.ip-eligibility h3 {
  font-family: "Montserrat", sans-serif; font-size: 18px; font-weight: 700;
  color: var(--hb-heading); text-align: center; margin-bottom: 22px;
}
.ip-eligibility-card {
  height: 100%; padding: 22px 24px; border-radius: 16px;
  background: var(--hb-card); border: 1px solid var(--hb-border);
}
.ip-eligibility-title { font-weight: 700; font-size: 14px; color: var(--hb-heading); margin-bottom: 12px; }
/* JobHub resets `ol, ul { list-style: none }` globally. */
.ip-eligibility-list { margin: 0; padding-left: 20px; list-style: disc outside; }
.ip-eligibility-list li { font-size: 13px; line-height: 1.6; color: var(--hb-text); margin-bottom: 8px; }
.ip-eligibility-list li::marker { color: var(--hb-brand); }

/* ── Explainer ── */
.ip-explain-card {
  height: 100%; padding: 24px; border-radius: 16px;
  background: var(--hb-card); border: 1px solid var(--hb-border);
}
.ip-explain-lead { font-weight: 700; font-size: 14.5px; color: var(--hb-heading); margin-bottom: 14px; }
.ip-explain-list { margin: 0 0 16px; padding-left: 22px; list-style: decimal outside; }
.ip-explain-list li { margin-bottom: 10px; }
.ip-explain-list li::marker { color: var(--hb-brand); font-weight: 700; }
.ip-explain-list code {
  font-family: "Montserrat", monospace; font-size: 13px; color: var(--hb-brand);
  background: rgba(151, 119, 250, 0.10); padding: 3px 8px; border-radius: 6px;
}
.ip-legend, .ip-facts { margin: 0; padding-left: 18px; list-style: disc outside; }
.ip-legend li, .ip-facts li { font-size: 13px; line-height: 1.7; color: var(--hb-text); }
.ip-legend li::marker, .ip-facts li::marker { color: var(--hb-muted); }

.ip-disclaimer {
  max-width: 760px; margin: 26px auto 0; text-align: center;
  font-size: 12.5px; line-height: 1.7; color: var(--hb-muted);
}

/* ── Responsive ── */
@media (max-width: 991px) {
  .ip-result { position: static; }
}
@media (max-width: 767px) {
  .ip-panel { padding: 24px 18px; }
  .ip-grid-2, .ip-types, .ip-programmes, .ip-conditions-grid,
  .ip-cards-2, .ip-tiles-2, .ip-tiles-3, .ip-scenario-inputs { grid-template-columns: 1fr; }
  .ip-rate-presets { flex-wrap: wrap; }
  .ip-rate-btn { flex: 1 0 calc(50% - 4px); }
  .ip-scenario { padding: 20px 16px; }
  .ip-table th, .ip-table td { padding: 9px 11px; }
}
