/* Didatec — bloc « form ».
   Chargé uniquement quand le bloc est présent (enqueue_style ACF). */

/* Brevo forms ------------------------------------------------------------ */

.brevo-form {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--50);
}

.brevo-form__frame {
	width: 100%;
	border: 0;
}

.brevo-form__missing {
	padding: var(--wp--preset--spacing--50);
	border: 1px dashed var(--wp--preset--color--black-20);
	border-radius: 5px;
	color: var(--wp--preset--color--black-80);
}

/* Brevo forms — HTML embed (.brevo-form--html) ---------------------------
   Figma 12105:34166. The Brevo code is pasted without sib-styles.css; its
   inline styles and its own <style> (which targets #sib-container, hence the
   !important below) are neutralised here. */

.brevo-form--html {
	--brevo-gap: var(--wp--preset--spacing--20);
	--brevo-radius: 5px;
	/* Code postal / Année column, shared by the SAV extra equipment rows. */
	--brevo-narrow: 186px;
}

/* Brevo containers: drop inline background, border, max-width and margins. */
.brevo-form--html .sib-form,
.brevo-form--html .sib-form-container,
.brevo-form--html #sib-container {
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	text-align: left !important;
}

/* Grid: Nom | Prénom, Email | Téléphone, Fonction, Établissement,
   Adresse | Code postal (186px), Ville, [SAV / quote fields], Votre demande,
   button. The SAV form reuses the same columns: N° de série | Année.
   Three columns so the half widths and the narrow column line up.
   Rows are matched by the Brevo attribute name, not by position: reordering
   fields in Brevo keeps the layout, and a field the theme does not know (or a
   browser without :has()) simply spans the full width. */
.brevo-form--html #sib-form {
	display: grid;
	grid-template-columns: calc(50% - var(--brevo-gap) / 2) minmax(0, 1fr) var(--brevo-narrow);
	gap: var(--brevo-gap);
	font-family: inherit;
}

.brevo-form--html #sib-form > div {
	grid-column: 1 / -1;
	padding: 0 !important;
}

.brevo-form--html #sib-form > div:has([name="NOM"]),
.brevo-form--html #sib-form > div:has([name="EMAIL"]) {
	grid-column: 1 / 2;
}

.brevo-form--html #sib-form > div:has([name="PRENOM"]),
.brevo-form--html #sib-form > div:has([name="SMS"]) {
	grid-column: 2 / -1;
}

.brevo-form--html #sib-form > div:has([name="ADRESSE"]),
.brevo-form--html #sib-form > div:has([name="NUMERO_SERIE"]) {
	grid-column: 1 / 3;
}

.brevo-form--html #sib-form > div:has([name="CODE_POSTAL"]),
.brevo-form--html #sib-form > div:has([name="ANNEE_FABRICATION"]) {
	grid-column: 3 / -1;
}

/* Button: 24px under the message (8px gap + 16px). */
.brevo-form--html #sib-form > div:has(.sib-form-block__button) {
	margin-top: var(--wp--preset--spacing--40);
}

/* SAV -------------------------------------------------------------------- */

/* "Informations sur votre équipement" subheading (Brevo text block). */
.brevo-form--html #sib-form > div:has(.sib-text-form-block) {
	margin-top: var(--wp--preset--spacing--40);
}

.brevo-form--html .sib-text-form-block,
.brevo-form--html .sib-text-form-block p {
	margin: 0 !important;
	padding: 0 !important;
	color: var(--wp--preset--color--blue) !important;
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--btn) !important;
	font-weight: 700 !important;
	line-height: 1.2 !important;
	text-align: left !important;
}

/* Serial number and year belong to the SAV process: a blue-tinted fill and
   outline sets them apart from the contact fields. */
.brevo-form--html .input[name="NUMERO_SERIE"],
.brevo-form--html .input[name="ANNEE_FABRICATION"],
.brevo-form--html .dt-serials__row .input {
	background: color-mix(in srgb, var(--wp--preset--color--blue) 8%, var(--wp--preset--color--white));
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--blue) 35%, transparent);
}

/* Extra equipment rows, added by the script shipped in the SAV Brevo code
   (.dt-serials) and joined into NUMERO_SERIE / ANNEE_FABRICATION on submit.
   Same columns as the serial number and year above. */
