@import 'theme/default';
@import 'theme/font';

$blue: $theme-primary-4;

.zent-table-container {
  margin-bottom: 20px;
}

.zent-table {
  box-sizing: border-box;
  width: 100%;

  a {
    @include theme-color(color, primary, 4);
    cursor: pointer;

    &:hover {
      cursor: pointer;
      text-decoration: none;
    }
  }

  .tr {
    @include theme-color(border-bottom-color, stroke, 6);
    display: flex;
    border-bottom-width: 1px;
    border-bottom-style: solid;
  }

  .expanded-item {
    width: 70px;
    text-align: center;
    position: relative;

    i {
      height: 100%;

      &::before {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
      }
    }
  }

  .thead {
    .tr {
      @include theme-color(border-bottom-color, stroke, 6);
      @include theme-color(background-color, stroke, 8);
      border-top: 0;
      border-bottom-width: 1px;
      border-bottom-style: solid;

      .cell {
        font-size: $font-size-normal;
        font-weight: 500;
      }
    }

    .sort-col {
      .sort-col-title {
        vertical-align: middle;
      }

      .sort-col-icon {
        position: relative;
        width: 10px;
        height: 17px;
        display: inline-block;
        vertical-align: middle;
        margin-left: 4px;
      }

      .caret-up {
        @include theme-color(border-bottom-color, stroke, 3);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-bottom-width: 7.5px;
        border-bottom-style: solid;
        position: absolute;
        top: 0;
        left: 0;
        cursor: pointer;
      }

      .caret-down {
        @include theme-color(border-top-color, stroke, 3);
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top-width: 7.5px;
        border-top-style: solid;
        position: absolute;
        bottom: 0;
        left: 0;
        cursor: pointer;
      }

      .caret-up.sort-active {
        @include theme-color(border-bottom-color, primary, 4);
      }

      .caret-down.sort-active {
        @include theme-color(border-top-color, primary, 4);
      }

      &:hover {
        .sort-col-icon {
          visibility: visible;
          opacity: 0.8;
        }
      }

      &--active {
        cursor: pointer;

        .sort-col-icon {
          visibility: visible;
        }
      }
    }
  }

  .tbody {
    .tr {
      &:hover {
        @include theme-color(background-color, stroke, 8);

        .empty-data {
          background: transparent;
        }
      }

      &--expanded {
        @include theme-color(background-color, stroke, 8);
      }

      .td {
        padding: 16px 0 8px;

        .expandable-btn {
          @include theme-color(background-color, stroke, 9);
          @include theme-color(border-color, stroke, 6);
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          display: inline-block;
          box-sizing: border-box;
          cursor: pointer;
          width: 17px;
          height: 17px;
          text-align: center;
          line-height: 10px;
          border-width: 1px;
          border-style: solid;

          &.expand-btn::after {
            content: '+';
            box-sizing: border-box;
          }

          &.collapse-btn::after {
            content: '-';
            box-sizing: border-box;
          }
        }
      }
    }

    .cell {
      min-height: 56px;
      font-size: $font-size-normal;
    }
  }

  .tfoot {
    margin-top: 16px;
    box-sizing: border-box;

    &__batchcomponents {
      float: left;
      padding-left: 10px;

      &--has-children {
        @include theme-color(background-color, stroke, 9);
        margin-bottom: 10px;
      }

      &--fixed {
        position: fixed;
        bottom: 0;
      }

      .subcomponent-wrapper {
        display: inline-block;
        vertical-align: middle;
      }
    }

    &__page {
      float: right;
    }
  }

  .cell {
    position: relative;
    display: flex;
    flex: auto;
    flex-basis: 0;
    box-sizing: border-box;
    padding: 8px 10px;
    padding-left: 0;
    min-height: 56px;
    align-items: center;
    text-align: left;
    font-size: $font-size-normal;

    &__child-container {
      overflow: hidden;
      width: 100%;
      text-overflow: ellipsis;
    }

    &:first-child {
      padding-left: 10px;
    }

    &:last-child {
      justify-content: flex-end;

      .cell__child-container {
        text-align: right;
      }
    }

    &.empty-data {
      line-height: 20px;
      height: 40px;
      justify-content: center;
    }

    &.cell--selection {
      padding-left: 34px;
    }

    &.cell--money,
    &.cell--end {
      justify-content: flex-end;

      .cell__child-container {
        text-align: right;
      }
    }

    &.cell--start {
      justify-content: flex-start;

      .cell__child-container {
        text-align: left;
      }
    }

    &.cell--center {
      justify-content: center;

      .cell__child-container {
        text-align: center;
      }
    }

    .asc,
    .desc {
      margin-left: 3px;
    }

    .desc {
      &:after {
        position: absolute;
        content: '\2193';
      }
    }

    .asc {
      &:after {
        position: absolute;
        content: '\2191';
      }
    }

    .select-check {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      margin-top: 0;
    }
  }

  .clearfix:after {
    content: '';
    display: table;
    clear: both;
  }
}
