@import '~@alife/theme-cnwms-operate/variables.scss';

$motion-default: cubic-bezier(0.4, 0, 0.2, 1);

.op-switch {
  display: inline-flex;
  align-items: center;
  margin-right: $s-4;
  text-align: left;
  color: $color-text1-5;
  outline: none;
  user-select: none;
  overflow: hidden;
  &-small,
  &-medium {
    height: $s-6;
    font-size: $s-5;
    .op-switch-inner {
      height: $s-6;
      width: $s-11;
      border-radius: $s-3;
      &-btn {
        height: $s-5;
        width: $s-5;
        top: 2px;
        border-radius: $s-3;
      }
      &-on .op-switch-inner-btn {
        left: calc(100% - #{$s-5} - 2px);
      }
      &-off .op-switch-inner-btn {
        left: 2px;
      }
      & + .op-switch-label {
        margin-left: 6px;
      }
    }
  }
  &-inner {
    position: relative;
    background-color: $color-text1-2;
    transition: background-color 0.15s $motion-default;
    cursor: pointer;
    &-btn {
      position: absolute;
      background-color: #ffffff;
      transition: all 0.1s $motion-default;
      transform-origin: left center;
    }
    &-on {
      background-color: $color-success-1;
    }
    &-off {
      background-color: $color-text1-2;
    }
  }
}
