@import '../settings/variables';
@import '../tools/mixins/position';
@import '../tools/mixins/breakpoints';

.c-table {
  &__wrapper {
    @include position(relative, auto, 1rem, auto, 1rem);
    margin-left: -1rem;
    margin-right: 1rem;
  }

  &__header {
    padding-bottom: $gutter-big;
  }
  
  &__download {
    display: inline-block;
    z-index: $layer-content-attached;
  }

  &__pool-name {
    position: relative;
  }
}

.c-default-table {
  margin-bottom: $margin-enormous;
  min-width: 825px;

  @media print {
    min-width: auto;
    overflow: hidden;
  }

  th,
  td {
    position: relative;
    text-align: right;
    padding: $gutter-normal $gutter-big $gutter-normal 0;
    width: 9%;

    @media print {
      padding: $gutter-small $gutter-small $gutter-small 0;
    }

    &:nth-child(1) {
      width: 15%;
      text-align: left;
      padding-left: $gutter-small;
      padding-right: $gutter-normal;

      @media print {
        width: inherit;
      }
    }
  }

  th {
    font-size: $font-size-caption;
    @media print {
      font-size: $font-size-caption;
      font-weight: $font-weight-bold;
    }
  }

  td {
    border-top: $hairline solid $color-neutral;
    padding: $gutter-big $gutter-big $gutter-big 0;

    @media print {
      padding: $gutter-normal $gutter-small $gutter-normal 0;
      font-size: $font-size-caption;
    }

    &:nth-child(4) {
      border-right: $hairline dashed $color-neutral;
    }
  }

  tbody {
    tr {
      &:hover {
        background-color: $color-background-alternative;
      }
    }
  }

  colgroup {
    col {
      &:first-child, &:last-child {
        width: auto;
      }

      &:nth-child(1) {
        width: 15%;
      }
    }
  }

  & &__no-data-row, & &__no-data-row:nth-child(2) {
    background-color: $color-background-alternative;
    font-weight: $font-weight-bold;
    text-align: center;
  }

  &__fixed-header {
    position: fixed;
    background: $color-background;
    z-index: $layer-screen-attached;
    top: $headers-summary-height;
    border-bottom: $hairline solid $color-neutral;
    padding-top: $gutter-normal;
    box-sizing: content-box;
    padding-left: $gutter-big;
    padding-right: $gutter-big;
    margin-left: - $gutter-big;
    display: none;

    @include media-breakpoint-up(md) {
      display: initial;
    }
  }

  &__table-header {
    td {
      width: auto;
      text-align: left;
      border: none;
      padding: 0 $gutter-big 0 0;
      &:nth-child(1), :last-child {
        width: auto;
      }
    }

    @media print {
      display: none;

      th {
        font-weight: $font-weight-bold;
      }
    }
  }
}

.c-tce-development-table {
  th,
  td {
    &:nth-child(4) {
      border-right: none;
    }
  }

  .c-default-table__fixed-header {
    top: 0;
    padding: 5rem 0 0 0;
    margin-left: 0;
  }
}

.c-vessel-voyage-table {
  th,
  td {
    width: 15%;
    text-align: left;

    &:nth-child(1) {
      width: 15%;
    }

    &:nth-child(4) {
      border-right: none;
    }
  }

  td {
    padding: 1rem 2rem 1rem 0;
  }

  colgroup {
    col {
      &:first-child, &:last-child {
        width: 15%;
      }

      &:nth-child(1) {
        width: 15%;
      }
    }
  }
}

.c-tce-with-warning-table {
  th, td {
    &:nth-child(1) {
      width: 5%;
      text-align: center;
      padding-left: 0;
      padding-right: 0;
      padding-bottom: 0;
    }
    &:nth-child(2) {
      width: 10%;
      text-align: left;
      padding-left: $gutter-small;
      padding-right: $gutter-normal;

      @media print {
        width: inherit;
      }
    }
  }

  td {
    padding: 2rem 1.75rem 2rem 0;
  }
}
