/**
 *
 * This file may have been modified by Bytedance Inc. (“Bytedance Inc.'s Modifications”). 
 * All Bytedance Inc.'s Modifications are Copyright (year) Bytedance Inc..  
 * 
 * This source code is licensed under the Apache license.
 * See LICENSE file in the project root for license information.
 *
 */
.@{ant-prefix}-table-thead:not(.sp-null) tr {

  th {
    color: @table-header-color;
    font-size: 12px;
    padding: 14px 16px;
    font-weight: normal;

    .@{ant-prefix}-table-column-sorters span.sp-tooltip {
      line-height: 20px;
      display: inline-block;
      border-bottom: 1px dashed @table-row-operation-color;
    }
    &.@{ant-prefix}-table-selection-column {
      padding: @table-padding-vertical 0 @table-padding-vertical @table-padding-horizontal;
    }
  }

  .@{ant-prefix}-table-column-sorter-up.active,
  .@{ant-prefix}-table-column-sorter-down.active {
    color: @color-primary-brand;
  }
}

.@{ant-prefix}-table:not(.sp-null) {
  border: @table-border-width @border-style-base @table-border-color;
  

  .@{ant-prefix}-table-selection-col,
  .@{ant-prefix}-table-expand-icon-col {
    width: 32px;
  }

  .serial-number {
    padding: @table-padding-vertical 0 @table-padding-vertical @table-padding-horizontal;
  }

  &:not(.@{ant-prefix}-table-bordered) {
    .@{ant-prefix}-table-tbody tr {

      td {

        &[rowspan] {
          border-left: 1px solid @table-border-color;
          border-right: 1px solid @table-border-color;
        }
 
        &[colspan] {
          border-left: 1px solid @table-border-color;
          border-right: 1px solid @table-border-color;
        }

        &:first-child {
          border-left: none;
        }

        &:last-child {
          border-right: none;
        }
      }
    }
  }

  .@{ant-prefix}-table-row-expand-icon {
    transform-origin: left center;
  }

  .@{ant-prefix}-table-ping-left:not(.@{ant-prefix}-table-has-fix-left) .@{ant-prefix}-table-container::before,
  .@{ant-prefix}-table-ping-left .@{ant-prefix}-table-cell-fix-left-first::after,
  .@{ant-prefix}-table-ping-left .@{ant-prefix}-table-cell-fix-left-last::after {
    box-shadow: inset 10px 0 8px -8px rgba(18, 20, 26, .08);
  }
  .@{ant-prefix}-table-ping-right:not(.@{ant-prefix}-table-has-fix-right) .@{ant-prefix}-table-container::after,
  .@{ant-prefix}-table-ping-right .@{ant-prefix}-table-cell-fix-right-first::after,
  .@{ant-prefix}-table-ping-right .@{ant-prefix}-table-cell-fix-right-last::after {
    box-shadow: inset -10px 0 8px -8px rgba(18, 20, 26, .08);
  }
  .@{ant-prefix}-btn-link,
  .@{ant-prefix}-btn-text {
    font-size: 12px;
  }
}

.@{ant-prefix}-table-tbody:not(.sp-null) {

  tr.row-vertical-top {
    vertical-align: top;
  }

  tr.@{ant-prefix}-table-row-selected {

    td {
      background-color: @table-row-selected-background;
    }
  }

  tr {
    // 表格轮廓存在边框时最后一行的下划线取消
    & when(@table-border-width > 0px) {

      &:last-child {

        td {
          border-bottom: none;

          &:first-child {
            border-bottom-left-radius: @table-border-radius-base;
          }

          &:last-child {
            border-bottom-right-radius: @table-border-radius-base;
          }
        }
      }
    }

    td {
      font-size: 12px;
      line-height: 20px;
      word-wrap: break-word;
      word-break: break-all;
      padding: 14px 16px;
      color: @table-body-color;
    }

    td.editable-cell {
      padding: 10px @table-padding-horizontal;
    }
    td.@{ant-prefix}-table-selection-column {
      padding: @table-padding-vertical 0 @table-padding-vertical @table-padding-horizontal;
    }
    td.@{ant-prefix}-table-row-expand-icon-cell {
      padding: @table-padding-vertical 0 @table-padding-vertical @table-padding-horizontal;
      .@{ant-prefix}-table-row-expand-icon {
        color: @table-row-operation-color;
        border-color: @table-row-operation-color;
      }
    }
  }

  tr:hover:not(.@{ant-prefix}-table-expanded-row):not(.@{ant-prefix}-table-placeholder) > td {
    background-color: @table-row-hover-background;
  }
  tr:hover:not(.@{ant-prefix}-table-row-selected):not(.@{ant-prefix}-table-placeholder) > td {
    background-color: @table-row-hover-background;
  }
  // 嵌套表格内部的单元格背景色
  tr.@{ant-prefix}-table-expanded-row:not(.@{ant-prefix}-table-expanded-row-level-0).expandable-sub-table {

    & > td,
    &:hover > td {
      background-color: #fff;
    }
  }
}

