:root {
  --van-stepper-background: var(--van-active-color);
  --van-stepper-button-icon-color: var(--van-text-color);
  --van-stepper-button-disabled-color: var(--van-background);
  --van-stepper-button-disabled-icon-color: var(--van-gray-5);
  --van-stepper-button-round-theme-color: var(--van-primary-color);
  --van-stepper-input-width: 32px;
  --van-stepper-input-height: 28px;
  --van-stepper-input-font-size: var(--van-font-size-md);
  --van-stepper-input-line-height: normal;
  --van-stepper-input-text-color: var(--van-text-color);
  --van-stepper-input-disabled-text-color: var(--van-text-color-3);
  --van-stepper-input-disabled-background: var(--van-active-color);
  --van-stepper-radius: var(--van-radius-md);
}

.van-stepper {
  display: inline-block;
  user-select: none;

  &__minus,
  &__plus {
    position: relative;
    box-sizing: border-box;
    width: var(--van-stepper-input-height);
    height: var(--van-stepper-input-height);
    margin: 0;
    padding: 0;
    color: var(--van-stepper-button-icon-color);
    vertical-align: middle;
    background: var(--van-stepper-background);
    border: 0;

    &::before {
      width: 50%;
      height: 1px;
    }

    &::after {
      width: 1px;
      height: 50%;
    }

    &::before,
    &::after {
      position: absolute;
      top: 50%;
      left: 50%;
      background-color: currentColor;
      transform: translate(-50%, -50%);
      content: '';
    }

    &--disabled {
      color: var(--van-stepper-button-disabled-icon-color);
      background-color: var(--van-stepper-button-disabled-color);
      cursor: not-allowed;
    }
  }

  &__minus {
    border-radius: var(--van-stepper-radius) 0 0 var(--van-stepper-radius);

    &::after {
      display: none;
    }
  }

  &__plus {
    border-radius: 0 var(--van-stepper-radius) var(--van-stepper-radius) 0;
  }

  &__input {
    box-sizing: border-box;
    width: var(--van-stepper-input-width);
    height: var(--van-stepper-input-height);
    margin: 0 2px;
    padding: 0;
    color: var(--van-stepper-input-text-color);
    font-size: var(--van-stepper-input-font-size);
    line-height: var(--van-stepper-input-line-height);
    text-align: center;
    vertical-align: middle;
    background: var(--van-stepper-background);
    border: 0;
    border-width: 1px 0;
    border-radius: 0;
    -webkit-appearance: none;

    &:disabled {
      color: var(--van-stepper-input-disabled-text-color);
      background-color: var(--van-stepper-input-disabled-background);
      // fix disabled color in iOS
      -webkit-text-fill-color: var(--van-stepper-input-disabled-text-color);
      opacity: 1;
    }

    &:read-only {
      cursor: default;
    }
  }

  &--round {
    .van-stepper__input {
      background-color: transparent;
    }

    .van-stepper__plus,
    .van-stepper__minus {
      border-radius: 100%;

      &--disabled {
        opacity: 0.3;
        cursor: not-allowed;
      }
    }

    .van-stepper__plus {
      color: var(--van-white);
      background: var(--van-stepper-button-round-theme-color);
    }

    .van-stepper__minus {
      color: var(--van-stepper-button-round-theme-color);
      background-color: var(--van-background-2);
      border: 1px solid var(--van-stepper-button-round-theme-color);
    }
  }
}
