/*
 * JAC Leasingrechner – Komponente für Avada-Seiten.
 * Farben und Schriften kommen aus Avadas globalen Variablen (--awb-*, --primary_color);
 * die Werte nach dem Komma gelten nur ausserhalb von Avada (eigenständige Rechner-Seite).
 */
.jac-lr {
	--lr-primary: var(--primary_color, #005f7f);
	--lr-ink: var(--awb-color8, #141617);
	--lr-ink-soft: var(--awb-color6, #434549);
	--lr-line: var(--awb-color3, #f2f3f5);
	--lr-line-strong: #dfe2e6;
	--lr-bg-soft: var(--awb-color2, #f9f9fb);
	--lr-white: var(--awb-color1, #ffffff);
	--lr-error: #b3261e;

	color: var(--lr-ink);
	font-family: var(--awb-typography4-font-family, Montserrat, Arial, Helvetica, sans-serif);
	font-size: var(--awb-typography4-font-size, 16px);
	line-height: 1.5;
	letter-spacing: var(--awb-typography4-letter-spacing, 0.015em);
}
.jac-lr *, .jac-lr *::before, .jac-lr *::after { box-sizing: border-box; }
.jac-lr [hidden] { display: none !important; }

/* ---------- Überschrift: in Avada gilt der H2-Stil des Themes ---------- */
.jac-lr-titel { margin-top: 0; }
:where(.jac-lr-titel) {
	font-family: Montserrat, Arial, Helvetica, sans-serif;
	font-size: 32px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2;
	color: #141617;
	margin-bottom: 32px;
}

/* ---------- Modellauswahl (nur auf der Rechner-Seite) ---------- */
.jac-lr__models {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin: 0 0 40px;
}
.jac-lr__model {
	appearance: none;
	font: inherit;
	color: inherit;
	background: var(--lr-white);
	border: 1px solid var(--lr-line-strong);
	padding: 12px 10px 14px;
	cursor: pointer;
	text-align: center;
	transition: border-color .15s, box-shadow .15s;
}
.jac-lr__model:hover { border-color: var(--lr-primary); }
.jac-lr__model[aria-checked="true"] { border-color: var(--lr-primary); box-shadow: inset 0 0 0 1px var(--lr-primary); }
.jac-lr__model:focus-visible { outline: 2px solid var(--lr-primary); outline-offset: 2px; }
.jac-lr__model img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; margin-bottom: 6px; }
.jac-lr__model-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.jac-lr__model-from { font-size: 13px; color: var(--lr-ink-soft); }

/* ---------- Raster ---------- */
.jac-lr__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
	gap: 48px;
	align-items: start;
}

/* ---------- Eingaben ---------- */
.jac-lr__field { margin: 0 0 20px; }
.jac-lr__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 8px;
}
.jac-lr__label {
	font-family: var(--awb-typography3-font-family, inherit);
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0;
	margin: 0;
}
.jac-lr__value { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jac-lr__value small { font-weight: 400; color: var(--lr-ink-soft); margin-left: 6px; font-size: 14px; }
.jac-lr__hint { font-size: var(--awb-typography5-font-size, 13px); color: var(--lr-ink-soft); margin: 6px 0 0; line-height: 1.45; }
.jac-lr__link {
	appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
	font: inherit; font-size: 14px; color: var(--lr-primary); text-decoration: underline;
}

.jac-lr__input {
	display: flex;
	align-items: center;
	background: var(--lr-white);
	border: 1px solid var(--lr-line-strong);
	padding: 0 14px;
	transition: border-color .15s;
}
.jac-lr__input:focus-within { border-color: var(--lr-primary); }
.jac-lr__input span { color: var(--lr-ink-soft); }
.jac-lr__input input {
	min-width: 0;
	width: 100%;
	border: 0 !important;
	outline: 0;
	background: transparent !important;
	box-shadow: none !important;
	font: inherit;
	font-weight: 700;
	color: var(--lr-ink);
	padding: 12px 8px !important;
	height: auto !important;
	margin: 0 !important;
}
.jac-lr__input:has(input:disabled) { background: var(--lr-bg-soft); }

/* Schieberegler */
.jac-lr input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 4px;
	margin: 10px 0 6px;
	padding: 0;
	border: 0;
	background: linear-gradient(to right, var(--lr-primary) var(--fill, 50%), var(--lr-line-strong) var(--fill, 50%));
	cursor: pointer;
	outline: none;
}
.jac-lr input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 22px; height: 22px; border-radius: 50%;
	background: var(--lr-white);
	border: 2px solid var(--lr-primary);
}
.jac-lr input[type="range"]::-moz-range-thumb {
	width: 18px; height: 18px; border-radius: 50%;
	background: var(--lr-white);
	border: 2px solid var(--lr-primary);
}
.jac-lr input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--primary_color-2a, rgba(0, 95, 127, .2)); }
.jac-lr__scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--lr-ink-soft); }

