/* Bricks Form Pro — frontend styles.
   Kept minimal and token-driven so Bricks' own form styling stays in control. */

/* Conditional logic + multi-step both hide a field's .form-group. Two separate
   classes so they never clobber each other; either one hides the field. The
   form keeps its native flex-wrap layout because we never re-parent fields. */
.bfp-hidden,
.bfp-step-hidden {
	display: none !important;
}

/* ------------------------------ Step navigation --------------------------- */

/* Progress + nav are direct children of the (flex-wrap / grid) form, so force
   them onto their own full-width row instead of flowing inline with fields. */
.bfp-progress,
.bfp-step-nav {
	flex: 0 0 100%;
	width: 100%;
	box-sizing: border-box;
	grid-column: 1 / -1;
}

.bfp-step-nav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-block: 1rem;
}

.bfp-step-nav .bfp-step-prev {
	margin-inline-end: auto;
}

.bfp-step-nav button {
	cursor: pointer;
	padding: 0.6em 1.4em;
	border: 1px solid currentColor;
	border-radius: var( --bfp-radius, 4px );
	background: transparent;
	color: inherit;
	font: inherit;
}

.bfp-step-nav .bfp-step-next {
	background: var( --bfp-accent, #1e73be );
	border-color: var( --bfp-accent, #1e73be );
	color: #fff;
}

.bfp-step-nav button:focus-visible {
	outline: 2px solid var( --bfp-accent, #1e73be );
	outline-offset: 2px;
}

/* ----------------------------- Progress: bar ------------------------------ */

.bfp-progress {
	margin-bottom: 1.5rem;
}

.bfp-progress-bar {
	width: 100%;
	height: 6px;
	background: var( --bfp-track, rgba( 0, 0, 0, 0.1 ) );
	border-radius: 999px;
	overflow: hidden;
}

.bfp-progress-bar-fill {
	height: 100%;
	width: 0;
	background: var( --bfp-accent, #1e73be );
	border-radius: 999px;
	transition: width 0.3s ease;
}

/* --------------------------- Progress: numbered --------------------------- */

.bfp-progress-steps {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 0.75rem 0 0;
	padding: 0;
	list-style: none;
	counter-reset: bfp-step;
}

.bfp-progress-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	flex: 1 1 0;
	text-align: center;
	color: var( --bfp-muted, #8a8a8a );
	font-size: 0.85em;
}

.bfp-progress-step-num {
	display: grid;
	place-items: center;
	width: 2em;
	height: 2em;
	border-radius: 50%;
	border: 2px solid currentColor;
	font-weight: 600;
	line-height: 1;
}

.bfp-progress-step.is-active {
	color: var( --bfp-accent, #1e73be );
	font-weight: 600;
}

.bfp-progress-step.is-done {
	color: var( --bfp-accent, #1e73be );
}

.bfp-progress-step.is-done .bfp-progress-step-num {
	background: var( --bfp-accent, #1e73be );
	border-color: var( --bfp-accent, #1e73be );
	color: #fff;
}

@media ( max-width: 480px ) {
	.bfp-progress-step-label {
		display: none;
	}
}

/* ------------------------------- Enhancements ------------------------------ */

/* Star rating */
.bfp-rating {
	display: inline-flex;
	gap: 0.15em;
	font-size: 1.6rem;
	line-height: 1;
}

.bfp-star-btn {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: var( --bfp-track, #c3c4c7 );
	transition: color 0.1s ease;
}

.bfp-star-btn.is-on {
	color: var( --bfp-accent, #f4b400 );
}

/* Range slider */
.bfp-range {
	width: 100%;
}

.bfp-range-output {
	display: inline-block;
	margin-top: 0.25rem;
	font-weight: 600;
}

/* -------------------------------- UK phone --------------------------------- */
/* The wrapper sits where the tel input used to, so Bricks' own field width and
   spacing still apply; only the inner arrangement is ours. */

.bfp-phone {
	display: flex;
	/* MUST wrap: the error message is a full-width flex item. Without wrapping
	   it would share the row with the field and squeeze it to nothing the
	   moment a number is rejected. */
	flex-wrap: wrap;
	align-items: stretch;
	width: 100%;
}

/* Prefix + field always share the first row; the error is pushed to its own
   line below by its 100% basis (see .bfp-phone-error). */
.bfp-phone > input[type="tel"] {
	flex: 1 1 8em;
	min-width: 0;
	border-start-start-radius: 0;
	border-end-start-radius: 0;
}

/* Static "+44" — a label, not a control, so it takes no focus and no pointer. */
.bfp-phone-prefix {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	padding: 0 0.7em;
	border: 1px solid var( --bfp-track, #c3c4c7 );
	border-inline-end: 0;
	border-start-start-radius: var( --bfp-radius, 4px );
	border-end-start-radius: var( --bfp-radius, 4px );
	background: rgba( 0, 0, 0, 0.03 );
	color: inherit;
	font: inherit;
	line-height: 1;
	white-space: nowrap;
	user-select: none;
	font-variant-numeric: tabular-nums;
}

/* Own full-width row underneath the field — never inline beside it. */
.bfp-phone-error {
	flex: 0 0 100%;
	width: 100%;
	order: 99;
	margin-block-start: 0.35em;
	color: var( --bfp-error, #b32d2e );
	font-size: 0.85em;
	line-height: 1.4;
}

.bfp-phone-error:empty {
	display: none;
}

.bfp-phone.is-invalid > input[type="tel"],
.bfp-phone.is-invalid .bfp-phone-prefix {
	border-color: var( --bfp-error, #b32d2e );
}

.bfp-phone.is-disabled {
	opacity: 0.6;
}

/* Signature pad */
.bfp-signature-holder {
	position: relative;
	display: inline-block;
}

.bfp-signature {
	border: 1px dashed var( --bfp-track, #c3c4c7 );
	border-radius: var( --bfp-radius, 4px );
	touch-action: none;
	max-width: 100%;
	background: #fff;
	cursor: crosshair;
}

.bfp-signature-clear {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 1.8em;
	height: 1.8em;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.06 );
	cursor: pointer;
	line-height: 1;
}

/* --- Form Pro: grid layout -------------------------------------------
   A twelve column grid. Spacing is owned by the grid, not by per-field
   percentages, so a row always fills the form edge to edge and the submit
   button shares the same rhythm.

   The tracks are minmax(0,1fr) with NO minimum width, which is the point: they
   never collapse, so a field set to 50% is half the form at 300px exactly as it
   is at 1300px. The previous auto-fit track carried a 240px floor, so any
   container under about 500px dropped to one column and no per-field width
   could override it. That is why a form looked right in the builder, where the
   canvas is wide, and stacked on the front end inside a narrow hero column.

   Sizing responds to the FORM's width, not the viewport, because the two
   disagree whenever a form sits in a sidebar, a hero column or a popup. */
.brxe-form.bfp-grid{
	display:grid;
	/* Defaults are the house values, so the layout is correct everywhere the
	   stylesheet loads (front end AND the builder canvas) even if the per-form
	   custom properties are not applied. The properties only override. */
	grid-template-columns:var(--bfp-cols,repeat(12,minmax(0,1fr)));
	column-gap:var(--bfp-col-gap,var(--space-s,1rem));
	row-gap:var(--bfp-row-gap,var(--space-xs,.75rem));
	align-items:start;
	container-type:inline-size;
}
/* Neutralise Bricks' nth-child percentage widths and its 20px field padding.
   Those percentages are re-expressed as spans below: inside a grid a width of
   50% would mean half of one track, not half of the form. */
.brxe-form.bfp-grid .form-group{
	width:auto!important;
	padding-bottom:0;
	grid-column:span var(--bfp-auto-span,6);
}
/* Anything that must run the full width of the form. */
.brxe-form.bfp-grid .form-group.bfp-full,
.brxe-form.bfp-grid .form-group.captcha,
.brxe-form.bfp-grid .form-group:has(textarea),
.brxe-form.bfp-grid .form-group:has(input[type=file]),
.brxe-form.bfp-grid .submit-button-wrapper{grid-column:1/-1}
.brxe-form.bfp-grid .submit-button-wrapper{margin-top:0}

/* An explicitly set percentage is a promise, kept at every width. */
.brxe-form.bfp-grid .form-group.bfp-w-1{grid-column:span 1}
.brxe-form.bfp-grid .form-group.bfp-w-2{grid-column:span 2}
.brxe-form.bfp-grid .form-group.bfp-w-3{grid-column:span 3}
.brxe-form.bfp-grid .form-group.bfp-w-4{grid-column:span 4}
.brxe-form.bfp-grid .form-group.bfp-w-5{grid-column:span 5}
.brxe-form.bfp-grid .form-group.bfp-w-6{grid-column:span 6}
.brxe-form.bfp-grid .form-group.bfp-w-7{grid-column:span 7}
.brxe-form.bfp-grid .form-group.bfp-w-8{grid-column:span 8}
.brxe-form.bfp-grid .form-group.bfp-w-9{grid-column:span 9}
.brxe-form.bfp-grid .form-group.bfp-w-10{grid-column:span 10}
.brxe-form.bfp-grid .form-group.bfp-w-11{grid-column:span 11}

/* A narrow FORM stacks the automatic fields. Fields carrying an explicit width
   are excluded, otherwise this would quietly undo the percentages above. */
@container (max-width:499px){
	.brxe-form.bfp-grid .form-group:not(.bfp-fixed):not(.bfp-full){grid-column:1/-1}
}


/* Running line cost shown beside a priced field. */
.bfp-line-cost{display:block;margin-top:4px;font-size:.8em;line-height:1.4;color:var(--bricks-text-light,#6b7280)}
.bfp-line-cost.has-value{font-weight:600;color:inherit}


/* Inline validation: the message a field earns on blur. The slot is always
   present once a field has been flagged, so clearing the text collapses it
   rather than reflowing the grid on every keystroke. */
.bfp-field-error{
	display:block;
	grid-column:1/-1;
	margin-top:4px;
	font-size:.8em;
	line-height:1.4;
	color:var(--bfp-error,#b32d2e);
}
.bfp-field-error:empty{display:none}
.form-group.bfp-invalid input,
.form-group.bfp-invalid select,
.form-group.bfp-invalid textarea{
	border-color:var(--bfp-error,#b32d2e);
}

/* Field help text: the rule, kept on screen. Sits between the control and any
   error message so the order reads field, rule, problem. */
.bfp-help{
	display:block;
	grid-column:1/-1;
	margin-top:4px;
	font-size:.8em;
	line-height:1.4;
	color:var(--bricks-text-light,#6b7280);
}
