/**
 * Calculator widgets — restyled into the AutoArty system.
 *
 * The `autoarty-tools` plugin ships calculator.css built for a DARK page:
 * #050814 ground, #f5f5f7 text, #d5dbff labels, 1.25rem radii, 30px soft
 * shadows, cyan/violet gradient buttons. Dropped onto the light editorial
 * theme that produced:
 *
 *   - labels at 1.29:1 contrast against the page — effectively invisible
 *   - widget headings painted black-on-navy by the theme's heading colour
 *   - a rounded, glowing panel in a system that is strictly sharp
 *   - a fixed 960px panel overflowing its container on narrow screens
 *
 * This file overrides the plugin stylesheet rather than editing it, so a
 * plugin update cannot silently revert the fix and the plugin stays portable.
 * Loaded after calculator.css; specificity is matched, not escalated.
 */

/* ============================================================
   PANEL
   ============================================================ */
.aa-page {
	background: transparent;
	color: var(--on-surface);
	padding: 0;
	font-family: var(--font-sans);
}

.aa-loan-calculator {
	max-width: 100%;
	margin: 2rem 0;
	padding: clamp(20px, 3vw, 32px);
	background: var(--paper-white);
	border: 2px solid var(--asphalt-black);
	border-radius: 0;
	box-shadow: var(--pop-red);
	color: var(--on-surface);
}

.aa-loan-header {
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid var(--asphalt-black);
}

.aa-loan-title {
	margin: 0 0 0.35rem;
	font-family: var(--font-serif);
	font-size: var(--t-h2);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	color: var(--asphalt-black);
}

.aa-loan-subtitle {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--t-body-sm);
	line-height: 1.6;
	color: var(--rim-gray);
}

/* ============================================================
   FORM
   ============================================================ */
.aa-loan-form {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	margin-bottom: 1.5rem;
}

.aa-loan-field-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

@media (min-width: 620px) {
	.aa-loan-field-row { grid-template-columns: 1fr 1fr; }
}

.aa-loan-field-group {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	min-width: 0;              /* lets fields shrink instead of overflowing */
}

.aa-loan-field-group label {
	font-family: var(--font-sans);
	font-size: var(--t-meta);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--asphalt-black);   /* was #d5dbff — 1.29:1 on the light ground */
}

/* --- inputs: 1px black box, red focus, per the design system ------- */
.aa-input-with-prefix,
.aa-input-with-suffix {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
	padding: 0 0.85rem;
	background: var(--paper-white);
	border: 1px solid var(--asphalt-black);
	border-radius: 0;
}

.aa-input-with-prefix:focus-within,
.aa-input-with-suffix:focus-within {
	border-color: var(--race-red);
	box-shadow: inset 0 0 0 1px var(--race-red);
}

.aa-prefix,
.aa-suffix {
	flex: 0 0 auto;
	font-family: var(--font-sans);
	font-size: var(--t-body-sm);
	font-weight: 700;
	color: var(--rim-gray);
}

.aa-input-with-prefix input,
.aa-input-with-suffix input {
	width: 100%;
	min-width: 0;
	border: none;
	outline: none;
	background: transparent;
	padding: 0.7rem 0;
	font-family: var(--font-sans);
	font-size: var(--t-body);
	color: var(--on-surface);
}

.aa-input-with-prefix input::placeholder,
.aa-input-with-suffix input::placeholder { color: var(--rim-gray); }

select#aa-loan-term-months {
	width: 100%;
	min-width: 0;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--asphalt-black);
	border-radius: 0;
	background: var(--paper-white);
	font-family: var(--font-sans);
	font-size: var(--t-body);
	color: var(--on-surface);
}

select#aa-loan-term-months:focus {
	outline: none;
	border-color: var(--race-red);
	box-shadow: inset 0 0 0 1px var(--race-red);
}

.aa-loan-help {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--t-caption);
	line-height: 1.5;
	color: var(--rim-gray);
}

