@use '../colors';

.root {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  color: colors.$basic-gray87;
  background: colors.$basic-gray8;
  &.focused {
    border-color: colors.$basic-blue;
  }
  &.disabled {
    color: colors.$basic-gray24;
    border-color: colors.$basic-gray4;
    background: colors.$basic-gray4;
  }
  &.failed {
    color: colors.$additional-deep-red;
  }
  &.size-xs {
    --stepper-button-width: 24px;
    width: var(--stepper-width, 122px);
    height: 32px;
    .input {
      font-size: 14px;
      line-height: 20px;
    }
  }
  &.size-s {
    --stepper-button-width: 24px;
    width: var(--stepper-width, 122px);
    height: 40px;
  }
  &.size-m {
    --stepper-button-width: 32px;
    width: var(--stepper-width, 160px);
    height: 48px;
  }
}

.input {
  border: 0;
  padding: 0;

  // не надо делать transparent: https://stackoverflow.com/q/43483363/13166471
  background: inherit;
  outline: 0;
  width: 0;
  flex-grow: 1;
  text-align: center;
  color: inherit;
  font: inherit;
  font-weight: 600;
  height: 100%;
  font-size: 16px;
  line-height: 24px;
}

.button {
  display: flex;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  width: var(--stepper-button-width);
  height: 100%;
  color: colors.$basic-gray87;
  flex-shrink: 0;
  &:first-child {
    justify-content: flex-end;
  }
  &:last-child {
    justify-content: flex-start;
  }
  &:not(.hidden):not(:disabled) {
    cursor: pointer;
  }
  &:disabled {
    color: colors.$basic-gray24;
    pointer-events: none;
  }
  &[hidden] {
    pointer-events: none;
    opacity: 0;
  }
}

.svg {
  fill: currentColor;
}
