/**
 * @file
 * Multiple element styles.
 *
 * @see /webform/test_element_multiple
 */

.form-type-webform-multiple::after {
  display: table;
  clear: both;
  content: " ";
}

.webform-multiple-table table {
  margin-bottom: 2px;
}

.webform-multiple-table td {
  vertical-align: top;
  white-space: nowrap;
}

.webform-multiple-table td .webform-element-help--title,
.webform-multiple-table td .webform-element-help--content {
  white-space: normal;
}

.webform-multiple-table td .description,
.webform-multiple-table td .messages,
.webform-multiple-table td .form-item--error-message {
  white-space: normal;
}

.webform-multiple-table td.webform-multiple-table--handle {
  width: 26px;
  padding: 0 0 0 1em;
  text-align: center;
  vertical-align: middle;
}

.webform-multiple-table td.webform-multiple-table--weight {
  width: 20px;
}

.webform-multiple-table td.webform-multiple-table--operations {
  width: 30px;
  padding: 0 2px;
  text-align: center;
  vertical-align: middle;
}
.webform-multiple-table td.webform-multiple-table--operations-two {
  width: 60px;
}

.webform-multiple-table td.webform-multiple-table--operations input {
  margin: 0 2px;
  opacity: 0.4;
  background: none;
}

.webform-multiple-table td.webform-multiple-table--operations input:hover,
.webform-multiple-table td.webform-multiple-table--operations input:focus,
.webform-multiple-table td.webform-multiple-table--operations input:active {
  opacity: 1;
  background: none;
}

.webform-multiple-table td select,
.webform-multiple-table td .form-type-textfield input,
.webform-multiple-table td .form-type-email input,
.webform-multiple-table td .form-type-url input,
.webform-multiple-table td .form-type-tel input,
.webform-multiple-table td .form-type-entity-autocomplete input,
.webform-multiple-table td .form-type-webform-autocomplete input {
  width: 100%;
}

.webform-multiple-table td .container-inline select,
.webform-multiple-table td.webform-has-field-prefix select,
.webform-multiple-table td.webform-has-field-suffix select,
.webform-multiple-table td.webform-has-field-prefix input,
.webform-multiple-table td.webform-has-field-suffix input {
  width: auto;
}

.webform-multiple-table td .form-type-datetime .form-type-textfield input {
  width: 12em;
}
.webform-multiple-table .webform-multiple-sort-weight {
  width: 4em;
}

.webform-multiple-table td input[type="image"] {
  box-sizing: border-box;
  width: 20px;
  min-width: initial;
  max-width: initial;
  height: auto;
  margin: 0;
  padding: 2px;
  border: 2px solid #333;
  border-radius: 50%;
}

.webform-multiple-table td input[type="image"] + input[type="image"] {
  margin-left: 2px;
}

.webform-multiple-table .container-inline input[type="submit"] {
  width: inherit;
}

/**
 * Add margin between stacked form items.
 */
.webform-multiple-table .form-item + .form-item {
  margin-top: 0.2em;
}

/**
 * Fix margin be checkboxes and radios.
 */
.webform-multiple-table .form-checkboxes .form-item,
.webform-multiple-table .form-radios .form-item {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

/**
 * Remove margin from no messages.
 */
.webform-multiple-table--no-items-message .messages__wrapper {
  padding: 0;
}

/**
 * Suppress table drag warnings.
 */
.webform-multiple-table .tabledrag-changed-warning,
.webform-multiple-table .tabledrag-changed {
  display: none !important; /* Must use !important because .tabledrag-changed 'display' is set via JavaScript */
}

/**
 * Tweak tabledrag toggle weight.
 */
.tabledrag-toggle-weight-wrapper.webform-multiple-tabledrag-toggle-weight {
  position: inherit;
  display: inherit;
  float: right;
}

.tabledrag-toggle-weight-wrapper.webform-multiple-tabledrag-toggle-weight button {
  position: inherit;
  top: inherit;
  right: inherit;
}

/**
 * IMCE tweaks
 */
.webform-multiple-table .imce-url-button {
  display: block;
}

/**
 * Mobile support to multiple table.
 */
@media (max-width: 768px) {
  .webform-multiple-table-responsive thead {
    display: none;
  }

  .webform-multiple-table-responsive tr {
    position: relative;
    display: block;
    padding: 0.5em 0;
  }

  .webform-multiple-table-responsive td {
    display: block;
    width: inherit;
    padding: 0.5em 1em;
    text-align: inherit;
    border: 0;
    background: transparent;
  }

  .webform-multiple-table-responsive td::after {
    display: table;
    clear: both;
    content: "";
  }

  .webform-multiple-table-responsive td.webform-multiple-table--operations {
    position: absolute;
    top: 0.75em;
    right: 0;
  }

  .webform-multiple-table-responsive td.webform-multiple-table--weight {
    width: 100%;
  }

  .webform-multiple-table-responsive td > div > label.visually-hidden {
    position: inherit !important;
    display: block;
    overflow: inherit;
    clip: inherit;
    width: inherit;
    height: inherit;
    margin: 0.2em 0;
  }
}