.@{ant-prefix}-table-empty:not(.sp-null):not(.@{ant-prefix}-table-bordered) .@{ant-prefix}-table-tbody tr td {
  border-bottom: none;
}

.@{ant-prefix}-table-wrapper:not(.sp-null).custom-style-gray {
  .@{ant-prefix}-table-thead tr th {
    background-color: @table-thead-custom-background;
    color: @table-thead-custom-text-color;
    font-weight: 500;
  }
}

.@{ant-prefix}-table-wrapper:not(.sp-null).custom-style-gray.@{ant-prefix}-pair-head-table {
  .@{ant-prefix}-table-thead tr th {
    background-color: @table-thead-custom-pair-background;
    color: @table-thead-custom-text-color;
    font-weight: 500;
  }
}

.@{ant-prefix}-table-pagination:not(.sp-null) {
  &.@{ant-prefix}-pagination {
    margin: 12px 0 24px;
  }
  align-items: center;
}

.@{ant-prefix}-table-thead:not(.sp-null)
> tr
> th:not(:last-child):not(.@{ant-prefix}-table-selection-column):not(.@{ant-prefix}-table-row-expand-icon-cell):not([colspan])::before {
  content: none;
}

// 双表头
.@{ant-prefix}-table-wrapper.auxo-pair-head-table {
  .@{ant-prefix}-table {
    border: 1px solid rgba(0, 0, 0, 0);
  }

  .@{ant-prefix}-table-row-level-0 {

    > td {
      background-color: #fff !important;
      border: none !important;
      padding-top: 24px !important;

      &::before {
        width: 100%;
        height: calc(100% - 8px);
        position: absolute;
        top: 8px;
        left: 0;
        content: '';
        display: block;
        background-color: @table-thead-custom-background !important;
      }
    }
    .@{ant-prefix}-table-selection-column {
      z-index: 3;
    }

    .auxo-pair-head-td {
      position: relative !important;
      left: 0 !important;

      &::after {
        display: none;
      }

      .auxo-pair-head-wrapper {
        position: sticky;
        left: @table-padding-horizontal;
      }

      &:not(.auxo-pair-head-first) {

        .auxo-pair-head-wrapper {
          left: 48px;
        }
      }
    }
  }

  .auxo-pair-footer-td {
    border-left: none !important;

    &::after {
      display: none;
    }

    .auxo-pair-footer-wrapper {
      position: sticky;
      left: @table-padding-horizontal;
    }

    &:not(.auxo-pair-head-first) {

      .auxo-pair-footer-wrapper {
        left: 48px;
      }
    }
  }

  .@{ant-prefix}-table-tbody {
    tr:not(.@{ant-prefix}-table-row-level-0) {
      &.@{ant-prefix}-table-row-selected {

        td {
          background-color: #fff;
        }
      }
    }
  }
  & when(@table-border-width > 0px) {
    .@{ant-prefix}-table-thead {
      border-radius: @table-border-radius-base;

      tr {

        th:first-child {
          border-left: @table-border-width @border-style-base @table-border-color;
        }

        th:last-child {
          border-right: @table-border-width @border-style-base @table-border-color;
        }
      }

      tr:first-child {

        th {
          border-top: @table-border-width @border-style-base @table-border-color;
        }
      }

      tr:last-child {

        th:first-child {
          border-bottom-left-radius: @table-border-radius-base;
        }

        th:last-child {
          border-bottom-right-radius: @table-border-radius-base;
        }
      }
    }

    .@{ant-prefix}-table-tbody {

      tr:last-child {

        td {
          border-bottom: @table-border-width @border-style-base @table-border-color;
        }
      }
      tr.@{ant-prefix}-table-row-level-0 {

        td:first-child {

          &::before {
            border-left: @table-border-width @border-style-base @table-border-color;
            border-top: @table-border-width @border-style-base @table-border-color;
            border-top-left-radius: @table-border-radius-base;
          }
        }

        td:last-child {

          &::before {
            border-right: @table-border-width @border-style-base @table-border-color;
            border-top: @table-border-width @border-style-base @table-border-color;
            border-top-right-radius: @table-border-radius-base;
          }
        }
      }
      tr:not(.@{ant-prefix}-table-row-level-0) {

        td:first-child {
          border-left: @table-border-width @border-style-base @table-border-color;
        }

        td:last-child {
          border-right: @table-border-width @border-style-base @table-border-color;
        }
      }

      tr.auxo-pair-group-row-last {

        td:first-child {
          border-bottom-left-radius: @table-border-radius-base;
        }

        td:last-child {
          border-bottom-right-radius: @table-border-radius-base;
        }
      }
    }
  }
}



