@import 'xtend-library/src/core/table/_table.less';

/**
 * vars
 */

// generate class: [false], [true] non responsive only, [sm, md, lg] responsive @breakpoints

@generate-table-scroll: sm, md;

/**
 * tables
 */

.table, .table-scroll {
  .margin(bottom, layout) !important;
  .margin(bottom, medium);
}

// .table

.table {
  th {
    vertical-align: top;
    .padding(x, tiny);
    .padding(y, tiny);
    .font-sans-semibold();
    .line-height-small();
    font-size: 11px;
    letter-spacing: .025em;
    text-transform: uppercase;
  }
  td {
    vertical-align: top;
    .padding(x, tiny);
    .padding(y, tiny);
    .line-height-small();
    font-size: 1.3rem;
  }
  // thead
  thead {
    th, td {
      border-right: 1px solid @shade-100;
      border-bottom: 1px solid @shade-100;
    }
    th, td {
      &:last-child {
        border-right: 0;
      }
    }
  }
  // tbody
  tbody {
    th, td {
      border-right: 1px solid @shade-100;
      border-bottom: 1px solid @shade-100;
    }
    th, td {
      &:last-child {
        border-right: 0;
      }
    }
    tr {
      &:last-child {
        th, td {
          border-bottom: 0;
        }
      }
    }
  }
  // tfoot
  /*
  tfoot {
    .padding(y, big) !important;
    background: @shade-100;
    th {
      .reset-text();
    }
    tr {
      border: 0;
      th, td {
        vertical-align: top;
        .padding(y, tiny) !important;
        .padding(x, medium) !important;
        text-align: right;
      }
      &:first-child {
        th, td {
          .padding(top, medium) !important;
        }
      }
      &:last-child {
        th, td {
          .padding(bottom, medium) !important;
        }
      }
    }
  }
  */
}

// .table-narrow

.table-narrow {
  th, td {
    .padding(x, layout);
    background: transparent;
  }
}

// .table-small

.table-small {
  th {
    .padding(x, small);
    .padding(y, small);
  }
  td {
    .padding(x, small);
    .padding(y, small);
  }
}

// .table-stripe

.table-stripe {
  tbody tr:nth-of-type(odd) {
    background: @shade-100;
  }
  tbody tr:nth-of-type(even) {
    background: transparent;
  }
}

// .table-border

.table-border {
  border-radius: 6px;
  border: 3px solid @shade-100;
  border-collapse: separate;
  border-spacing: 0;
}

// .table-responsive

.table-responsive {
  @media @max-sm {
    border-top: 2px solid @shade-100;
    thead, th {
      display: none;
    }
    tr {
      .full();
      .padding(y, medium);
    }
    td {
      display: inline-flex;
      flex-direction: column;
      justify-content: center;
      .padding(x, medium);
      .padding(y, small);
      text-align: center;
      .list {
        justify-content: center;
      }
    }
    // data-th
    td:before {
      .form-label();
      content: attr(data-th);
      width: 100%;
      justify-content: center;
      text-align: center;
    }
  }
}
