.input-container {
  position: relative;
  display: inline-block;
  margin: 0 5px; /* Отступ от текста */
}

.input-with-buttons {
  padding: 5px 0px;
  font-size: 100%;
  text-align: center;
  color: #fff;
  background-color: #333;
  border: 1px solid #666666;
  border-radius: 4px;
  width: 60px;
  transition: padding 0.2s ease;
  /* Скрываем стандартные кнопки - расширенный вариант */
  appearance: none;
  -moz-appearance: textfield;
  -webkit-appearance: none;
}

/* Скрываем стрелки в Webkit браузерах - более агрессивный подход */
.input-with-buttons::-webkit-outer-spin-button,
.input-with-buttons::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  display: none;
}

/* Дополнительные правила для Firefox */
.input-with-buttons[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.btn-decrement,
.btn-increment {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  background: #666666;
  border: 1px solid #ccc;
  width: 30px;
  height: 32px;
  font-size: 120%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1;
  margin: 0 2px;
  border-radius: 3px;
}

.btn-decrement {
  left: -2px;
}

.btn-increment {
  right: -2px;
}

.btn-decrement:hover,
.btn-increment:hover {
  background: #333;
}

.btn-decrement:disabled,
.btn-increment:disabled {
  background: #f5f5f5;
  color: #ccc;
  cursor: not-allowed;
}

/* Показываем кнопки при фокусе - уменьшили padding */
.input-with-buttons:focus {
  padding: 5px 18px;
}

.input-with-buttons:focus + .btn-decrement,
.input-with-buttons:focus + .btn-decrement + .btn-increment {
  opacity: 1;
  visibility: visible;
}

/* Показываем при наведении */
.input-container:hover .btn-decrement,
.input-container:hover .btn-increment {
  opacity: 1;
  visibility: visible;
}

.input-container:hover .input-with-buttons {
  padding: 5px 25px;
}

/* Анимация shake при вводе значения с ошибкой */
.shake-error {
  animation: shake 0.4s ease-in-out;
  border-color: red;
  background-color: #553333; /* Темный фон с красным оттенком */
  color: #fff; /* Белый текст для лучшей читаемости */
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(0);
  }
}
