/*
 * Finance Calculators — shared styles for 4 calculators (mortgage, compound,
 * payoff, inflation). Same brand palette as Moon Calendar / World Clock.
 */

.fc-tool {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	color: inherit;
}
.fc-tool *,
.fc-tool *::before,
.fc-tool *::after { box-sizing: inherit; }

/* ── Top nav (Mortgage / Compound / Payoff / Inflation) ────────── */

.fc-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0.4rem;
	margin-bottom: 1rem;
	background: var(--fc-bar-bg, #f7fafc);
	border: 1px solid var(--fc-border-light, #edf2f7);
	border-radius: 999px;
}

.fc-nav__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 1rem;
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--fc-label, #4a5568);
	background: transparent;
	border: none;
	border-radius: 999px;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.12s, color 0.12s;
}

.fc-nav__btn:hover {
	color: var(--fc-accent, #2b6cb0);
	background: rgba(43, 108, 176, 0.06);
}

.fc-nav__btn--active {
	color: #fff;
	background: linear-gradient(135deg, #1a2942 0%, #2b6cb0 100%);
}

.fc-nav__btn-glyph { font-size: 1rem; line-height: 1; }

/* ── Layout ────────────────────────────────────────────────────── */

.fc-layout {
	display: grid;
	grid-template-columns: 1fr 18rem;
	gap: 1rem;
	align-items: flex-start;
}

.fc-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	min-width: 0;
}

.fc-results {
	position: sticky;
	top: 1rem;
}

/* ── Grid + fields ─────────────────────────────────────────────── */

.fc-grid { display: grid; gap: 0.75rem; }
.fc-grid--2 { grid-template-columns: repeat(2, 1fr); }
.fc-grid--3 { grid-template-columns: repeat(3, 1fr); }

.fc-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	min-width: 0;
}

