// Drupal admin tables
//
// Complex forms that appear in html `<table>` elements.
//
// If your custom theme isn't used for Drupal's admin pages, you can safely
// delete this component to save file weight in the generated CSS.
//
// Markup: form-table.hbs
//
// Style guide: forms.form-table

.form-table,
%form-table {
  &__sticky-header {
    position: fixed;
    visibility: hidden;
    margin-top: 0;
    background-color: color(body-bg);

    &.is-sticky,
    &--is-sticky {
      visibility: visible;
    }
  }

  &__header {
    border-bottom: 3px solid color(border);
    padding-right: 1em;
    text-align: left;

    @include rtl() {
      text-align: right;
      padding-left: 1em;
      padding-right: 0;
    }
  }

  &__body {
    border-top: 1px solid color(border);
  }

  &__row {
    padding: .1em .6em;
    border-bottom: 1px solid color(border);
    background-color: color(row-stripe);
  }

  &__row-even {
    background-color: color(body-bg);
  }

  &__list {
    margin: 0;
  }

  &__narrow-column {
    // scss-lint:disable VendorPrefix
    width: -moz-min-content;
    width: -webkit-min-content;
    // scss-lint:enable VendorPrefix
    text-align: center;
  }

  // Automatically set styles on child HTML structure.
  th {
    @extend %form-table__header;

    // Override specificity. :-p
    &.form-table__narrow-column {
      @extend %form-table__narrow-column;
    }
  }

  tbody {
    @extend %form-table__body;

    tr {
      @extend %form-table__row;

      &:nth-child(even) {
        @extend %form-table__row-even;
      }
    }
  }

  ul {
    @extend %form-table__list;
  }
}

//
// Drupal selectors.
//

.sticky-header {
  @extend %form-table__sticky-header;
}

form table {
  @extend %form-table;
}

td,
th {
  .checkbox {
    @extend %form-table__narrow-column;
  }
}

// Markup generated by theme_tablesort_indicator().
td.active {
  background-color: darken(color(row-stripe), 6.8%);
}

td.menu-disabled {
  background: color(row-disabled);
}

// TableSelect behavior.
tr.selected td {
  background: color(table-select);
}
