/* NairoCRM Forms — front-end styles.
 *
 * Defaults are the NairoCRM brand. Every value is a custom property, so a
 * brand build changes the look without touching this file:
 *   - per-form colours and fonts arrive from the builder as inline variables
 *     (--nf-primary, --nf-button, --nf-ink, --nf-font-heading, --nf-font-body);
 *   - the site preset (includes/site-preset.php) can set any other token
 *     below through nairo_forms_preset_tokens().
 * Every rule is scoped under .nf-card so theme input and button styles
 * cannot override the form.
 */

.nf-card {
	--nf-primary: #1E61D6;          /* NairoCRM blue */
	--nf-primary-hover: #1a52b4;
	--nf-button: #1E61D6;
	--nf-button-hover: #1a52b4;
	--nf-button-shadow: rgba(30, 97, 214, 0.45);
	--nf-ink: #0F1B33;              /* NairoCRM ink */
	--nf-link: #14438f;
	--nf-ring: rgba(30, 97, 214, 0.18);
	--nf-text: #2b3a55;
	--nf-muted: #5b6b86;
	--nf-border: #dfe6f1;
	--nf-bg: #ffffff;
	--nf-field-bg: #f6f8fc;
	--nf-success: #2f6b0c;          /* NairoCRM green, darkened for legible text */
	--nf-success-bg: #edf7e3;
	--nf-success-line: #74C427;     /* NairoCRM green */
	--nf-error: #b42a3a;
	--nf-error-bg: #fbecee;
	--nf-radius: 16px;
	--nf-card-border: var(--nf-border);
	--nf-card-pad: 36px 34px 32px;
	/* Button label. White fails AA on a light accent, so a brand whose button
	   colour is light sets this to its own ink. */
	--nf-button-text: #ffffff;
	--nf-placeholder: #8c99b0;
	--nf-field-radius: 10px;
	--nf-button-radius: 10px;
	--nf-top-width: 1px;
	--nf-top-color: var(--nf-border);
	--nf-shadow: 0 24px 48px -32px rgba(15, 27, 51, 0.35);
	--nf-card-max: 680px;
	/* Added in 3.3.0. Each falls back to the value that was fixed before. */
	--nf-title-weight: 800;
	--nf-label-weight: 600;
	--nf-button-weight: 700;
	/* Status messages carry an even border in their own text colour rather
	   than a coloured edge down one side. */
	--nf-status-edge: 0px;
	--nf-status-ring: currentColor;
	--nf-track: #e6ecf5;
	--nf-fill: var(--nf-primary);
	--nf-back-text: var(--nf-ink);
	--nf-back-border: var(--nf-border);

	box-sizing: border-box;
	width: 100%;
	max-width: var(--nf-card-max);
	margin: 0 auto;
	padding: var(--nf-card-pad, 36px 34px 32px);
	background: var(--nf-bg);
	border: 1px solid var(--nf-card-border, var(--nf-border));
	border-top: var(--nf-top-width) solid var(--nf-top-color);
	border-radius: var(--nf-radius);
	box-shadow: var(--nf-shadow);
	font-family: var(--nf-font-body, 'Manrope'), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: var(--nf-text);
	text-align: left;
}

.nf-card *,
.nf-card *::before,
.nf-card *::after {
	box-sizing: border-box;
}

/* Header */

.nf-card .nf-title {
	margin: 0 0 6px;
	font-family: var(--nf-font-heading, 'Manrope'), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 26px;
	font-weight: var(--nf-title-weight, 800);
	line-height: 1.25;
	letter-spacing: -0.02em;
	color: var(--nf-ink);
}

.nf-card .nf-subtitle {
	margin: 0 0 6px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--nf-muted);
}

.nf-card .nf-head + .nf-form {
	margin-top: 22px;
}

/* Field grid */

.nf-card .nf-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 18px;
}

.nf-card .nf-col-full {
	grid-column: 1 / -1;
}

.nf-card .nf-col-half {
	grid-column: span 1;
}

.nf-card .nf-field {
	margin-bottom: 18px;
	min-width: 0;
}

.nf-card .nf-label {
	display: block;
	margin-bottom: 7px;
	font-family: var(--nf-font-label, var(--nf-font-heading, 'Manrope')), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 13.5px;
	font-weight: var(--nf-label-weight, 600);
	line-height: 1.4;
	color: var(--nf-ink);
}

