@mixin list-layout {
  display: inline-grid;
  grid-template-columns: 1fr 40px;

  @include media-breakpoint-up(lg) {
    grid-template-columns: minmax(150px, 25%) 1fr 1fr 60px;
  }

  @for $i from 1 through 4 {
    & > :nth-child(#{$i}) {
      grid-column: $i;
    }
  }

  & > * {
    grid-row: 1;
  }
}

#webhooks-list-page {
  & > .page-content {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 40px 40px 1fr;
    box-sizing: border-box;
    padding-top: 1.5rem;
    row-gap: 2rem;

    @include media-breakpoint-up(lg) {
      row-gap: 0;
      padding: 0;
      align-self: stretch;
      box-sizing: border-box;
      user-select: none;
      display: grid;
      grid-template-columns: 1fr;
      grid-template-rows: 147px 67px 1fr;
      max-height: 100%;
      overflow: hidden;
    }

    header {
      grid-column: 1;
      grid-row: 1;
      box-sizing: border-box;
      width: 100%;
      padding: 0 2rem;

      @include media-breakpoint-up(lg) {
        display: flex;
        flex-flow: row;
        align-content: center;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        gap: 3rem;
        padding: 4rem 6rem 4.6rem;
      }

      h1 {
        display: none;

        @include media-breakpoint-up(lg) {
          display: block;
          font-size: 4.1rem;
          line-height: 6.1rem;
          font-family: Poppins;
          color: var(--text-main);
          @include text-weight(semiBold);
        }
      }

      .search {
        width: 100%;
        height: 40px;

        @include media-breakpoint-up(lg) {
          width: 400px;
        }
      }
    }

    .actions {
      grid-row: 2;
      grid-column: 1;
      width: 100%;
      height: 100%;
      display: flex;
      flex-flow: row nowrap;
      box-sizing: border-box;
      padding: 0 2rem;
      align-content: center;
      align-items: center;
      justify-content: flex-start;

      .select-container {
        min-height: 40px;
      }

      @include media-breakpoint-up(lg) {
        height: auto;
        padding: 0 6rem 2.7rem;
      }

      .items-count {
        display: flex;
        flex-direction: row;
        align-content: center;
        align-items: center;
        justify-content: flex-start;
        width: auto;
        height: auto;
        gap: 1rem;

        span {
          @include text-weight(semiBold);
          @include poppins;

          color: var(--text-main);

          @include media-breakpoint-down(lg) {
            font-size: 1.5rem;
            line-height: 2.1rem;
            text-transform: uppercase;
          }

          @include media-breakpoint-up(lg) {
            font-size: 2rem;
            line-height: 3rem;
          }
        }

        .count {
          display: flex;
          flex-direction: row;
          align-items: center;
          align-content: center;
          justify-content: center;
          min-width: 30px;
          box-sizing: border-box;
          padding: 0 5px;
          height: 30px;
          background-color: var(--gray-light);
          border-radius: 1rem;

          span {
            @include text-weight(semiBold);
            @include poppins;

            color: var(--white);
            font-size: 1.2rem;
            text-align: center;
            line-height: 1.8rem;
          }
        }
      }

      .controls {
        display: flex;
        flex-direction: row;
        align-content: center;
        align-items: center;
        justify-content: center;
        margin-left: auto;

        & > .select {
          height: 40px;
        }

        & > .add-item {
          min-width: 110px;
          width: auto;

          svg {
            rect,
            g {
              fill: var(--white);
            }
          }
        }

        @include media-breakpoint-down(lg) {
          column-gap: 1rem;

          & > button {
            width: 40px;
            height: 40px;

            span {
              display: none;
            }
          }

          & > .add-item {
            min-width: 0;
            padding: 0;
            width: 40px;
            height: 40px;
          }
        }

        @include media-breakpoint-up(lg) {
          gap: 2rem;

          & > div {
            width: 180px;
          }

          .btn {
            min-width: 110px;
          }
        }
      }
    }

    .list-loader,
    .virtualized-list-container,
    .no-data {
      grid-column: 1;
      grid-row: 3;
    }

    .no-data {
      width: 100%;
      text-align: center;
      margin-top: 20px;
    }

    .list-loader {
      width: 100%;
      height: 100%;
      display: flex;
      flex-flow: column;
      align-items: center;
      justify-content: center;
      align-content: center;
    }

    .virtualized-list-container {
      grid-template-columns: 1fr;
      grid-template-rows: 1fr;

      @include media-breakpoint-up(lg) {
        grid-template-rows: 28px 1fr;
      }

      .headers {
        display: none;

        @include media-breakpoint-up(lg) {
          @include list-layout;

          :nth-child(4) {
            justify-content: center;
          }
        }
      }

      .scroll-container {
        padding: 0;
        margin-right: 5px;
        grid-row: 1;
        grid-column: 1;
        padding-bottom: 1.5rem;

        @include media-breakpoint-up(lg) {
          padding-bottom: 4rem;
          grid-row: 2;
        }
      }

      .default-row {
        @include list-layout;

        align-items: center;
        grid-template-rows: 1fr;
        height: 60px;
        padding: 0 1.5rem;

        @include media-breakpoint-up(lg) {
          padding: 0 1.5rem 0 5rem;
        }

        span {
          @include list-text;
        }

        & > :nth-child(1) {
          user-select: text;
        }

        & > :nth-child(3) {
          display: flex;
          flex-flow: row nowrap;
          align-items: center;
          align-content: center;
          justify-content: flex-start;
          column-gap: 1rem;
        }

        & > :nth-child(4) {
          button {
            width: 100%;
          }
        }
      }
    }
  }
}
