/**
 * @file
 * Flexbox element styles.
 *
 * @see /webform/example_layout_flexbox
 * @see /webform/test_element_flexbox_flex
 */

@media (min-width: 768px) {
  .webform-flexbox {
    display: flex;
    margin: 1em -0.5em;
  }

  /*
   * Make sure flexbox is always using 'display: flex' when toggled via #states.
   * @see https://stackoverflow.com/questions/38491653/jquery-show-a-flex-box/4121
   */
  .webform-flexbox.js-webform-states-hidden[style*="display: block"] {
    display: flex !important;
  }

  .webform-flexbox .webform-flexbox {
    margin: 1em 0;
  }

  .webform-flexbox--justify-flex-start {
    justify-content: flex-start;
  }

  .webform-flexbox--justify-flex-end {
    justify-content: flex-end;
  }

  .webform-flexbox--justify-center {
    justify-content: center;
  }

  .webform-flexbox--justify-space-between {
    justify-content: space-between;
  }

  .webform-flexbox--justify-space-around {
    justify-content: space-around;
  }

  .webform-flexbox--flex-start {
    align-items: flex-start;
  }

  .webform-flexbox--flex-end {
    align-items: flex-end;
  }

  .webform-flexbox--center {
    align-items: center;
  }

  .webform-flex {
    min-width: 0;
  }

  .webform-flex--container {
    margin: 0 0.5em;
  }

  .webform-flex--container > .form-item {
    margin: 0;
  }

  .webform-flex--container > .form-item > input:not([type="checkbox"]),
  .webform-flex--container > .form-item > select {
    width: 100%;
  }

  .container-inline .webform-flex--container > .form-item > input:not([type="checkbox"]),
  .container-inline .webform-flex--container > .form-item > select,
  .webform-flex--container > .form-item.webform-element--title-inline > input:not([type="checkbox"]),
  .webform-flex--container > .form-item.webform-element--title-inline > select {
    width: inherit;
  }

  .webform-flex--container > .webform-has-field-prefix > input:not([type="checkbox"]),
  .webform-flex--container > .webform-has-field-suffix > input:not([type="checkbox"]),
  .webform-flex--container > .webform-has-field-prefix > select,
  .webform-flex--container > .webform-has-field-suffix > select {
    width: 85%;
  }

  .webform-flex--container > .webform-has-field-prefix.webform-flex.webform-has-field-suffix > input:not([type="checkbox"]),
  .webform-flex--container > .webform-has-field-prefix.webform-flex.webform-has-field-suffix > select {
    width: 70%;
  }

  .webform-flex--container > .webform-element-help-container--element > input:not([type="checkbox"]),
  .webform-flex--container > .webform-element-help-container--element > select {
    width: 85%;
  }

  .webform-flex--container > .webform-has-field-prefix.webform-element-help-container--element > input:not([type="checkbox"]),
  .webform-flex--container > .webform-has-field-suffix.webform-element-help-container--element > select {
    width: 70%;
  }

  .webform-flex--container > .webform-has-field-prefix.webform-has-field-suffix.webform-element-help-container--element > input:not([type="checkbox"]),
  .webform-flex--container > .webform-has-field-prefix.webform-has-field-suffix.webform-element-help-container--element > select {
    width: 50%;
  }

  .webform-flex--1 {
    flex: 1;
  }

  .webform-flex--2 {
    flex: 2;
  }

  .webform-flex--3 {
    flex: 3;
  }

  .webform-flex--4 {
    flex: 4;
  }

  .webform-flex--5 {
    flex: 5;
  }

  .webform-flex--6 {
    flex: 6;
  }

  .webform-flex--7 {
    flex: 7;
  }

  .webform-flex--8 {
    flex: 8;
  }

  .webform-flex--9 {
    flex: 9;
  }

  .webform-flex--10 {
    flex: 10;
  }

  .webform-flex--11 {
    flex: 11;
  }

  .webform-flex--12 {
    flex: 12;
  }

  /* Select other */
  .webform-flex--container > .form-type-webform-select-other select {
    width: 100%;
  }

  .webform-flex--container > .form-type-webform-select-other .form-item {
    margin: 0;
  }

  .webform-flex--container > .form-type-webform-select-other .form-item + .form-item {
    margin-top: 0.5em;
  }

  /* Range. */
  .webform-flex--container > .form-type-range-output > .form-range-output {
    width: 66%;
  }

  /* Composite. */
  .form-composite > .webform-flexbox {
    margin: 1em -0.5em;
  }

  /* Radios/checkboxes. */
  .webform-flex--container .form-type-checkbox,
  .webform-flex--container .form-type-radio {
    white-space: nowrap;
  }
}