.brevo-form--html .dt-serials__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--brevo-narrow);
	gap: var(--brevo-gap);
	margin-top: var(--brevo-gap);
}

.brevo-form--html .dt-serials__year {
	position: relative;
}

/* Room for the remove button (8px offset + 18px wide): the "Année de
   fabrication" placeholder still fits in the narrow column. */
.brevo-form--html .dt-serials__year .input {
	padding-right: calc(var(--wp--preset--spacing--20) + 20px);
}

.brevo-form--html .dt-serials__rm {
	position: absolute;
	top: 50%;
	right: var(--wp--preset--spacing--20);
	transform: translateY(-50%);
	padding: 4px;
	border: 0;
	background: none;
	color: var(--wp--preset--color--field-text);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.brevo-form--html .dt-serials__rm:hover {
	color: var(--wp--preset--color--blue);
}

/* 8px above and below, plus the grid gap: 16px before "Votre demande". */
.brevo-form--html .dt-serials__add {
	margin-block: var(--brevo-gap);
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--blue);
	font: inherit;
	font-size: var(--wp--preset--font-size--btn);
	text-decoration: underline;
	cursor: pointer;
}

/* Equipment photo (inc/sav-photo.php): the Brevo field PHOTO only carries the
   URL; sav-photo.js puts a picker in its place. Same fill as the serial
   number, a dashed outline for the drop area. */
.brevo-form--html input[name="PHOTO"] {
	display: none;
}

.brevo-form--html .sav-photo {
	display: grid;
	gap: var(--wp--preset--spacing--10);
}

/* Visually hidden, still focusable: the label below is what shows. */
.brevo-form--html .sav-photo__input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.brevo-form--html .sav-photo__drop,
.brevo-form--html .sav-photo__preview {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	box-sizing: border-box;
	/* Same height as a text field: its padding plus one line. */
	min-height: calc(var(--wp--preset--spacing--40) * 2 + 1.3em);
	border-radius: var(--brevo-radius);
	background: color-mix(in srgb, var(--wp--preset--color--blue) 8%, var(--wp--preset--color--white));
	font-size: var(--wp--preset--font-size--btn);
	line-height: 1.3;
}

.brevo-form--html .sav-photo__drop {
	flex-wrap: wrap;
	padding: calc(var(--wp--preset--spacing--40) - 1px);
	border: 1px dashed color-mix(in srgb, var(--wp--preset--color--blue) 35%, transparent);
	color: var(--wp--preset--color--field-text);
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.brevo-form--html .sav-photo__drop:hover,
.brevo-form--html .sav-photo__drop.is-over {
	border-color: var(--wp--preset--color--blue);
}

.brevo-form--html .sav-photo__input:focus-visible + .sav-photo__drop {
	outline: 2px solid var(--wp--preset--color--blue);
	outline-offset: 0;
}

.brevo-form--html .sav-photo__icon {
	flex: none;
	width: 18px;
	height: 18px;
	color: var(--wp--preset--color--blue);
}

.brevo-form--html .sav-photo__hint {
	margin-left: auto;
	font-size: var(--wp--preset--font-size--subheading);
}

.brevo-form--html .sav-photo[data-state="busy"] .sav-photo__drop {
	opacity: 0.6;
	cursor: progress;
}

.brevo-form--html .sav-photo__preview {
	display: none;
	padding: var(--wp--preset--spacing--10) var(--wp--preset--spacing--40) var(--wp--preset--spacing--10) var(--wp--preset--spacing--10);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wp--preset--color--blue) 35%, transparent);
	color: var(--wp--preset--color--black);
}

.brevo-form--html .sav-photo[data-state="done"] .sav-photo__drop {
	display: none;
}

.brevo-form--html .sav-photo[data-state="done"] .sav-photo__preview {
	display: flex;
}

.brevo-form--html .sav-photo__thumb {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 3px;
	object-fit: cover;
}

.brevo-form--html .sav-photo__name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.brevo-form--html .sav-photo__remove {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: var(--wp--preset--spacing--10);
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--blue);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.brevo-form--html .sav-photo__remove .icon {
	width: 16px;
	height: 16px;
}

.brevo-form--html .sav-photo__status {
	margin: 0;
	color: var(--wp--preset--color--field-text);
	font-size: var(--wp--preset--font-size--subheading);
	line-height: 1.3;
}

