/*
 * VSA add-to-cart confirmation modal.
 *
 * Loaded after the generated theme stylesheet on product pages.
 * The native ps_shoppingcart module retains markup and behavior ownership.
 */

body#product #blockcart-modal .modal-content {
  border: 0;
  border-radius: var(--vsa-component-card-radius);
  overflow: hidden;
}

body#product #blockcart-modal .modal-header {
  display: block;
  padding: 1rem 3rem;
  position: relative;
  text-align: center;
}

body#product #blockcart-modal .modal-title {
  color: var(--vsa-semantic-text-heading);
  display: block;
  margin: 0;
  max-width: none;
  text-align: center;
  white-space: normal;
  width: 100%;
}

body#product #blockcart-modal .modal-title .material-icons {
  color: inherit;
  display: inline-block;
  float: none;
  font-size: 1.25rem;
  line-height: 1;
  margin: 0 0.4rem 0 0;
  position: static;
  transform: none;
  vertical-align: -0.18em;
}

body#product #blockcart-modal .modal-header .close {
  margin: 0;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

body#product #blockcart-modal .product-name,
body#product #blockcart-modal .product-name a {
  color: var(--vsa-semantic-action-primary);
}

body#product #blockcart-modal .product-name a:hover,
body#product #blockcart-modal .product-name a:focus {
  color: var(--vsa-semantic-action-primary-hover);
}

@media (max-width: 899px) {
  body#product #blockcart-modal .modal-dialog {
    margin: 1rem auto;
    max-width: 34rem;
    width: calc(100% - 2rem);
  }

  body#product #blockcart-modal .modal-content {
    max-height: calc(100vh - 2rem);
    overflow-x: hidden;
    overflow-y: auto;
  }

  body#product #blockcart-modal .modal-body {
    padding: 1.25rem;
  }

  body#product #blockcart-modal .modal-body > .row,
  body#product #blockcart-modal .divide-right > .row {
    display: block;
    margin-inline: 0;
  }

  body#product #blockcart-modal .modal-body > .row > [class*="col-"],
  body#product #blockcart-modal .divide-right > .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
    padding-inline: 0;
    width: 100%;
  }

  body#product #blockcart-modal .divide-right {
    border-right: 0;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    text-align: center;
  }

  body#product #blockcart-modal .product-image {
    display: block;
    height: auto;
    margin: 0 auto 1rem;
    max-width: 11rem;
    width: 100%;
  }

  body#product #blockcart-modal .product-name,
  body#product #blockcart-modal .product-name a,
  body#product #blockcart-modal .divide-right p {
    margin-inline: auto;
    text-align: center;
  }

  body#product #blockcart-modal .cart-content {
    padding-left: 0;
    width: 100%;
  }

  body#product #blockcart-modal .cart-products-count {
    text-align: center;
  }

  body#product #blockcart-modal .cart-content p {
    overflow-wrap: anywhere;
  }

  body#product #blockcart-modal .cart-content p:not(.cart-products-count) {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
  }

  body#product #blockcart-modal .cart-content .value {
    flex: 0 0 auto;
    text-align: right;
  }

  body#product #blockcart-modal .cart-content-btn {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    width: 100%;
  }

  body#product #blockcart-modal .cart-content-btn .btn,
  body#product #blockcart-modal .cart-content-btn button,
  body#product #blockcart-modal .cart-content-btn a {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    margin: 0;
    max-width: none;
    min-width: 0;
    white-space: normal;
    width: 100%;
  }
}

/* VSA PRODUCT ADD-TO-CART ICON ALIGNMENT START */
/*
 * Keep the native Material Icons cart glyph and the button label
 * centred on one horizontal axis on desktop and mobile.
 */
body#product .vsa-product-actions .add-to-cart {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

body#product
  .vsa-product-actions
  .add-to-cart
  .material-icons.shopping-cart {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  height: auto;
  justify-content: center;
  line-height: 1;
  margin: 0;
  position: static;
  top: auto;
  transform: none;
  vertical-align: middle;
  width: auto;
}
/* VSA PRODUCT ADD-TO-CART ICON ALIGNMENT END */

/* VSA MOBILE CART ACTION ORDER START */
/*
 * On mobile and tablet, checkout is the primary first action.
 * Continue shopping remains available immediately below it.
 * Desktop keeps the native source order.
 */
@media (max-width: 899px) {
  body#product
    #blockcart-modal
    .cart-content-btn
    > .btn-primary {
    order: 1;
  }

  body#product
    #blockcart-modal
    .cart-content-btn
    > .btn-secondary {
    order: 2;
  }
}
/* VSA MOBILE CART ACTION ORDER END */

/* VSA BLOCKCART PRODUCT TOTAL GLOBAL OWNER START */
/*
 * The Classic ps_shoppingcart modal assigns the stable .product-total class
 * to the displayed grand-total row in both tax-display branches. The optional
 * .product-tax paragraph may follow it, so positional last-of-type ownership
 * is intentionally avoided.
 */
body#product
  #blockcart-modal
  .cart-content
  > p.product-total {
  border: 1px solid color-mix(
    in srgb,
    var(--vsa-semantic-text-body) 14%,
    transparent
  );
  border-radius: var(--vsa-component-card-radius);
  box-sizing: border-box;
  overflow: hidden;
}
/* VSA BLOCKCART PRODUCT TOTAL GLOBAL OWNER END */

/* VSA BLOCKCART REAL-ASPECT PRODUCT IMAGE START */
body #blockcart-modal .product-image {
  border-radius: var(--vsa-component-card-radius);
  display: block;
  height: auto;
  margin-inline: auto;
  max-height: 9.375rem;
  max-width: 9.375rem;
  object-fit: contain;
  overflow: hidden;
  width: auto;
}
/* VSA BLOCKCART REAL-ASPECT PRODUCT IMAGE END */
