/* ==========================================================================
   Monarch BioLabs — WooCommerce bridge styles.
   Restyles WooCommerce's own generated markup (variation form, quantity
   input, add-to-cart button, price HTML, reviews, pagination) to match the
   ported design system in monarch.css, without touching WooCommerce's
   functional JS/AJAX behavior.
   ========================================================================== */

/* Price HTML — wc_price() wraps amounts in <ins>/<del> for sale prices */
.pdp-price ins,
.product-card__body ins { text-decoration: none; }
.pdp-price del,
.product-card__body del { color: var(--color-text-muted); font-size: 0.75em; margin-right: 6px; }

/* Variation form (size selector) */
.variations { margin-bottom: 0; }
.variations table,
.variations tbody,
.variations tr,
.variations td { display: block; width: 100%; }
.variations td.label { display: none; } /* our own "Size" label already renders via .option-label */
.variations select { display: none; } /* replaced visually by pill UI, kept for WC's price/stock logic */
.woocommerce-variation-add-to-cart .reset_variations {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: 10px;
}
.woocommerce-variation-description p { color: var(--color-text-muted); font-size: 0.88rem; }
.woocommerce-variation-price .price { font-weight: 800; }
.single_variation_wrap { margin-bottom: 18px; }

/* Quantity + Add to cart row */
form.cart { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
form.cart .quantity { margin: 0; }
form.cart .qty {
  width: 64px;
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  text-align: center;
  font-size: 0.95rem;
  font-family: inherit;
}
form.cart .single_add_to_cart_button {
  flex: 1 1 auto;
  min-width: 200px;
}
.woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-disabled .single_add_to_cart_button {
  opacity: 0.5;
  pointer-events: none;
}
p.stock { font-size: 0.82rem; color: var(--color-text-muted); margin: 0 0 12px; }
p.stock.out-of-stock { color: #c0392b; }

/* Product description tab (WooCommerce description field rendered as-is) */
.pdp-description ul {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pdp-description ul li {
  display: flex;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--color-text);
}
.pdp-description ul li::before { content: "✓"; color: var(--color-accent); font-weight: 800; flex-shrink: 0; }
.pdp-description table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 16px 0;
}
.pdp-description th,
.pdp-description td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--color-border); }
.pdp-description table + p,
.pdp-description p:last-child { font-size: 0.75rem; color: var(--color-text-muted); }

/* Reviews (WooCommerce native comments template) */
#reviews .woocommerce-Reviews-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 18px; }
#reviews .commentlist { list-style: none; margin: 0 0 28px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
#reviews .comment_container {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
#reviews .star-rating { color: var(--color-accent); }
#reviews .comment-form-rating select { padding: 8px; border-radius: 8px; border: 1px solid var(--color-border); }
#reviews #respond input[type="text"],
#reviews #respond input[type="email"],
#reviews #respond textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-family: inherit;
  margin-bottom: 12px;
}
#reviews #respond .form-submit input {
  font-family: inherit;
  font-weight: 700;
  background: var(--color-navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill, 999px);
  padding: 12px 26px;
  cursor: pointer;
}
.woocommerce-noreviews { color: var(--color-text-muted); font-size: 0.9rem; }

/* Shop archive pagination */
.woocommerce-pagination { margin-top: 40px; }
.woocommerce-pagination ul.page-numbers {
  list-style: none;
  display: flex;
  gap: 8px;
  padding: 0;
  justify-content: center;
}
.woocommerce-pagination .page-numbers li a,
.woocommerce-pagination .page-numbers li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
}
.woocommerce-pagination .page-numbers li span.current {
  background: var(--color-navy);
  color: #fff;
  border-color: var(--color-navy);
}

/* Storefront's default page template renders its own "Checkout"/"Cart"
   <h1 class="entry-title">, duplicating the <h1> our own checkout/cart
   template already prints below the breadcrumb. Hide Storefront's copy on
   these two WooCommerce pages specifically. */
body.woocommerce-checkout .entry-header,
body.woocommerce-cart .entry-header { display: none; }

/* ==========================================================================
   Checkout — 3-step wizard (form-checkout.php override + checkout-steps.js)
   ========================================================================== */

/* WooCommerce's own "Billing details" / field-set headings — we supply our
   own .checkout-card__title instead, so hide the default ones. */
.woocommerce-billing-fields > h3,
.woocommerce-shipping-fields > h3 { display: none; }

/* Field rows: WooCommerce wraps every field in <p class="form-row ...">,
   with the actual control inside <span class="woocommerce-input-wrapper">.
   Restyle to match the ported checkout-billing-form look regardless of that
   wrapping. */
