/* ============================================
   Vylepšení bloku "Přidat do košíku" na detailu produktu  (v6)
   - Box vyplňuje šířku rodiče, tmavě zelený border
   - Desktop (od 992 px): cena vlevo, košík vpravo, ve dvou řádcích
   - Tablet/mobil (do 991 px): vše pod sebou, zarovnáno VLEVO
   - Úzký mobil (do 480 px): množství a tlačítko pod sebou (tlačítko full-width)
   ============================================ */

/* === DESKTOP (od 992 px) === */
@media (min-width: 992px) {
  html body .product-detail .price-line,
  html body .p-detail .price-line {
    display: grid !important;
    grid-template-columns: auto auto 1fr auto;
    width: 100%;
    padding: 16px 24px !important;
    row-gap: 6px;
    column-gap: 12px;
    box-sizing: border-box;
    border: 2px solid #2f7a3c !important;
    border-radius: 12px !important;
  }

  html body .product-detail .price-line > .p-final-price-wrapper,
  html body .p-detail .price-line > .p-final-price-wrapper {
    display: contents;
  }

  html body .product-detail .price-line .price-standard,
  html body .p-detail .price-line .price-standard {
    grid-row: 1; grid-column: 1; align-self: end;
  }

  html body .product-detail .price-line .price-save,
  html body .p-detail .price-line .price-save {
    grid-row: 1; grid-column: 2; justify-self: start; align-self: end;
    margin-left: 6px;
  }

  html body .product-detail .price-line .price-final,
  html body .p-detail .price-line .price-final {
    grid-row: 2; grid-column: 1 / 3; align-self: center;
  }

  html body .product-detail .price-line > .add-to-cart,
  html body .p-detail .price-line > .add-to-cart {
    grid-row: 2; grid-column: 4;
    align-self: center;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    justify-self: end;
  }

  html body .product-detail .price-line .add-to-cart .quantity,
  html body .p-detail .price-line .add-to-cart .quantity {
    flex: 0 0 auto; margin: 0 !important;
  }

  html body .product-detail .price-line .add-to-cart .add-to-cart-button,
  html body .p-detail .price-line .add-to-cart .add-to-cart-button {
    flex: 0 0 auto !important; width: auto !important; margin: 0 !important;
  }

  html body .product-detail .price-line > .availability-value,
  html body .p-detail .price-line > .availability-value {
    grid-row: 3; grid-column: 1 / -1;
  }
}

/* Skrýt prázdný .price-measure */
html body .price-line .price-measure:empty {
  display: none;
}

/* === TABLET + MOBIL (do 991 px) — vše pod sebou, vlevo === */
@media (max-width: 991px) {
  html body .product-detail .price-line,
  html body .p-detail .price-line {
    display: block !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 16px 20px !important;
    box-sizing: border-box;
    border: 2px solid #2f7a3c !important;
    border-radius: 12px !important;
    text-align: left !important;
  }

  /* Cenový wrapper - blok */
  html body .product-detail .price-line > .p-final-price-wrapper,
  html body .p-detail .price-line > .p-final-price-wrapper {
    display: block !important;
    margin-bottom: 12px;
    text-align: left !important;
  }

  /* Přeškrtnutá cena + sleva inline (na jednom řádku) */
  html body .product-detail .price-line .price-standard,
  html body .p-detail .price-line .price-standard {
    display: inline-block;
  }

  html body .product-detail .price-line .price-save,
  html body .p-detail .price-line .price-save {
    display: inline-block;
    margin-left: 8px;
  }

  /* Hlavní cena pod nimi */
  html body .product-detail .price-line .price-final,
  html body .p-detail .price-line .price-final {
    display: block;
    margin-top: 4px;
    text-align: left !important;
  }

  /* Košík - množství + tlačítko vlevo, vedle sebe, ne roztažené */
  html body .product-detail .price-line > .add-to-cart,
  html body .p-detail .price-line > .add-to-cart {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    margin: 0 0 12px !important;
    text-align: left !important;
  }

  html body .product-detail .price-line .add-to-cart .quantity,
  html body .p-detail .price-line .add-to-cart .quantity {
    flex: 0 0 auto !important;
    margin: 0 !important;
  }

  /* Tlačítko - přirozená šířka, NE roztažené */
  html body .product-detail .price-line .add-to-cart .add-to-cart-button,
  html body .p-detail .price-line .add-to-cart .add-to-cart-button {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
  }

  /* Skladem dole, vlevo */
  html body .product-detail .price-line > .availability-value,
  html body .p-detail .price-line > .availability-value {
    display: block;
    text-align: left !important;
  }
}

/* === ÚZKÝ MOBIL (do 480 px) — množství a tlačítko pod sebou === */
@media (max-width: 480px) {
  html body .product-detail .price-line > .add-to-cart,
  html body .p-detail .price-line > .add-to-cart {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  html body .product-detail .price-line .add-to-cart .quantity,
  html body .p-detail .price-line .add-to-cart .quantity {
    align-self: flex-start;
  }

  html body .product-detail .price-line .add-to-cart .add-to-cart-button,
  html body .p-detail .price-line .add-to-cart .add-to-cart-button {
    width: 100% !important;
    flex: 1 1 auto !important;
  }
}
