/* CyberTech PC — final mobile product-card alignment fix
   Load AFTER css_code.css and css_design.css. */
@media (max-width: 680px) {
  /* The older stylesheet uses align-items:start, so cards in the same row
     never stretch to equal height. */
  html body.ct-modern-design #productsArea #productsGrid,
  html body.ct-modern-design #productsGrid.products-grid {
    align-items: stretch !important;
    grid-auto-rows: 1fr !important;
  }

  html body.ct-modern-design #productsGrid > .product-card {
    align-self: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Stable media/title/price geometry on both cards in a row. */
  html body.ct-modern-design #productsGrid > .product-card .product-image {
    height: 155px !important;
    min-height: 155px !important;
    max-height: 155px !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .product-name {
    min-height: 49px !important;
    max-height: 49px !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .product-price {
    min-height: 28px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Every footer reserves the same space. An unavailable product therefore
     ends on the same baseline as a buyable product. */
  html body.ct-modern-design #productsGrid > .product-card .product-form {
    width: 100% !important;
    min-height: 84px !important;
    margin-top: auto !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
    gap: 7px !important;
  }

  /* Quantity control: compact, centered, fixed-size. HTML order is − 1 +. */
  html body.ct-modern-design #productsGrid > .product-card .qty-row {
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    direction: ltr !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .qty-btn {
    flex: 0 0 36px !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #dbe3ee !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #0f172a !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    touch-action: manipulation !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .qty-input {
    flex: 0 0 50px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 4px !important;
    text-align: center !important;
    direction: ltr !important;
    border: 1px solid #dbe3ee !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #0f172a !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 36px !important;
    appearance: textfield !important;
    -moz-appearance: textfield !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .qty-input::-webkit-inner-spin-button,
  html body.ct-modern-design #productsGrid > .product-card .qty-input::-webkit-outer-spin-button {
    margin: 0 !important;
    -webkit-appearance: none !important;
  }

  html body.ct-modern-design #productsGrid > .product-card .add-btn,
  html body.ct-modern-design #productsGrid > .product-card .out-of-stock-btn {
    width: 100% !important;
    min-height: 41px !important;
    height: 41px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
  }

  /* Do not let an out-of-stock rule collapse the reserved footer. */
  html body.ct-modern-design #productsGrid > .product-card.is-out-of-stock .product-form,
  html body.ct-modern-design #productsGrid > .product-card:has(.product-stock.stock-out) .product-form {
    min-height: 84px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-end !important;
  }
}

/* =========================================================
 *  MOBILE — safe 12px space from screen edges
 *  ========================================================= */
@media (max-width: 680px) {

  html body .products-with-facets,
  html body #productsArea {
    width: 100% !important;
    max-width: 100% !important;

    margin: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;

    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  html body .products-with-facets > .products-grid,
  html body .products-with-facets > #productsGrid,
  html body #productsArea > #productsGrid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    margin: 0 !important;
    padding: 0 !important;

    box-sizing: border-box !important;

    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;

    column-gap: 10px !important;
    row-gap: 16px !important;
  }

  html body #productsGrid > .product-card {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;

    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* טקסט לא יכול לצאת מגבולות הכרטיס */
  html body #productsGrid .product-name {
    width: 100% !important;
    max-width: 100% !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;

    box-sizing: border-box !important;

    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: break-word !important;
  }

  html body #productsGrid .product-price,
  html body #productsGrid .product-form {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
