.bz-table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;

  > thead > tr > th {
    border-bottom: 1px solid $bz-neutral-600;
    font-weight: $bz-font-weight-semibold;
    position: relative;
    text-align: left;

    > div {
      overflow: hidden;
    }

    .bz-icn {
      fill: $bz-theme-400;
    }
  }

  > tbody > tr:not(:last-child) {
    border-bottom: 1px solid $bz-neutral-300;
  }

  > tbody > tr:hover {
    background-color: $bz-neutral-200;
  }

  > tbody > tr:hover > td.bz-table__cell--buttons button {
    opacity: 1;
  }

  &--responsive {
    overflow-x: auto;
    width: 100%;
  }

  &--fixed-header {
    display: flex;
    flex-direction: column;
    height: 100%;

    > thead {
      display: block;
      position: relative;
    }

    > tbody {
      display: block;
      overflow-y: auto;
      overflow-x: hidden;
    }

    &.bz-table--loading thead {

      &::after {
        animation: table-loader 4s ease infinite;;
        background-color: $bz-theme-400;
        bottom: 0;
        content: "";
        display: block;
        height: 2px;
        left: 0;
        position: absolute;
      }

      > tr > th {
        border-color: $bz-theme-100;
      }
    }
  }

  .bz-badge {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__col-title {
    display: flex;
    align-items: center;

    span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}

.bz-table__cell {
  font-size: $bz-font-size-body-small;
  padding: $bz-space-inset-squish-s;
  position: relative;

  &--compact {
    padding-bottom: $bz-space-inset-xs;
    padding-top: $bz-space-inset-xs;

    .bz-table__content > * {
      margin-bottom: $bz-space-stack-xs;
    }
  }

  &--normal {
    padding-bottom: $bz-space-inset-s;
    padding-top: $bz-space-inset-s;

    .bz-table__content > * {
      margin-bottom: $bz-space-stack-s;
    }
  }

  &--comfortable {
    padding-bottom: $bz-space-inset-m;
    padding-top: $bz-space-inset-m;

    .bz-table__content > * {
      margin-bottom: $bz-space-stack-m;
    }
  }

  &--buttons {
    .bz-btn-icn{
      opacity: 0;
      padding: 0;
      &:focus {
        opacity: 1;
      }
      &--active{
          opacity: 1;
      }
    }
  }

  &--actions{
    padding: 0;
  }
}

th.bz-table__cell {
  padding: 0;
  
  .bz-table__col-title {
    padding: $bz-space-inset-squish-s;
    cursor: pointer;
  }

  &--compact {
    .bz-table__col-title {
      padding-bottom: $bz-space-inset-xs;
      padding-top: $bz-space-inset-xs;
    }
  }

  &--normal {
    .bz-table__col-title {
      padding-bottom: $bz-space-inset-s;
      padding-top: $bz-space-inset-s;
    }
  }

  &--comfortable {
    .bz-table__col-title {
      padding-bottom: $bz-space-inset-m;
      padding-top: $bz-space-inset-m;
    }
  }
}

.bz-table__content {
  display: flex;
  flex-direction: column;

  > * {
    margin-bottom: $bz-space-stack-s;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    &:last-child {
      margin-bottom: 0;
    }
  }
}

.bz-table__col-sort {
  display: inline-block;
  cursor: pointer;
  height: 16px;
  vertical-align: middle;
}

.bz-table__col-resize {
  align-items: stretch;
  bottom: -2px;
  cursor: col-resize;
  display: flex;
  justify-content: center;
  opacity: 0;
  position: absolute;
  right: -5px;
  top: 0;
  transition: opacity .3s ease;
  width: 9px;

  &::after {
    background-color: $bz-theme-100;
    content: "";
    transition: background-color .3s ease;
    width: 1px;
  }

  &:hover {
    &::after {
      background-color: $bz-theme-400;
    }
  }
}

thead:hover {
  .bz-table__col-resize {
    opacity: 1;
  }
}

.bz-table__col-border {
  border-right-color: transparent;
  border-right-style: solid;
  border-right-width: 1px;
  transition: border-right-color .3s ease;

  &--active {
    border-right-color: $bz-theme-400;
  }
}

.bz-table-options {
  align-items: flex-start;
  background-color: $bz-neutral-100;
  border-bottom: 1px solid $bz-neutral-300;
  display: flex;
  justify-content: space-between;
  padding: .5rem 1.6rem .5rem 2.4rem;

  &__left{
    flex: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__left,
  &__right {
    align-items: center;
    display: flex;
  }
}

.bz-table-pagination {
  border-top: 1px solid $bz-neutral-300;
  padding: $bz-space-inset-m;
  display: flex;
  justify-content: flex-end;
}

.bz-table__responsive-label{
  color: $bz-neutral-600;
  font-weight: $bz-font-weight-semibold;
}

@keyframes table-loader{
  from{
      left:0%;
      width:0%;
  }
  50%{
      left:0%;
      width:100%;
  }
  to{
      left:100%;
      width:0%;
  }
}


//--------- RESPONSIVE STYLES

@media screen and (max-width: 719px) {
	.bz-table, .bz-table thead, .bz-table tbody, .bz-table th, .bz-table__cell, .bz-table tr {
		display: block;
	}

	.bz-table thead  tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	.bz-table tr { border: 1px solid $bz-neutral-300; }

	.bz-table__cell {
		border: none;
    display: flex;
    position: relative;
  }
}
