/*
 * OfflineOps contact form.
 *
 * Every value is a theme.json token so the form follows the brand colour set
 * in Store Settings. Each token carries a fallback, because this is a plugin:
 * under a different theme the variables are simply absent, and a form with no
 * visible borders is worse than one in default greys.
 *
 * Pill controls to match the checkout (woo-classic.css), logical properties
 * throughout so it mirrors correctly in RTL.
 */

.oo-form-wrap {
	--oo-line: var(--wp--preset--color--line, #dedcd6);
	--oo-primary: var(--wp--preset--color--primary, #1f6f5c);
	--oo-sale: var(--wp--preset--color--sale, #9c2f2f);
	--oo-muted: var(--wp--preset--color--muted, #6b6962);
	--oo-base: var(--wp--preset--color--base, #fff);
	--oo-radius-pill: var(--wp--custom--radius--pill, 999px);
	--oo-radius-lg: var(--wp--custom--radius--lg, 16px);
	--oo-gap: var(--wp--preset--spacing--40, 1.5rem);
}

.oo-form {
	display: grid;
	gap: var(--oo-gap);
	margin: 0;
}

.oo-form__row {
	display: flex;
	flex-direction: column;
	gap: .4rem;
	margin: 0;
}

.oo-form__label {
	font-size: var(--wp--preset--font-size--sm, 1rem);
	font-weight: 500;
}

.oo-form__req {
	color: var(--oo-sale);
	font-weight: 700;
}

.oo-form__opt {
	color: var(--oo-muted);
	font-size: var(--wp--preset--font-size--xs, .875rem);
	font-weight: 400;
}

.oo-form__control {
	box-sizing: border-box;
	inline-size: 100%;
	padding-block: .7rem;
	padding-inline: 1.1rem;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 1rem);
	line-height: 1.6;
	color: inherit;
	background: var(--oo-base);
	border: 1px solid var(--oo-line);
	border-radius: var(--oo-radius-pill);
	box-shadow: none;
	transition: border-color var(--wp--custom--transition--fast, 140ms)
		var(--wp--custom--transition--ease, ease);
}

/* A message is paragraphs, not a line: a pill would crop its own text. */
textarea.oo-form__control {
	border-radius: var(--oo-radius-lg);
	min-block-size: 8rem;
	resize: vertical;
}

.oo-form__control:focus {
	border-color: var(--oo-primary);
	outline: none;
}

.oo-form__row.has-error .oo-form__control {
	border-color: var(--oo-sale);
}

.oo-form__error {
	font-size: var(--wp--preset--font-size--xs, .875rem);
	color: var(--oo-sale);
}

.oo-form__alert {
	padding: .9rem 1.1rem;
	margin: 0;
	font-size: var(--wp--preset--font-size--sm, 1rem);
	background: var(--wp--preset--color--surface, #f6f6f4);
	border-inline-start: 3px solid var(--oo-sale);
	border-radius: var(--wp--custom--radius--md, 8px);
}

/* The honeypot. Moved out of view rather than display:none — some bots skip
   fields that are display:none, which defeats the point of having one. */
.oo-form__trap {
	position: absolute !important;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	margin: 0;
}

.oo-form__actions {
	margin: 0;
}

/* Padding, radius and colour here are a fallback, not the final word. Under
   the OfflineOps theme, theme.json emits
   `:root :where(.wp-element-button, .wp-block-button__link)`, which scores
   0,1,0 — the same as this selector — and is printed after this file, so it
   wins the tie and the button takes the site's standard button metrics. That
   is the right outcome: the theme should own the look on its own site. These
   values are what the button falls back to under a theme that defines no
   button element style. */
.oo-form__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding-block: .85rem;
	padding-inline: 2rem;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--sm, 1rem);
	font-weight: 550;
	line-height: 1.4;
	color: var(--oo-on-primary, #fff);
	background: var(--oo-primary);
	border: 0;
	border-radius: var(--wp--custom--radius--md, 8px);
	cursor: pointer;
	transition: background var(--wp--custom--transition--fast, 140ms)
		var(--wp--custom--transition--ease, ease);
}

.oo-form__submit:hover {
	background: var(--wp--preset--color--primary-dark, #164d41);
}

@media (min-width: 600px) {
	.oo-form__actions { text-align: start; }
	.oo-form__submit { min-inline-size: 12rem; }
}

/* Confirmation. Replaces the form rather than sitting above it. */
.oo-form__done {
	padding: var(--wp--preset--spacing--50, 2.5rem);
	text-align: center;
	background: var(--wp--preset--color--surface, #f6f6f4);
	border-radius: var(--oo-radius-lg);
	box-shadow: var(--wp--preset--shadow--sm, 0 1px 2px rgba(23, 22, 20, .06));
}

.oo-form__done-title {
	margin: 0;
	font-size: var(--wp--preset--font-size--lg, 1.4375rem);
	font-weight: 600;
	color: var(--oo-primary);
}

.oo-form__done-text {
	margin-block: .5rem 0;
	font-size: var(--wp--preset--font-size--sm, 1rem);
	color: var(--oo-muted);
}

@media (prefers-reduced-motion: reduce) {
	.oo-form__control,
	.oo-form__submit {
		transition: none;
	}
}