.fc-field > span {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--fc-label, #4a5568);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.fc-field input,
.fc-field select {
	width: 100%;
	padding: 0.55rem 0.75rem;
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--fc-text, #1a202c);
	background: #fff;
	border: 1px solid var(--fc-border, #cbd5e0);
	border-radius: 6px;
	transition: border-color 0.12s, box-shadow 0.12s;
	font-variant-numeric: tabular-nums;
}

.fc-field input:focus,
.fc-field select:focus {
	outline: none;
	border-color: var(--fc-accent, #2b6cb0);
	box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}

/* Double input for "down payment" with $ + % side-by-side */
.fc-double-input {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 5rem;
	gap: 0.4rem;
}

.fc-double-input__pct {
	position: absolute;
	right: 0.6rem;
	top: 50%;
	transform: translateY(-50%);
	font-size: 0.85rem;
	color: var(--fc-label-light, #718096);
	pointer-events: none;
}

.fc-hint {
	margin: 0;
	font-size: 0.82rem;
	color: var(--fc-label-light, #718096);
}

/* ── Action buttons ────────────────────────────────────────────── */

.fc-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.55rem 1rem;
	font-family: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--fc-btn-text, #2b6cb0);
	background: #fff;
	border: 1px solid var(--fc-border, #cbd5e0);
	border-radius: 6px;
	cursor: pointer;
}

.fc-btn:hover {
	background: #ebf4ff;
	border-color: var(--fc-accent, #2b6cb0);
}

.fc-btn--ghost {
	color: var(--fc-label, #4a5568);
	background: transparent;
	border-color: transparent;
}

.fc-btn--ghost:hover {
	color: var(--fc-accent, #2b6cb0);
	background: rgba(43, 108, 176, 0.07);
}

/* ── Results sidebar ───────────────────────────────────────────── */

.fc-results__panel {
	background: linear-gradient(135deg, #1a2942 0%, #2b6cb0 100%);
	color: #f4f1ea;
	border-radius: 12px;
	padding: 1.2rem;
}

.fc-results__panel h4 {
	margin: 0 0 0.5rem 0;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: rgba(244, 241, 234, 0.7);
}

.fc-results__big {
	font-size: 2.1rem;
	font-weight: 700;
	line-height: 1.1;
	color: #fff;
	font-variant-numeric: tabular-nums;
	margin-bottom: 0.8rem;
}

.fc-results__breakdown,
.fc-results__totals {
	margin: 0;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.3rem 0.7rem;
	font-size: 0.88rem;
	font-variant-numeric: tabular-nums;
}

.fc-results__breakdown dt,
.fc-results__totals dt {
	color: rgba(244, 241, 234, 0.85);
}

.fc-results__breakdown dd,
.fc-results__totals dd {
	margin: 0;
	text-align: right;
	color: #fff;
}

.fc-results__sep {
	height: 1px;
	background: rgba(244, 241, 234, 0.2);
	margin: 0.85rem 0;
}

.fc-results__totals {
	font-size: 0.92rem;
}

/* ── Amortization table ────────────────────────────────────────── */

.fc-amort {
	margin-top: 0.5rem;
	max-height: 24rem;
	overflow-y: auto;
	border: 1px solid var(--fc-border-light, #edf2f7);
	border-radius: 6px;
}

.fc-amort__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
}

.fc-amort__table thead th {
	position: sticky;
	top: 0;
	background: #1a2942;
	color: #fff;
	padding: 0.5rem 0.7rem;
	text-align: right;
	font-size: 0.78rem;
	letter-spacing: 0.04em;
}

.fc-amort__table thead th:first-child { text-align: left; }

.fc-amort__table tbody td {
	padding: 0.4rem 0.7rem;
	border-bottom: 1px solid var(--fc-border-light, #edf2f7);
	text-align: right;
}

.fc-amort__table tbody td:first-child {
	text-align: left;
	font-weight: 600;
	color: var(--fc-label, #4a5568);
}

/* ── Debt payoff specifics ─────────────────────────────────────── */

.fc-payoff-intro {
	margin-bottom: 1rem;
	padding: 0.7rem 0.9rem;
	background: var(--fc-bar-bg, #f7fafc);
	border-radius: 6px;
	font-size: 0.92rem;
	color: var(--fc-label, #4a5568);
}

.fc-debts {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	margin-bottom: 0.5rem;
}

.fc-debt {
	display: grid;
	grid-template-columns: 1fr 5.5rem 4rem 5rem 2rem;
	gap: 0.4rem;
	align-items: center;
}

.fc-debt input {
	padding: 0.5rem 0.65rem;
	font-family: inherit;
	font-size: 0.92rem;
	color: var(--fc-text, #1a202c);
	background: #fff;
	border: 1px solid var(--fc-border, #cbd5e0);
	border-radius: 6px;
	font-variant-numeric: tabular-nums;
}

.fc-debt__bal,
.fc-debt__apr,
.fc-debt__min { text-align: right; }

.fc-debt__rm {
	width: 2rem;
	height: 2rem;
	padding: 0;
	font-size: 1.1rem;
	color: var(--fc-label, #4a5568);
	background: transparent;
	border: 1px solid var(--fc-border-light, #edf2f7);
	border-radius: 4px;
	cursor: pointer;
}

.fc-debt__rm:hover {
	color: #c53030;
	background: #fff5f5;
	border-color: #fc8181;
}

.fc-payoff-budget { margin: 1rem 0; }

.fc-payoff-results {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.875rem;
	margin-top: 0.75rem;
}

.fc-payoff-strategy {
	background: var(--fc-bar-bg, #f7fafc);
	border: 1px solid var(--fc-border-light, #edf2f7);
	border-radius: 8px;
	padding: 0.85rem 1rem;
}

.fc-payoff-strategy h4 {
	margin: 0 0 0.6rem 0;
	font-size: 1rem;
	font-weight: 700;
	color: var(--fc-text, #1a202c);
}

.fc-payoff-strategy--snowball { border-left: 4px solid #4299e1; }
.fc-payoff-strategy--avalanche { border-left: 4px solid #d97706; }

.fc-payoff-strategy dl {
	margin: 0;
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.3rem 0.75rem;
	font-size: 0.88rem;
}

.fc-payoff-strategy dt {
	color: var(--fc-label, #4a5568);
	font-weight: 500;
}

.fc-payoff-strategy dd {
	margin: 0;
	color: var(--fc-text, #1a202c);
	font-weight: 600;
}

.fc-payoff-recommendation {
	margin-top: 1rem;
	padding: 0.7rem 0.9rem;
	border-radius: 6px;
	font-size: 0.92rem;
	font-weight: 600;
	background: linear-gradient(90deg, #fffaeb 0%, #fffbeb 100%);
	border: 1px solid #f6ad55;
	color: #744210;
}

.fc-payoff-recommendation--err {
	background: #fff5f5;
	border-color: #fc8181;
	color: #9b2c2c;
}

/* ── Footer ────────────────────────────────────────────────────── */

.fc-tool__footer {
	margin-top: 1rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--fc-border-light, #edf2f7);
	font-size: 0.825rem;
	color: #2f855a;
	font-weight: 500;
	text-align: center;
}

/* ── Mobile ────────────────────────────────────────────────────── */

@media (max-width: 900px) {
	.fc-layout {
		grid-template-columns: 1fr;
	}
	.fc-results {
		position: static;
	}
	.fc-payoff-results {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 640px) {
	.fc-grid--2,
	.fc-grid--3 { grid-template-columns: 1fr; }
	.fc-debt {
		grid-template-columns: 1fr 4.5rem 3rem 4rem 1.8rem;
		gap: 0.3rem;
	}
	.fc-debt input {
		padding: 0.45rem 0.5rem;
		font-size: 0.82rem;
	}
	.fc-nav { gap: 0.2rem; padding: 0.3rem; }
	.fc-nav__btn { padding: 0.4rem 0.7rem; font-size: 0.82rem; }
	.fc-nav__btn-label { display: none; }
	.fc-nav__btn-glyph { font-size: 1.15rem; }
	.fc-results__big { font-size: 1.7rem; }
}
