@use '../../partials/dir';
@use './state';

.toggle {
  width: 44px;
  height: 24px;
  padding: 0 var(--sp-ultra-tight);
  display: flex;
  align-items: center;
  border-radius: var(--bo-radius);
  box-shadow: var(--bs-surface-border);
  cursor: pointer;
  background-color: var(--bg-surface-low);
  @include state.disabled;

  transition: background 200ms ease-in-out;

  &::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: var(--tc-surface-low);
    border-radius: calc(var(--bo-radius) / 2);
    transition: transform 200ms ease-in-out,
      opacity 200ms ease-in-out;
    opacity: 0.6;
  }

  &--active {
    background-color: var(--bg-positive);

    &::before {
      --ltr: translateX(calc(125%));
      --rtl: translateX(calc(-125%));
      @include dir.prop(transform, var(--ltr), var(--rtl));

      transform: translateX(calc(125%));
      background-color: white;
      opacity: 1;
    }
  }
}