.nf-card .nf-req {
	margin-left: 3px;
	color: var(--nf-error);
}

.nf-card .nf-input {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	min-height: 48px;
	margin: 0;
	padding: 12px 14px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--nf-ink);
	background: var(--nf-field-bg);
	border: 1px solid var(--nf-border);
	border-radius: var(--nf-field-radius);
	box-shadow: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
}

.nf-card .nf-input::placeholder {
	color: var(--nf-placeholder, #8c99b0);
	opacity: 1;
}

.nf-card .nf-input:hover {
	border-color: var(--nf-border-hover, #c6d2e6);
}

.nf-card .nf-input:focus {
	outline: none;
	background: #ffffff;
	border-color: var(--nf-primary);
	box-shadow: 0 0 0 3px var(--nf-ring);
}

.nf-card .nf-textarea {
	min-height: 130px;
	resize: vertical;
}

.nf-card .nf-select {
	padding-right: 40px;
	cursor: pointer;
	background-image: var(--nf-select-arrow, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6b86' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"));
	background-repeat: no-repeat;
	background-position: right 15px center;
}

.nf-card .nf-select:invalid,
.nf-card .nf-select:has(option[value=""]:checked) {
	color: var(--nf-placeholder, #8c99b0);
}

.nf-card .nf-select option {
	color: var(--nf-ink);
}

/* Radio and checkbox groups */

.nf-card .nf-choices {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding-top: 2px;
}

.nf-card .nf-choice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 15px;
	line-height: 1.45;
	color: var(--nf-ink);
	cursor: pointer;
}

.nf-card .nf-choice input {
	flex-shrink: 0;
	width: 17px;
	height: 17px;
	margin: 2px 0 0;
	accent-color: var(--nf-primary);
}

/* Honeypot: visually removed, still in the DOM for bots */

.nf-card .nf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Turnstile */

.nf-card .nf-turnstile {
	margin: 2px 0 14px;
}

/* Consent line: small copy pinned above the button */

.nf-card .nf-consent {
	margin: 2px 0 16px;
}

.nf-card .nf-consent-line {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-size: 13px;
	line-height: 1.6;
	color: var(--nf-muted);
	cursor: pointer;
}

.nf-card .nf-consent-line input {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin: 3px 0 0;
	accent-color: var(--nf-primary);
}

.nf-card .nf-consent-line a {
	margin-left: 0.15em;
	color: var(--nf-link);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.nf-card .nf-consent-line a:hover {
	color: var(--nf-primary);
}

/* Button */

.nf-card button.nf-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 50px;
	margin-top: 2px;
	padding: 14px 26px;
	font-family: var(--nf-font-heading, 'Manrope'), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 15px;
	font-weight: var(--nf-button-weight, 700);
	line-height: 1.3;
	color: var(--nf-button-text, #ffffff);
	background: var(--nf-button, var(--nf-primary));
	border: none;
	border-radius: var(--nf-button-radius);
	cursor: pointer;
	transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.nf-card button.nf-button:hover {
	color: var(--nf-button-text, #ffffff);
	background: var(--nf-button-hover, var(--nf-primary-hover));
	box-shadow: 0 10px 22px -14px var(--nf-button-shadow);
}

.nf-card button.nf-button:active {
	transform: translateY(1px);
}

.nf-card button.nf-button:focus-visible {
	outline: 3px solid var(--nf-ring);
	outline-offset: 2px;
}

.nf-card button.nf-button[disabled] {
	opacity: 0.7;
	cursor: wait;
}

/* Status */

.nf-card .nf-status {
	margin: 14px 0 0;
	font-size: 14.5px;
	line-height: 1.55;
	min-height: 1em;
}

.nf-card .nf-status:empty {
	display: none;
}

.nf-card .nf-status.is-success {
	padding: 16px 18px;
	font-weight: 600;
	color: var(--nf-success);
	background: var(--nf-success-bg);
	border-left: var(--nf-status-edge, 3px) solid var(--nf-success-line, var(--nf-success));
	box-shadow: inset 0 0 0 1px var(--nf-status-ring, transparent);
	border-radius: var(--nf-field-radius);
}

.nf-card .nf-status.is-error {
	padding: 12px 14px;
	font-weight: 600;
	color: var(--nf-error);
	background: var(--nf-error-bg);
	border-left: var(--nf-status-edge, 3px) solid var(--nf-error);
	box-shadow: inset 0 0 0 1px var(--nf-status-ring, transparent);
	border-radius: var(--nf-field-radius);
}

/* Sent state */

.nf-card.is-sent .nf-form > :not(.nf-status) {
	display: none;
}

.nf-card.is-sent .nf-status {
	margin-top: 0;
}

/* Mobile */

@media (max-width: 560px) {
	.nf-card {
		padding: 26px 20px 22px;
	}

	.nf-card .nf-grid {
		grid-template-columns: 1fr;
	}

	.nf-card .nf-col-half {
		grid-column: 1 / -1;
	}

	.nf-card .nf-title {
		font-size: 22px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nf-card .nf-input,
	.nf-card button.nf-button {
		transition: none;
	}
}

/* Submit button loading spinner */

.nf-card button.nf-button.is-loading {
	opacity: 0.88;
	pointer-events: none;
}

.nf-card button.nf-button.is-loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 9px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	vertical-align: middle;
	animation: nf-spin 0.7s linear infinite;
}

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

/* Hidden controls stay hidden whatever the theme does with [hidden]. */

.nf-card [hidden] {
	display: none !important;
}

/* Stepped forms (3.3.0) */

.nf-card fieldset.nf-step {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.nf-card .nf-step-title {
	display: block;
	float: none;
	width: 100%;
	margin: 0 0 6px;
	padding: 0;
	font-family: var(--nf-font-heading, 'Manrope'), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 19px;
	font-weight: var(--nf-step-weight, 700);
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: var(--nf-ink);
}

.nf-card .nf-step-title:focus {
	outline: none;
}

.nf-card .nf-step-intro {
	margin: 0 0 18px;
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--nf-muted);
}

.nf-card .nf-step-title + .nf-grid {
	margin-top: 16px;
}

.nf-card .nf-progress {
	margin: 0 0 22px;
}

.nf-card .nf-progress-label {
	margin: 0 0 8px;
	font-size: 13.5px;
	line-height: 1.4;
	color: var(--nf-muted);
}

.nf-card .nf-progress-track {
	display: block;
	height: 6px;
	overflow: hidden;
	background: var(--nf-track, #e6ecf5);
	border-radius: 999px;
}

.nf-card .nf-progress-fill {
	display: block;
	height: 100%;
	background: var(--nf-fill, var(--nf-primary));
	border-radius: 999px;
	transition: width 0.25s ease;
}

.nf-card .nf-step-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 4px;
}

.nf-card .nf-step-nav .nf-button {
	flex: 1 1 200px;
	width: auto;
}

.nf-card button.nf-back {
	flex: 0 0 auto;
	min-height: 50px;
	margin-top: 2px;
	padding: 14px 22px;
	font-family: var(--nf-font-heading, 'Manrope'), 'Manrope', 'Segoe UI', Arial, sans-serif;
	font-size: 15px;
	font-weight: var(--nf-button-weight, 700);
	line-height: 1.3;
	color: var(--nf-back-text, var(--nf-ink));
	background: transparent;
	border: 1px solid var(--nf-back-border, var(--nf-border));
	border-radius: var(--nf-button-radius);
	cursor: pointer;
}

.nf-card button.nf-back:hover {
	border-color: var(--nf-ink);
}

.nf-card button.nf-back:focus-visible {
	outline: 3px solid var(--nf-ring);
	outline-offset: 2px;
}

/* Next step after a successful submit */

.nf-card .nf-status .nf-next-link {
	display: inline-block;
	margin-top: 12px;
	padding: 11px 18px;
	font-weight: var(--nf-button-weight, 700);
	color: var(--nf-button-text, #ffffff);
	text-decoration: none;
	background: var(--nf-button, var(--nf-primary));
	border-radius: var(--nf-button-radius);
}

.nf-card .nf-status .nf-next-link:hover {
	background: var(--nf-button-hover, var(--nf-primary-hover));
}

.nf-card .nf-status .nf-next-link:focus-visible {
	outline: 3px solid var(--nf-ring);
	outline-offset: 2px;
}

.nf-card .nf-status:focus {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	.nf-card .nf-progress-fill {
		transition: none;
	}
}
