/**
 * @file
 * Visual styles for form components.
 */

form .field-multiple-table {
  margin: 0;
}
form .field-multiple-table .field-multiple-drag {
  width: 30px;
  padding-right: 0; /* LTR */
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag {
  padding-left: 0;
}
form .field-multiple-table .field-multiple-drag .tabledrag-handle {
  padding-right: 0.5em; /* LTR */
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag .tabledrag-handle {
  padding-right: 0;
  padding-left: 0.5em;
}
form .field-add-more-submit {
  margin: 0.5em 0 0;
}

/**
 * Markup generated by Form API.
 */
.form-item,
.form-actions {
  margin-top: 1em;
  margin-bottom: 1em;
}
tr.odd .form-item,
tr.even .form-item {
  margin-top: 0;
  margin-bottom: 0;
}
.form-composite > .fieldset-wrapper > .description,
.form-item .description {
  font-size: 0.85em;
}
label.option {
  display: inline;
  font-weight: normal;
}
.form-composite > legend,
.label {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: bold;
}
.form-checkboxes .form-item,
.form-radios .form-item {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}
.form-type-radio .description,
.form-type-checkbox .description {
  margin-left: 2.4em; /* LTR */
}
[dir="rtl"] .form-type-radio .description,
[dir="rtl"] .form-type-checkbox .description {
  margin-right: 2.4em;
  margin-left: 0;
}
.marker {
  color: var(--color-danger, #c10007);
}
/*
 * The asterisk itself is a real character, not a background image, so it
 * matches the DKG "label" SDC's own required marker (components/forms/label)
 * and doesn't need a missing icon asset. Kept as a class-driven ::after
 * (rather than moved into the SDC) because Drupal's #states API
 * (core/misc/states.js) toggles the js-form-required/form-required classes
 * at runtime for conditionally-required fields - a Twig-rendered marker
 * wouldn't react to that.
 *
 * The type is stated rather than inherited, and this is why: the marker
 * hangs off the <label>, while the label's text is inside a span the SDC
 * gives `text-sm leading-5 font-medium`. So `em` here measures the label's
 * own 16px, not the 14px the marker sits beside. Restated in absolute
 * units, the asterisk is the same size and weight as the text it follows,
 * on the same baseline, 2px after it - the design's `_Label`
 * (Figma 15161:62762), and what the SDC's own marker draws.
 */
.form-required::after {
  margin-inline-start: 0.125rem; /* 2px */
  content: "*";
  color: var(--color-danger, #c10007);
  font-size: 0.875rem; /* 14px */
  font-weight: 500;
  line-height: 1.25rem; /* 20px */
}
abbr.tabledrag-changed,
abbr.ajax-changed {
  border-bottom: none;
}
/*
 * input.error is styled by the "text-input" SDC's own danger state
 * (components/forms/text-input) instead - it renders a borderless <input>
 * inside a styled wrapper, so a border here would win by specificity and
 * show up as a stray border around the wrapper's padding.
 *
 * select.error is left out for the same reason. Wherever select-listbox
 * draws its picker the native select is kept in flow but `invisible`,
 * with the picker laid over it, so this rule painted a border nobody
 * could see and grew the box the picker stretches to. The control the
 * reader does see is the trigger, and it now carries the danger state
 * itself - templates/form/select.html.twig reads core's "error" class and
 * passes `state: 'danger'` down, which components/forms/select-listbox
 * draws on the trigger and on the fallback alike.
 */
.form-item textarea.error {
  border: 1px solid var(--color-danger-subtle, #ffc9c9);
}
