/**
 * DeL x Firmli: Form Builder forms (0.7.0).
 *
 * Two layers:
 *   1. Always: the few rules a form needs to work (the spam trap stays
 *      hidden, [hidden] errors stay hidden, the phone row lines up).
 *   2. Only with "Plugin styles" (.dff-styled on the wrapper): the DeL look.
 *      Choose "No styles" in the builder and none of it applies, so your
 *      own CSS starts from the browser defaults.
 *
 * Every custom property lives on the wrapper, never on :root, so Blocksy
 * and Elementor variables are never touched. Class names never change.
 */

/* 1. Always ---------------------------------------------------------- */

.dff-wrap .dff-hp {
	position: absolute !important;
	left: -10000px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.dff-wrap [hidden] {
	display: none !important;
}

.dff-wrap .dff-phone {
	display: flex;
	gap: 6px;
}

.dff-wrap .dff-phone .dff-tel {
	flex: 1 1 auto;
	min-width: 0;
}

.dff-wrap .dff-message:empty {
	display: none;
}

/* 2. Plugin styles ----------------------------------------------------
 *
 * Every rule below is wrapped in :where(), so it weighs no more than a
 * single class. Any CSS you write for your own section, such as
 * .my-section .dff-label { color: #fff; }, beats it, whatever order the
 * stylesheets load in. The builder's own CSS box is stronger still.
 */

.dff-wrap.dff-styled {
	--dff-blue: #1965B0;
	--dff-orange: #F57921;
	--dff-green: #30B34B;
	--dff-dark: #102033;
	--dff-body: #54595F;
	--dff-muted: #7A7A7A;
	--dff-border: #eaeaec;
	--dff-surface: #f4f4f5;
	--dff-error: #b42318;
	--dff-radius: 8px;
	--dff-gap: 14px;
	color: var(--dff-body);
	font-size: 15px;
	line-height: 1.5;
}

:where(.dff-wrap.dff-styled) .dff-form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--dff-gap);
	margin: 0;
}

:where(.dff-wrap.dff-styled) .dff-field {
	flex: 1 1 100%;
	min-width: 0;
	margin: 0;
}

:where(.dff-wrap.dff-styled) .dff-w--half {
	flex: 1 1 calc(50% - var(--dff-gap));
	min-width: 200px;
}

:where(.dff-wrap.dff-styled) .dff-w--third {
	flex: 1 1 calc(33.333% - var(--dff-gap));
	min-width: 160px;
}

:where(.dff-wrap.dff-styled) .dff-label {
	display: block;
	margin: 0 0 5px;
	padding: 0;
	color: var(--dff-dark);
	font-weight: 600;
	font-size: 14px;
}

:where(.dff-wrap.dff-styled) .dff-required {
	color: var(--dff-error);
}

:where(.dff-wrap.dff-styled input).dff-input:where(:not([type="checkbox"]):not([type="radio"])),
:where(.dff-wrap.dff-styled select).dff-input,
:where(.dff-wrap.dff-styled textarea).dff-input {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #d0d3d8;
	border-radius: var(--dff-radius);
	background: #fff;
	color: var(--dff-dark);
	font: inherit;
	box-shadow: none;
}

:where(:where(.dff-wrap.dff-styled) .dff-phone select).dff-cc {
	flex: 0 0 auto;
	width: auto;
	max-width: 118px;
}

:where(.dff-wrap.dff-styled textarea).dff-input {
	min-height: 110px;
	resize: vertical;
}

:where(.dff-wrap.dff-styled) .dff-input:where(:focus) {
	outline: 2px solid var(--dff-blue);
	outline-offset: 1px;
	border-color: var(--dff-blue);
}