.@{ant-prefix}-table-wrapper:not(.auxo-pair-head-table) {
  .@{ant-prefix}-table {

    &-thead {

      & > tr {

        & > th {
          // 表头和标题之间的分割线要去除
          border-bottom: 1px solid transparent; 
        }
      }
    }

    div.@{ant-prefix}-table-summary {

      .@{ant-prefix}-table-summary > tr {

        &:last-of-type {
  
          & > td { 
            // 解决总结栏且固定定位时上边框重叠问题
            border-top: none;
          }
           
        }
      }

    }

    &-summary {

      & > tr {

        &:last-of-type {

          & > td {
            // 解决总结栏边框问题
            border-bottom: none;
            border-right: none !important;
            border-top: 1px solid @table-border-color;
          }
         
        }
      }
    }
  }
}




.@{ant-prefix}-table-tbody > tr > td > .@{ant-prefix}-table-wrapper:only-child {

  &.custom-style-gray {
    .@{ant-prefix}-table-thead tr th {
      // 当table套table时，表头文字不需要加粗
      font-weight: 400;
    }
  } 
}

// table套table时干掉子table的边框
.@{ant-prefix}-table-tbody > tr > td > .@{ant-prefix}-table-wrapper:only-child .@{ant-prefix}-table {
  border: none;
} 

// table套 table时对齐文字的边距
.@{ant-prefix}-table-tbody > tr > td > .@{ant-prefix}-table-wrapper:only-child .@{ant-prefix}-table {
  margin: -14px -16px -14px 17px;
}
  
// 下拉小箭头的icon对齐
.@{ant-prefix}-dropdown-trigger > .anticon.anticon-down {
  font-size: 12px;
  vertical-align: -1px;
}

.@{ant-prefix}-table-selection-extra {
  padding-inline-start: 2px;
}

// 当table添加了border属性时出现分割线重叠情况进行处理，由于权重问题这里还需进行保留
.@{ant-prefix}-table.@{ant-prefix}-table-bordered > .@{ant-prefix}-table-container {
  border-left: none;
  
  & >.@{ant-prefix}-table-header > table {
    border-top: none;
  }
  
 
  & >.@{ant-prefix}-table-content > table {
    border-top: none;
    .@{ant-prefix}-table-tbody {

      tr > td {

        &.@{ant-prefix}-table-selection-column {
          padding-right: @table-padding-horizontal;
        }
        &.@{ant-prefix}-table-row-expand-icon-cell {
          padding-right: @table-padding-horizontal;
        }

        &:last-of-type {
          border-right: none;
        }
      }
    }

    .@{ant-prefix}-table-thead {

      tr > th {

        &.@{ant-prefix}-table-selection-column {
          padding-right: @table-padding-horizontal;
        }

        &:last-of-type {
          border-right: none;
        }
      }
    }
    
  }
}


// 兼容sticky+bordered的情况
.@{ant-prefix}-table.@{ant-prefix}-table-bordered > .@{ant-prefix}-table-container {

  table {

    colgroup {
      .@{ant-prefix}-table-selection-col {
        width: 48px;
      }
    }
    .@{ant-prefix}-table-tbody {

      tr > td {

        &.@{ant-prefix}-table-selection-column {
          padding-right: @table-padding-horizontal;
          padding-left: @table-padding-horizontal;
        }

        &:last-of-type {
          border-right: none;
        }
      }
    }

    .@{ant-prefix}-table-thead {

      tr > th {

        &.@{ant-prefix}-table-selection-column {
          padding-right: @table-padding-horizontal;
          padding-left: @table-padding-horizontal;
        }

        &:last-of-type {
          border-right: none;
        }
      }
    }
    
  }
}



