/*
 * CNC Lead Form - self-contained stylesheet (CONTRACTS: the form).
 *
 * The form must look right inside ANY theme, so it carries its own scoped
 * design tokens on .cnclf (light-neutral defaults, WCAG AA on white). Admin
 * Appearance settings arrive as inline CSS custom properties on the wrapper
 * (--cnclf-bg / --cnclf-input-bg / --cnclf-btn / --cnclf-gap /
 * --cnclf-radius) and win over these defaults via var() fallbacks.
 */

.cnclf {
	--cnclf-text: #111827;
	--cnclf-text-2: #374151;
	--cnclf-muted: #5b6b80; /* AA >= 4.5:1 on white */
	--cnclf-border: #d1d5db;
	--cnclf-accent: #2563eb; /* AA 5.17:1 on white */
	--cnclf-ok: #15803d;
	--cnclf-danger: #dc2626;
	/* Full width of the embedding container by default; the "Form max width"
	   Appearance setting caps it via --cnclf-maxw. width:100% guards against
	   themes shrink-wrapping shortcode output. */
	width: 100%;
	max-width: var(--cnclf-maxw, none);
	box-sizing: border-box;
	/* container border: 0 until the Appearance settings set --cnclf-bw/-bc */
	border: var(--cnclf-bw, 0) solid var(--cnclf-bc, #d1d5db);
	color: var(--cnclf-text);
	font-size: 16px;
	line-height: 1.6;
}

.cnclf--boxed {
	padding: 20px;
	background: var(--cnclf-bg, transparent);
	border-radius: 12px;
}

.cnclf .cnclf__title {
	margin: 0 0 16px;
	font-size: 22px;
	line-height: 1.3;
	color: var(--cnclf-text);
}

.cnclf .cnclf__notice,
.cnclf .cnclf__error {
	margin: 0 0 16px;
	padding: 12px 16px;
	font-size: 14px;
	color: var(--cnclf-text-2);
	background: #fef2f2;
	border: 1px solid var(--cnclf-border);
	border-left: 3px solid var(--cnclf-danger);
	border-radius: 8px;
}

.cnclf .cnclf__row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0 12px;
}

@media (min-width: 640px) {
	.cnclf .cnclf__row {
		grid-template-columns: 1fr 1fr;
	}
}

.cnclf .cnclf__field {
	margin: 0 0 var(--cnclf-gap, 16px);
}

/* labels live INSIDE the fields as placeholders; real labels stay for
   screen readers only (full clip pattern). */
