/* stylelint-disable */
@mixin tableStyles {
  width: 100% !important;
  border: none;
  margin-bottom: 1.4rem;
  border-radius: var(--table-border-radius);
  font-weight: 400;
  table-layout: auto;
  @include link-color(var(--table-content-color, --color-6));
  @include overflow(overflow-x, auto, touch);
  display: block;
  box-shadow: var(--table-box-shadow, 0px 4px 6px -2px rgba(27, 27, 28, 0.02), 0px 12px 16px -4px rgba(27, 27, 28, 0.05));
  padding-bottom: 2.4rem;
  min-width: 100% !important;

  &::-webkit-scrollbar {
    height: 0.6rem;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 2px;
    background-color: #515156;
    border-radius: 100px;
  }

  /* Track */
  &::-webkit-scrollbar-track {
    background: #e0e0e2;
    border-radius: 100px;
    opacity: 0.2;
  }
  @include scrollbar(
    var(--scroll-height-1, 0.8rem),
    var(--scroll-height-2, 0.8rem),
    var(--color-100, #515156)
  );

  * {
    box-sizing: var(--table-box-sizing, content-box);
  }

  thead,
  tbody {
    display: table;
    width: 100%;
    table-layout: auto;
    box-sizing: border-box;
    @include min(tablet) {
     table-layout: fixed; 
    }
  }

  @include min(tablet) {
    width: 100%;
    padding-bottom: 0;
  }

  thead,
  tbody {
    tr {
      border: var(--header-border);
      th {
        padding: 4px 16px;
        height: 5.6rem;
        color: var(--table-head-text);
        background: var(--table-head-background);
        border-right: var(--border-right-table-header, 2px solid var(--table-head-background));
        font-weight: 700;
        font-size: 1.6rem;
        line-height: 2.7rem;

        &:first-child {
          border-top-left-radius: var(--table-border-radius);
        }

        &:last-child {
          border-top-right-radius: var(--table-border-radius);
        }

        a {
          color: white !important;
          text-decoration: underline;
        }
      }
    }
    tr {
      background-color: var(--table-background);

      &:nth-child(odd) {
        background-color: var(--table-highlight);
      }

      td {
        padding: 4px 16px;
        line-height: 2.7rem;
        height: 5.6rem;
        border: var(--border-table-content, none);

        a {
          text-decoration: underline;
          line-height: 2.7rem;
          font-weight: 500;
          img {
            width: 15rem;
          }
        }
      }
    }

    tr:last-child td:last-child {
      border-bottom-right-radius: var(--table-border-radius);
    }

    tr:last-child td:first-child {
      border-bottom-left-radius: var(--table-border-radius);
    }
  }

  td,
  th {
    @include max(tablet) {
      min-width: 15rem;
    }

    img {
      max-width: none;
    }
  }
}

.templateOne,
.templateOne > div {
  width: 100%;
  box-sizing: var(--box-sizing-templateOne, border-box);
  table {
    @include tableStyles;
  }
}

.templateTwo {
  margin-bottom: 1rem;
  margin-top: 1rem;
  box-sizing: var(--box-sizing-templateTwo, content-box);
  table {
    @include tableStyles;
  }
}

.templateOne,
.templateOne > div {
  width: 100%;
  box-sizing: var(--box-sizing-templateOne, border-box);
  table {
    @include tableStyles;
  }
}

.templateTwo {
  margin-bottom: 1rem;
  margin-top: 1rem;

  @include max(mobile) {
    table {
      border-collapse: inherit;
      box-shadow: none;

      th {
        display: none;
      }

      tbody {
        overflow: hidden;
        background: var(--stack-table-background-color, white);
        @include flex-direction(column);
        tr {
          border-radius: 16px;
          box-shadow: 0px 4px 4px -2px rgba(27, 27, 28, 0.06),
            0px 6px 8px -2px rgba(27, 27, 28, 0.08);
          &:not(:first-child) {
            margin-bottom: 1.4em;
          }
          &:first-child {
            td {
              color: white !important;
              background: red;
              display: none;
              border-radius: 0;

              &:first-child {
                border-top-left-radius: var(--table-border-radius);
                border-top-right-radius: var(--table-border-radius);
              }

              a {
                color: white !important;
                text-decoration: underline;
              }
            }
          }

          td {
            display: block;
            text-align: left !important;
            height: var(--table-template-two-mobile-height, 4rem);
            @include flex-align(center, flex-start);
            background: var(--even-td-template-two, #fff);
            &:not(:last-child) {
              border-bottom: var(--td-template-two-border, none);
            }
            &:nth-child(odd) {
              background: var(--odd-td-template-two, #eee);
            }
          }

          &:last-child {
            td {
              border-radius: 0;
              &:last-child {
              }
            }
          }
        }
      }
    }
  }
}
