/**
 * @file
 * Visual styles for views exposed form.
 */

/**
 * Use flexbox and some margin resets to make the fields + actions go inline.
 *
 * For (at least) Media Library, this file is typically inserted by AJAX add_css
 * command when the dialog is opened. The AJAX add_css command always adds the
 * missing-but-required CSS assets to the beginning of the HTML <head>. Because
 * of this, we cannot rely on the expected loading order of the CSS assets.
 * This is why we have to double these selectors: we have to get the expected
 * output even for the Media Library modal.
 *
 * @todo Remove double selectors after https://www.drupal.org/node/1461322
 * has been resolved.
 */

.views-exposed-form.views-exposed-form {
  display: flex;
  flex-wrap: wrap;
  margin-top: var(--space-l);
  margin-bottom: var(--space-l);
  padding: var(--space-xs) var(--space-l) var(--space-l) var(--space-l);
  border: var(--details-border-size) solid var(--details-border-color);
  border-radius: var(--details-border-size-radius);
  background-color: var(--color-white);
  box-shadow: var(--details-box-shadow);
}
.views-exposed-form--preview.views-exposed-form--preview {
  margin-top: 0;
}

.views-exposed-form__item.views-exposed-form__item {
  max-width: 100%;
  margin: var(--space-s) var(--space-xs) 0 0; /* LTR */
}
[dir="rtl"] .views-exposed-form__item.views-exposed-form__item {
  margin-right: 0;
  margin-left: var(--space-xs);
}

.views-exposed-form__item--preceding-actions.views-exposed-form__item--preceding-actions {
  margin-right: var(--space-m); /* LTR */
}
[dir="rtl"] .views-exposed-form__item--preceding-actions.views-exposed-form__item--preceding-actions {
  margin-right: 0;
  margin-left: var(--space-m);
}

.views-exposed-form__item--actions.views-exposed-form__item--actions .button {
  margin-top: 0;
  margin-bottom: 0;
}

.views-exposed-form__item--actions.views-exposed-form__item--actions .button:last-child {
  margin-right: 0;
}
[dir="rtl"] .views-exposed-form__item--actions.views-exposed-form__item--actions:last-child {
  margin-left: 0;
}

.views-exposed-form .form-item--no-label,
.views-exposed-form__item.views-exposed-form__item.views-exposed-form__item--actions {
  /* Line height of a label + existing margin for the element + margin for label */
  margin-top: calc(var(--line-height-form-label) + var(--space-s) + var(--space-xs));
}
