.table {

  td {

    .td-title {
      display: inline;
      padding-right: $spacing-xs;
      color: $black;
      @include hover-focus {
        color: $link-hover-color;
      }
    }

    &.td-fixed-width {
      max-width: 150px;
    }

    &.td-actions {
      min-width: 120px;
      max-width: 150px;
    }

    &.title {
      max-width: 500px;
    }
  }

  &.table-borderless {
    th {
      border: 0;
    }

    td {
      border: 0;
    }
  }

  &.table-sm td {
    padding-right: $spacing;
    &:last-child {
      padding-right: 0;
    }
  }
}

table[data-sortable] {
  th {
    @include io-icomoon("caret-empty-double");
    overflow: hidden;
    position: relative;
    padding-right: 30px;
    white-space: nowrap;

    &:hover {
      cursor: pointer;
    }

    &:before {
      visibility: visible;
      position: absolute;
      top: 12px;
      right: $spacing-xs;
      font-size: $font-size-icon-xs;
    }

    &[data-sorted="true"]:before {
      visibility: visible;
    }

    &[data-sorted-direction="descending"] {
      @include io-icomoon("caret-up-double");
    }

    &[data-sorted-direction="ascending"] {
      @include io-icomoon("caret-down-double");
    }
  }
}

.table-pl-0 {
  thead tr th:first-of-type,
  tbody tr td:first-of-type,
  tfoot tr td:first-of-type {
    padding-left: 0px;
  }

}

.table-border-y-0 {
  border: 0;
  thead tr:first-of-type td:first-of-type,
  thead tr:first-of-type th:first-of-type,
  tbody tr td:first-of-type,
  tbody tr th:first-of-type {
    border-left: 0!important;
  }

  thead tr:first-of-type td:last-of-type,
  thead tr:first-of-type th:last-of-type,
  tbody tr td:last-of-type {
    border-right: 0!important;
  }
}

.table-inside-border {
  @extend .table-bordered;
  border: 0;

  thead tr:first-of-type td, th,
  tbody tr:first-of-type td, th {
    border-top: 0 !important;
  }

  thead tr:first-of-type td:first-of-type,
  thead tr:first-of-type th:first-of-type,
  tbody tr td:first-of-type,
  tbody tr th:first-of-type {
    border-left: 0!important;
  }

  thead tr:first-of-type td:last-of-type,
  thead tr:first-of-type th:last-of-type,
  tbody tr td:last-of-type {
    border-right: 0!important;
  }

  tbody tr:last-of-type td,
  tbody tr:last-of-type th {
    border-bottom: 0!important;
  }
  tfoot tr td {
    border-top-style: double !important;
    border-top-width: 4px !important;
    border-left: 0!important;
    border-right: 0!important;
    border-bottom: 0!important;
  }
}

.scrollable-table td:first-of-type, 
.scrollable-table th:first-of-type {
  background-color: $white;
}

.table-vertical-centered {
  vertical-align: middle;
}


// .table {
//   table-layout: auto;
// }

// .table th, 
// .table td, 
// .table thead th, 
// .table tbody td, 
// .table tfoot td, 
// .table tfoot th {
//   width: auto;
// }

.table th,
.table thead th {
  font-size: $table-header-font-size;
  font-weight: $table-header-font-weight;
  padding-top: $spacing-xxs;
  padding-bottom: $spacing-xxs;
  border-bottom-width: $border-width;
}

.table tr:first-child td,
.table.tbody tr:first-child td {
  border-top: 0;
}

.table-bordered,
.table-bordered thead,
.table-bordered tbody {
  border: 0;
}

.table-bordered tr th:first-child,
.table-bordered tr td:first-child {
  border-left: 0;
}

.table-bordered tr td:last-child,
.table-bordered tr th:last-child {
  border-right: 0;
}

.table td.cell-with-buttons {
  padding-top: $spacing-xxs;
  padding-bottom: $spacing-xxs;
}

.table .linked-cell:hover,
.table .linked-row:hover {
  cursor: pointer;
  color: white;
  background-color: $link-hover-color;  
}

.table tr:has(.highlight-parent-row:hover) {
  cursor: pointer;
  color: white;
  background-color: $link-hover-color;
}
