// mdl table style
.mdl-data-table {
  white-space: inherit;

  tbody {
    tr {
      &.is-selected {
        background-color: $state-primary-bg;
      }

      &:hover {
        background-color: $table-bg-hover;
      }
    }
  }
  td, th {   

    &:first-of-type {
      padding-left: $table-cell-padding;
    }

    &:last-of-type {
      padding-right: $table-cell-padding;
    }
  }
}

// Sortable table
//
// Adds styling for sortable/disabled/active sort cells.

.table-sortable {
    > thead > tr > .sortable {
        &.active {
            background: $table-bg-hover; //overrides bootstrap's active color
            border-color: $brand-primary;
            color: #222;
            font-weight: 700;
        }

        &:hover {
            background: $table-bg-hover;
            border-color: $brand-primary;
            cursor: pointer;
        }
    }
}

// Borderless version
//
// gets rid of all cell borders

.table-borderless {
  > tbody,
  > tfoot {
    > tr {
      > th,
      > td {
        border: none;
      }
    }
  }
}

.panel > .panel-collapse > .table {
    border-top: 1px solid $panel-default-border;
}

// Borderless version
//
// gets rid of all cell borders

.table-bordered {  
  border: 1px solid $table-border-color;  
}

// Row hover effect
//
// Duplicated from Bootstrap for precedence over striping

.table-hover {
  > tbody > tr:hover {
    background-color: $table-bg-hover;
  }
}


// Outlined version
//
// Adds a border to the outside of the table, but not the cells.

.table-outline {
    border: 1px solid $table-border-color;
}

// Vertical align middle all cells
.table-valign {
    > tbody > tr > td {
        vertical-align: middle;
    }
}

// table with extra padding
.table-comfortable {
  > thead,
  > tbody,
  > tfoot {
    > tr {
      > th,
      > td {
        padding: $table-cell-padding*1.5 $table-cell-padding*1.5;
      }
    }
  }
}

// table with odd and even color switched
.table-striped {
  > tbody {
    > tr:nth-of-type(even) {
    background-color: $table-bg-accent;
    }
    tr:nth-of-type(odd) {
    background-color: $white;
    }
  }
}


// Adds a background color to the table header
.table > thead > tr {
    background: $gray-lighter;
  > th {
    border-bottom-color: $table-border-color;
    border-bottom-width: 2px;
    // font-weight: 600;
  }
}

.table-group {
    background-color: darken($table-bg-hover, 5%);
}

// Styles the .table-config-column
.table > thead > tr > .table-config-column {
    width: 28px;
    text-align: center;
    padding: 0;
    vertical-align: middle;

    > button {
      background: none;
      padding: 0;
      margin: 0;
      border: none;
      width: 100%;
      height: 100%;

      &:hover {
          background-color: $table-bg-hover;
          border-color: $brand-primary;
      }
    }
}

// Expandable tables

.table[data-pl-expandable-rows] {
    > tbody > tr:not([data-pl-detail-row]) {
        cursor: pointer;
    }
    > tbody > tr[data-pl-detail-row] > td:first-child {
        box-shadow: inset 3px 0 0 #eee;
        background: #f6f6f6;
    }
    > tbody > tr[aria-expanded="false"] > td > .icon-angle-right::after {
        transition: transform .05s;
        transform: rotate(0deg);
    }
    > tbody > tr[aria-expanded="true"] > td > .icon-angle-right::after {
        transition: transform .05s;
        transform: rotate(90deg);
    }
}


// Contextual backgrounds

.table-primary {
    @include table-variant($state-primary-bg, $white);
}
.table-success {
    @include table-variant($state-success-bg, $white);
}
.table-warning {
    @include table-variant($state-warning-bg, $brand-warning-text);
}
.table-danger {
    @include table-variant($state-danger-bg, $white);
}
.table-info {
    @include table-variant($state-info-bg, $white);
}
.table-inverse {
    @include table-variant($gray-dark, $gray-light);
}
.table-clear {
  > thead > tr {
    background: transparent;
  }
}

.table {
  
  @extend .mdl-data-table;

  > tbody > tr > td.non-numeric,
  > thead > tr > th.non-numeric {
    @extend .mdl-data-table__cell--non-numeric;
  }
  > tbody > tr > td {
    color: $gray-dark;
  }
  > tbody > tr > th {
      text-align: left !important;
      color: $gray-dark;
      font-weight: normal;
  }
}

.table-selectable {
  @extend .table;
  @extend .table-selectable !optional;

  > thead > tr > th:first-child,
  > tbody > tr > td:first-child,
  > tbody > tr > th {
      text-align: left !important;
      width: 50px;
  }

  thead {
     > label.cbp-checkbox {
      margin-top: 0;
    }
  }

  td {
    > label.cbp-checkbox {
      vertical-align: middle;
    }
  }
}

.floating-table-header {
  margin-bottom: 0;
}

.floating-table-body {
  overflow: auto;
  > table > thead {
    display: none;
  }
}