.checkout-billing-form .form-row { margin: 0 0 16px; }
.checkout-billing-form .form-row label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.checkout-billing-form .form-row label .required { color: #c0392b; text-decoration: none; }
.checkout-billing-form .form-row input[type="text"],
.checkout-billing-form .form-row input[type="email"],
.checkout-billing-form .form-row input[type="tel"],
.checkout-billing-form .form-row input[type="password"],
.checkout-billing-form .form-row select,
.checkout-billing-form .form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 10px);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--color-surface);
}
.checkout-billing-form .form-row input:focus,
.checkout-billing-form .form-row select:focus,
.checkout-billing-form .form-row textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.checkout-billing-form .form-row.woocommerce-invalid input,
.checkout-billing-form .form-row.woocommerce-invalid select {
  border-color: #c0392b;
}
/* Checkbox-type fields (WC's "Ship to a different address?" toggle and our
   custom institutional-certification field both use this shape). */
.checkout-billing-form .form-row label.checkbox,
.woocommerce-shipping-fields .form-row label.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.checkout-billing-form .form-row label.checkbox input,
.woocommerce-shipping-fields .form-row label.checkbox input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  accent-color: var(--color-accent);
}
#ship-to-different-address {
  margin-bottom: 18px;
  font-size: 0.9rem;
  font-weight: 700;
}
#ship-to-different-address label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.woocommerce-additional-fields > h3 { display: none; }
.woocommerce-additional-fields textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm, 10px);
  border: 1px solid var(--color-border);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--color-surface);
  resize: vertical;
}

/* WooCommerce's own default stylesheet floats #order_review (a leftover
   from the classic 2-column checkout layout). Our design stacks everything
   in a single card, so cancel the float — otherwise the floated table
   escapes the card's background/border box entirely (collapsed-parent-height
   bug) and visually overlaps whatever comes after it on the page. */
#order_review.woocommerce-checkout-review-order { float: none !important; width: 100% !important; }
.checkout-card::after { content: ""; display: table; clear: both; }

/* Order review table (cart items + totals inside the Order Summary card) */
.woocommerce-checkout-review-order-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.woocommerce-checkout-review-order-table thead { display: none; }
.woocommerce-checkout-review-order-table td,
.woocommerce-checkout-review-order-table th {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  text-align: left;
}
.woocommerce-checkout-review-order-table .product-name { font-weight: 600; }
.woocommerce-checkout-review-order-table .product-total,
.woocommerce-checkout-review-order-table td.product-total { text-align: right; font-weight: 700; }
.woocommerce-checkout-review-order-table tfoot th { font-weight: 700; }
.woocommerce-checkout-review-order-table tfoot td { text-align: right; }
.woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout-review-order-table .order-total td { font-size: 1.05rem; font-weight: 800; border-bottom: none; }

/* Shipping methods list — reskinned as selectable pill rows, matching the
   ported .shipping-option look. The radios stay WooCommerce's real,
   functional controls; only the wrapper visuals change. */
ul.woocommerce-shipping-methods { list-style: none; margin: 8px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.woocommerce-shipping-methods li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 12px);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-surface);
}
ul.woocommerce-shipping-methods li.selected {
  border-color: var(--color-accent);
  background: var(--color-bg-alt);
}
ul.woocommerce-shipping-methods li input[type="radio"] { accent-color: var(--color-accent); margin-right: 8px; }
ul.woocommerce-shipping-methods li label { display: flex; align-items: center; flex: 1; cursor: pointer; }
ul.woocommerce-shipping-methods li .woocommerce-Price-amount { font-weight: 800; margin-left: auto; }

/* Coupon box (Order Summary sidebar) — reskinned to the ported .promo-box
   input + Apply-button look; still WooCommerce's real coupon AJAX form. */
.monarch-checkout-coupon .woocommerce-form-coupon-toggle { display: none; }
.monarch-checkout-coupon .checkout_coupon { display: flex !important; gap: 8px; margin: 0 0 18px; padding: 0; border: none; }
.monarch-checkout-coupon .checkout_coupon p { margin: 0; }
.monarch-checkout-coupon .checkout_coupon .form-row-first { flex: 1; }
.monarch-checkout-coupon .checkout_coupon input#coupon_code {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 10px);
  font-family: inherit;
  font-size: 0.88rem;
}
.monarch-checkout-coupon .checkout_coupon .button {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 10px 18px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-navy);
  background: transparent;
  color: var(--color-navy);
  cursor: pointer;
  white-space: nowrap;
}

/* Payment methods box + terms checkbox + Place Order button */
ul.wc_payment_methods { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.wc_payment_methods li.wc_payment_method {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 12px);
  padding: 14px 16px;
  background: var(--color-surface);
}
ul.wc_payment_methods li.wc_payment_method label { font-weight: 700; font-size: 0.92rem; cursor: pointer; }
ul.wc_payment_methods .payment_box {
  margin-top: 12px;
  padding: 14px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm, 10px);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.woocommerce-noticed-no-payment-methods,