/* Laufzeit: wie Avadas Tabs – eckig, gleich breit, gewählt in Petrol */
.jac-lr__seg {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	border: 1px solid var(--lr-line-strong);
}
.jac-lr__seg button {
	appearance: none;
	min-width: 0;
	font: inherit;
	font-size: 15px;
	color: var(--lr-ink);
	background: var(--lr-white);
	border: 0;
	border-left: 1px solid var(--lr-line-strong);
	padding: 12px 4px;
	cursor: pointer;
	transition: background .15s, color .15s;
}
.jac-lr__seg button:first-child { border-left: 0; }
.jac-lr__seg button:hover { background: var(--lr-bg-soft); }
.jac-lr__seg button[aria-checked="true"] { background: var(--lr-primary); color: #fff; font-weight: 700; }
.jac-lr__seg button:focus-visible { outline: 2px solid var(--lr-primary); outline-offset: 2px; position: relative; }

.jac-lr__action { padding-top: 4px; }
.jac-lr__error {
	margin: 0 0 14px;
	padding: 10px 14px;
	border: 1px solid #e8b4b0;
	background: #fbeceb;
	color: #8c1d18;
	font-size: 14px;
}

/* ---------- Buttons: auf Avada-Seiten gelten Avadas eigene Button-Stile ---------- */
:where(.jac-lr) .jac-lr__btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	font-family: inherit;
	font-size: 12px; font-weight: 700; letter-spacing: .18px; text-transform: uppercase;
	line-height: 1.2;
	padding: 13px 29px;
	border: 0;
	border-radius: 4px;
	background: var(--lr-primary);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
}
:where(.jac-lr) .jac-lr__btn:hover { filter: brightness(.9); color: #fff; }
:where(.jac-lr) .jac-lr__btn .button-icon-right { margin-left: 0.7em; font-size: 12px; }
.jac-lr--ohne-fa .jac-lr__btn .button-icon-right {
	display: inline-block;
	width: 6px; height: 6px;
	border-top: 2px solid currentColor;
	border-right: 2px solid currentColor;
	transform: rotate(45deg);
	margin-left: 0.6em;
}
.jac-lr .jac-lr__btn--block { width: 100%; }
.jac-lr .jac-lr__btn--light,
.jac-lr .jac-lr__btn--light:hover {
	background: var(--lr-white) !important;
	color: var(--lr-primary) !important;
	box-shadow: inset 0 0 0 1px var(--lr-primary) !important;
}
.jac-lr .jac-lr__btn--light:hover { background: var(--lr-bg-soft) !important; }
.jac-lr .jac-lr__btn--light .fusion-button-text,
.jac-lr .jac-lr__btn--light .button-icon-right { color: var(--lr-primary) !important; }

/* ---------- Ergebnis ---------- */
.jac-lr__result {
	position: sticky;
	top: 120px;
	background: var(--lr-bg-soft);
	padding: 32px;
}
.jac-lr__result-label { font-size: 16px; font-weight: 700; margin: 0; }
.jac-lr__rate {
	display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
	margin: 6px 0 2px;
	transition: opacity .2s;
}
.jac-lr__rate-chf { font-size: 18px; font-weight: 700; }
.jac-lr__rate-amount {
	font-size: 40px; font-weight: 700; line-height: 1.1;
	letter-spacing: -0.015em;
	font-variant-numeric: tabular-nums;
}
.jac-lr__rate-per { font-size: 16px; }
.jac-lr__sub { font-size: 13px; color: var(--lr-ink-soft); margin: 0; }
.jac-lr__stale {
	margin: 14px 0 0;
	padding: 10px 12px;
	background: var(--lr-white);
	border: 1px solid var(--lr-line-strong);
	font-size: 14px;
}
.jac-lr__table { width: 100%; margin: 20px 0 24px; border-collapse: collapse; font-size: 14px; transition: opacity .2s; }
.jac-lr__table th, .jac-lr__table td {
	padding: 7px 0;
	border: 0;
	border-bottom: 1px solid var(--lr-line-strong);
	background: none;
	text-align: left;
	font-weight: 400;
	vertical-align: top;
}
.jac-lr__table th { color: var(--lr-ink-soft); padding-right: 12px; }
.jac-lr__table td { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jac-lr.is-stale .jac-lr__rate,
.jac-lr.is-stale .jac-lr__table { opacity: .35; }
.jac-lr__actions { display: grid; gap: 10px; }
.jac-lr__legal {
	margin: 0;
	font-size: 11px;
	line-height: 1.6;
	color: var(--lr-ink-soft);
}
/* Der Rechtstext steht unter dem Raster (nicht darin), damit das mitlaufende Ergebnis ihn nie überdeckt.
   Abstand wie die Rasterlücke; zwei Klassen, damit die Regel gegen Avadas «.post-content p» gewinnt. */
.jac-lr .jac-lr__legal { margin-top: 48px; }

/* ---------- Kopfbereich: Preis-Kacheln (Variante 3c) ---------- */
#leasingrechner { scroll-margin-top: 160px; }
.jac-lr-hero-titel { flex: 0 0 36% !important; width: 36% !important; max-width: 36% !important; }
.jac-lr-hero-spalte { flex: 1 1 0; min-width: 0; }
.jac-lr-hero {
	--lr-primary: var(--primary_color, #005f7f);
	color: var(--awb-color8, #141617);
	font-family: var(--awb-typography4-font-family, Montserrat, Arial, Helvetica, sans-serif);
}
.jac-lr-hero *, .jac-lr-hero *::before, .jac-lr-hero *::after { box-sizing: border-box; }
.jac-lr-hero__kacheln {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
	gap: 12px;
	padding-top: 11px; /* Platz für die Zins-Pille */
}
.jac-lr-hero__kacheln[data-n="3"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); }
.jac-lr-hero__kachel {
	position: relative;
	min-height: 112px;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
	padding: 16px 12px;
	text-align: center;
	background: var(--awb-color1, #fff);
	border: 1px solid var(--awb-color3, #f2f3f5);
	color: inherit;
	text-decoration: none;
}
.jac-lr-hero__wert { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.jac-lr-hero__label { font-size: 14px; line-height: 1.3; }
.jac-lr-hero__kachel--leasing,
.jac-lr-hero__kachel--leasing:hover,
.jac-lr-hero__kachel--leasing:focus { background: var(--lr-primary); border: 2px solid var(--lr-primary); color: #fff; }
.jac-lr-hero__kachel--leasing:hover { filter: brightness(.88); }
.jac-lr-hero__kachel--leasing:focus-visible { outline: 3px solid var(--lr-primary); outline-offset: 3px; }
.jac-lr-hero__kachel--leasing .jac-lr-hero__wert { font-size: 32px; color: #fff; }
.jac-lr-hero__kachel--leasing small { font-size: 16px; font-weight: 700; }
.jac-lr-hero__link { font-size: 14px; text-decoration: underline; color: #fff; }
.jac-lr-hero__pille {
	position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
	background: #fff; color: var(--lr-primary);
	border: 2px solid var(--lr-primary);
	font-size: 12px; font-weight: 700; line-height: 1.2;
	padding: 3px 10px; border-radius: 99px; white-space: nowrap;
}
.jac-lr-hero__notiz { margin: 10px 0 0; font-size: 14px; }

@media (max-width: 1024px) {
	.jac-lr-hero__wert { font-size: 22px; }
	.jac-lr-hero__kachel--leasing .jac-lr-hero__wert { font-size: 26px; }
}
@media (max-width: 800px) {
	.jac-lr-hero-titel { flex: 0 0 100% !important; width: 100% !important; max-width: 100% !important; }
	.jac-lr-hero-spalte { flex: 0 0 100%; padding-top: 16px; }
	.jac-lr-hero__kacheln,
	.jac-lr-hero__kacheln[data-n="3"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.jac-lr-hero__kacheln[data-n="2"] { grid-template-columns: minmax(0, 1fr); }
	.jac-lr-hero__kachel--leasing { grid-column: 1 / -1; order: -1; margin-bottom: 8px; }
}

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 900px) {
	.jac-lr__grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
	.jac-lr .jac-lr__legal { margin-top: 32px; }
	.jac-lr__result { position: static; padding: 24px 20px; }
	.jac-lr__models { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 150px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
	.jac-lr__model { scroll-snap-align: start; }
}
@media (max-width: 420px) {
	.jac-lr__seg button { font-size: 14px; padding: 12px 0; }
	.jac-lr__rate-amount { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
	.jac-lr * { transition: none !important; }
}
