/* MOBILE RESPONSIVE */
@media (max-width: 768px) {

  /* Hide table header */
  .woocommerce table.group_table thead {
    display: none !important;
  }

  /* Make rows behave like cards */
  .woocommerce table.group_table tbody tr {
    display: grid !important;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 14px;
    padding: 14px;
    background: #fff;
  }

  /* Stack each cell */
  .woocommerce table.group_table tbody td {
    display: block !important;
    width: 100% !important;
    padding: 6px 0 !important;
    border: none !important;
    text-align: left !important;
    white-space: normal !important;
  }

  /* Width of quantity selector */
  .woocommerce-grouped-product-list td.quantity .quantity {
    min-width: auto !important;
  }

  /* Labels before content */
  .woocommerce table.group_table tbody td.sku::before {
    content: "Koodi: ";
    font-weight: 600;
  }

  .woocommerce table.group_table tbody td.label::before {
    content: "Tuote: ";
    font-weight: 600;
  }

  .woocommerce table.group_table tbody td.price::before {
    content: "Hinta: ";
    font-weight: 600;
  }

  .woocommerce table.group_table tbody td.stock::before {
    content: "Varasto: ";
    font-weight: 600;
  }

  .woocommerce table.group_table tbody td.quantity::before {
    content: "Määrä: ";
    font-weight: 600;
  }

  /* Quantity row inline layout */
  .woocommerce table.group_table tbody td.quantity {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px;
  }

  .woocommerce table.group_table tbody td.quantity::before {
    flex-shrink: 0;
    margin: 0;
  }

  .woocommerce table.group_table tbody td.quantity .quantity,
  .woocommerce table.group_table tbody td.quantity .contact-button-transparent {
    flex-grow: 1;
    width: auto !important;
  }

  form.cart .single_add_to_cart_button {
    margin-left: 0 !important;
  }

  /* Reserve space for sticky button */
  form.grouped_form {
    position: relative;
  }

  /* Sticky Add to Cart – Keep exactly like this */
  #stickyAddToCart {
    display: none;
    position: fixed;
    bottom: 0;
    margin-bottom: -5px;
    left: 0;
    right: 0;
    z-index: 9999;
    font-weight: 600;
    font-size: 16px;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 5px;
    padding: 15px 20px 17px 17px !important;
    height: auto !important;
    line-height: normal !important;
  }

  #stickyAddToCart.visible {
    display: flex !important;
  }

  #stickyAddToCart.unstuck {
    position: static !important;
    width: 100% !important;
    margin-top: 14px;
    display: flex !important;
  }


  @media (max-width: 420px) {
    .woocommerce table.group_table tbody td {
      font-size: 14px;
    }
  }
}