@use '../../styles/variables' as *;

.table-skeleton {
  pointer-events: none;
  user-select: none;

  th,
  td {
    color: $transparent;
  }

  tbody tr {
    box-shadow: none !important;

    &:hover {
      background: $transparent !important;
      box-shadow: none !important;
    }
  }
}

.table-skeleton__line,
.table-skeleton__avatar,
.table-skeleton__pill,
.table-skeleton__icon,
.table-skeleton__button {
  position: relative;
  display: block;
  overflow: hidden;
  flex: 0 0 auto;
  background: $color-skeleton;

  &::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
      90deg,
      $transparent,
      $color-skeleton-highlight,
      $transparent
    );
    animation: table-skeleton-shimmer 1.35s ease-in-out infinite;
  }
}

.table-skeleton__line {
  width: var(--table-skeleton-line-width, 66%);
  max-width: 100%;
  height: 14px;
  border-radius: 999px;
}

.table-skeleton__stack {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.table-skeleton__person {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;

  .table-skeleton__stack {
    flex: 1;
  }
}

.table-skeleton__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.table-skeleton__pill {
  width: 112px;
  height: 28px;
  border-radius: 999px;
}

.table-skeleton__icons {
  display: grid;
  width: max-content;
  grid-template-columns: repeat(4, 20px);
  gap: 4px 8px;
}

.table-skeleton__icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.table-skeleton__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-skeleton__button {
  width: 116px;
  height: 34px;
  border-radius: 12px;
}

.table-skeleton__button--single {
  width: 118px;
}

.employees-table-card.is-updating .employees-table,
.devices-table-card.is-updating .devices-table,
.organisation-employees-table-card.is-updating table {
  opacity: 0.58;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

@keyframes table-skeleton-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .table-skeleton__line,
  .table-skeleton__avatar,
  .table-skeleton__pill,
  .table-skeleton__icon,
  .table-skeleton__button {
    &::after {
      animation: none;
    }
  }
}
