/**
 * BizFin247 — Business Loan Calculator styles.
 * Scoped under #bizfin-loan. Inherits brand tokens (--bf-*) from frontend.css.
 */

.bizfin-loan {
	color: var(--bf-ink, #0f172a);
}

.bizfin-loan__layout {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	gap: 24px;
	align-items: start;
}

/* --------------------------------------------------------------------- *
 * Inputs
 * --------------------------------------------------------------------- */
.bizfin-loan__form { margin: 0; }

.bizfin-loan__group {
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 16px;
	padding: 22px;
	margin: 0;
	background: #fff;
	position: sticky;
	top: 20px;
}
.bizfin-loan__group legend {
	font-weight: 700;
	font-size: 13px;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--bf-primary, #4f46e5);
	padding: 0 8px;
}

.bizfin-loan__field { margin-top: 20px; }
.bizfin-loan__field:first-of-type { margin-top: 8px; }

.bizfin-loan__label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #475569;
	margin-bottom: 8px;
}

.bizfin-loan input[type="number"] {
	width: 100%;
	font: inherit;
	font-size: 18px;
	font-weight: 700;
	color: var(--bf-ink, #0f172a);
	padding: 12px 14px;
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 12px;
	background: #fff;
	box-sizing: border-box;
}
.bizfin-loan input[type="number"]:focus {
	outline: none;
	border-color: var(--bf-primary, #4f46e5);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary, #4f46e5) 18%, transparent);
}

/* Currency prefix + percent suffix */
.bizfin-loan__money,
.bizfin-loan__suffix {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
}
.bizfin-loan__money:focus-within,
.bizfin-loan__suffix:focus-within {
	border-color: var(--bf-primary, #4f46e5);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary, #4f46e5) 18%, transparent);
}
.bizfin-loan__money input,
.bizfin-loan__suffix input {
	border: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
}
.bizfin-loan__sym,
.bizfin-loan__unit {
	display: grid;
	place-items: center;
	padding: 0 14px;
	background: var(--bf-bg-soft, #f8fafc);
	color: #64748b;
	font-weight: 700;
	font-size: 15px;
}
.bizfin-loan__unit { border-left: 1px solid var(--bf-border, #e5e7eb); }
.bizfin-loan__sym { border-right: 1px solid var(--bf-border, #e5e7eb); }

/* Term + unit toggle */
.bizfin-loan__term {
	display: flex;
	gap: 10px;
}
.bizfin-loan__term input[type="number"] { flex: 1; }

/* Segmented toggle */
.bizfin-loan__toggle {
	display: inline-flex;
	background: var(--bf-bg-soft, #f1f5f9);
	border-radius: 10px;
	padding: 3px;
	flex: 0 0 auto;
}
.bizfin-loan__toggle-btn {
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	border: 0;
	background: none;
	color: #64748b;
	padding: 8px 14px;
	border-radius: 8px;
	cursor: pointer;
	transition: all .15s ease;
}
.bizfin-loan__toggle-btn.is-active {
	background: #fff;
	color: var(--bf-primary, #4f46e5);
	box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

/* Sliders */
.bizfin-loan__slider {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	margin-top: 14px;
	border-radius: 999px;
	background: var(--bf-border, #e5e7eb);
	outline: none;
	cursor: pointer;
}
.bizfin-loan__slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--bf-primary, #4f46e5);
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(15, 23, 42, .3);
}
.bizfin-loan__slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--bf-primary, #4f46e5);
	border: 3px solid #fff;
	box-shadow: 0 1px 4px rgba(15, 23, 42, .3);
}

.bizfin-loan__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 24px;
}

/* --------------------------------------------------------------------- *
 * Results
 * --------------------------------------------------------------------- */
.bizfin-loan__results {
	background: #fff;
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 18px;
	box-shadow: 0 10px 40px rgba(15, 23, 42, .06);
	padding: 28px;
}

.bizfin-loan__headline {
	text-align: center;
	padding: 14px 0 22px;
	border-bottom: 1px solid #f1f5f9;
}
.bizfin-loan__headline-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	color: #94a3b8;
}
.bizfin-loan__headline-value {
	display: block;
	font-size: clamp(34px, 6vw, 46px);
	font-weight: 800;
	line-height: 1.1;
	color: var(--bf-primary, #4f46e5);
	margin: 6px 0 2px;
}
.bizfin-loan__headline-note { font-size: 13px; color: #94a3b8; }

.bizfin-loan__stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 22px 0 18px;
}
.bizfin-loan__stat {
	background: var(--bf-bg-soft, #f8fafc);
	border-radius: 12px;
	padding: 14px;
	text-align: center;
}
.bizfin-loan__stat-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: #94a3b8;
	font-weight: 700;
	margin-bottom: 4px;
}
.bizfin-loan__stat-value {
	display: block;
	font-size: 18px;
	font-weight: 800;
	color: #0f172a;
}
.bizfin-loan__stat-value--accent { color: #e11d48; }

/* Principal vs interest bar */
.bizfin-loan__bar {
	display: flex;
	height: 12px;
	border-radius: 999px;
	overflow: hidden;
	background: #f1f5f9;
	margin-bottom: 8px;
}
.bizfin-loan__bar-principal { background: var(--bf-primary, #4f46e5); transition: width .3s ease; }
.bizfin-loan__bar-interest { background: #f43f5e; transition: width .3s ease; }
.bizfin-loan__legend {
	display: flex;
	gap: 18px;
	justify-content: center;
	font-size: 12px;
	color: #64748b;
	margin-bottom: 22px;
}
.bizfin-loan__legend span { display: inline-flex; align-items: center; gap: 6px; }
.bizfin-loan__dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bizfin-loan__dot--p { background: var(--bf-primary, #4f46e5); }
.bizfin-loan__dot--i { background: #f43f5e; }

/* Schedule */
.bizfin-loan__schedule-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	flex-wrap: wrap;
}
.bizfin-loan__schedule-head h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 800;
}
.bizfin-loan__table-wrap {
	max-height: 380px;
	overflow: auto;
	border: 1px solid var(--bf-border, #e5e7eb);
	border-radius: 12px;
}
.bizfin-loan__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}
.bizfin-loan__table thead th {
	position: sticky;
	top: 0;
	background: #f8fafc;
	text-align: left;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: #64748b;
	padding: 10px 12px;
	border-bottom: 1px solid var(--bf-border, #e5e7eb);
	z-index: 1;
}
.bizfin-loan__table tbody td {
	padding: 9px 12px;
	border-bottom: 1px solid #f1f5f9;
}
.bizfin-loan__table tbody tr:nth-child(even) { background: #fbfcfe; }
.bizfin-loan__col-num { text-align: right; white-space: nowrap; }
.bizfin-loan__empty {
	text-align: center;
	color: #94a3b8;
	padding: 20px;
	font-size: 14px;
}

/* --------------------------------------------------------------------- *
 * Responsive
 * --------------------------------------------------------------------- */
@media (max-width: 900px) {
	.bizfin-loan__layout { grid-template-columns: 1fr; }
	.bizfin-loan__group { position: static; }
	.bizfin-loan__results { padding: 20px; }
}
@media (max-width: 520px) {
	.bizfin-loan__stats { grid-template-columns: 1fr; }
	.bizfin-loan__term { flex-direction: column; }
	.bizfin-loan__toggle { align-self: flex-start; }
}

/* --------------------------------------------------------------------- *
 * Print — clean report + full schedule (no scroll clipping)
 * --------------------------------------------------------------------- */
@media print {
	body * { visibility: hidden !important; }
	#bizfin-loan-report, #bizfin-loan-report * { visibility: visible !important; }
	#bizfin-loan-report {
		position: absolute;
		inset: 0;
		box-shadow: none;
		border: 0;
		padding: 0;
	}
	.bizfin-loan__toggle { display: none !important; }
	.bizfin-loan__table-wrap {
		max-height: none !important;
		overflow: visible !important;
		border: 0;
	}
	.bizfin-loan__table thead th { position: static; }
	.bizfin-loan__table tbody tr { page-break-inside: avoid; }
}
