/*
 * One error look for every Gravity Form (added 2026-10-13).
 *
 * Before this, each stylesheet reddened only some controls: text, email,
 * phone and textarea boxes went red, but number boxes, dropdowns, radio and
 * checkbox cards, chips, consent boxes and file drops did not, and three forms
 * had no red borders at all. Name and address fields turned every part red,
 * even the optional "Address Line 2" and parts already filled in.
 *
 * Rules here key on aria-invalid, which Gravity Forms sets on each control it
 * rejects and assets/js/gf-live-errors.js turns off part by part as the
 * visitor fixes them. Loaded with that script (inc/gf-live-errors.php).
 * !important plus :not(#ij-gf), an id-weight no-op, because the per-template
 * sheets style these with long selectors (the legacy-markup rules in
 * realtor-form.css reach 0,8,2 with !important).
 */
:root { --ij-gf-error: #b3261e; }

/* Rejected boxes: text, email, phone, number, date, website, dropdowns, textareas. */
html body:not(#ij-gf) .gform_wrapper .gfield_error input[aria-invalid="true"]:not([type="radio"]):not([type="checkbox"]),
html body:not(#ij-gf) .gform_wrapper .gfield_error select[aria-invalid="true"],
html body:not(#ij-gf) .gform_wrapper .gfield_error textarea[aria-invalid="true"] {
	border-color: var(--ij-gf-error) !important;
}

/* Parts of a name or address that are fine keep their normal border. */
html body:not(#ij-gf) .gform_wrapper .gfield_error input[aria-invalid="false"]:not([type="radio"]):not([type="checkbox"]),
html body:not(#ij-gf) .gform_wrapper .gfield_error select[aria-invalid="false"],
html body:not(#ij-gf) .gform_wrapper .gfield_error textarea[aria-invalid="false"] {
	border-color: var(--ij-gf-input-border, #dee7ed) !important;
}

/* Radio and checkbox cards, and the contact form's chips. Depending on the
   form the card's border is drawn by .gchoice or by its label; the other one
   has no border, so colouring both is safe. */
html body:not(#ij-gf) .gform_wrapper .gfield_error .gchoice,
html body:not(#ij-gf) .gform_wrapper .gfield_error .gchoice > label {
	border-color: var(--ij-gf-error) !important;
}

/* Consent and other single tick boxes (native, so an outline rather than a border). */
html body:not(#ij-gf) .gform_wrapper .gfield_error .ginput_container_consent input[type="checkbox"] {
	outline: 2px solid var(--ij-gf-error);
	outline-offset: 1px;
	border-radius: 3px;
}

/* File upload drop area. */
html body:not(#ij-gf) .gform_wrapper .gfield_error .gform_drop_area {
	border-color: var(--ij-gf-error) !important;
}

/* The field's own label turns red, whether it is a <label> (single box) or a
   <legend> (names, addresses, radios, consent). Gravity Forms meant both to,
   but the template sheets out-rank it for legends and on some forms for
   labels too. Sub-labels such as "First Name" or "City" stay as they are. The
   application form keeps its dark labels on purpose (application.css). */
html body:not(.ij-apply):not(#ij-gf) .gform_wrapper .gfield_error > .gfield_label,
html body:not(.ij-apply):not(#ij-gf) .gform_wrapper .gfield_error > .ginput_complex > legend.gfield_label,
html body:not(.ij-apply):not(#ij-gf) .gform_wrapper .gfield_error legend.gfield_label {
	color: var(--ij-gf-error) !important;
}
