/**
 * Ersparnis Rechner – Frontend Styles
 * Design zu 100% an brickfox.de angelehnt:
 *  - Primär:  #312c48 (offizielle brickfox theme-color, dunkles Aubergine)
 *  - Akzent:  #F18700 (brickfox Fuchs-Orange)
 * Schrift erbt vom Theme (Elementor), damit sie identisch zur Seite ist.
 */

.er-calc {
	--er-primary: #312c48;
	--er-primary-soft: #443d63;
	--er-accent: #f18700;
	--er-accent-dark: #d97700;
	--er-bg: #ffffff;
	--er-bg-soft: #f6f5fa;
	--er-border: #e6e3ef;
	--er-text: #312c48;
	--er-text-soft: #6d6884;
	--er-radius: 14px;
	--er-shadow: 0 8px 30px rgba(49, 44, 72, 0.10);

	color: var(--er-text);
	max-width: 1140px;
	margin: 0 auto;
	padding: 8px;
	box-sizing: border-box;
}

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

/* ---------- Kopf ---------- */
.er-calc__head {
	text-align: center;
	margin-bottom: 32px;
}

.er-calc__headline {
	color: var(--er-primary);
	font-size: clamp(1.6rem, 3.5vw, 2.4rem);
	font-weight: 800;
	margin: 0 0 10px;
	line-height: 1.2;
}

.er-calc__subline {
	color: var(--er-text-soft);
	font-size: 1.05rem;
	margin: 0;
}

/* ---------- Grid ---------- */
.er-calc__grid {
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 28px;
	align-items: start;
}

@media (max-width: 880px) {
	.er-calc__grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- Formular ---------- */
.er-calc__form {
	background: var(--er-bg);
	border: 1px solid var(--er-border);
	border-radius: var(--er-radius);
	box-shadow: var(--er-shadow);
	padding: 28px;
}

.er-field {
	margin-bottom: 26px;
	border: 0;
	padding: 0;
	min-inline-size: auto;
}

.er-field__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin-bottom: 8px;
}

.er-label {
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--er-primary);
	line-height: 1.35;
}

.er-value {
	font-weight: 800;
	font-size: 1.05rem;
	color: var(--er-accent);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.er-hint {
	margin: 8px 0 0;
	font-size: 0.82rem;
	color: var(--er-text-soft);
	line-height: 1.45;
}

/* ---------- Presets ---------- */
.er-field--presets legend.er-label {
	margin-bottom: 10px;
	display: block;
}

.er-presets {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

@media (max-width: 560px) {
	.er-presets {
		grid-template-columns: 1fr;
	}
}

/* Hohe Spezifität + !important, damit globale Theme-/Elementor-Button-Styles
   (oranger Hintergrund, weiße Schrift) die Presets nicht überschreiben. */
.er-calc .er-presets button.er-preset {
	appearance: none !important;
	background: var(--er-bg-soft) !important;
	background-image: none !important;
	border: 2px solid var(--er-border) !important;
	border-radius: 10px !important;
	box-shadow: none !important;
	padding: 12px 10px !important;
	margin: 0 !important;
	width: 100%;
	text-align: left !important;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease !important;
	color: var(--er-text) !important;
	font: inherit !important;
	line-height: 1.4 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

.er-calc .er-presets button.er-preset:hover,
.er-calc .er-presets button.er-preset:focus {
	background: var(--er-bg-soft) !important;
	border-color: var(--er-accent) !important;
	color: var(--er-text) !important;
	transform: translateY(-1px);
}

.er-calc .er-presets button.er-preset.is-active,
.er-calc .er-presets button.er-preset.is-active:hover,
.er-calc .er-presets button.er-preset.is-active:focus {
	border-color: var(--er-accent) !important;
	background: #fff6ea !important;
}

.er-calc .er-preset__name {
	display: block;
	font-weight: 800;
	color: var(--er-primary) !important;
	margin-bottom: 4px;
}

.er-calc .er-presets button.er-preset.is-active .er-preset__name {
	color: var(--er-accent-dark) !important;
}

.er-calc .er-preset__desc {
	display: block;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--er-text-soft) !important;
	font-weight: 400;
}

/* ---------- Slider ---------- */
.er-calc input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 8px;
	border-radius: 999px;
	background: linear-gradient(
		to right,
		var(--er-accent) 0%,
		var(--er-accent) var(--er-fill, 50%),
		var(--er-border) var(--er-fill, 50%),
		var(--er-border) 100%
	);
	outline: none;
	margin: 6px 0 0;
	cursor: pointer;
}

.er-calc input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--er-primary);
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(49, 44, 72, 0.35);
	transition: transform 0.15s ease, background 0.15s ease;
}

.er-calc input[type="range"]::-webkit-slider-thumb:hover,
.er-calc input[type="range"]:focus-visible::-webkit-slider-thumb {
	transform: scale(1.12);
	background: var(--er-accent);
}

.er-calc input[type="range"]::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--er-primary);
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(49, 44, 72, 0.35);
	transition: transform 0.15s ease, background 0.15s ease;
	cursor: pointer;
}

.er-calc input[type="range"]::-moz-range-thumb:hover {
	transform: scale(1.12);
	background: var(--er-accent);
}

.er-calc input[type="range"]:focus-visible {
	box-shadow: 0 0 0 3px rgba(241, 135, 0, 0.35);
}

/* ---------- Stundensatz ---------- */
.er-rate-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 8px;
}

.er-calc input[type="number"] {
	width: 130px;
	padding: 10px 12px;
	border: 2px solid var(--er-border);
	border-radius: 10px;
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--er-primary);
	background: var(--er-bg);
	transition: border-color 0.2s ease;
}

.er-calc input[type="number"]:focus {
	border-color: var(--er-accent);
	outline: none;
}

