$scrollbarSize: 12px;

@include comp(virtual-table) {
  height: 100%;
  width: 100%;
  overflow: hidden;
  color: plv(text-2);

  tr, td {
    transition: background-color linear 100ms;

    & > .#{componentName(icon)} {
      vertical-align: -0.15em;
    }
  }

  .virtual-table-head-table-wrapper {
    position: sticky;
    top: 0;
    z-index: 4;
    background-color: plv(table-head-background);

    .virtual-table-head-table {
      color: plv(text-1);
    }

    td {
      background-color: plv(table-head-background);
    }
  }

  &:not(.virtual-table-has-summary) {
    .virtual-table-body-table-wrapper {
      padding-bottom: 9px;
    }
  }

  .virtual-table-summary-table-wrapper {
    padding-bottom: 9px;
    position: sticky;
    bottom: 0;
    z-index: 4;
    background-color: plv(table-summary-background);

    &:before {
      position: absolute;
      top: -1px;
      left: 0;
      right: 0;
      border-top: solid 1px plv(table-border-color);
      content: '';
      z-index: 5;
    }

    td {
      background-color: plv(table-summary-background);
    }
  }

  .virtual-table-head-table, .virtual-table-summary-table, .virtual-table-body-table {
    tr {
      td {
        box-sizing: border-box;
        border-bottom: solid 1px plv(table-border-color);
      }
    }
  }

  .virtual-table-head-table {
    td:hover {
      //background-color: plv(table-head-background-hover);
    }
  }

  .virtual-table-body-table {
    tr {
      border-bottom: solid 1px plv(table-border-color);

      td {
        background-color: plv(background-color);
      }

      &:hover {
        td:not([data-span=true]) {
          background-color: plv(table-row-hover-color);
        }
      }

      &.plt-row-current {
        td:not([data-span=true]) {
          background-color: plv(table-row-current-color);
        }
      }

      &.plt-row-checked {
        td:not([data-span=true]) {
          background-color: plv(primary-light-1);
          border-bottom-color: plv(primary-light-2);
        }
      }
    }
  }
}

@include prefix(scroll-table) {
  position: relative;

  @include prefix(scroll) {
    .scroll-content {
      min-width: 100%;
    }

    .scroll-wrapper {
      height: calc(100% + 20px);
    }

    .vertical-scrollbar-wrapper, .horizontal-scrollbar-wrapper {
      z-index: 10;
    }
  }

  &:hover {
    @include prefix(scroll) {
      & > .horizontal-scrollbar-wrapper, & > .vertical-scrollbar-wrapper {
        .vertical-scrollbar, .horizontal-scrollbar {
          opacity: 1;
        }
      }
    }
  }

  table {
    border-collapse: initial;
    border-spacing: 0;
    box-sizing: border-box;
    table-layout: fixed;
    /**
     * table一直都是有个最小宽度100%。
     * 当总列宽小于表格宽度时，table没有具体width宽度，fit列不设置库宽度，使其自适应宽度；
     * 当总列宽大于表格宽度时，table设置具体的width宽度，fit值无效，以列具体宽度为准；
     */
    //min-width: 100%;  // 不能设置min-width，当文字过长的时候，会自动撑开列宽，导致表头与表体错位
    width: 100%;

    tr {
      //position: relative;

      td {
        &:not(.plt-cell-editing) {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }

        box-sizing: border-box;
        position: relative;
        padding: 1px 11px;

        .cell-fit-height {
          height: 100%;
          display: flex;
          align-items: center;
        }

        .cell-align-center {
          justify-content: center;
        }

        .cell-align-start {
          justify-content: flex-start;
        }

        .cell-align-right {
          justify-content: flex-end;
        }
      }
    }
  }
}
