/**
 * Widerruf & Kontakt – Withdrawal / Revocation Form (frontend + editor preview).
 *
 * Theme-driven styling: labels above inputs, thin borders, spacing via
 * theme spacing presets with safe fallbacks. Responsive grid collapses on mobile.
 */

.wk-revocation-form-wrap {
	--wk-rf-gap: var(--wp--preset--spacing--30, 1.5rem);
	--wk-rf-field-gap: 0.4rem;
	--wk-rf-border: #cacaca;
	--wk-rf-muted: #6b7280;
}

.wk-revocation-form {
	display: flex;
	flex-direction: column;
	gap: var(--wk-rf-gap);
}

.wk-revocation-form .wk-rf-row {
	margin: 0;
}

/* Field grid */
.wk-rf-row--fields {
	display: grid;
	gap: var(--wk-rf-gap);
	grid-template-columns: repeat( var( --wk-rf-cols, 3 ), minmax( 0, 1fr ) );
}

.wk-rf-row--fields[data-cols="1"] { --wk-rf-cols: 1; }
.wk-rf-row--fields[data-cols="2"] { --wk-rf-cols: 2; }
.wk-rf-row--fields[data-cols="3"] { --wk-rf-cols: 3; }

/* Field: label above input */
.wk-rf-field {
	display: flex;
	flex-direction: column;
	gap: var(--wk-rf-field-gap);
	margin: 0;
}

.wk-rf-field label {
	font-size: var(--wp--preset--font-size--small, 0.9rem);
	line-height: 1.3;
}

.wk-rf-req {
	color: inherit;
}

.wk-revocation-form input[type="text"],
.wk-revocation-form input[type="email"],
.wk-revocation-form input[type="date"],
.wk-revocation-form textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 0.7em 0.9em;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid var(--wk-rf-border);
	border-radius: 6px;
}

.wk-revocation-form textarea {
	resize: vertical;
	min-height: 5rem;
}

.wk-revocation-form input:focus,
.wk-revocation-form textarea:focus {
	outline: 2px solid var(--wp--preset--color--primary, #1a1a1a);
	outline-offset: 1px;
}

.wk-revocation-form input[aria-invalid="true"],
.wk-revocation-form textarea[aria-invalid="true"] {
	border-color: #d63638;
	outline-color: #d63638;
}

/* Consent row */
.wk-rf-consent .wk-rf-consent-label {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	font-size: var(--wp--preset--font-size--small, 0.85rem);
	line-height: 1.5;
}

.wk-rf-consent input[type="checkbox"] {
	margin-top: 0.2em;
	flex: 0 0 auto;
}

.wk-rf-consent-text a {
	text-decoration: underline;
}

/* Submit: inherit theme button styles via wp-block-button markup */
.wk-rf-submit-row.wp-block-buttons {
	margin: 0;
}

.wk-rf-submit-row .wp-block-button {
	margin: 0;
}

.wk-rf-submit[aria-busy="true"],
.wk-rf-submit.is-busy {
	opacity: 0.7;
	cursor: progress;
}

/* Honeypot */
.wk-rf-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Field error text */
.wk-rf-error {
	color: #d63638;
	font-size: 0.85em;
	line-height: 1.3;
}

/* Feedback (non-field errors) */
.wk-rf-feedback {
	padding: 0.8em 1em;
	border-radius: 2px;
	font-size: var(--wp--preset--font-size--small, 0.9rem);
}

.wk-rf-feedback--error {
	background: #fcf0f1;
	color: #8a1f23;
	border: 1px solid #d63638;
}

/* Success message (replaces the form) */
.wk-rf-success {
	padding: 1.2em 1.4em;
	border-radius: 2px;
	background: var(--wp--preset--color--tertiary, #f0f0f0);
	border: 1px solid var(--wk-rf-border);
	font-size: var(--wp--preset--font-size--medium, 1rem);
	outline: none;
}

/* Mobile: single column */
@media (max-width: 781px) {
	.wk-rf-row--fields {
		grid-template-columns: 1fr;
	}
}