.brevo-form--html .sav-photo__status:empty {
	display: none;
}

.brevo-form--html .sav-photo[data-state="error"] .sav-photo__status {
	color: var(--wp--preset--color--red);
}

/* Help text under the serial number. */
.brevo-form--html .entry__specification {
	display: block !important;
	margin: var(--wp--preset--spacing--10) 0 0 !important;
	padding: 0 !important;
	color: var(--wp--preset--color--field-text) !important;
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--subheading) !important;
	line-height: 1.3 !important;
	text-align: left !important;
}

/* Quote ------------------------------------------------------------------ */

/* PRODUITS is meant to be filled from the selection, already listed beside
   the form: the field stays in the form, hidden. */
.brevo-form--html #sib-form > div:has([name="PRODUITS"]) {
	display: none;
}

/* Fields ----------------------------------------------------------------- */

.brevo-form--html .sib-form-block,
.brevo-form--html .form__entry,
.brevo-form--html .form__label-row,
.brevo-form--html .entry__field {
	margin: 0;
	padding: 0;
}

.brevo-form--html .input,
.brevo-form--html .sib-sms-input-wrapper {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: var(--wp--preset--spacing--40);
	border: 0;
	border-radius: var(--brevo-radius);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--black);
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--btn) !important;
	line-height: 1.3;
	letter-spacing: -0.01em;
	box-shadow: none;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.brevo-form--html textarea.input {
	display: block;
	height: 125px;
	resize: vertical;
}

.brevo-form--html .input::placeholder,
.brevo-form--html .sib-sms-select__phone-number::placeholder {
	color: var(--wp--preset--color--field-text) !important;
	font-family: inherit !important;
	opacity: 1;
}

.brevo-form--html .input:focus-visible,
.brevo-form--html .sib-sms-input-wrapper:focus-within {
	outline: 2px solid var(--wp--preset--color--blue);
	outline-offset: 0;
}

/* Phone: flag + calling code + number in a single white box. */
.brevo-form--html .sib-sms-input-wrapper {
	display: flex !important;
	align-items: center;
	padding-block: 0;
}

.brevo-form--html .sib-sms-select {
	display: flex;
	flex: 1;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	min-width: 0;
}

/* Country picker trigger: the flag came from the sib-styles.css sprite;
   without it the title was 0px wide and no longer clickable. A chevron
   replaces it. */
.brevo-form--html .sib-sms-select__title {
	position: relative;
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	align-self: stretch;
	min-width: 16px;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20) var(--wp--preset--spacing--40) 0;
	cursor: pointer;
}

.brevo-form--html .sib-sms-select__title::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 1.5px solid var(--wp--preset--color--field-text);
	border-bottom: 1.5px solid var(--wp--preset--color--field-text);
	transform: translateY(-2px) rotate(45deg);
}

.brevo-form--html .sib-sms-select__title .sib-flag,
.brevo-form--html .sib-sms-select__label-text,
.brevo-form--html .sib-sms-tooltip {
	display: none;
}

/* Country (SAV): a native select, its arrow replaced by the phone picker's
   chevron. Unselected, it shows "Pays" in the placeholder colour. */
.brevo-form--html .entry__field:has(> #PAYS) {
	position: relative;
}

.brevo-form--html #PAYS {
	appearance: none;
	padding-right: calc(var(--wp--preset--spacing--40) + 16px);
	cursor: pointer;
}

.brevo-form--html #PAYS:invalid {
	color: var(--wp--preset--color--field-text);
}

.brevo-form--html .entry__field:has(> #PAYS)::after {
	content: "";
	position: absolute;
	top: 50%;
	right: var(--wp--preset--spacing--40);
	width: 8px;
	height: 8px;
	border-right: 1.5px solid var(--wp--preset--color--field-text);
	border-bottom: 1.5px solid var(--wp--preset--color--field-text);
	transform: translateY(-70%) rotate(45deg);
	pointer-events: none;
}

.brevo-form--html .sib-sms-select__number-input {
	position: relative;
	display: flex;
	flex: 1;
	align-items: center;
	min-width: 0;
}