:where(.dff-wrap.dff-styled) .dff-options {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

:where(.dff-wrap.dff-styled) .dff-option,
:where(.dff-wrap.dff-styled) .dff-check {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 0 0 6px;
	color: var(--dff-body);
	font-size: 14px;
	font-weight: 400;
	cursor: pointer;
}

:where(:where(.dff-wrap.dff-styled) .dff-option) input,
:where(:where(.dff-wrap.dff-styled) .dff-check) input {
	margin: 3px 0 0;
	accent-color: var(--dff-blue);
}

:where(:where(.dff-wrap.dff-styled) .dff-check) a {
	color: var(--dff-blue);
	text-decoration: underline;
}

:where(.dff-wrap.dff-styled) .dff-help {
	margin-top: 4px;
	color: var(--dff-muted);
	font-size: 13px;
}

:where(.dff-wrap.dff-styled) .dff-error {
	margin-top: 4px;
	color: var(--dff-error);
	font-size: 13px;
}

:where(.dff-wrap.dff-styled .has-error) .dff-input:where(:not([type="checkbox"]):not([type="radio"])) {
	border-color: var(--dff-error);
}

:where(.dff-wrap.dff-styled) .dff-actions {
	flex: 1 1 100%;
}

:where(.dff-wrap.dff-styled) .dff-submit {
	display: inline-block;
	min-height: 44px;
	padding: 11px 26px;
	border: 0;
	border-radius: var(--dff-radius);
	background: var(--dff-orange);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

:where(.dff-wrap.dff-styled) .dff-submit:where(:hover),
:where(.dff-wrap.dff-styled) .dff-submit:where(:focus-visible) {
	background: #e06a14;
}

:where(.dff-wrap.dff-styled) .dff-submit:where([disabled]) {
	opacity: .65;
	cursor: wait;
}

:where(.dff-wrap.dff-styled) .dff-message {
	flex: 1 1 100%;
	padding: 10px 14px;
	border-radius: var(--dff-radius);
	background: var(--dff-surface);
	font-size: 14px;
}

/* Status colours take precedence over form-specific text and surface colours. */
.dff-wrap form[data-dff-form] .dff-message:is(.is-success, .is-error) {
	background: #fff !important;
	padding: 10px 14px;
	border-radius: var(--dff-radius, 8px);
}

.dff-wrap form[data-dff-form] .dff-message.is-success {
	color: #1d6b2c !important;
	font-weight: 600;
}

.dff-wrap form[data-dff-form] .dff-message.is-error,
.dff-wrap form[data-dff-form] .dff-error {
	color: #b42318 !important;
}

@media (max-width: 520px) {
	:where(.dff-wrap.dff-styled) .dff-w--half,
	:where(.dff-wrap.dff-styled) .dff-w--third {
		flex-basis: 100%;
	}
}

/* "My own HTML" (0.7.0 additions): screen-reader-only text, and errors on
   inputs written by hand (no .dff-field wrapper). Unstyled forms only get
   the screen-reader rule. */
:where(.dff-wrap) .dff-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
:where(.dff-wrap) .dff-options:where(:has(> .dff-sr)) {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
:where(.dff-wrap.dff-styled) :where(.dff-input.has-error):where(:not([type="checkbox"]):not([type="radio"])) {
	border-color: var(--dff-error);
}
:where(.dff-wrap) .dff-error[data-dff-error-for][hidden] {
	display: none !important;
}

/* More field types and layout blocks (0.7.0 additions). */
:where(.dff-wrap) .dff-block { flex: 1 1 100%; }
:where(.dff-wrap.dff-styled) .dff-heading { margin: 8px 0 4px; color: var(--dff-text, #102033); line-height: 1.25; }
:where(.dff-wrap.dff-styled) .dff-paragraph { margin: 0 0 4px; }
:where(.dff-wrap.dff-styled) .dff-divider { border: 0; border-top: 1px solid var(--dff-border, #eaeaec); margin: 8px 0; }
:where(.dff-wrap) .dff-range { display: flex; align-items: center; gap: 12px; }
:where(.dff-wrap) .dff-range .dff-slider { flex: 1 1 auto; min-width: 0; padding: 0; }
:where(.dff-wrap) .dff-range__value { min-width: 4ch; white-space: nowrap; font-variant-numeric: tabular-nums; }
:where(.dff-wrap.dff-styled) .dff-colour { width: 64px; height: 40px; padding: 2px; cursor: pointer; }
:where(.dff-wrap.dff-styled) .dff-multi { min-height: 96px; }

/* 0.8.0: more column widths, and fields hidden by a condition. */
:where(.dff-wrap.dff-styled) .dff-w--quarter {
	flex: 1 1 calc(25% - var(--dff-gap));
	min-width: 130px;
}
:where(.dff-wrap.dff-styled) .dff-w--two-thirds {
	flex: 1 1 calc(66.666% - var(--dff-gap));
	min-width: 220px;
}
:where(.dff-wrap.dff-styled) .dff-w--three-quarters {
	flex: 1 1 calc(75% - var(--dff-gap));
	min-width: 240px;
}
@media (max-width: 520px) {
	:where(.dff-wrap.dff-styled) .dff-w--quarter,
	:where(.dff-wrap.dff-styled) .dff-w--two-thirds,
	:where(.dff-wrap.dff-styled) .dff-w--three-quarters {
		flex-basis: 100%;
	}
}
:where(.dff-wrap) .dff-is-hidden {
	display: none !important;
}

/* 0.8.0 r8: every dropdown shows a down arrow, whatever the theme, Popup
   Maker or a form's own CSS does to <select> (the live popup lost its
   arrows to a theme "background: none"). The arrow properties are
   !important on purpose; colours, borders, size and font stay yours. */
.dff-wrap .dff-form select:not([multiple]):not([size]),
.dff-wrap .dff-form .dff-combo__input {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%237A7A7A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 12px center !important;
	background-size: 12px 8px !important;
	padding-right: 36px !important;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}
.dff-wrap .dff-form select.dff-cc:not([multiple]):not([size]) {
	background-position: right 8px center !important;
	padding-right: 26px !important;
}
.dff-wrap .dff-form select:not([multiple]):not([size])::-ms-expand {
	display: none;
}

/* 0.8.0 r8: searchable Course list. */
.dff-wrap .dff-combo {
	position: relative;
	width: 100%;
}
.dff-wrap .dff-combo__input {
	width: 100%;
	box-sizing: border-box;
	cursor: text;
}
.dff-wrap .dff-combo__input:disabled {
	cursor: not-allowed;
}
.dff-wrap .dff-combo__list {
	position: absolute;
	z-index: 99999;
	left: 0;
	right: 0;
	top: calc(100% + 2px);
	margin: 0;
	padding: 4px 0;
	list-style: none;
	max-height: 240px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #eaeaec;
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(16, 32, 51, 0.14);
	text-align: left;
}
.dff-wrap .dff-combo__opt {
	margin: 0;
	padding: 8px 12px;
	font-size: 14px;
	line-height: 1.35;
	color: #102033;
	cursor: pointer;
}
.dff-wrap .dff-combo__opt[aria-selected="true"],
.dff-wrap .dff-combo__opt.is-active {
	background: #f4f4f5;
}
.dff-wrap .dff-combo__opt.is-other {
	border-top: 1px solid #eaeaec;
	color: #1965B0;
}
.dff-wrap .dff-combo__none {
	margin: 0;
	padding: 8px 12px;
	font-size: 13px;
	color: #7A7A7A;
}
.dff-wrap .dff-combo select.dff-combo__native {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none !important;
	left: 0;
	bottom: 0;
}
