/*
 * Form controls always read left-to-right.
 *
 * The portal is Arabic-first and flips the whole page to RTL. That is right for
 * prose, but it is wrong for the values people type into fields: emails, phone
 * numbers, passwords, URLs and dates are LTR data even when the label above
 * them is Arabic. These rules are deliberately loaded after every other
 * stylesheet and use `!important` so a page-specific RTL rule (or an inline
 * style added by a rendered template) cannot flip a control back.
 */

html[dir="rtl"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
html[dir="rtl"] select,
html[dir="rtl"] textarea,
html[dir="rtl"] [contenteditable="true"],
html[dir="rtl"] [contenteditable=""] {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
}

/*
 * `.form-select` draws its own chevron as a background image. The RTL rule in
 * components.css moves it to the left and reserves the gutter there; once the
 * control itself is LTR the chevron and gutter belong on the right again.
 */
html[dir="rtl"] .form-select {
  background-position: right var(--space-3) center !important;
  padding-right: var(--space-10) !important;
  padding-left: var(--space-4) !important;
}
