.amount {
  display: flex;
  transition: all 0.3s ease;
  position: relative;
}
.product-page .amount {
  max-width: 23rem;
}
.amount__button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  background-color: inherit;
  transition: all 0.3s ease;
  width: 100%;
  background-color: #fff;
}
.amount__button svg {
  width: 0.6rem;
  height: 1.1rem;
  display: inline-block;
  vertical-align: middle;
  position: relative;
  fill: currentColor;
  fill-rule: evenodd;
}

.amount__button:hover {
  background-color: var(--color-bg-accent);
}

.product-page .amount__button {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: center;
  justify-content: center;
  width: 2.4rem;
  position: absolute;
  top: 0.4rem;
  bottom: 0.4rem;
  transition: background 0.25s;
}

.amount__input {
  display: block;
  font-size: var(--text-h3);
  line-height: 2.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: #fff;
  border: 1px solid var(--color-border-soft);
  border-radius: 4px;
  padding: 1rem 2.4rem;
  height: 5rem;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
}

.amount__button_left {
  left: 0.4rem;
  border-radius: 4px 0 0 4px;
}
.amount__button_right {
  right: 0.4rem;
  border-radius: 0 4px 4px 0;
}

/* Стилизация по образцу OZON */
.cart-amount-wrapper {
  display: flex !important;
  align-items: center !important;
  gap: 0;
  position: relative !important;
  align-self: center !important;
  overflow: visible !important;
}

.cart-amount__container {
  display: flex !important;
  align-items: center !important;
  gap: 0;
  position: relative;
  align-self: center !important;
  overflow: visible !important;
  min-width: 0 !important; /* чтобы flex-ребёнок (input) мог расти */
}

/* Выравнивание по вертикали с кнопками */
.product-page__buy-buttons {
  align-items: center !important;
}

.product-page__buy-buttons .cart-amount-wrapper,
.product__amount .cart-amount-wrapper,
.js-product-controls .cart-amount-wrapper,
.product-page__buy-buttons .cart-amount__container,
.product__amount .cart-amount__container,
.js-product-controls .cart-amount__container {
  align-self: center !important;
  display: flex !important;
}

/* Перекрываем все возможные стили для кнопок */
.cart-amount-wrapper .cart-amount__button,
.cart-amount-wrapper .cart-amount__minus,
.cart-amount-wrapper .cart-amount__plus,
.cart-amount__container .cart-amount__button,
.cart-amount__container .cart-amount__minus,
.cart-amount__container .cart-amount__plus {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: #e8f0fe !important;
  color: #005bff !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  position: relative !important;
  overflow: visible !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  -ms-flex-align: center !important;
  -ms-flex-pack: center !important;
}

.cart-amount-wrapper .cart-amount__button:hover,
.cart-amount-wrapper .cart-amount__minus:hover,
.cart-amount-wrapper .cart-amount__plus:hover,
.cart-amount__container .cart-amount__button:hover,
.cart-amount__container .cart-amount__minus:hover,
.cart-amount__container .cart-amount__plus:hover {
  background: #d0e3ff !important;
}

.cart-amount-wrapper .cart-amount__button:active,
.cart-amount-wrapper .cart-amount__minus:active,
.cart-amount-wrapper .cart-amount__plus:active,
.cart-amount__container .cart-amount__button:active,
.cart-amount__container .cart-amount__minus:active,
.cart-amount__container .cart-amount__plus:active {
  transform: scale(0.95) !important;
}

/* Стили для SVG внутри кнопок */
.cart-amount-wrapper .cart-amount__button svg,
.cart-amount-wrapper .cart-amount__minus svg,
.cart-amount-wrapper .cart-amount__plus svg,
.cart-amount__container .cart-amount__button svg,
.cart-amount__container .cart-amount__minus svg,
.cart-amount__container .cart-amount__plus svg,
.cart-amount-wrapper svg {
  width: 24px !important;
  height: 24px !important;
  fill: #005bff !important;
  pointer-events: none !important;
  position: relative !important;
  z-index: 1;
  display: inline-block !important;
  vertical-align: middle !important;
}

.cart-amount__button-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background-color: #005bff;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    width 0.3s ease,
    height 0.3s ease,
    opacity 0.3s ease;
}

.cart-amount-wrapper .cart-amount__button:active .cart-amount__button-ripple,
.cart-amount-wrapper .cart-amount__minus:active .cart-amount__button-ripple,
.cart-amount-wrapper .cart-amount__plus:active .cart-amount__button-ripple {
  width: 100px;
  height: 100px;
  opacity: 0.1;
}

.cart-amount__value {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0 12px;
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.5;
  color: #001a34 !important;
  user-select: none;
}

/* Поле ручного ввода количества — визуально как .cart-amount__value */
.cart-amount-wrapper .cart-amount.cart-amount__input,
.cart-amount__container .cart-amount.cart-amount__input {
  position: relative !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  width: var(--amount-input-width, 40px) !important; /* расширение через JS: setProperty('--amount-input-width', Nch) */
  min-width: 40px !important;
  max-width: 12rem !important;
  padding: 0 4px !important;
  box-sizing: content-box !important;
  height: 40px !important;
  margin: 0 !important;
  display: block !important;
  font-family: inherit !important;
  font-size: var(--text) !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  color: #001a34 !important;
  background: transparent !important;
  border: none !important;
  text-align: center !important;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cart-amount-wrapper .cart-amount.cart-amount__input::-webkit-outer-spin-button,
.cart-amount-wrapper .cart-amount.cart-amount__input::-webkit-inner-spin-button,
.cart-amount__container .cart-amount.cart-amount__input::-webkit-outer-spin-button,
.cart-amount__container .cart-amount.cart-amount__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cart-amount-wrapper .cart-amount.cart-amount__input:focus,
.cart-amount__container .cart-amount.cart-amount__input:focus {
  outline: none;
}

.cart-amount__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Tooltip "Последний товар" при ручном вводе больше максимума */
.cart-amount__input-max-tooltip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.8rem;
  background: #333;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.cart-amount__input-max-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}
.cart-amount__input-max-tooltip.show,
.cart-amount__input-numeric-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

.cart-amount__input-numeric-tooltip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.8rem;
  background: #333;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.cart-amount__input-numeric-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

/* Tooltip "Последний товар" */
.cart-amount__button .cart-amount__last-item-tooltip,
.cart-amount__plus .cart-amount__last-item-tooltip,
.js-amount-change-up .cart-amount__last-item-tooltip,
.js-minicart-amount-change-up .cart-amount__last-item-tooltip {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.8rem;
  background: #333;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  z-index: 10000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cart-amount__button .cart-amount__last-item-tooltip::after,
.cart-amount__plus .cart-amount__last-item-tooltip::after,
.js-amount-change-up .cart-amount__last-item-tooltip::after,
.js-minicart-amount-change-up .cart-amount__last-item-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

.cart-amount__button .cart-amount__last-item-tooltip.show,
.cart-amount__plus .cart-amount__last-item-tooltip.show,
.js-amount-change-up .cart-amount__last-item-tooltip.show,
.js-minicart-amount-change-up .cart-amount__last-item-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}
