/* Revolutionary Forms, frontend */

:root {
	--rf-radius: 10px;
	--rf-radius-sm: 6px;
	--rf-color-primary: #2563eb;
	--rf-color-primary-hover: #1d4ed8;
	--rf-color-primary-soft: rgba(37, 99, 235, 0.16);
	--rf-color-text: #111827;
	--rf-color-muted: #6b7280;
	/* Required marker: a gray that keeps 7:1 on the white form card. Not red:
	   a required field is not an error. See the theme override below. */
	--rf-color-required: #4b5563;
	--rf-color-border: #e5e7eb;
	--rf-color-border-hover: #cbd5e1;
	--rf-color-bg: #ffffff;
	--rf-color-bg-soft: #f9fafb;
	--rf-color-error: #dc2626;
	--rf-color-error-bg: #fef2f2;
	--rf-color-success: #15803d;
	--rf-color-success-bg: #f0fdf4;
	/* 0.9.0: every color that used to be hard-coded is a variable, with the
	   old value as its default, so a theme (or the Color mode mapping below)
	   can repaint the whole form. */
	--rf-color-input-bg: #ffffff;
	--rf-color-placeholder: #9ca3af;
	--rf-color-on-primary: #ffffff;
	--rf-color-primary-soft-hover: rgba(37, 99, 235, 0.26);
	--rf-color-primary-line: rgba(37, 99, 235, 0.55);
	--rf-color-primary-glow: rgba(37, 99, 235, 0.35);
	--rf-color-pending: #4b5563;
	--rf-color-on-pending: #ffffff;
	--rf-color-disabled: #c4c9d2;
	--rf-color-day-off: #b3b9c4;
	--rf-color-error-text: #7f1d1d;
	--rf-color-error-line: rgba(220, 38, 38, 0.25);
	--rf-color-success-text: #14532d;
	--rf-color-success-line: rgba(21, 128, 61, 0.3);
	--rf-color-success-line-soft: rgba(21, 128, 61, 0.25);
	--rf-color-success-line-strong: rgba(21, 128, 61, 0.35);
	--rf-color-success-hover: #ecfdf5;
	--rf-color-button-disabled: #9ca3af;
	--rf-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
	--rf-shadow-md: 0 6px 24px -8px rgba(15, 23, 42, 0.12), 0 1px 2px rgba(15, 23, 42, 0.04);
	--rf-shadow-focus: 0 0 0 4px var(--rf-color-primary-soft);
	--rf-shadow-error-focus: 0 0 0 4px rgba(220, 38, 38, 0.16);
	--rf-transition: 150ms ease;
}

/* Theme Color mode (Multipurpose theme 1.48+ and other revdash themes).
   The theme sets html[data-color-mode="dark"|"light"] before paint and
   prints its palette as --dash-mode-* variables; the form follows it: the
   card is the theme surface, inputs sit on the page background, and the
   primary color is the theme accent with the theme's text-on-accent color.
   Text colored "primary" (links, available days, time slots) uses the
   theme link color, since an accent such as gold is too light to read on a
   white card. Declared on html so a site's own --rf-color-* overrides on
   body or on the form still win. Without the attribute nothing here
   applies and the form looks as it always has. */
