$frost-toggle-button-height: 30px;
$frost-toggle-button-switch-width: 35px;
$frost-toggle-button-switch-height: 22px;

$frost-toggle-button-hover-color: #c6eafc;
$frost-toggle-button-hover-shadow: rgba(0, 0, 0, .2);

.frost-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: $frost-toggle-button-height;
  border-radius: 0;

  &.disabled {
    opacity: .4;
  }

  .frost-toggle-input {
    display: none;

    &.is-toggled {
      + {
        .frost-toggle-button {
          background-color: $frost-color-blue-1;

          &:after {
            right: calc(100% - 35px - 5px);  // accounts for width of button and padding
          }
        }
      }
    }
  }

  .frost-toggle-button {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    transition: background-color .2s;
    outline: 0;
    background-color: $frost-color-lgrey-1;
    cursor: pointer;

    &.disabled {
      cursor: default;
    }

    &.medium {
      width: 90px;  // per spec
      height: $frost-toggle-button-height;
      padding: 3px;
    }

    &:before,
    &:after {
      display: block;
      position: absolute;
      width: $frost-toggle-button-switch-width;
      height: $frost-toggle-button-switch-height;
      content: '';
    }

    &:hover {
      &:not(.disabled) {
        &:before,
        &:after {
          background-color: $frost-toggle-button-hover-color;
          box-shadow: 0 2px 4px $frost-toggle-button-hover-shadow;
        }
      }
    }

    &:after {
      top: calc(50% - (#{$frost-toggle-button-switch-height} / 2));
      right: 5px;
      transition: right .2s;
      background-color: $frost-color-white;
    }

    &:before {
      display: none;
    }

    .frost-toggle-text {
      flex: 1;
      text-align: center;

      &.off {
        color: $frost-color-grey-4;
      }

      &.on {
        color: $frost-color-white;
      }
    }
  }
}
