$component: table;

.#{el($component)} {
  position: relative;
  overflow: hidden;
  @include box-sizing(border-box);
  width: 100%;
  max-width: 100%;
  background-color: get-color(white);
  // border: 1px solid $table-border-color; //removing main table border
  color: $table-text-color;
  &:before { //shadowing
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: $table-border-color;
    z-index: 1;
  }
  &:after { //shadowing
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    // background-color: $table-border-color; //removing main table border
    z-index: 1;
  }
  .#{el(tooltip)}.cell {
    min-width: 50px;
  }
  td, th {
    padding: 12px 0;
    min-width: 0;
    @include box-sizing(border-box);
    text-overflow: ellipsis;
    vertical-align: middle;
    position: relative;
    &.is-center {
      text-align: center;
    }
    &.is-left {
      text-align: left;
    }
    &.is-right {
      text-align: right;
    }
    &.gutter {
      width: 15px;
      border-right-width: 0;
      border-bottom-width: 0;
      padding: 0
    }
  }
  .cell {
    @include box-sizing(border-box);
    white-space: normal;
    line-height: 23px
  }
  .cell, th div {
    padding-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  td, th.#{is(leaf)} {
    border-bottom: 1px solid $table-border-color;
  }
  th.#{is(sortable)} {
    cursor: pointer;
  }
  td > div {
    @include box-sizing(border-box);
  }
  .caret-wrapper {
    position: relative;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    margin-top: -2px;
    width: 16px;
    height: 30px;
    overflow: initial;
    .ascending, .descending {
      &:before {
        content: '' !important;
      }
    }
  }
  .sort-caret {
    display: inline-block;
    width: 0;
    height: 0;
    border: 0;
    content: "";
    position: absolute;
    left: 3px;
    z-index: 2;
    &.ascending {
      top: 9px;
      border-top: none;
      border-right: 5px solid transparent;
      border-bottom: 5px solid $sort-button-color;
      border-left: 5px solid transparent;
    }
    &.descending {
      bottom: 9px;
      border-top: 5px solid $sort-button-color;
      border-right: 5px solid transparent;
      border-bottom: none;
      border-left: 5px solid transparent;
    }
  }
  .ascending {
    .sort-caret.ascending {
      border-bottom-color: $sort-button-color-active;
    }
  }
  .descending {
    .sort-caret.descending {
      border-top-color: $sort-button-color-active;
    }
  }
  .hidden-columns {
    visibility: hidden;
    position: absolute;
    z-index: -1;
  }
}

.#{el($component, empty-block)} {
  position: relative;
  min-height: 60px;
  text-align: center;
  width: 100%;
  height: 100%;
}

.#{el($component, empty-text)} {
  position: absolute;
  left: 50%;
  top: 50%;
  @include transform(translate(-50%, -50%));
  color: get-color(blue-light);
}

.#{el($component, expand-column)} {
  .cell {
    padding: 0;
    text-align: center;
  }
}

.#{el($component, expand-icon)} {
  position: relative;
  cursor: pointer;
  color: #666;
  @include transition(transform .2s ease-in-out);
  height: 20px;

  .cell {
    position: relative;
    cursor: pointer;
    color: #666;
    @include transition(transform 0.2s ease-in-out);
    height: 40px;
  }

  > .#{el(icon)} {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -5px;
    margin-top: -5px;
  }
}

.#{el($component, expand-icon, expanded)} {
  @include transform(rotate(90deg));
}

.#{el($component, expanded-cell)} {
  &[class*=cell] {
    padding: 20px 50px;
  }
  background-color: get-color(gray-lightest);
  box-shadow: inset 0 2px 0 #f4f4f4;

  &:hover {
    background-color: get-color(gray-lightest) !important;
  }
}

.#{el($component, false, fit)} {
  border-right: 0;
  border-bottom: 0;
  th.gutter, td.gutter {
    border-right-width: 1px;
  }
}

.#{el($component, false, border)} {
  th, td {
    border-right: 1px solid $table-border-color;
  }
  th {
    border-bottom: 1px solid $table-border-color;
  }
}

.#{el($component, fixed)}, .#{el($component, fixed, right)} {
  position: absolute;
  top: 0;
  left: 0;
  @include box-shadow(1px 0 8px #d3d4d6);
  overflow-x: hidden;
  &:before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background-color: $table-border-color;
    z-index: 4;
  }
}

.#{el($component, fixed-right-patch)} {
  position: absolute;
  top: -1px;
  right: 0;
  background-color: $table-header-background;
  border-bottom: 1px solid $table-border-color;
}

.#{el($component, fixed-right)} {
  top: 0;
  left: auto;
  right: 0;
  .#{el($component, fixed-body-wrapper)}, .#{el($component, fixed-footer-wrapper)}, .#{el($component, fixed-header-wrapper)} {
    left: auto;
    right: 0;
  }
}

.#{el($component, fixed-header-wrapper)}, .#{el($component, fixed-body-wrapper)}, .#{el($component, fixed-footer-wrapper)} {
  width: 100%;
}

.#{el($component, fixed-header-wrapper)} {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
}

.#{el($component, fixed-body-wrapper)} {
  position: absolute;
  left: 0;
  top: 37px;
  overflow: hidden;
  z-index: 3;
}

.#{el($component, fixed-footer-wrapper)} {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  tbody td {
    border-top: 1px solid $table-border-color;
    background-color: $table-footer-background;
    color: $table-text-color;
  }
}

.#{el($component, footer-wrapper)} {
  margin-top: -1px;
  td {
    border-top: 1px solid $table-border-color;
  }
}

.#{el($component, header)}, .#{el($component, body)}, .#{el($component, footer)} {
  table-layout: fixed;
}

.#{el($component, fixed-header-wrapper)}, .#{el($component, fixed-footer-wrapper)} {
  overflow: hidden;
  tbody td {
    background-color: $table-header-background;
    color: $table-text-color;
  }
}

.#{el($component, body-wrapper)} {
  overflow: auto;
  position: relative;
}

.#{el($component, false, striped)} {
  .#{el($component, body)} {
    tr.#{el($component, row, striped)} {
      background: $table-header-background;
      background-clip: padding-box;
    }
  }
}

.#{el($component, body)} {
  tr.current-row > td {
    background-color: $table-header-background;
  }
  tr.hover-row {
    &, &.#{el($component, row, striped)} {
      &, &.current-row {
        > td {
          background-color: $table-header-background;
        }
      }
    }
  }
}