.woocommerce-info { font-size: 0.9rem; }
.woocommerce-terms-and-conditions-wrapper { margin: 16px 0; }
.woocommerce-terms-and-conditions-wrapper label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--color-accent);
}
.woocommerce-terms-and-conditions-wrapper a { color: var(--color-accent-dark); text-decoration: underline; }
#place_order {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 15px 20px;
  border-radius: var(--radius-pill, 999px);
  border: none;
  background: var(--color-navy);
  color: #fff;
  cursor: pointer;
}
#place_order:hover { opacity: 0.92; }
.woocommerce-checkout-payment { background: transparent !important; border: none !important; padding: 0 !important; }

/* WooCommerce's own field-level error/notice list at the top of checkout */
.woocommerce-NoticeGroup ul.woocommerce-error { list-style: none; }

/* WooCommerce's default notices (added to cart, errors) restyled to match brand */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
  list-style: none;
  margin: 0 0 24px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.woocommerce-error { border-color: #c0392b; color: #c0392b; }
.woocommerce-message .button,
.woocommerce-info .button {
  float: right;
  font-weight: 700;
  color: var(--color-navy);
}


/* ==========================================================================
   Cart + checkout completion pass
   ========================================================================== */
.monarch-cart-header,
.checkout-page-header {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto 24px;
}
.monarch-cart-header h1,
.checkout-page-header h1 {
  margin: 6px 0 10px;
  color: var(--color-navy);
  font-size: clamp(2.25rem, 4vw, 3.55rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}
.monarch-cart-header p,
.checkout-page-header > p {
  max-width: 760px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.monarch-checkout-assurance {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
.monarch-checkout-assurance span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  background: var(--color-bg-alt);
  color: var(--color-navy);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.monarch-checkout-assurance span::before {
  content: "✓";
  color: var(--color-accent);
  font-weight: 900;
}
body.woocommerce-cart .site-main > .woocommerce,
body.woocommerce-cart .entry-content > .woocommerce {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr);
  gap: 20px;
  width: 100%;
  max-width: 1180px;
}
body.woocommerce-cart .woocommerce-notices-wrapper,
body.woocommerce-cart .monarch-cart-header,
body.woocommerce-cart .monarch-shipping-progress {
  grid-column: 1 / -1;
}
body.woocommerce-cart .woocommerce-cart-form {
  grid-column: 1;
  max-width: none;
  margin: 0;
}
body.woocommerce-cart .cart-collaterals {
  grid-column: 2;
  max-width: none;
  margin: 0;
  align-self: start;
  position: sticky;
  top: 110px;
}
body.woocommerce-cart .cart-collaterals .cart_totals {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
body.woocommerce-cart .shop_table .product-thumbnail img {
  width: 76px;
  height: 76px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--color-bg-alt);
}
body.woocommerce-cart .product-remove a {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  color: #a63d3d !important;
  text-decoration: none;
}
body.woocommerce-cart .cart_totals .order-total th,
body.woocommerce-cart .cart_totals .order-total td {
  padding-top: 18px;
  font-size: 1.08rem;
  font-weight: 800;
}
.checkout-page-header {
  margin-bottom: 28px;
}
.checkout-page-header .breadcrumb {
  margin-bottom: 18px;
}
.checkout-card {
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 32px rgba(15,46,38,.07);
}
.checkout-card__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.checkout-card__title-row .checkout-card__title {
  margin-bottom: 0;
}
.checkout-card__title-row > a {
  color: var(--color-accent-dark);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: underline;
}
.checkout-card__intro {
  margin: -5px 0 20px;
  color: var(--color-text-muted);
  font-size: .88rem;
  line-height: 1.55;
}
.checkout-summary .checkout-card {
  position: sticky;
  top: 110px;
}
.checkout-step-actions {
  margin-top: 16px;
}
@media(max-width:900px) {
  body.woocommerce-cart .site-main > .woocommerce,
  body.woocommerce-cart .entry-content > .woocommerce {
    grid-template-columns: 1fr;
  }
  body.woocommerce-cart .woocommerce-cart-form,
  body.woocommerce-cart .cart-collaterals {
    grid-column: 1;
  }
  body.woocommerce-cart .cart-collaterals,
  .checkout-summary .checkout-card {
    position: static;
  }
}
@media(max-width:600px) {
  .monarch-cart-header h1,
  .checkout-page-header h1 {
    font-size: 2.25rem;
  }
  .monarch-checkout-assurance {
    display: grid;
    grid-template-columns: 1fr;
  }
  .monarch-checkout-assurance span {
    justify-content: center;
  }
  body.woocommerce-cart .shop_table .product-thumbnail {
    display: none;
  }
  .checkout-card__title-row {
    align-items: flex-start;
  }
}
