@import "./var";

@table-prefix: ~'@{ui-prefix}-table';
@table-main: ~'@{table-prefix}-main';
@table-head: ~'@{table-prefix}-head';
@table-body: ~'@{table-prefix}-body';
@table-thead: ~'@{table-prefix}-thead';
@table-tbody: ~'@{table-prefix}-tbody';

.@{table-prefix} {
  font-size: 14px;

  table {
    width: 100%;
    table-layout: fixed;
    border-spacing: 0;
    border-collapse: collapse;
    text-align: center;
  }

  .@{table-main} {
    overflow-x: auto;

    .@{table-head} {
      overflow: scroll;
    }

    .@{table-body} {
      background: @white;
    }

    .@{table-thead} {
      tr {
        th {
          padding: @table-padding;
          border-bottom: @table-border;
          background: @table-head-bg;
        }
      }
    }

    .@{table-tbody} {
      tr {
        td {
          padding: @table-padding;
          border-bottom: @table-border;
        }
      }
    }
  }

  &.@{table-prefix}--border {
    .@{table-main} {
      border-left: @table-border;
      border-right: @table-border;
    }

    .@{table-head},
    .@{table-body} {
      & > table {
        border-top: @table-border;
      }
    }

    .@{table-thead},
    .@{table-tbody} {
      tr {
        th:nth-last-child(n + 2),
        td:nth-last-child(n + 2) {
          border-right: @table-border;
        }
      }
    }

    &.@{table-prefix}--independent-head {
      .@{table-body} {
        & > table {
          border-top: 0;
        }
      }
    }
  }

  &.@{table-prefix}--scroll-x {
    .@{table-main} {
      .@{table-tbody} {
        tr:last-child {
          td {
            border-bottom: 0;
          }
        }
      }
    }
  }

  &.@{table-prefix}--scroll-y {
    .@{table-main} {
      border-right: 0;
    }
  }
}
