/**
 * Mieterstrom-Registrierung – Wizard (mobile-first).
 * Alle Klassen unter .msr- gescoped, damit das Theme nicht kollidiert.
 */

/* ── Öffnen-Button ──────────────────────────────────────────────────────────── */
.msr-open-btn {
	display: inline-block;
	padding: 0.85rem 1.5rem;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: #1a7a3c;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.msr-open-btn:hover { background: #15672f; }
.msr-open-btn:disabled { opacity: 0.7; cursor: default; }

/* ── Overlay + Modal ────────────────────────────────────────────────────────── */
body.msr-noscroll { overflow: hidden; }

.msr-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	padding: 0;
}
.msr-overlay[hidden] { display: none; }

/* Modal ist auf die Viewport-Höhe gekappt (dvh berücksichtigt mobile
   Browser-Chrome); nur der Schritt-Bereich (.msr-steps-scroll) scrollt intern,
   Kopf/Fortschritt/Navigation bleiben immer sichtbar. */
.msr-modal {
	position: relative;
	width: 100%;
	max-width: 560px;
	height: 100vh;
	height: 100dvh;
	margin: 0;
	background: #fff;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	overflow: hidden;
}

/* Desktop: zentrierte Karte statt Vollbild */
@media (min-width: 600px) {
	.msr-overlay { padding: 2.5rem 1rem; align-items: flex-start; }
	.msr-modal {
		height: auto;
		max-height: calc(100vh - 5rem);
		max-height: calc(100dvh - 5rem);
		border-radius: 14px;
		box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	}
}

/* ── Kopf ───────────────────────────────────────────────────────────────────── */
.msr-modal-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.1rem 1.25rem;
	border-bottom: 1px solid #e6e6e6;
}
.msr-title { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.msr-close-btn {
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	font-size: 1.6rem;
	line-height: 1;
	color: #555;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	/* Native Button-Chrome (macOS/Safari) zeigt sonst bei Hover/Klick einen
	   eigenen (blauen) Kreis-Effekt, unabhängig von unseren Styles. */
	appearance: none;
	-webkit-appearance: none;
	outline: none;
	box-shadow: none;
}
.msr-close-btn:hover,
.msr-close-btn:focus,
.msr-close-btn:active {
	color: #555;
	background: transparent;
	outline: none;
	box-shadow: none;
}
.msr-close-btn:focus-visible {
	outline: 2px solid #1a7a3c;
	outline-offset: 2px;
}

/* ── Fortschritt ────────────────────────────────────────────────────────────── */
.msr-progress {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.9rem 1.25rem 0;
}
.msr-progress-bar {
	flex: 1 1 auto;
	height: 6px;
	background: #e6e6e6;
	border-radius: 3px;
	overflow: hidden;
}
.msr-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #1a7a3c;
	border-radius: 3px;
	transition: width 0.25s ease;
}
.msr-progress-text { flex: 0 0 auto; font-size: 0.85rem; color: #666; font-variant-numeric: tabular-nums; }

/* ── Formular / Schritte ────────────────────────────────────────────────────── */
/* .msr-form ist eine Flex-Spalte: .msr-steps-scroll nimmt den verfügbaren Platz
   und scrollt bei Bedarf vertikal, .msr-nav bleibt darunter immer sichtbar. */
.msr-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.msr-form[hidden] { display: none; }
.msr-steps-scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 1.25rem;
}
.msr-step { display: block; }
.msr-step[hidden] { display: none; }
.msr-step-title { margin: 0 0 1rem; font-size: 1.05rem; line-height: 1.35; }