.er-rate-unit {
	font-weight: 700;
	color: var(--er-text-soft);
}

/* ---------- Honeypot: unsichtbar für Menschen ---------- */
.er-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

/* ---------- Berechnen-Button ---------- */
.er-btn {
	appearance: none;
	display: block;
	width: 100%;
	background: var(--er-accent);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 16px 28px;
	font-size: 1.1rem;
	font-weight: 800;
	cursor: pointer;
	letter-spacing: 0.02em;
	transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	box-shadow: 0 6px 18px rgba(241, 135, 0, 0.35);
	font-family: inherit;
}

.er-btn:hover {
	background: var(--er-accent-dark);
	transform: translateY(-2px);
	box-shadow: 0 10px 24px rgba(241, 135, 0, 0.45);
}

.er-btn:active {
	transform: translateY(0);
}

/* Animation: erst NACH der ersten Änderung aktiv */
.er-btn.is-armed {
	animation: er-pulse 1.6s ease-in-out infinite;
}

@keyframes er-pulse {
	0%, 100% {
		box-shadow: 0 6px 18px rgba(241, 135, 0, 0.35), 0 0 0 0 rgba(241, 135, 0, 0.55);
		transform: scale(1);
	}
	50% {
		box-shadow: 0 6px 22px rgba(241, 135, 0, 0.5), 0 0 0 14px rgba(241, 135, 0, 0);
		transform: scale(1.025);
	}
}

@media (prefers-reduced-motion: reduce) {
	.er-btn.is-armed {
		animation: none;
		outline: 3px solid rgba(241, 135, 0, 0.55);
		outline-offset: 3px;
	}
}

.er-btn[disabled] {
	opacity: 0.6;
	cursor: wait;
}

/* ---------- Ergebnis ---------- */
.er-calc__result {
	background: var(--er-primary);
	color: #fff;
	border-radius: var(--er-radius);
	box-shadow: var(--er-shadow);
	padding: 30px 28px;
	position: sticky;
	top: 24px;
}

.er-result__title {
	color: #fff;
	font-size: 1.15rem;
	font-weight: 800;
	margin: 0 0 20px;
	line-height: 1.35;
}

/* ---------- Rechenfall: manuell vs. brickfox ---------- */
.er-compare {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 22px;
}

.er-compare__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 14px;
	border-radius: 10px;
	padding: 12px 14px;
}

.er-compare__row--manual {
	background: rgba(255, 255, 255, 0.07);
	border: 1px solid rgba(255, 255, 255, 0.12);
}

.er-compare__row--brickfox {
	background: rgba(241, 135, 0, 0.14);
	border: 1px solid rgba(241, 135, 0, 0.45);
}

.er-compare__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.er-compare__label {
	font-weight: 800;
	font-size: 0.92rem;
	color: #fff;
}

.er-compare__row--brickfox .er-compare__label {
	color: var(--er-accent);
}

.er-compare__sub {
	font-size: 0.72rem;
	color: rgba(255, 255, 255, 0.6);
	line-height: 1.4;
	margin-top: 2px;
}

.er-compare__figures {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	white-space: nowrap;
}

.er-compare__cost {
	font-weight: 900;
	font-size: 1.15rem;
	color: #fff;
	font-variant-numeric: tabular-nums;
}

.er-compare__row--brickfox .er-compare__cost {
	color: var(--er-accent);
}

.er-compare__meta {
	font-size: 0.7rem;
	color: rgba(255, 255, 255, 0.55);
	margin-top: 2px;
}

.er-result__eyebrow {
	display: block;
	font-size: 0.8rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.7);
	margin-bottom: 4px;
}

.er-result__total {
	display: flex;
	flex-direction: column;
	margin-bottom: 6px;
}

.er-result__amount {
	font-size: clamp(2rem, 5vw, 2.9rem);
	font-weight: 900;
	color: var(--er-accent);
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.er-result__amount > span {
	transition: opacity 0.25s ease;
}

.er-result__amount > span.is-updating {
	opacity: 0;
}

/* Dezentes Sternchen an der Summe – verweist auf die Fußnote unten. */
.er-result__asterisk {
	font-size: 0.45em;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.55);
	vertical-align: super;
	margin-left: 2px;
	line-height: 0;
}

.er-result__period {
	color: rgba(255, 255, 255, 0.75);
	font-size: 0.95rem;
	margin-top: 4px;
}

.er-result__year {
	color: rgba(255, 255, 255, 0.9);
	font-size: 1.05rem;
	font-weight: 700;
	padding-bottom: 18px;
	margin-bottom: 18px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.er-result__year span {
	color: var(--er-accent);
	font-variant-numeric: tabular-nums;
}

.er-result__breakdown {
	list-style: none;
	margin: 0 0 18px;
	padding: 0;
}

.er-result__breakdown li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 14px;
	padding: 9px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.85);
}

.er-result__breakdown li:last-child {
	border-bottom: 0;
}

.er-result__breakdown strong {
	color: #fff;
	font-weight: 800;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.er-result__note {
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.55);
	margin: 0 0 20px;
	line-height: 1.5;
}

.er-cta {
	display: block;
	text-align: center;
	background: var(--er-accent);
	color: #fff !important;
	text-decoration: none !important;
	border-radius: 999px;
	padding: 14px 24px;
	font-weight: 800;
	transition: background 0.2s ease, transform 0.15s ease;
}

.er-cta:hover {
	background: var(--er-accent-dark);
	transform: translateY(-2px);
	color: #fff;
}

/* Fußnote: sehr klein und dezent, ganz unten im Ergebnispanel. */
.er-result__footnote {
	margin: 16px 0 0;
	font-size: 0.66rem;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.42);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	padding-top: 12px;
}