.cnclf label.cnclf-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.cnclf .cnclf__field input,
.cnclf .cnclf__field textarea {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 15px;
	color: var(--cnclf-text);
	background: var(--cnclf-input-bg, #f9fafb);
	border: 1px solid var(--cnclf-border);
	border-radius: var(--cnclf-radius, 12px);
	box-sizing: border-box;
}

.cnclf .cnclf__field input::placeholder,
.cnclf .cnclf__field textarea::placeholder {
	color: var(--cnclf-muted);
	opacity: 1;
}

.cnclf .cnclf__field textarea {
	min-height: 110px;
	resize: vertical;
	line-height: 1.6;
}

.cnclf .cnclf__field input:focus-visible,
.cnclf .cnclf__field textarea:focus-visible {
	outline: 2px solid var(--cnclf-accent);
	outline-offset: 1px;
	border-color: var(--cnclf-accent);
}

/* the tel widget wraps the input; keep the wrapper full width */
.cnclf .cnclf__field .iti {
	display: block;
	width: 100%;
}

/* The country-search input inside the dropdown must keep the LIB's own
   spacing: its magnifier icon sits inside a padding computed from the
   --iti-* variables. */
.cnclf .cnclf__field .iti__search-input {
	min-height: 0;
	padding: 10px 12px 10px calc(var(--iti-spacer-horizontal, 8px) + var(--iti-globe-icon-size, 16px) + var(--iti-spacer-horizontal, 8px));
	background: transparent;
	border: 0;
	border-radius: 3px;
}

.cnclf .cnclf__field .iti__search-input:focus {
	outline: 2px solid var(--cnclf-accent);
	outline-offset: -2px;
	border: 0;
}

/* leading icon inside a field (first name / email) */
.cnclf .cnclf__inputwrap {
	position: relative;
	display: block;
}

.cnclf .cnclf__inputwrap .cnclf__icon {
	position: absolute;
	top: 50%;
	left: 12px;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: var(--cnclf-muted);
	pointer-events: none;
}

.cnclf .cnclf__inputwrap input {
	padding-left: 38px;
}

.cnclf .cnclf__icon {
	display: inline-block;
	width: 16px;
	height: 16px;
	vertical-align: -0.125em;
}

/* amount field: trailing currency suffix inside the input */
.cnclf .cnclf__amount {
	position: relative;
	display: block;
}

.cnclf .cnclf__amount input {
	padding-right: 52px;
}

.cnclf .cnclf__usd {
	position: absolute;
	top: 50%;
	right: 12px;
	transform: translateY(-50%);
	font-size: 12px;
	font-weight: 600;
	color: var(--cnclf-accent);
	pointer-events: none;
}

.cnclf .cnclf__consent {
	margin: 0 0 var(--cnclf-gap, 16px);
	font-size: 14px;
	color: var(--cnclf-text-2);
}

.cnclf .cnclf__consent input {
	margin-right: 8px;
}

.cnclf .cnclf__consent-note {
	display: block;
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--cnclf-muted);
}

.cnclf .cnclf__submit {
	margin: 0 0 10px;
}

.cnclf .cnclf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 46px;
	padding: 10px 20px;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: var(--cnclf-btn, var(--cnclf-accent));
	border: 1px solid var(--cnclf-btn, var(--cnclf-accent));
	border-radius: var(--cnclf-radius, 12px);
	cursor: pointer;
	transition: filter 0.15s ease;
}

.cnclf .cnclf-btn:hover {
	filter: brightness(0.92);
}

.cnclf .cnclf-btn:focus-visible {
	outline: 2px solid var(--cnclf-accent);
	outline-offset: 2px;
}

.cnclf .cnclf-btn:disabled {
	opacity: 0.7;
	cursor: default;
}

.cnclf .cnclf__secure {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 0;
	font-size: 12px;
	color: var(--cnclf-muted);
	text-align: center;
}

.cnclf .cnclf__icon--lock {
	width: 13px;
	height: 13px;
	flex: 0 0 auto;
}

/* -- success panel ------------------------------------------------------ */

.cnclf--sent {
	text-align: center;
}

.cnclf .cnclf__check {
	width: 56px;
	height: 56px;
	margin: 0 auto 12px;
	font-size: 26px;
	line-height: 56px;
	color: #fff;
	background: var(--cnclf-ok);
	border-radius: 50%;
}

.cnclf .cnclf__thanks {
	margin: 0 0 6px;
	font-size: 22px;
}

.cnclf .cnclf__intro {
	margin: 0 0 20px;
	color: var(--cnclf-text-2);
}

.cnclf .cnclf__next {
	padding: 16px;
	text-align: left;
	background: var(--cnclf-input-bg, #f9fafb);
	border: 1px solid var(--cnclf-border);
	border-radius: 8px;
}

.cnclf .cnclf__next-title {
	margin: 0 0 12px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--cnclf-muted);
}

.cnclf .cnclf__steps {
	margin: 0;
	padding: 0 0 0 20px;
}

.cnclf .cnclf__step {
	margin: 0 0 10px;
	font-size: 14px;
	color: var(--cnclf-text-2);
}

.cnclf .cnclf__step strong {
	display: inline-block;
	margin-right: 6px;
	color: var(--cnclf-text);
}

@media (prefers-reduced-motion: reduce) {
	.cnclf * {
		transition: none !important;
	}
}