.msr-field { display: block; margin-bottom: 1rem; }
.msr-label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; font-weight: 600; color: #333; }
.msr-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 0.75rem 0.85rem;
	font-size: 1rem;         /* ≥16px verhindert iOS-Zoom */
	line-height: 1.3;
	color: #222;
	background: #fff;
	border: 1px solid #bbb;
	border-radius: 8px;
	appearance: none;
}
.msr-input:focus { outline: none; border-color: #1a7a3c; box-shadow: 0 0 0 3px rgba(26, 122, 60, 0.15); }
.msr-input:disabled { background: #f2f2f2; color: #999; }

select.msr-input {
	background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.6rem center;
	padding-right: 2.25rem;
}

.msr-field-row { display: flex; gap: 0.75rem; }
.msr-field-plz { flex: 0 0 35%; }
.msr-field-ort { flex: 1 1 auto; }

.msr-hint { margin: 0.35rem 0 0; font-size: 0.82rem; line-height: 1.4; color: #666; }

/* ── Tarifdetails (Beispielrechnung nach Hausauswahl) ──────────────────────── */
.msr-tarifdetails {
	margin-top: 1rem;
	padding: 0.9rem 1rem;
	background: #f7f7f7;
	border-radius: 10px;
}
.msr-tarifdetails[hidden] { display: none; }
.msr-tarifdetails-title { margin: 0 0 0.75rem; font-size: 0.95rem; line-height: 1.3; }
.msr-tarifdetails-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.75rem;
	margin-bottom: 0.6rem;
}
@media (min-width: 460px) {
	.msr-tarifdetails-grid { grid-template-columns: repeat(3, 1fr); }
}
.msr-tarifdetails-col {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	padding: 0.6rem 0.7rem;
	text-align: center;
	background: #fff;
	border-radius: 8px;
}
.msr-tarifdetails-head { font-size: 0.85rem; font-weight: 600; color: #333; }
.msr-tarifdetails-kwh { font-size: 0.78rem; color: #666; }
.msr-tarifdetails-permonth { font-size: 0.78rem; color: #666; }
.msr-tarifdetails-price { margin-top: 0.15rem; font-size: 1.1rem; font-weight: 700; color: #1a7a3c; }

.msr-legal-text {
	max-height: 12rem;
	margin-bottom: 0.75rem;
	padding: 0.75rem 0.9rem;
	overflow-y: auto;
	font-size: 0.82rem;
	line-height: 1.45;
	color: #444;
	background: #f7f7f7;
	border-radius: 8px;
}
.msr-legal-text p { margin: 0 0 0.6rem; }
.msr-legal-text ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.msr-legal-text li { margin-bottom: 0.35rem; }
.msr-legal-text p:last-child, .msr-legal-text ul:last-child { margin-bottom: 0; }

/* Checkboxen / Radios */
.msr-check, .msr-radio {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	margin-bottom: 0.75rem;
	font-size: 0.95rem;
	line-height: 1.4;
	cursor: pointer;
}
.msr-check input, .msr-radio input {
	flex: 0 0 auto;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: 0.1rem;
}
.msr-fieldset { margin: 0 0 1rem; padding: 0; border: 0; }
.msr-fieldset legend { padding: 0; }

.msr-sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Zusammenfassung ────────────────────────────────────────────────────────── */
.msr-summary {
	display: grid;
	grid-template-columns: minmax(8rem, 40%) 1fr;
	gap: 0.4rem 1rem;
	margin: 0 0 1.25rem;
	padding: 0.9rem 1rem;
	background: #f7f7f7;
	border-radius: 10px;
	font-size: 0.9rem;
}
.msr-summary dt { color: #666; }
.msr-summary dd { margin: 0; color: #222; font-weight: 600; word-break: break-word; }

/* ── Fehlerzeile ────────────────────────────────────────────────────────────── */
.msr-formerror {
	margin: 0.5rem 0 0;
	padding: 0.7rem 0.9rem;
	font-size: 0.9rem;
	color: #8a1f1f;
	background: #fdecec;
	border: 1px solid #f3bcbc;
	border-radius: 8px;
}
.msr-formerror[hidden] { display: none; }

/* ── Navigation ─────────────────────────────────────────────────────────────── */
.msr-nav {
	flex: 0 0 auto;
	display: flex;
	gap: 0.75rem;
	padding: 1rem 1.25rem 1.25rem;
	border-top: 1px solid #eee;
}
.msr-btn {
	flex: 1 1 auto;
	padding: 0.85rem 1rem;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
}
.msr-btn-back { flex: 0 0 auto; color: #333; background: #ececec; }
.msr-btn-back:hover { background: #e0e0e0; }
.msr-btn-next, .msr-btn-submit { color: #fff; background: #1a7a3c; }
.msr-btn-next:hover, .msr-btn-submit:hover { background: #15672f; }
.msr-btn:disabled { opacity: 0.6; cursor: default; }
.msr-btn[hidden] { display: none; }

/* ── Erfolgsmeldung ─────────────────────────────────────────────────────────── */
.msr-success {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 2.5rem 1.5rem;
	text-align: center;
}
.msr-success[hidden] { display: none; }
.msr-success-icon {
	width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem;
	font-size: 2rem; line-height: 3.5rem; color: #fff;
	background: #1a7a3c; border-radius: 50%;
}
.msr-success-msg { margin: 0 0 1.5rem; font-size: 1.05rem; line-height: 1.5; }

/* ── Rechtstexte / Schritt 8 ────────────────────────────────────────────────── */
.msr-subtitle { margin: 1rem 0 0.5rem; font-size: 0.95rem; line-height: 1.3; }
.msr-freiwillig { margin: 0 0 1rem; padding: 0.6rem 0.8rem; color: #333; background: #eef6f0; border-radius: 8px; }
.msr-legal-text:focus-visible { outline: 2px solid #1a7a3c; outline-offset: 2px; }

/* ── Kündigungsbutton [mieterstrom_kuendigung] ──────────────────────────────── */
.msr-kuendigung { max-width: 36rem; }
.msr-kuendigung-form[hidden], .msr-kuendigung [hidden] { display: none; }
.msr-kuendigung .msr-nav { padding: 1rem 0 0; }
.msr-kuendigung .msr-success { padding: 1.5rem 0; text-align: left; }
.msr-kuendigung .msr-success-icon { margin-left: 0; }

/* ── Editor-Vorschau ────────────────────────────────────────────────────────── */
.msr-block-preview { padding: 0.5rem 0; }
