div.dataTables_wrapper {
  .dataTable {
    margin-top: 0 !important;

    .column-actions {
      min-width: 8rem;

      a {
        visibility: hidden;

        &:first-of-type {
          padding-right: 0.5rem;
        }
      }
    }

    .no-sort {
      pointer-events: none;

      &.sorting {
        &:after,
        &:before {
          display: none;
        }
      }
    }

    tbody {
      tr {
        .select-checkbox {
          padding-left: 0.25rem;

          &:after,
          &:before {
            --checkboxSize: 13px;
            height: var(--checkboxSize);
            left: 1.5rem;
            top: 0.7rem;
            width: var(--checkboxSize);
          }

          &:after {
            background-position-y: center;
            background-position-x: -2.4px;
            background-repeat: no-repeat;
            background-size: 130%;
          }

          &:before {
            border-color: var(--text-default);
            border-radius: 2px;
            margin: 0;
          }
        }

        &.selected {
          color: var(--text-default);

          a {
            color: var(--text-link);

            &.btn-danger {
              color: $white;

              &:hover,
              &:active {
                color: $white;
              }
            }
            &.btn-warning {
              color: $black;

              &:hover,
              &:active {
                color: $black;
              }
            }

            &:hover {
              color: var(--text-link-hover);
            }
          }

          &:nth-of-type(even) {
            background-color: var(--primary-bg);
          }

          &:nth-of-type(odd) {
            background-color: rgba(0, 0, 0, 0.05);
          }

          .select-checkbox {
            &:after {
              background-image: image-url('check.svg');
              content: '';
              margin: 0;
            }

            &:before {
              background-color: $primary;
              border-color: $primary;
            }
          }
        }
      }
    }

    thead {
      th {
        background-color: var(--primary-bg);
        box-shadow: 8px 5px 10px 0px rgba(82, 63, 105, 0.08);
        vertical-align: middle;
        white-space: nowrap;

        &:last-of-type {
          clip-path: inset(0px 0px -20px -1px);
        }

        &.sorting {
          &::after {
            content: '\f0dc';
            display: inline-block;
            font-family: var(--fa-style-family, 'Font Awesome 6 Free');
            margin-left: 0.5rem;
            opacity: 0;
            position: static;
          }

          &:before {
            display: none;
          }

          &.sorting_asc {
            &::after {
              content: '\f0d8';
              opacity: 1;
            }
          }

          &.sorting_desc {
            &::after {
              content: '\f0d7';
              opacity: 1;
            }
          }

          &.reverse-sort {
            &.sorting_asc {
              &::after {
                content: '\f0d7';
              }
            }

            &.sorting_desc {
              &::after {
                content: '\f0d8';
              }
            }
          }
        }
      }
    }

    tr {
      &:focus-within,
      &:hover {
        .column-actions a {
          visibility: visible;
        }
      }
    }
  }

  .sticky-toolbar {
    background-color: var(--primary-bg);
    margin-bottom: 0.5rem;
    padding: 1rem 0;
    position: sticky;
    top: var(--sticky-header-height);
    z-index: 2;

    &.is-sticky {
      border-bottom: 1px solid var(--border-color);
    }
  }

  .dataTables_footer_content {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;

    .dataTables_info {
      padding: 0 !important;
    }

    .dataTables_paginate {
      .pagination {
        border-top: none;
        margin: 0;
        padding: 0;

        .page-item {
          &.active {
            .page-link {
              background: $primary;
              border-color: $primary;
              color: $white;
            }
          }

          &.disabled {
            .page-link {
              background-color: var(--secondary-bg);
              border-color: var(--border-color);
              color: var(--text-muted);
            }
          }

          .page-link {
            background-color: var(--primary-bg);
            border-color: var(--border-color);
            color: var(--text-link);

            &:hover,
            &:focus {
              background-color: var(--secondary-bg);
              border-color: var(--border-color);
              color: var(--text-link-hover);
            }
          }
        }
      }
    }

    @media screen and (max-width: 1199px) {
      flex-direction: column;
      justify-content: center;

      .dataTables_info {
        margin-top: 0.5rem;
      }

      .dataTables_paginate {
        .pagination {
          margin-top: 1.5rem;
        }
      }
    }
  }

  .dataTables_filter {
    text-align: left;

    input:focus {
      box-shadow: none;
    }

    @include media-breakpoint-up(sm) {
      div.dataTables_filter {
        text-align: right;
      }
    }
  }

  .dataTables_footer_content {
    margin-top: 0.5rem;

    .pagination li:not(:last-child) {
      padding-right: 5px;
    }
  }

  .dt-buttons {
    flex: unset;

    .btn {
      border: none;
      background: var(--secondary-bg);
      color: var(--text-default);
      flex-grow: 0;

      &:hover,
      &:not(:disabled):not(.disabled):active {
        background: var(--secondary-bg-strong);
      }

      &:first-child {
        border-color: var(--border-color);
      }

      &:has(+ .btn-group) {
        border-right: none;
      }
    }

    .buttons-collection {
      border: none;
      background: var(--secondary-bg);
      color: var(--text-default);

      &:hover,
      &:not(:disabled):not(.disabled):active {
        background: var(--secondary-bg-strong);
      }

      &.dropdown-toggle {
        &:after {
          display: none;
        }
      }
    }
  }

  .dt-button-collection {
    z-index: 1001;

    .dropdown-item,
    .dropdown-item.active {
      background-color: var(--primary-bg);
      color: var(--text-link);
      font-size: 0.9rem;
      font-weight: 300;
      padding: 0.375rem 1rem;
      position: relative;
      transition: color 0s;

      &.buttons-columnVisibility {
        background-color: var(--primary-bg);
        padding-left: 2.25rem;

        &.active {
          &::before {
            background-color: $primary;
            background-image: image-url('check.svg');
            border-color: $primary;
          }
        }

        &::before {
          --checkboxSize: 13px;
          background-repeat: no-repeat;
          background-position-y: center;
          background-position-x: -2.4px;
          background-size: 130%;
          border: 1px solid var(--text-default);
          border-radius: 2px;
          content: '';
          height: var(--checkboxSize);
          left: 1rem;
          position: absolute;
          top: calc(50% - (var(--checkboxSize) / 2));
          width: var(--checkboxSize);
        }

        span {
          padding-left: 0.25rem;
          padding-top: 0.25rem;
        }
      }

      &.disabled {
        color: var(--text-muted);
        cursor: not-allowed;
        pointer-events: auto;
      }

      &:focus,
      &:hover {
        color: var(--text-link-hover);
        background-color: var(--secondary-bg);
      }
    }
  }

  .tag-btn ~ .dt-button-collection {
    .dropdown-item {
      &:nth-last-child(2) {
        border-top: 1px solid var(--border-color);
      }
    }
  }

  .table {
    --bs-table-striped-bg: var(--table-stripe-bg);

    td {
      padding: 0.4rem 0.75rem;
    }

    th {
      &:focus {
        outline: none !important;

        &:not(.no-sort) {
          box-shadow: inset $focus-shadow;
        }
      }
    }
  }

  .table-wrapper {
    overflow-x: auto;
  }

  tr:last-of-type {
    td {
      border-bottom: 1px solid var(--border-color);
    }
  }

  .user-name {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-left: 0.5rem;

    .badge {
      font-size: 70%;
      font-weight: 600;
      line-height: 0.75rem;
      width: fit-content;
    }

    span:not(.badge) {
      line-height: 1.35rem;
    }
  }
}
