$table-compact-mode-max-width: 80em !default;

.ls-table {
  overflow-y: auto;
  position: relative;

  &__loader {
    position: sticky;
    width: 100%;
    height: 0.5rem;
    overflow: hidden;
    top: 0;
    z-index: 1;
  }

  &__loader-progress {
    width: 100%;
    height: 100%;
    position: absolute;
    background: linear-gradient(45deg, $color-primary, $color-primary-hover);
    left: -100%;
    animation: table-load 2s linear infinite;
  }

  @keyframes table-load {

    0% {
      left: -100%;
    }

    100% {
      left: 100%;
    }
  }

  &__table {
    width: 100%;
    border-collapse: collapse;

    &--loading {
      opacity:0.5;
      cursor: default;
      pointer-events: none;
      transition-duration: 0.2s;
    }
  }

  &__table,
  &__header-row,
  &__header-cell,
  &__body,
  &__row,
  &__cell {
    @media (max-width: $table-compact-mode-max-width) {
      display: block;
    }
  }

  &__header {
    text-align: left;

    @media (max-width: $table-compact-mode-max-width) {
      display: none;
    }
  }

  &__header-cell {
    text-align: left;
    box-shadow: 0 $border-width 0 $color-border;

    &--fixed {
      background-color: $color-theme-light;
      color: $color-theme-light-font;
      position: sticky;
      top: 0;

      @media (max-width: $table-compact-mode-max-width) {
        position: relative;
      }
    }
  }

  &__row {

    &--clickable {
      cursor: pointer;
    }

    &--expanded {

      &:not(:hover) {

        & > td {
          color: $color-theme-light-font;
          background-color: $color-input-bg;
        }
      }
    }

    &:not(:first-of-type) {

      & > td {
        border-top: set-border();
      }
    }

    @media (max-width: $table-compact-mode-max-width) {

      & > td {

        &:not(:first-of-type) {
          border-top: $border-width dotted $color-border;
        }
      }
    }
  }

  &__cell {

    @media (max-width: $table-compact-mode-max-width) {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      width: 100% !important;
      text-align: right !important;

      &::before {
        content: var(--header);
        text-align: left;
        font-weight: bold;
        width: 20%;
        min-width: 15rem;
        margin-right: 3 * $sp;
      }
    }

    &--action {
      width: 0.1%;

      @media (max-width: $table-compact-mode-max-width) {
        width: 100%;
      }
    }

    &--hidden {
      visibility: hidden;
    }

  }

  &__body-placeholder {
    text-align: center;
  }
}