/* ============================================================
   ACTIONS
   ============================================================ */
.aa-loan-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.aa-loan-actions button {
	border-radius: 0;
	padding: 0.8rem 1.75rem;
	font-family: var(--font-sans);
	font-size: 0.9375rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}

button#aa-loan-calculate {
	background: var(--race-red);
	color: var(--paper-white);
	border: 2px solid var(--race-red);
	box-shadow: none;
}

button#aa-loan-calculate:hover {
	background: var(--surface-tint);
	border-color: var(--surface-tint);
	transform: none;
	box-shadow: none;
}

button#aa-loan-calculate:active { transform: none; box-shadow: none; }

.aa-secondary {
	background: transparent;
	color: var(--asphalt-black);            /* was #a5b1d8 — 2.02:1 */
	border: 2px solid var(--asphalt-black);
}

.aa-secondary:hover { background: var(--asphalt-black); color: var(--paper-white); }

.aa-loan-error {
	min-height: 1.2rem;
	margin: 0.35rem 0 0;
	font-family: var(--font-sans);
	font-size: var(--t-meta);
	font-weight: 700;
	color: var(--error);
}

/* ============================================================
   RESULTS
   ============================================================ */
.aa-loan-results {
	border-top: 2px solid var(--asphalt-black);
	padding-top: 1.5rem;
}

.aa-results-title {
	margin: 0 0 1rem;
	font-family: var(--font-sans);
	font-size: var(--t-meta);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--asphalt-black);
}

.aa-results-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
}

@media (min-width: 560px) {
	.aa-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
	.aa-results-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.aa-result-card {
	min-width: 0;
	padding: 0.9rem 1rem;
	border-radius: 0;
	background: var(--surface-container-low);
	border: 1px solid var(--surface-dim);
	border-top: 3px solid var(--race-red);
}

.aa-result-label {
	margin-bottom: 0.35rem;
	font-family: var(--font-sans);
	font-size: var(--t-caption);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--rim-gray);          /* was #a3aed8 — 2.08:1 */
}

.aa-result-value {
	font-family: var(--font-sans);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--asphalt-black);
	overflow-wrap: anywhere;         /* long currency strings must not overflow */
}

.aa-loan-disclaimer {
	margin-top: 1rem;
	font-family: var(--font-sans);
	font-size: var(--t-caption);
	line-height: 1.5;
	color: var(--rim-gray);
}

/* ============================================================
   AFFILIATE CTA
   ============================================================ */
.aa-affiliate-cta {
	margin-top: 1.25rem;
	padding: 1rem 1.15rem;
	border-radius: 0;
	background: var(--surface-container-low);
	border: 1px solid var(--surface-dim);
	border-left: 4px solid var(--race-red);
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	font-family: var(--font-sans);
	font-size: var(--t-body-sm);
	color: var(--on-surface);
}

.aa-affiliate-link {
	font-family: var(--font-sans);
	font-size: var(--t-body-sm);
	font-weight: 700;
	/* --primary, not --race-red: on the tinted CTA panel Race Red measures
	   4.4:1, just under AA. The darker red clears it. */
	color: var(--primary);           /* was #76e4ff — 1.39:1 */
	text-decoration: underline;
	text-underline-offset: 2px;
}

.aa-affiliate-link:hover { color: var(--surface-tint); }

/* ============================================================
   The theme's own heading colour must not reach inside the widget
   ============================================================ */
.aa-loan-calculator h1,
.aa-loan-calculator h2,
.aa-loan-calculator h3,
.aa-loan-calculator h4 { color: var(--asphalt-black); }

/* ============================================================
   Nothing in a tool page may exceed the viewport
   ============================================================ */
.aa-loan-calculator,
.aa-loan-calculator * { max-width: 100%; box-sizing: border-box; }

.aa-loan-calculator input,
.aa-loan-calculator select { max-width: 100%; }