.brevo-form--html .sib-sms-select__calling-code,
.brevo-form--html .sib-sms-select__phone-number {
	padding: var(--wp--preset--spacing--40) 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--black);
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--btn) !important;
	line-height: 1.3;
	outline: none;
}

.brevo-form--html .sib-sms-select__calling-code {
	width: 3.5em;
	color: var(--wp--preset--color--field-text) !important;
}

.brevo-form--html .sib-sms-select__phone-number {
	flex: 1;
	min-width: 0;
}

/* Field errors: Brevo's main.js toggles them with an inline `display`
   (block / none). Hidden by default without !important so that inline value
   wins; :empty cannot be used, the labels ship with whitespace inside. */
.brevo-form--html .entry__error {
	display: none;
	margin: var(--wp--preset--spacing--10) 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	color: var(--wp--preset--color--red) !important;
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--subheading) !important;
	text-align: left !important;
}

/* Button ----------------------------------------------------------------- */

.brevo-form--html .sib-form-block__button {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	margin: 0 !important;
	padding: 12px 20px !important;
	border: 0 !important;
	border-radius: var(--brevo-radius) !important;
	background: var(--wp--preset--color--blue) !important;
	color: var(--wp--preset--color--white) !important;
	font-family: inherit !important;
	font-size: var(--wp--preset--font-size--btn) !important;
	font-weight: 700 !important;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

/* Same hover as the theme buttons (.btn--primary): the fill turns black. */
.brevo-form--html .sib-form-block__button:hover,
.brevo-form--html .sib-form-block__button:focus-visible {
	background: var(--wp--preset--color--black) !important;
}

.brevo-form--html .sib-form-block__button svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.brevo-form--html .sib-hide-loader-icon {
	display: none;
}

/* Brevo honeypot: must never show. */
.brevo-form--html .input--hidden {
	display: none !important;
}

/* Success / error panels (shown by Brevo's main.js): styled with the other
   notices in base.css. Once sent, only the confirmation remains: the form
   (and its intro text) is hidden. Without :has(), the form stays below it. */
.brevo-form--html:has(#success-message.sib-form-message-panel--active) #sib-container {
	display: none !important;
}

/* The intro line placed just before the form goes with it: the editor's
   paragraph on the contact and SAV pages, the quote template's label. */
p:has(+ .brevo-form--html #success-message.sib-form-message-panel--active),
.quote__form-label:has(+ .quote__form-inner #success-message.sib-form-message-panel--active) {
	display: none;
}

/* Mobile: one column, on the theme's 1024px switch. */
@media (max-width: 1023px) {
	.brevo-form--html #sib-form {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Every row holds a [name] field or the [type] submit button: same
	   specificity as the desktop placements, which this overrides by coming
	   later. */
	.brevo-form--html #sib-form > div:has([name], [type]) {
		grid-column: 1 / -1;
	}

	/* Extra equipment rows stack like the serial number and year above; a
	   wider gap keeps each pair together. */
	.brevo-form--html .dt-serials__row {
		grid-template-columns: minmax(0, 1fr);
		margin-top: var(--wp--preset--spacing--40);
	}
}

/* Country list: Brevo's main.js appends it straight to <body> (outside
   .brevo-form) and positions it with inline top/left. Without sib-styles.css
   it rendered as a ~4700px static block at the bottom of the page. */
.sib-sms-select__list {
	position: absolute;
	z-index: 1000;
	display: none;
	box-sizing: border-box;
	max-height: 280px;
	margin: 0;
	padding: var(--wp--preset--spacing--10) 0;
	overflow-y: auto;
	list-style: none;
	background: var(--wp--preset--color--white);
	border-radius: 5px;
	box-shadow: 0 8px 24px var(--wp--preset--color--black-20);
	color: var(--wp--preset--color--black);
	font-size: var(--wp--preset--font-size--btn);
	line-height: 1.3;
}

.sib-sms-select__list.sib-is-open {
	display: block;
}

.sib-sms-select__list li {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
	cursor: pointer;
}

/* Calling code shown right of the country name. */
.sib-sms-select__list li::after {
	content: attr(data-value);
	margin-left: auto;
	color: var(--wp--preset--color--field-text);
}

.sib-sms-select__list li:hover,
.sib-sms-select__list li:focus {
	background: var(--wp--preset--color--field);
}

.sib-sms-select__list .sib-flag {
	display: none;
}
