$bulma-sticky-table-zindex: 5 !default

@media screen
  .table.has-sticky-column,
  .table.has-sticky-footer,
  .table.has-sticky-header
    border-collapse: separate

    tbody,
    thead
      td,
      th
        border-top-width: 0

    &.is-bordered
      border: $table-cell-border
      td,
      th
        border-left-width: 0
        &:last-child
          border-right-width: 0
      tbody tr:last-child,
      tfoot tr:last-child
        td,
        th
          border-bottom-width: 0

  .table.has-sticky-header
    thead th
      @if $table-head-background-color ==  'transparent' or $table-head-background-color == rgba(0, 0, 0, 0)
        background-color: $table-background-color
      position: sticky
      top: 0
      z-index: $bulma-sticky-table-zindex

  .has-navbar-fixed-top * .table.has-sticky-header thead th,
  .has-navbar-fixed-top .table.has-sticky-header thead th
    top: $navbar-height

  .has-navbar-fixed-top * .modal .table.has-sticky-header thead th,
  .has-navbar-fixed-top .modal .table.has-sticky-header thead th
    top: 0

  .table.has-sticky-footer
    tfoot th
      @if $table-foot-background-color == 'transparent' or $table-foot-background-color == rgba(0, 0, 0, 0)
        background-color: $table-background-color
      position: sticky
      bottom: 0
      z-index: $bulma-sticky-table-zindex

  .has-navbar-fixed-bottom * .table.has-sticky-footer tfoot th,
  .has-navbar-fixed-bottom .table.has-sticky-footer tfoot th
    bottom: $navbar-height

  .has-navbar-fixed-bottom * .modal .table.has-sticky-footer tfoot th,
  .has-navbar-fixed-bottom .modal .table.has-sticky-footer tfoot th
    bottom: 0

  .table.has-sticky-column
    tfoot th:first-child,
    thead th:first-child
      @if $table-head-background-color == 'transparent' or $table-head-background-color == rgba(0, 0, 0, 0)
        background-color: $table-background-color
      position: sticky
      left: 0
      z-index: $bulma-sticky-table-zindex + 1

    tbody th:first-child
      @if $table-body-background-color == 'transparent' or $table-body-background-color == rgba(0, 0, 0, 0)
        background-color: $table-background-color
      position: sticky
      left: 0
      z-index: $bulma-sticky-table-zindex

    tbody tr.is-selected th:first-child
      background-color: $table-row-active-background-color

    &.is-hoverable
      tbody tr:not(.is-selected):hover th:first-child
        background-color: $table-row-hover-background-color

    &.is-striped
      tbody tr:not(.is-selected):nth-child(even) th:first-child
        background-color: $table-striped-row-even-background-color

    &.is-striped.is-hoverable
      tbody tr:not(.is-selected):nth-child(even):hover th:first-child
        background-color: $table-striped-row-even-hover-background-color