/* TechTools — mortgage calculator styles */
/* ---- Loan Type Tabs ---- */
.mortgage-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-btn);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  width: fit-content;
}
.mortgage-tab {
  padding: 10px 28px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  white-space: nowrap;
}
.mortgage-tab:first-child {
  border-right: 1px solid rgba(255,255,255,0.06);
}
.mortgage-tab.active {
  background: rgba(16,185,129,0.15);
  color: var(--cat-life);
  text-shadow: 0 0 16px rgba(16,185,129,0.35);
}
.mortgage-tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

/* ---- Config Panel ---- */
.mortgage-panel {
  margin-bottom: 24px;
}
.mortgage-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.param-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.param-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.param-unit {
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}
.param-input-wrap {
  display: flex;
  align-items: stretch;
  position: relative;
}
.param-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  font-size: 18px;
  font-family: var(--font-hero);
  font-weight: 600;
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  padding-right: 52px;
  -moz-appearance: textfield;
}
.param-input::-webkit-outer-spin-button,
.param-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.param-input:focus {
  border-color: rgba(16,185,129,0.5);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.08);
}
.param-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}
.param-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  font-weight: 500;
}

/* Actions */
.mortgage-actions {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 12px;
}
.mortgage-actions .btn-primary {
  border-color: rgba(16,185,129,0.3);
  background: rgba(16,185,129,0.12);
  box-shadow: 0 0 16px rgba(16,185,129,0.1), 0 0 32px rgba(16,185,129,0.04), inset 0 1px 0 rgba(255,255,255,0.06);
}
.mortgage-actions .btn-primary:hover {
  background: rgba(16,185,129,0.22);
  border-color: rgba(16,185,129,0.55);
  box-shadow: 0 0 36px rgba(16,185,129,0.25), 0 0 64px rgba(16,185,129,0.12), 0 8px 24px rgba(0,0,0,0.3);
}
.mortgage-actions .btn-primary:active {
  background: rgba(16,185,129,0.3);
}

/* ---- Result Panel ---- */
.mortgage-result {
  min-height: 160px;
  margin-bottom: 24px;
}
#resultContent { display: none; }
#resultContent.visible { display: block; }
#emptyState.hidden { display: none; }

/* Result Cards */
.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.result-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}
.result-card.highlight {
  border-color: rgba(16,185,129,0.25);
  background: rgba(16,185,129,0.06);
}
.result-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.result-card-value {
  font-family: var(--font-hero);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(16,185,129,0.15);
}
.result-card.highlight .result-card-value {
  color: var(--cat-life);
  text-shadow: 0 0 24px rgba(16,185,129,0.35);
}
.result-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Bar Chart ---- */
.chart-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
  padding: 20px 24px;
}
.section-title {
  font-family: var(--font-hero);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.chart-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chart-label {
  width: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  text-align: right;
}
.chart-track {
  flex: 1;
  height: 20px;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  overflow: hidden;
}
.chart-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.chart-principal {
  background: linear-gradient(90deg, rgba(16,185,129,0.7), rgba(52,211,153,0.9));
  box-shadow: 0 0 12px rgba(16,185,129,0.3);
}
.chart-interest {
  background: linear-gradient(90deg, rgba(255,180,84,0.7), rgba(255,180,84,0.9));
  box-shadow: 0 0 12px rgba(255,180,84,0.25);
}
.chart-pct {
  width: 44px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.legend-principal { background: rgba(16,185,129,0.8); box-shadow: 0 0 6px rgba(16,185,129,0.4); }
.legend-interest { background: rgba(255,180,84,0.8); box-shadow: 0 0 6px rgba(255,180,84,0.4); }

/* ---- Schedule Table ---- */
.schedule-section {
  margin-bottom: 24px;
  display: none;
}
.schedule-section.visible { display: block; }
.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.schedule-header .section-title { margin-bottom: 0; }
.schedule-header .btn-sm {
  border-color: rgba(16,185,129,0.2);
}
.schedule-header .btn-sm:hover {
  border-color: rgba(16,185,129,0.45);
  box-shadow: 0 0 16px rgba(16,185,129,0.18);
}
.schedule-scroll {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  max-height: 500px;
  overflow-y: auto;
}
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 500px;
}
.schedule-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.schedule-table th {
  background: rgba(16,185,129,0.1);
  color: var(--cat-life);
  font-weight: 600;
  padding: 12px 14px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid rgba(16,185,129,0.15);
}
.schedule-table th:first-child { text-align: center; }
.schedule-table td {
  padding: 10px 14px;
  text-align: right;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.schedule-table td:first-child {
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
}
.schedule-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}
.schedule-table tbody tr.row-sep {
  background: rgba(16,185,129,0.04);
}
.schedule-table tbody tr.row-sep td {
  border-top: 1px solid rgba(16,185,129,0.15);
}
.schedule-ellipsis {
  text-align: center;
  padding: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}
.schedule-ellipsis.visible { display: block; }

/* ---- Early Repayment Section ---- */
.early-repay-section {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  display: none;
}
.early-repay-section.visible { display: block; }
.early-repay-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.early-repay-form .param-group {
  flex: 1;
  min-width: 160px;
  max-width: 240px;
}
.early-repay-form .btn-secondary {
  border-color: rgba(16,185,129,0.2);
  background: rgba(16,185,129,0.08);
  box-shadow: 0 0 12px rgba(16,185,129,0.08);
  color: var(--cat-life);
  align-self: flex-end;
}
.early-repay-form .btn-secondary:hover {
  background: rgba(16,185,129,0.16);
  border-color: rgba(16,185,129,0.45);
  box-shadow: 0 0 24px rgba(16,185,129,0.2);
  color: var(--cat-life);
}
.early-repay-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.early-result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.early-result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.early-result-value {
  font-family: var(--font-hero);
  font-size: 24px;
  font-weight: 700;
  color: var(--cat-life);
  text-shadow: 0 0 16px rgba(16,185,129,0.25);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .mortgage-tabs { width: 100%; }
  .mortgage-tab { flex: 1; text-align: center; padding: 10px 16px; font-size: 14px; }
  .mortgage-params { grid-template-columns: 1fr; gap: 12px; }
  .result-cards { grid-template-columns: 1fr 1fr; }
  .result-card-value { font-size: 24px; }
  .early-repay-form { flex-direction: column; }
  .early-repay-form .param-group { max-width: 100%; }
  .early-repay-result { grid-template-columns: 1fr; }
  .mortgage-panel { padding: 20px 16px; }
  .chart-section { padding: 16px; }
  .chart-label { width: 32px; font-size: 12px; }
  .chart-pct { width: 36px; font-size: 12px; }
  .schedule-table { font-size: 12px; }
  .schedule-table th,
  .schedule-table td { padding: 8px 10px; }
}
@media (max-width: 480px) {
  .result-cards { grid-template-columns: 1fr; }
  .result-card-value { font-size: 22px; }
  .early-repay-section { padding: 16px; }
}
