@use "../theme.scss" as *;

.flip-switch {
  display: inline-block;
  outline: none;
  background-color: $flip-switch-bg-color;
  position: relative;
  width: 5em;
  user-select: none;
  border-width: 1px;
  border-style: solid;
  border-color: $flip-switch-border-color;
  background-color: $flip-switch-border-color;

  &.flip-switch-pressed {
    & .flip-switch-track {
      margin-left: 0;
    }

    & .flip-switch-knob {
      left: calc(100% - 1.8em);
    }
  }

  & .flip-switch-knob {
    width: 1.1em;
    margin: 0.3em;
    background-color: $flip-switch-knob-bg-color;
    border: 0;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    transition: all 0.2s ease-in 0s;
  }
}

.flip-switch-label {
  display: block;
  overflow: hidden;
  cursor: pointer;
  border: 0;
  background-color: $app-viewport-bg-color;
}

.flip-switch-track {
  width: 200%;
  margin-left: -100%;
  transition: margin 0.2s ease-in 0s;
  display: flex;
  flex-direction: row;

  & .flip-switch-active,
  & .flip-switch-inactive {
    width: 50%;
    padding: 0 0.5em;
    line-height: $flip-switch-height;
    font-weight: bold;
    box-sizing: border-box;
  }

  & .flip-switch-active {
    background-color: $flip-switch-active-bg-color;
    color: $flip-switch-active-color;
    text-align: left;
  }

  & .flip-switch-inactive {
    text-align: right;
  }
}