html[data-color-mode] {
	--rf-color-bg: var(--dash-mode-surface, #ffffff);
	--rf-color-bg-soft: var(--dash-mode-surface-alt, #f9fafb);
	--rf-color-input-bg: var(--dash-mode-bg, #ffffff);
	--rf-color-text: var(--dash-mode-text, #111827);
	--rf-color-muted: var(--dash-mode-muted, #6b7280);
	--rf-color-required: var(--dash-mode-muted, #4b5563);
	--rf-color-placeholder: var(--dash-mode-muted, #6b7280);
	--rf-color-border: var(--dash-mode-border, #e5e7eb);
	--rf-color-border-hover: var(--dash-mode-muted, #cbd5e1);
	--rf-color-primary: var(--dash-mode-accent, #2563eb);
	--rf-color-primary-hover: var(--dash-mode-accent-hover, var(--dash-mode-accent, #1d4ed8));
	--rf-color-on-primary: var(--dash-mode-accent-text, #ffffff);
	--rf-color-primary-ink: var(--dash-mode-link, var(--dash-mode-text, #2563eb));
	--rf-color-primary-soft: color-mix(in srgb, var(--dash-mode-accent, #2563eb) 22%, transparent);
	--rf-color-primary-soft-hover: color-mix(in srgb, var(--dash-mode-accent, #2563eb) 32%, transparent);
	--rf-color-primary-line: var(--dash-mode-muted, #6b7280);
	--rf-color-primary-glow: transparent;
	--rf-color-pending: var(--dash-mode-text, #4b5563);
	--rf-color-on-pending: var(--dash-mode-surface, #ffffff);
	--rf-color-disabled: var(--dash-mode-border, #c4c9d2);
	--rf-color-day-off: var(--dash-mode-muted, #b3b9c4);
	--rf-color-button-disabled: var(--dash-mode-border, #9ca3af);
	/* A solid two-tone ring: visible on any surface, whatever the accent. */
	--rf-shadow-focus: 0 0 0 2px var(--rf-color-bg), 0 0 0 4px var(--rf-color-primary-ink, var(--rf-color-primary));
	--rf-shadow-error-focus: 0 0 0 2px var(--rf-color-bg), 0 0 0 4px var(--rf-color-error);
	--rf-shadow-md: 0 1px 2px rgba(0, 0, 0, 0.06);
	--rf-color-error-bg: color-mix(in srgb, var(--rf-color-error) 10%, var(--dash-mode-surface, #ffffff));
	--rf-color-error-line: color-mix(in srgb, var(--rf-color-error) 45%, transparent);
	--rf-color-error-text: var(--dash-mode-text, #7f1d1d);
	--rf-color-success-bg: color-mix(in srgb, var(--rf-color-success) 12%, var(--dash-mode-surface, #ffffff));
	--rf-color-success-line: color-mix(in srgb, var(--rf-color-success) 45%, transparent);
	--rf-color-success-line-soft: var(--rf-color-success-line);
	--rf-color-success-line-strong: var(--rf-color-success-line);
	--rf-color-success-text: var(--dash-mode-text, #14532d);
	--rf-color-success-hover: var(--dash-mode-surface-alt, #ecfdf5);
}
/* Error and success colors readable (4.5:1 or better) on both surfaces. */
html[data-color-mode="light"] {
	--rf-color-error: #a9222e;
	--rf-color-success: #15803d;
}
html[data-color-mode="dark"] {
	--rf-color-error: #ffb6b6;
	--rf-color-success: #86efac;
	--rf-shadow-md: none;
}
/* Links inside the confirmation and the calendar links follow the theme's
   link color in Color mode (the browser default blue fails on dark). */
html[data-color-mode] .rf-form-confirmation a,
html[data-color-mode] .rf-meeting-cal-links a {
	color: var(--rf-color-primary-ink, var(--rf-color-primary));
}

.rf-form-wrap {
	max-width: 720px;
	margin: 1.75em 0;
	/* Match the active theme's body font via the suite font contract. */
	font-family: var(--rev-font, inherit);
}

.rf-form {
	background: var(--rf-color-bg);
	padding: 2rem;
	border: 1px solid var(--rf-color-border);
	border-radius: var(--rf-radius);
	box-shadow: var(--rf-shadow-md);
}

.rf-form-title {
	margin: 0 0 0.35em;
	font-size: 1.45em;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--rf-color-text);
	line-height: 1.25;
}
.rf-form-description {
	margin: 0 0 1.5em;
	color: var(--rf-color-muted);
	font-size: 0.95em;
	line-height: 1.55;
}

.rf-fields {
	list-style: none !important;
	margin: 0 0 1.25em !important;
	padding: 0 !important;
}
.rf-field { margin: 0 0 1.15em; padding: 0; }
.rf-field:last-child { margin-bottom: 0; }

.rf-label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.45em;
	color: var(--rf-color-text);
	font-size: 0.95em;
	letter-spacing: -0.005em;
}

/* Visually hidden text that assistive technology still reads. */
.rf-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.rf-required-marker {
	color: var(--rf-color-required);
	margin-left: 3px;
	font-weight: 700;
	font-size: 1.05em;
}

.rf-input input[type="text"],
.rf-input input[type="email"],
.rf-input input[type="tel"],
.rf-input input[type="url"],
.rf-input input[type="number"],
.rf-input input[type="date"],
.rf-input input[type="time"],
.rf-input textarea,
.rf-input select {
	width: 100%;
	padding: 0.7em 0.9em;
	font-size: 1em;
	line-height: 1.4;
	color: var(--rf-color-text);
	font-family: inherit;
	border: 1px solid var(--rf-color-border);
	border-radius: var(--rf-radius-sm);
	background: var(--rf-color-input-bg);
	box-shadow: var(--rf-shadow-sm);
	box-sizing: border-box;
	transition: border-color var(--rf-transition), box-shadow var(--rf-transition);
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.rf-input input[type="text"]:hover,
.rf-input input[type="email"]:hover,
.rf-input input[type="tel"]:hover,
.rf-input input[type="url"]:hover,
.rf-input input[type="number"]:hover,
.rf-input input[type="date"]:hover,
.rf-input input[type="time"]:hover,
.rf-input textarea:hover,
.rf-input select:hover {
	border-color: var(--rf-color-border-hover);
}

.rf-input input:focus,
.rf-input textarea:focus,
.rf-input select:focus {
	outline: none;
	border-color: var(--rf-color-primary-ink, var(--rf-color-primary));
	box-shadow: var(--rf-shadow-focus);
}

.rf-input input::placeholder,
.rf-input textarea::placeholder,
.rf-sub input::placeholder {
	color: var(--rf-color-placeholder);
	opacity: 1;
}

.rf-input select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.5 7.5l4.5 4.5 4.5-4.5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.85em center;
	background-size: 12px;
	padding-right: 2.4em;
	cursor: pointer;
}

.rf-input textarea {
	resize: vertical;
	min-height: 130px;
}

.rf-input input[type="file"] {
	padding: 0.45em 0;
	font-size: 0.95em;
	background: transparent;
	box-shadow: none;
	border: 0;
}

.rf-file-help {
	margin-top: 6px;
	font-size: 0.85em;
	color: var(--rf-color-muted);
}

.rf-size-small input,
.rf-size-small select,
.rf-size-small textarea { max-width: 240px; }
.rf-size-medium input,
.rf-size-medium select,
.rf-size-medium textarea { max-width: 480px; }
.rf-size-large input,
.rf-size-large select,
.rf-size-large textarea { max-width: 100%; }

.rf-choices {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
}
.rf-choice {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	font-weight: 400;
	cursor: pointer;
	padding: 0.4em 0.55em;
	border-radius: var(--rf-radius-sm);
	transition: background var(--rf-transition);
	color: var(--rf-color-text);
}
.rf-choice:hover { background: var(--rf-color-bg-soft); }
.rf-choice input[type="radio"],
.rf-choice input[type="checkbox"] {
	margin: 0;
	width: 1.05em;
	height: 1.05em;
	accent-color: var(--rf-color-primary);
	cursor: pointer;
}

.rf-multi {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75em;
}
.rf-multi-name { grid-template-columns: 1fr 1fr; }
.rf-multi-address { grid-template-columns: 1fr 1fr; }
.rf-multi-address .rf-sub-street,
.rf-multi-address .rf-sub-street2 { grid-column: 1 / -1; }

.rf-sub { display: flex; flex-direction: column; }
.rf-sub input {
	width: 100%;
	padding: 0.65em 0.9em;
	border: 1px solid var(--rf-color-border);
	border-radius: var(--rf-radius-sm);
	background: var(--rf-color-input-bg);
	font-size: 1em;
	font-family: inherit;
	color: var(--rf-color-text);
	box-sizing: border-box;
	box-shadow: var(--rf-shadow-sm);
	transition: border-color var(--rf-transition), box-shadow var(--rf-transition);
	-webkit-appearance: none;
	appearance: none;
}
.rf-sub input:hover { border-color: var(--rf-color-border-hover); }
.rf-sub input:focus {
	outline: none;
	border-color: var(--rf-color-primary-ink, var(--rf-color-primary));
	box-shadow: var(--rf-shadow-focus);
}
.rf-sub-label {
	font-size: 0.78em;
	color: var(--rf-color-muted);
	margin-top: 5px;
	letter-spacing: 0.01em;
}

/* Question & Answer */
.rf-qa {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1em;
	counter-reset: rf-qa;
}
.rf-qa-item {
	margin: 0;
	padding: 0;
	counter-increment: rf-qa;
}
.rf-qa-question {
	display: block;
	margin-bottom: 0.4em;
	font-weight: 500;
	line-height: 1.4;
	color: var(--rf-color-text);
}
.rf-qa-numbered .rf-qa-question::before {
	content: counter(rf-qa) ". ";
	color: var(--rf-color-muted);
}
.rf-qa textarea { min-height: 90px; }
.rf-qa-empty {
	font-size: 0.875em;
	color: var(--rf-color-muted);
}

.rf-field-description {
	margin-top: 0.45em;
	font-size: 0.875em;
	color: var(--rf-color-muted);
	line-height: 1.45;
}

.rf-field.rf-has-error .rf-input input,
.rf-field.rf-has-error .rf-input textarea,
.rf-field.rf-has-error .rf-input select,
.rf-field.rf-has-error .rf-sub input,
.rf-input [aria-invalid="true"],
.rf-input [aria-invalid="true"] input {
	border-color: var(--rf-color-error);
}
.rf-field.rf-has-error .rf-input input:focus,
.rf-field.rf-has-error .rf-input textarea:focus,
.rf-field.rf-has-error .rf-input select:focus,
.rf-field.rf-has-error .rf-sub input:focus {
	box-shadow: var(--rf-shadow-error-focus);
}

.rf-field-error {
	margin-top: 0.5em;
	color: var(--rf-color-error);
	font-size: 0.875em;
	font-weight: 500;
}

.rf-form-error-summary {
	background: var(--rf-color-error-bg);
	border: 1px solid var(--rf-color-error-line);
	border-left: 4px solid var(--rf-color-error);
	color: var(--rf-color-error-text);
	padding: 0.85em 1em;
	margin-bottom: 1.25em;
	border-radius: var(--rf-radius-sm);
	font-size: 0.95em;
}

.rf-error-summary-title {
	margin: 0;
	font-weight: 600;
}
.rf-error-summary-list {
	margin: 0.5em 0 0 1.25em !important;
	padding: 0 !important;
	list-style: disc;
}
.rf-error-summary-list li { margin: 0.2em 0; }
.rf-error-summary-list a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.rf-error-summary-list a:hover { text-decoration-thickness: 2px; }

/* Focus moves to these after a submit; keep the ring visible. */
.rf-form-error-summary:focus,
.rf-form-confirmation:focus,
.rf-meeting:focus {
	outline: 3px solid var(--rf-color-primary-ink, var(--rf-color-primary));
	outline-offset: 2px;
}
.rf-form-error-summary:focus:not(:focus-visible),
.rf-form-confirmation:focus:not(:focus-visible) {
	outline: 2px solid currentColor;
}

.rf-form-confirmation {
	background: var(--rf-color-success-bg);
	border: 1px solid var(--rf-color-success-line-soft);
	border-left: 4px solid var(--rf-color-success);
	color: var(--rf-color-success-text);
	padding: 1.1em 1.25em;
	border-radius: var(--rf-radius-sm);
	font-size: 1em;
	line-height: 1.55;
}

.rf-form-footer {
	display: flex;
	align-items: center;
	gap: 0.85em;
	margin-top: 0.5em;
}

/* Submit button consumes the FULL theme CTA contract (--rev-btn-*): colors,
   shape, size, font (family/case), shadow, hover text color, the combined
   hover transform (lift/grow/tilt/slide), the shine sweep, and the pulse
   loop. Mirrors the reference consumer (backups admin.css); every var keeps
   the plugin's own value as the fallback so the button still looks right
   with no Revolutionary theme active. */
.rf-submit {
	position: relative;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--rev-btn-padding, 0.8em 1.6em);
	background: var(--rev-btn-bg, var(--rf-color-primary));
	color: var(--rev-btn-color, var(--rf-color-on-primary));
	border: var(--rev-btn-border, 0);
	border-radius: var(--rev-btn-radius, var(--rf-radius-sm));
	font-weight: var(--rev-btn-font-weight, 600);
	font-size: var(--rev-btn-font-size, 1em);
	font-family: var(--rev-btn-font-family, inherit);
	text-transform: var(--rev-btn-text-transform, none);
	letter-spacing: 0.005em;
	cursor: pointer;
	box-shadow: var(--rev-btn-shadow, 0 1px 2px rgba(15, 23, 42, 0.08));
	transition: var(--rev-btn-transition, background var(--rf-transition), transform var(--rf-transition), box-shadow var(--rf-transition));
	/* Pulse, animates only when the theme sets --rev-btn-pulse to the keyframe
	   name; defaults to none so the hover transform stays free. */
	animation: var(--rev-btn-pulse, none) 2.4s ease-in-out infinite;
}
.rf-submit:hover {
	background: var(--rev-btn-bg-hover, var(--rf-color-primary-hover));
	color: var(--rev-btn-color-hover, var(--rev-btn-color, var(--rf-color-on-primary)));
	box-shadow: var(--rev-btn-shadow-hover, 0 8px 16px -4px var(--rf-color-primary-glow));
	transform: var(--rev-btn-hover-transform, translateY(var(--rev-btn-lift, -1px)));
	font-family: var(--rev-btn-font-family-hover, var(--rev-btn-font-family, inherit));
}
/* Shine sweep, the ::after is always present but invisible until the theme
   turns it on with --rev-btn-shine:1. */
.rf-submit::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
	transform: translateX(-120%);
	transition: transform 0.7s ease;
	pointer-events: none;
	opacity: var(--rev-btn-shine, 0);
}
.rf-submit:hover::after {
	transform: translateX(120%);
}
@keyframes theme-default-btn-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.035); }
}
.rf-submit:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.rf-submit:focus-visible {
	outline: none;
	box-shadow: var(--rf-shadow-focus), 0 1px 2px rgba(15, 23, 42, 0.08);
}
.rf-submit:disabled {
	background: var(--rf-color-button-disabled);
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
	animation: none;
}
.rf-submit:disabled::after {
	opacity: 0;
}

.rf-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid var(--rf-color-border);
	border-top-color: var(--rf-color-primary);
	border-radius: 50%;
	animation: rf-spin 0.7s linear infinite;
}
.rf-form.rf-loading .rf-spinner { display: inline-block; }
.rf-form.rf-loading .rf-submit { opacity: 0.85; }

@keyframes rf-spin { to { transform: rotate(360deg); } }

.rf-section-title {
	margin: 1.6em 0 0.5em;
	padding-bottom: 0.45em;
	border-bottom: 1px solid var(--rf-color-border);
	font-size: 1.1em;
	color: var(--rf-color-text);
	font-weight: 600;
	letter-spacing: -0.005em;
}
.rf-section-description {
	color: var(--rf-color-muted);
	font-size: 0.95em;
	margin-bottom: 0.6em;
	line-height: 1.5;
}

.rf-page-break {
	border: 0;
	border-top: 1px dashed var(--rf-color-border);
	margin: 1.5em 0;
}

.rf-field-recaptcha .rf-input {
	display: flex;
}
.rf-recaptcha-note {
	margin: 0;
	color: var(--rf-color-muted);
	font-size: 0.85em;
	line-height: 1.45;
}
.rf-invisible-captcha { display: none; }
.rf-recaptcha-missing {
	display: inline-block;
	padding: 0.7em 0.95em;
	background: var(--rf-color-error-bg);
	color: var(--rf-color-error-text);
	border: 1px dashed var(--rf-color-error);
	border-radius: var(--rf-radius-sm);
	font-style: normal;
	font-size: 0.9em;
}

/* Topic chooser (form setting): buttons above the fields, linkable with ?topic=<key>. */
.rf-topics {
	margin: 0 0 1.5em;
}
.rf-topics-heading {
	margin: 0 0 0.6em;
	font-weight: 600;
	color: var(--rf-color-text);
}
.rf-topics-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.rf-form .rf-topic {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	min-width: 44px;
	padding: 0.5em 1.1em;
	border: 1px solid var(--rf-color-border);
	border-radius: 999px;
	background: var(--rf-color-bg);
	color: var(--rf-color-text);
	font-size: 0.95em;
	line-height: 1.3;
	text-decoration: none;
	cursor: pointer;
	transition: border-color var(--rf-transition), background-color var(--rf-transition), color var(--rf-transition);
}
.rf-form .rf-topic:hover {
	border-color: var(--rf-color-border-hover);
}
.rf-form .rf-topic:focus-visible {
	outline: none;
	box-shadow: var(--rf-shadow-focus);
	border-color: var(--rf-color-primary-ink, var(--rf-color-primary));
}
.rf-form .rf-topic.is-active,
.rf-form .rf-topic[aria-pressed="true"],
.rf-form .rf-topic[aria-current="true"] {
	background: var(--rf-color-primary);
	border-color: var(--rf-color-primary);
	color: var(--rf-color-on-primary);
}
.rf-topic-intro {
	margin: 0.9em 0 0;
	color: var(--rf-color-muted);
	font-size: 0.95em;
	line-height: 1.55;
}
.rf-topic-intro[hidden] {
	display: none;
}
@media (max-width: 480px) {
	.rf-topics-list .rf-topic {
		flex: 1 1 100%;
	}
}
