.p-tools {
  position: relative;
}

.p-tools .pr-action {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.p-tools .pr-action .add-to-cart-button,
.p-tools .pr-action .btn-cart {
  position: relative;
  z-index: 2;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.listing-qty-floating {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  z-index: 3;
  display: flex;
  align-items: stretch;
  width: 96px;
  height: 46px;
  border: 1px solid #d8d8d8;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}

.product:hover .listing-qty-floating,
.p-tools:hover .listing-qty-floating,
.p-tools:focus-within .listing-qty-floating {
  opacity: 0.96;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

.listing-qty-floating__input {
  width: 58px;
  min-width: 58px;
  border: 0;
  text-align: center;
  font-size: 14px;
  color: #222;
  background: #fff;
  outline: none;
  padding: 0 6px;
  -moz-appearance: textfield;
}

.listing-qty-floating__input::-webkit-outer-spin-button,
.listing-qty-floating__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.listing-qty-floating__buttons {
  display: flex;
  flex-direction: column;
  width: 36px;
  border-left: 1px solid #d8d8d8;
}

.listing-qty-floating__btn {
  flex: 1;
  border: 0;
  background: #fff;
  color: #555;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: background 0.15s ease;
}

.listing-qty-floating__btn:hover {
  background: #f5f5f5;
}

.listing-qty-floating__btn + .listing-qty-floating__btn {
  border-top: 1px solid #d8d8d8;
}

.p-tools .pr-action .add-to-cart-button,
.p-tools .pr-action .btn-cart {
  min-width: 124px;
}

/* ===== SMART CARTON SUGGESTION ===== */

.listing-carton-suggestion {
  display: none;
  width: 100%;
  margin: 0 0 8px 0;
}

.listing-carton-suggestion__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.listing-carton-suggestion__text {
  font-size: 11px;
  line-height: 1.25;
  color: #727272;
}

.listing-carton-suggestion__text strong {
  font-weight: 600;
  color: #5f5f5f;
}

.listing-carton-suggestion__actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.listing-carton-suggestion__action {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.listing-carton-suggestion__action:hover {
  opacity: 0.72;
}

.listing-carton-suggestion__dismiss {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 14px;
  height: 14px;
  font-size: 16px;
  line-height: 14px;
  color: #a3a3a3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.listing-carton-suggestion__dismiss:hover {
  color: #666;
}

/* ===== TABLET / MENŠÍ NOTEBOOKY ===== */

@media (min-width: 768px) and (max-width: 1280px) {
  .listing-qty-floating {
    width: 90px;
    height: 44px;
  }

  .listing-qty-floating__input {
    width: 54px;
    min-width: 54px;
    font-size: 13px;
  }

  .listing-qty-floating__buttons {
    width: 34px;
  }

  .p-tools .pr-action .add-to-cart-button,
  .p-tools .pr-action .btn-cart {
    min-width: 116px;
    min-height: 44px;
  }
}

/* ===== MOBIL ===== */

@media (max-width: 767px) {
  .p-tools .pr-action {
    width: 100%;
    justify-content: space-between;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .listing-carton-suggestion {
    width: 100%;
    margin: 0 0 7px 0;
  }

  .listing-carton-suggestion__inner {
    align-items: flex-start;
    text-align: left;
    gap: 2px;
  }

  .listing-carton-suggestion__text {
    font-size: 10px;
    line-height: 1.2;
  }

  .listing-carton-suggestion__actions {
    justify-content: flex-start;
    gap: 6px;
  }

  .listing-carton-suggestion__action {
    font-size: 11px;
  }

  .listing-carton-suggestion__dismiss {
    width: 12px;
    height: 12px;
    font-size: 14px;
    line-height: 12px;
  }

  .listing-qty-floating {
    position: relative;
    top: auto;
    right: auto;
    width: 88px;
    height: 42px;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
    box-shadow: none;
    flex: 0 0 88px;
  }

  .listing-qty-floating__input {
    width: 52px;
    min-width: 52px;
    font-size: 13px;
  }

  .listing-qty-floating__buttons {
    width: 32px;
  }

  .listing-qty-floating__btn {
    font-size: 15px;
  }

  .p-tools .pr-action .add-to-cart-button,
  .p-tools .pr-action .btn-cart {
    min-width: 48px;
    width: 48px;
    max-width: 48px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    flex: 0 0 48px;
    justify-content: center;
  }

  .p-tools .pr-action .add-to-cart-button span,
  .p-tools .pr-action .btn-cart span {
    display: none;
  }

  .p-tools .pr-action .add-to-cart-button::before,
  .p-tools .pr-action .btn-cart::before {
    display: none;
  }

  .p-tools .pr-action .add-to-cart-button::after,
  .p-tools .pr-action .btn-cart::after {
    content: "";
    width: 20px;
    height: 20px;
    background: url('/user/documents/upload/dokosiku.svg') no-repeat center;
    background-size: contain;
    display: block;
  }
}

@media (max-width: 767px) {
  .listing-carton-suggestion {
    display: none !important;
  }
}