/* Optional native Product Bundles upsells: open rows, no replacement controls.
 * The existing packet-sale script remains responsible for prices, validation,
 * checkbox state, quantities and submitted cart data. Configured quantities
 * stay in the native form; the optional rows show selection, image, name and price. */
body.single-product .bundle_sells_form {
  --bws-pv-green: var(--bws-brand-primary, #35ad84);
  --bws-pv-green-soft: var(--bws-brand-soft, #f3faf5);
  --bws-pv-border: var(--bws-brand-border, #dde4df);
  --bws-pv-text: var(--bws-brand-ink, #27312d);
  --bws-pv-muted: var(--bws-brand-muted, #52615a);
}
body.single-product .bundle_form.bundle_sells_form {
  gap: 0 !important;
}
body.single-product .bundle_sells_form .bundled_product.bundled_product_summary.bundled_item_optional:has(.bws-pv-card-layout) {
  width: 100%;
  min-width: 0;
  margin: 0 !important;
  padding: 12px 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-bottom: 1px solid var(--bws-pv-border) !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  box-sizing: border-box;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout {
  display: grid !important;
  grid-template-columns: 40px 64px minmax(0, 1fr) auto;
  grid-template-rows: auto;
  grid-template-areas: "select image title price";
  align-items: center;
  gap: 5px 12px;
  width: 100%;
  min-width: 0;
  color: var(--bws-pv-text);
  font-family: "BWS Sans", Inter, system-ui, sans-serif;
}
/* These wrappers have no semantic role. Flattening keeps native nodes, their
 * listeners and form ownership intact while allowing one readable grid. */
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .details,
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-bottom {
  display: contents !important;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images,
body.single-product #content .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images {
  grid-area: image;
  float: none !important;
  width: 64px !important;
  height: 64px !important;
  min-width: 0;
  max-width: none;
  max-height: none;
  margin: 0 !important;
  padding: 0 !important;
  background: #fff;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-image-only {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 2px;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-image-only > img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 6px;
  box-shadow: none;
  object-fit: contain;
}
body.single-product .bundle_sells_form .bundled_item_optional h4.bundled_product_title {
  grid-area: title;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--bws-pv-text);
  font-family: "BWS Sans", Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  text-transform: none;
  overflow-wrap: anywhere;
}
body.single-product .bundle_sells_form .bundled_item_optional h4.bws-pv-price {
  grid-area: price;
  justify-self: end;
  min-width: 0;
  margin: 0 !important;
  color: var(--bws-pv-text);
  font-family: "BWS Sans", Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
  white-space: normal;
}
body.single-product .bundle_sells_form .bundled_item_optional h4.bws-pv-price .price {
  justify-content: flex-end;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-price .woocommerce-Price-amount {
  white-space: nowrap;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-price del {
  color: var(--bws-pv-muted);
  opacity: 1;
}
body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-quantity {
  display: none !important;
  grid-area: quantity;
  justify-self: end;
  min-width: 0;
  font-size: 12px;
}
body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox {
  grid-area: select;
  justify-self: start;
  align-self: center;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 40px;
  min-width: 40px;
  min-height: 44px;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--bws-pv-text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  line-height: 1;
}
/* Keep the native label text in the accessibility tree after moving its visible
 * treatment to the checkbox. Never remove the checkbox or disable a quantity. */
body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox .bws-pv-checkbox-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox input {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  margin: 0 !important;
  accent-color: var(--bws-brand-solid, #278062);
}
body.single-product .bundle_sells_form .bundled_item_optional.bws-pv-selected label.bws-pv-checkbox {
  color: var(--bws-pv-text);
  background: var(--bws-pv-green-soft);
  border: 0;
}
body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox:has(input:focus-visible) {
  outline: 2px solid var(--bws-brand-heading, #27312d);
  outline-offset: 2px;
}
body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox.bws-pv-disabled {
  background: #f0f2f0;
  color: var(--bws-pv-muted);
  opacity: 1;
}
@media (max-width: 767px) {
  body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout {
    grid-template-columns: 36px 72px minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas: "select image title" "select image price";
    gap: 5px 10px;
  }
  body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images,
  body.single-product #content .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images {
    width: 72px !important;
    height: 72px !important;
  }
  body.single-product .bundle_sells_form .bundled_item_optional h4.bundled_product_title {
    align-self: end;
    font-size: 15px;
  }
  body.single-product .bundle_sells_form .bundled_item_optional h4.bws-pv-price {
    align-self: start;
    justify-self: start;
    font-size: 16px;
    text-align: left;
  }
  body.single-product .bundle_sells_form .bundled_item_optional h4.bws-pv-price .price {
    justify-content: flex-start;
  }
  body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox {
    width: 36px;
    min-width: 36px;
  }
  /* Presentation only: retain the configured quantity and submitted native field. */
  body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-quantity {
    display: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox {
    transition: none;
  }
}

/* Keep long German product names readable on the smallest phones. */
@media (max-width: 359px) {
  body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout { grid-template-columns: 28px 64px minmax(0, 1fr); column-gap: 8px; }
  body.single-product .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images,
  body.single-product #content .bundle_sells_form .bundled_item_optional .bws-pv-card-layout > .bundled_product_images { width: 64px !important; height: 64px !important; }
  body.single-product .bundle_sells_form .bundled_item_optional label.bws-pv-checkbox { width: 28px; min-width: 28px; }
}
