/*
 * Widerruf Button – Frontend (mobile-first).
 * Typografie und Farben werden bewusst weitgehend geerbt, damit das aktive
 * Theme greift; Backend-Design-Einstellungen überschreiben per Inline-CSS.
 */

.wrb-wrap {
	margin: 0.5em 0;
}

.wrb-align-center {
	text-align: center;
}

.wrb-align-right {
	text-align: right;
}

.wrb-button {
	display: inline-block;
	cursor: pointer;
	min-height: 44px;
	padding: 0.6em 1.4em;
	font: inherit;
	line-height: 1.4;
	text-align: center;
	-webkit-appearance: none;
	appearance: none;
}

.wrb-button--ghost {
	background: transparent;
	border: 1px solid currentColor;
	color: inherit;
}

/* ---------- Modal ---------- */

.wrb-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.wrb-modal[hidden] {
	display: none;
}

.wrb-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.wrb-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-height: 92vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	color: inherit;
	padding: 1.25rem 1.25rem 1.75rem;
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}

/* Ab Tablet: zentriertes Dialogfenster statt Bottom-Sheet. */
@media (min-width: 640px) {
	.wrb-modal {
		align-items: center;
		padding: 1.5rem;
	}

	.wrb-modal__dialog {
		max-width: 560px;
		border-radius: 12px;
		padding: 2rem;
	}
}

.wrb-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 44px;
	height: 44px;
	border: 0;
	background: transparent;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: inherit;
	opacity: 0.7;
}

.wrb-modal__close:hover,
.wrb-modal__close:focus {
	opacity: 1;
}

.wrb-modal__title {
	margin: 0 2rem 0.75rem 0;
}

/* ---------- Formular ---------- */

.wrb-form__hint,
.wrb-confirm__hint {
	font-size: 0.9em;
	opacity: 0.85;
	margin: 0 0 1rem;
}

.wrb-field {
	margin-bottom: 1rem;
}

.wrb-field label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 600;
}

.wrb-field input,
.wrb-field textarea,
.wrb-field select {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0.55em 0.75em;
	font: inherit;
	color: inherit;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 6px;
	background: #fff;
}

.wrb-field textarea {
	resize: vertical;
}

.wrb-field input:focus,
.wrb-field textarea:focus,
.wrb-field select:focus {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.wrb-field--invalid input,
.wrb-field--invalid textarea {
	border-color: #b91c1c;
}

.wrb-field__error,
.wrb-form__error {
	color: #b91c1c;
	font-size: 0.85em;
	margin: 0.35rem 0 0;
}

/* ---------- Datenschutz-Hinweis + optionale Zustimmungs-Checkbox ---------- */

.wrb-privacy {
	font-size: 0.85em;
	opacity: 0.85;
	margin: 0 0 1rem;
}

.wrb-privacy a,
.wrb-consent a {
	color: inherit;
	text-decoration: underline;
}

.wrb-field--consent .wrb-consent {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	font-weight: 400;
	font-size: 0.9em;
	cursor: pointer;
}

.wrb-field--consent input[type="checkbox"] {
	flex: 0 0 auto;
	width: 1.15em;
	height: 1.15em;
	min-height: 0;
	margin: 0.2em 0 0;
	accent-color: currentColor;
}

.wrb-field--invalid .wrb-consent {
	color: #b91c1c;
}

/* Honeypot: aus dem Viewport geschoben, nicht display:none (manche Bots erkennen das). */
.wrb-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.wrb-form__submit,
.wrb-confirm__submit {
	width: 100%;
	margin-top: 0.5rem;
}

@media (min-width: 640px) {
	.wrb-form__submit,
	.wrb-confirm__submit {
		width: auto;
	}
}

.wrb-button[disabled] {
	opacity: 0.6;
	cursor: wait;
}

/* ---------- Stufe 2: Zusammenfassung ---------- */

.wrb-confirm__summary {
	margin: 0 0 1.25rem;
	padding: 0.9rem 1rem;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 8px;
}

.wrb-confirm__summary dt {
	font-weight: 600;
	font-size: 0.85em;
	opacity: 0.8;
	margin-top: 0.6rem;
}

.wrb-confirm__summary dt:first-child {
	margin-top: 0;
}

.wrb-confirm__summary dd {
	margin: 0.1rem 0 0;
	overflow-wrap: anywhere;
}

.wrb-confirm__actions {
	display: flex;
	flex-direction: column-reverse;
	gap: 0.6rem;
}

@media (min-width: 640px) {
	.wrb-confirm__actions {
		flex-direction: row;
		justify-content: flex-end;
	}
}

/* ---------- Erfolgsansicht ---------- */

.wrb-success {
	text-align: center;
	padding: 1rem 0 0.5rem;
}

.wrb-success__icon {
	font-size: 2.5rem;
	line-height: 1;
	margin: 0 0 0.75rem;
	color: #15803d;
}

.wrb-success__message {
	margin: 0 0 1.25rem;
}

/* Kein Seiten-Scroll, solange das Modal offen ist. */
body.wrb-modal-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
	.wrb-modal__dialog {
		animation: wrb-slide-up 0.22s ease-out;
	}

	@keyframes wrb-slide-up {
		from {
			transform: translateY(24px);
			opacity: 0;
		}
		to {
			transform: translateY(0);
			opacity: 1;
		}
	}
}
