/* Finance Calculator (UK) — front-end styles.
   Colours are driven by CSS custom properties injected inline from the
   admin settings (see FC_Shortcode::inline_css). */

.fc-calc {
	--fc-bg: #ffffff;
	--fc-panel: #f5f7fa;
	--fc-button: #1a56db;
	--fc-button-text: #ffffff;
	--fc-accent: #1a56db;
	--fc-text: #1f2937;

	box-sizing: border-box;
	background: var(--fc-bg);
	color: var(--fc-text);
	border: 1px solid rgba( 0, 0, 0, 0.08 );
	border-radius: 12px;
	padding: 24px;
	font-family: inherit;
	line-height: 1.4;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.06 );
}

.fc-calc *,
.fc-calc *::before,
.fc-calc *::after {
	box-sizing: border-box;
}

/* ---- Form ---- */
.fc-form {
	margin: 0 0 20px;
}

.fc-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-end;
}

.fc-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	flex: 1 1 160px;
	min-width: 0;
}

.fc-field label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--fc-text);
	opacity: 0.85;
}

.fc-input-wrap {
	display: flex;
	align-items: center;
	background: #fff;
	border: 1px solid rgba( 0, 0, 0, 0.18 );
	border-radius: 8px;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fc-input-wrap:focus-within {
	border-color: var(--fc-accent);
	box-shadow: 0 0 0 3px rgba( 26, 86, 219, 0.15 );
}

.fc-input-wrap input {
	border: 0;
	outline: 0;
	background: transparent;
	padding: 10px 12px;
	font-size: 1rem;
	width: 100%;
	min-width: 0;
	color: var(--fc-text);
	-moz-appearance: textfield;
}

.fc-input-wrap input::-webkit-outer-spin-button,
.fc-input-wrap input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.fc-prefix,
.fc-suffix {
	padding: 0 10px;
	font-size: 0.95rem;
	color: var(--fc-text);
	opacity: 0.65;
	white-space: nowrap;
}

.fc-prefix {
	border-right: 1px solid rgba( 0, 0, 0, 0.1 );
}

.fc-suffix {
	border-left: 1px solid rgba( 0, 0, 0, 0.1 );
}

/* Locked (read-only) input, e.g. a fixed interest rate. */
.fc-input-wrap.fc-locked {
	background: rgba( 0, 0, 0, 0.04 );
}

.fc-input-wrap.fc-locked input {
	cursor: not-allowed;
	opacity: 0.75;
}

.fc-field-action {
	flex: 0 0 auto;
}

.fc-button {
	appearance: none;
	border: 0;
	cursor: pointer;
	background: var(--fc-button);
	color: var(--fc-button-text);
	font-size: 1rem;
	font-weight: 600;
	padding: 11px 28px;
	border-radius: 8px;
	transition: filter 0.15s ease, transform 0.05s ease;
	width: 100%;
}

.fc-button:hover {
	filter: brightness( 0.93 );
}

.fc-button:active {
	transform: translateY( 1px );
}

.fc-button:focus-visible {
	outline: 3px solid rgba( 26, 86, 219, 0.4 );
	outline-offset: 2px;
}

/* ---- Error message ---- */
.fc-error {
	background: #fdecea;
	border: 1px solid #f5c2c0;
	color: #8a1f1a;
	border-radius: 8px;
	padding: 12px 14px;
	margin: 0 0 20px;
	font-size: 0.9rem;
	font-weight: 600;
}

/* ---- Results ---- */
.fc-results {
	display: grid;
	gap: 14px;
	/* auto-fit so 4 cards (or 5 when a fee is shown) flow responsively. */
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
}

.fc-result {
	background: var(--fc-panel);
	border-radius: 10px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.fc-result-label {
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 600;
	opacity: 0.7;
}

.fc-result-value {
	/* Fluid base size; JS auto-fit then guarantees a max of two lines. */
	font-size: clamp( 1.05rem, 0.85rem + 1.1vw, 1.6rem );
	font-weight: 700;
	line-height: 1.2;
	color: var(--fc-accent);
	overflow-wrap: anywhere;
	word-break: normal;
}

/* The APR is the headline figure. */
.fc-result-apr .fc-result-value {
	font-size: clamp( 1.15rem, 0.9rem + 1.3vw, 1.8rem );
}

/* ---- Sidebar (stacked) layout ---- */
.fc-calc.fc-layout-sidebar .fc-fields {
	flex-direction: column;
	align-items: stretch;
}

.fc-calc.fc-layout-sidebar .fc-field {
	flex: 1 1 auto;
}

.fc-calc.fc-layout-sidebar .fc-results {
	grid-template-columns: 1fr;
}

.fc-calc.fc-layout-sidebar .fc-result {
	flex-direction: row;
	align-items: baseline;
	justify-content: space-between;
}

.fc-calc.fc-layout-sidebar .fc-result {
	gap: 12px;
}

.fc-calc.fc-layout-sidebar .fc-result-value {
	font-size: clamp( 1rem, 0.9rem + 0.6vw, 1.3rem );
	text-align: right;
	min-width: 0;
}

.fc-calc.fc-layout-sidebar .fc-result-apr .fc-result-value {
	font-size: clamp( 1.05rem, 0.95rem + 0.7vw, 1.4rem );
}

/* ---- Responsive: full-width collapses gracefully on small screens ---- */
@media ( max-width: 540px ) {
	.fc-calc .fc-fields {
		flex-direction: column;
		align-items: stretch;
	}
}

@media ( max-width: 460px ) {
	.fc-calc.fc-layout-fullwidth .fc-results {
		grid-template-columns: 1fr;
	}
}
