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

.machines-page {
  .devices-table-card {
    min-height: 0;
  }
}

.machines-table {
  --machines-actions-cell-width: 150px;
  --machines-actions-group-width: 228px;
  --machines-actions-cell-padding: 20px;

  min-width: 940px;

  th:nth-child(1),
  td:nth-child(1) {
    width: 330px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 260px;
  }

  th:nth-child(3),
  td:nth-child(3) {
    width: 180px;
  }

  th:nth-child(4),
  td:nth-child(4) {
    width: var(--machines-actions-cell-width);
  }

  th:nth-child(4) {
    text-align: left;
  }

  td:nth-child(4) {
    text-align: right;
  }

  th:last-child,
  td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: $color-surface;
    box-shadow: -12px 0 18px rgba(0, 0, 0, 0.04);
  }

  th:last-child {
    z-index: 3;
  }

  tbody tr:hover td:last-child {
    background: $color-primary-tint-soft;
  }
}

.machine-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;

  span {
    overflow: hidden;
    color: $color-text-strong;
    font-size: $font-size-17;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  small {
    overflow: hidden;
    color: $color-text-muted;
    font-size: $font-size-14;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.machine-muted {
  display: inline-block;
  color: $color-text-muted;
  font-size: $font-size-15;
  font-weight: 500;
}

.machines-status {
  text-transform: none;

  .devices-dot {
    background: currentColor;
  }
}

.machines-status--green {
  background: $color-success-tint;
  color: $color-success;
}

.machines-status--blue {
  background: $color-primary-tint;
  color: $color-primary;
}

.machines-status--gray {
  background: $color-bg;
  color: $gray50;
}

.machines-status--red {
  background: $color-danger-tint-strong;
  color: $red;
}

.machines-actions {
  display: flex;
  width: var(--machines-actions-group-width);
  margin-left: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.machines-action {
  min-height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: 12px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;

  font-size: $font-size-13;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.machines-action--beacon {
  width: 112px;
}

.machines-action--edit,
.machines-action--bind {
  background: $blue20;
  color: $blue;

  &:hover {
    background: $blue;
    color: $color-text-inverse;
    box-shadow: var(--shadow-primary);
  }
}

.machines-action--warning {
  background: $color-warning-tint;
  color: $orange;

  &:hover {
    background: $orange;
    color: $color-text-inverse;
    box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--color-warning) 85%, transparent);
  }
}

.machines-action--delete {
  background: $color-danger-tint-strong;
  color: $red;

  &:hover {
    background: $red;
    color: $color-text-inverse;
    box-shadow: var(--shadow-danger);
  }
}

[data-theme='dark'] {
  .machines-status--gray {
    background: rgba($gray50-rgb, 0.15);
  }

  .machines-table {
    th:last-child,
    td:last-child {
      background: $color-surface;
      box-shadow: -12px 0 18px rgba(0, 0, 0, 0.16);
    }

    tbody tr:hover td:last-child {
      background: rgba($color-primary-rgb, 0.03);
    }
  }
}
