/* ============================================================================
   A) PRODUCT WRAPPER & VARIATION WRAPPER BASICS
   =========================================================================== */

/* Legend above product loop: hover for icon tooltips */
.mlvf-loop-icons-legend {
  font-size: 13px;
  color: #555;
  margin: 0 0 12px 0;
  padding: 8px 0;
  line-height: 1.45;
  font-family: brandon-grotesque, sans-serif;
}

.mlvf-loop-icons-legend .mlvf-loop-legend-footnote {
  font-size: 0.92em;
  color: #777;
  font-style: italic;
}

/* Each product in the loop - OPTIMIZED FOR SCANNING */
.woocommerce ul.products {
  row-gap: 12px;
}

.woocommerce ul.products li.product {
  margin-bottom: 14px !important;
}

/* Product card wrapper: content-heavy cards get .mlvf-card-expanded (horizontal layout) via customizer-styles. */
.woocommerce ul.products li.product .mlvf-product-wrapper {
  position: relative;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
  overflow: hidden;
}

/* Hover state - more pronounced for better feedback */
.woocommerce ul.products li.product .mlvf-product-wrapper:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(165, 204, 188, 0.15);
  border-color: #a5ccbc;
}

/* Focus-within for keyboard navigation */
.woocommerce ul.products li.product .mlvf-product-wrapper:focus-within {
  border-color: #a5ccbc;
  box-shadow: 0 0 0 3px rgba(165, 204, 188, 0.2);
}

@media (max-width: 640px) {
  .woocommerce ul.products li.product .mlvf-product-wrapper {
    padding: 12px;
    gap: 4px;
  }
}

/* Mobile 2-col: compact card for narrow columns */
@media (max-width: 480px) {
  .woocommerce ul.products li.product .mlvf-product-wrapper {
    padding: 0 0 8px 0;
    gap: 2px;
    border-radius: 10px;
  }
  .woocommerce ul.products li.product .mlvf-image-wrapper {
    margin: 0;
    border-radius: 10px 10px 0 0;
  }
  .woocommerce ul.products li.product .mlvf-image-wrapper img {
    max-height: none;
    aspect-ratio: 1 / 1;
  }
  .woocommerce ul.products li.product .mlvf-image-wrapper a.mlvf-product-link {
    border-radius: 10px 10px 0 0;
  }
  .woocommerce ul.products li.product .mlvf-details-and-form-wrapper {
    padding: 6px 8px 0;
  }
  /* Compact organic note */
  .woocommerce ul.products li.product .mlvf-organic-note {
    font-size: 0.6em;
    margin: 0;
    line-height: 1.2;
  }
  /* Compact product tip / short description */
  .woocommerce ul.products li.product .mlvf-loop-short-description {
    font-size: 0.7em;
    line-height: 1.2;
    margin: 2px 0;
  }
  /* Compact badges */
  .woocommerce ul.products li.product .mlvf-herbal-icons,
  .woocommerce ul.products li.product .bsb-product-badges--loop,
  .woocommerce ul.products li.product .eg-product-badges--loop {
    font-size: 0.65em;
    gap: 2px;
  }
  .woocommerce ul.products li.product .mlvf-tip {
    font-size: 0.65em;
    line-height: 1.2;
    margin: 2px 0 0;
  }
}

/* Variation form wrapper (for variable products) */
.woocommerce ul.products li.product .mlvf-var-form-wrapper {
  position: relative;
  z-index: 90;
  background: #f9f9f9;
  padding: 8px;
  border: 1px solid #ddd;
  margin-bottom: 10px;
}

/* Container for the product image, so we can put overlays inside it.
   Full-bleed on top/sides so image is edge-to-edge in column layout;
   content-heavy horizontal layout overrides margin at 769px+ so text wrap is unchanged. */
.woocommerce ul.products li.product .mlvf-image-wrapper {
  position: relative;
  overflow: visible;
  border-radius: 12px 12px 0 0;
  margin: -12px -12px 0 -12px;
  line-height: 0;
}
.woocommerce ul.products li.product .mlvf-image-wrapper a.mlvf-product-link {
  display: block;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}

/* Variation image gallery nav (prev/next) - shown when variation has multiple images */
.woocommerce ul.products li.product .mlvf-loop-gallery-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
  pointer-events: none;
}
.woocommerce ul.products li.product .mlvf-loop-gallery-nav button {
  pointer-events: auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}
.woocommerce ul.products li.product .mlvf-loop-gallery-nav button:hover:not(:disabled) {
  background: #fff;
  color: #101326;
}
.woocommerce ul.products li.product .mlvf-loop-gallery-nav button:disabled {
  opacity: 0.4;
  cursor: default;
}
.woocommerce ul.products li.product .mlvf-loop-gallery-nav .mlvf-gallery-dots {
  display: none;
}

.woocommerce ul.products li.product .mlvf-image-wrapper .mlvf-favorite-trigger {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
}

.woocommerce ul.products li.product .mlvf-product-wrapper .mlvf-favorite-trigger .eg-heart {
  position: relative;
  top: 0;
  right: 0;
  min-width: 0;
  min-height: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.woocommerce ul.products li.product .mlvf-product-wrapper .mlvf-favorite-trigger .eg-heart:focus-visible {
  outline: 2px solid #101326;
  outline-offset: 2px;
}

.woocommerce ul.products li.product .mlvf-product-wrapper .mlvf-favorite-trigger--standalone {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 110;
}

/* Adjust favorites button positioning for products without photos */
.woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-favorite-trigger--standalone {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 100;
}

.woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-favorite-trigger--standalone .eg-heart {
  transform: translate3d(53%, -40%, 0) !important;
}

.woocommerce ul.products li.product .mlvf-details-and-form-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Compact order: image → brand → title → price → flavor/traditional → badges → tip */
.woocommerce ul.products li.product .mlvf-product-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.woocommerce ul.products li.product .mlvf-product-details .mlvf-brand {
  margin: 0;
  font-size: 0.9em;
}
.woocommerce ul.products li.product .mlvf-product-details .mlvf-product-title {
  margin: 0 0 2px 0;
}
/* Organic note under product name (bulk food, not conventional/local) */
.woocommerce ul.products li.product .mlvf-product-details .mlvf-organic-note {
  margin: 0 0 2px 0;
  font-size: 0.72em;
  font-style: italic;
  color: #2c4d3d;
  line-height: 1.2;
}
.woocommerce ul.products li.product .mlvf-product-details .price-container {
  margin: 0 0 2px 0;
}

/* Default loop: image fills the card column edge-to-edge, rounded top only */
.woocommerce ul.products li.product .mlvf-image-wrapper img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  object-position: center;
  border-radius: 12px 12px 0 0;
}

/* Compact layout for products without images */
.woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-image-wrapper {
  display: none;
}

.woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-details-and-form-wrapper {
  margin-top: 0.25rem;
}

/* ============================================================================
   B) "SELECT OPTIONS" TOGGLE (Variable products) - IMPROVED VISIBILITY
   =========================================================================== */
.woocommerce ul.products li.product .mlvf-special-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  background: #f5f9f6;
  border: 1.5px solid #a5ccbc;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  color: #2c5e54;
  transition: all 0.2s ease;
  box-shadow: none;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.woocommerce ul.products li.product .mlvf-special-button:hover {
  background: #f0f7f5;
  border-color: #2c5e54;
  box-shadow: none;
  transform: translateY(-1px);
}

.woocommerce ul.products li.product .mlvf-special-button:active {
  transform: scale(0.98);
}

.woocommerce ul.products li.product .mlvf-special-button .down-arrow {
  margin-left: 8px;
  transition: transform 0.3s ease;
  display: inline-block;
  font-size: 12px;
}

.down-arrow.rotated {
  transform: rotate(180deg);
}

/* ============================================================================
   C) VARIATION OVERLAY (where the form is displayed after "Select Options")
   =========================================================================== */
.woocommerce ul.products li.product .mlvf-var-overlay {
  position: relative;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-top: 0 !important;
}

/* Show only when the visible class is added */
.woocommerce ul.products li.product .mlvf-var-overlay.visible {
  display: block;
}

/* Space above the variation form */
.woocommerce ul.products li.product .mlvf-var-form-wrapper form.variations_form {
  margin-top: 8px;
}

/* ============================================================================
   D) VARIATION TABLE & PRICE HIDING - UPDATED FOR BUTTONS
   =========================================================================== */

/* Keep the variations table visible but hide the actual dropdowns */
.woocommerce ul.products li.product .mlvf-var-overlay .variations {
  display: block !important;
  width: 100% !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  margin-bottom: 4px !important; /* Reduced from 8px */
}

/* Hide the actual dropdown selects - they'll be replaced by buttons */
.woocommerce ul.products li.product .mlvf-var-overlay .variations select {
  display: none !important;
}

/* Hide the table cell labels since we're creating custom ones */
.woocommerce ul.products li.product .mlvf-var-overlay .variations td.label {
  display: none !important;
}

/* Ensure the value cells take full width */
.woocommerce ul.products li.product .mlvf-var-overlay .variations td.value {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  padding: 0 !important;
}

/* Stack the label above, controls below (with wrap if needed) */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .variations tr {
  display: block;
  margin-bottom: 1rem;
}
.woocommerce ul.products li.product .mlvf-var-form-wrapper .variations td.label {
  /* We insert a cleaner attribute heading via JS, so hide the original table
     cell to prevent duplicate labels and awkward wrapping. */
  display: none;
}
.woocommerce ul.products li.product .mlvf-var-form-wrapper .variations td.value {
  display: flex;
  flex-wrap: wrap; /* wrap if too many options */
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

/* ============================================================================
   D1) MINIMALIST VARIATION BUTTONS STYLING
   =========================================================================== */

/* Container for variation buttons */
.woocommerce .mlvf-attribute-buttons {
  margin-bottom: 1rem;
}

.woocommerce .mlvf-attribute-group {
  margin-bottom: 0.5rem;
}

/* Minimalist outlined variation buttons */
.woocommerce .mlvf-option-btn {
  display: inline-block;
  padding: 4px 9px;
  margin: 0 4px 4px 0;
  background: #f8fafb;
  border: 1.5px solid #d3d6da;
  border-radius: 6px;
  color: #555;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-transform: capitalize;
}

/* Hover state */
.woocommerce .mlvf-option-btn:hover {
  border-color: #a5ccbc;
  background: #f0f7f5;
  color: #2c5e54;
}

/* Active/Selected state — survey-style (exclude color dots which keep their inline bg) */
.woocommerce .mlvf-option-btn.active:not(.mlvf-color-dot) {
  background: linear-gradient(135deg, #e8f5f3 0%, #dce8e4 50%, #e0eef0 100%);
  border-color: #2c5e54;
  box-shadow: 0 0 0 2px #bfe2dc;
  color: #2c5e54;
}

/* Disabled/Sold out state */
.woocommerce .mlvf-option-btn.sold-out,
.woocommerce .mlvf-option-btn:disabled {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: 0.6;
}

/* Hide default 'Total: xx' or normal price for variable products, so we can
   rely on custom Subtotal lines. */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .single_variation .woocommerce-variation-price,
.woocommerce ul.products li.product .mlvf-var-form-wrapper .single_variation .price,
.woocommerce ul.products li.product .single_variation .woocommerce-variation-price,
.woocommerce ul.products li.product .single_variation .price {
  display: none !important;
}

/* Keep variation prices visible on single product pages */

/* Stock text => smaller, italic, reduced spacing */
.woocommerce ul.products li.product .mlvf-var-overlay .stock {
  font-size: 0.85em !important;
  font-style: italic !important;
  margin: 2px 0 4px 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
}

/* Hide stock status in product loops to reduce clutter */
.woocommerce ul.products li.product .mlvf-var-overlay .stock {
  display: none !important;
}

/* Stock text => smaller, italic */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .woocommerce-variation-availability {
  font-size: 0.9em;
  font-style: italic;
  color: #666;
  margin-top: 3px;
}

/* ============================================================================
   E) VARIATION: QTY + ADD-TO-CART & SUBTOTAL
   =========================================================================== */

/* The container that holds quantity & add-to-cart in one row */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .variations_button {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px 0; 
}

/* show variation row when a variation is selected */
.variations_form .variations_button,
.variations_form .mlvf-loop-add-button {
  display: flex !important;
  align-items: center;
}

/* NEW: Variable product layout to match simple products */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 8px !important;
}

/* Quantity row - full width */
.woocommerce ul.products li.product .mlvf-var-overlay .quantity {
  width: 100% !important;
  margin-bottom: 8px !important;
}

/* Action row - ADD button left, subtotal right (like simple products) */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_button {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  gap: 8px !important;
}

/* Ensure the entire add-to-cart section is visible when enabled */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled {
  display: flex !important;
  flex-direction: column !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Quantity row - full width */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart .quantity {
  width: 100% !important;
  display: flex !important;
  justify-content: flex-start !important;
}

/* Action row - ADD button left, subtotal right */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart .variations_button {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Variation quantity input => 36px tall, minimal padding */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .qty {
  height: 36px;
  width: 65px; /* enough for up/down arrows plus numeric text */
  line-height: 36px;
  text-align: center;
  box-sizing: border-box;
  padding: 0 4px;
  opacity: 1 !important; /* override hidden states from other plugins */
  display: inline-block !important;
}

/* Variation quantity input in overlay */
.woocommerce ul.products li.product .mlvf-var-overlay .quantity .qty {
  width: 65px !important;
  height: 36px !important;
  margin: 0 !important;
}

/* REMOVED: Old conflicting variable product button styling */

.woocommerce ul.products li.product .mlvf-variation-controls .mlvf-custom-add-button {
  flex-shrink: 0;
  margin-left: 8px;
  background: linear-gradient(135deg, #e0f7f9 0%, #ddedeb 100%) !important;
  color: #101326 !important;
  border: 2px solid #101326 !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: background 0.3s ease, box-shadow 0.3s ease;
  height: 40px !important;
  padding: 0 12px !important;
  font-size: 14px !important;
  line-height: 36px !important;
}
.woocommerce ul.products li.product .mlvf-variation-controls .mlvf-custom-add-button:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}
.woocommerce ul.products li.product .mlvf-variation-controls .mlvf-custom-add-button.loading {
  opacity: 0.6;
}

/* ============================================================================
   F) VARIABLE PRODUCT OVERLAY LAYOUT - MATCH SIMPLE PRODUCTS
   =========================================================================== */

/* CRITICAL: Variable product overlay should use the same layout as simple products */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-box {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 8px !important;
}

.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 8px !important;
}

.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-action-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 0 !important;
}

/* Variable product quantity input should match simple products */
.woocommerce ul.products li.product .mlvf-var-overlay .quantity .qty {
  width: 80px !important;
  height: 36px !important;
  line-height: 36px !important;
  text-align: center !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  padding: 0 4px !important;
  border: 1px solid #ddd !important;
  border-radius: 4px !important;
  font-size: 14px !important;
}

/* REMOVED: Old conflicting variable product button styling */

/* Variable product subtotal container should match simple products */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-subtotal-container {
  text-align: left !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #333 !important;
  flex-grow: 1 !important;
}

/* ============================================================================
   G) SIMPLE OVERLAY => pinned bottom-right in the .mlvf-image-wrapper
   =========================================================================== */
.woocommerce ul.products li.product .mlvf-simple-overlay {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #fff;
  border: 1px solid #ddd;
  padding: 8px;
  z-index: 100;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  /* If you want a column layout for the qty row & the subtotal row */
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px; 
}

/* ============================================================================
   G) QUANTITY INPUTS & BUTTONS
   =========================================================================== */

/* Quantity input styling */
.woocommerce ul.products li.product .mlvf-quantity-box .qty {
  width: 80px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  box-sizing: border-box;
  padding: 0 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

/* Quantity row layout */
.woocommerce ul.products li.product .mlvf-quantity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

/* Action row layout */
.woocommerce ul.products li.product .mlvf-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Bottle + ADD row: on mobile let bottle button share space with ADD instead of full width */
.woocommerce ul.products li.product .mlvf-bottle-and-action-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  order: 2; /* after .mlvf-quantity-row (order: 1) in .mlvf-quantity-box */
}

.woocommerce ul.products li.product .mlvf-bottle-and-action-wrap .pbv-loop-bottle-buttons {
  flex: 0 1 auto;
  margin: 0;
  min-width: 0;
}

.woocommerce ul.products li.product .mlvf-bottle-and-action-wrap .pbv-loop-bottle-btn {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
}

.woocommerce ul.products li.product .mlvf-bottle-and-action-wrap .mlvf-action-row {
  flex: 1 1 auto;
  min-width: 0;
}

/* ============================================================================
   H) BUTTONS & STYLING
   =========================================================================== */

/* Common button styling for loops - IMPROVED INTERACTION */
.woocommerce ul.products li.product .mlvf-quantity-box .add_to_cart_button {
  flex-shrink: 0;
  margin-left: 0;
  min-width: 60px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #2c5e54 0%, #3a7a6d 100%);
  color: #fff;
  border: 1.5px solid #2c5e54;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(44, 94, 84, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.woocommerce ul.products li.product .mlvf-quantity-box .add_to_cart_button:hover {
  background: linear-gradient(135deg, #3a7a6d 0%, #4a8e80 100%);
  box-shadow: 0 4px 10px rgba(44, 94, 84, 0.35);
  transform: translateY(-1px);
}

.woocommerce ul.products li.product .mlvf-quantity-box .add_to_cart_button:active {
  transform: scale(0.98);
  box-shadow: 0 2px 4px rgba(44, 94, 84, 0.2);
}

.woocommerce ul.products li.product .mlvf-quantity-box .add_to_cart_button.loading {
  opacity: 0.7 !important;
  cursor: wait !important;
}

/* Make sure the loading animation is centered on the button */
.woocommerce ul.products li.product .button.add_to_cart_button.loading {
  color: transparent !important;
}
.woocommerce ul.products li.product .button.add_to_cart_button.added {
  background: #94b8a6 !important;
  color: white !important;
  border-color: #94b8a6 !important;
}

/* ============================================================================
   I) COMMON BUTTON STATES & QUANTITY SUFFIX
   =========================================================================== */

/* For per-item quantities, show "ea" for clarity */
.woocommerce ul.products li.product .mlvf-quantity-suffix {
  font-size: 0.85em;
  color: #888;
  margin-left: 6px;
  font-style: italic;
  align-self: center; /* Vertically align with the quantity input */
}

/* Override Genesis Simple Edits if necessary */
.woocommerce ul.products li.product .mlvf-simple-overlay .quantity-nav,
.woocommerce ul.products li.product .mlvf-simple-overlay .quantity {
  margin-bottom: 0 !important;
}
.woocommerce ul.products li.product .mlvf-simple-overlay .quantity-button,
.woocommerce ul.products li.product .mlvf-simple-overlay .qty {
  height: 40px !important;
  line-height: 40px !important;
}

/* ============================================================================
   J) RESPONSIVE IMPROVEMENTS
   =========================================================================== */
@media (max-width: 768px) {
  /* Adjust heart positioning for mobile - move it inside the card slightly */
  .woocommerce ul.products li.product .mlvf-image-wrapper .mlvf-favorite-trigger {
    top: 6px;
    right: 6px;
  }
  
  /* Products WITH images - standalone trigger (shouldn't normally exist but just in case) */
  .woocommerce ul.products li.product .mlvf-product-wrapper:not(.mlvf-no-image) .mlvf-favorite-trigger--standalone {
    top: 6px;
    right: 6px;
  }
  
  /* Products WITHOUT images - keep inside card */
  .woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-favorite-trigger--standalone {
    top: 6px;
    right: 6px;
  }

  /* On smaller screens, stack quantity/button */
  .woocommerce ul.products li.product .mlvf-simple-overlay {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  /* Ensure quantity input takes full width */
  .woocommerce ul.products li.product .mlvf-simple-overlay .qty,
  .woocommerce ul.products li.product .mlvf-simple-overlay .button {
    width: 100% !important;
    margin: 0 !important;
  }
}

/* ============================================================================
   K) SUBTOTAL STYLING
   =========================================================================== */

/* Style for the subtotal container */
.woocommerce ul.products li.product .mlvf-subtotal-container {
  margin-top: 4px;
  font-size: 13px;
  text-align: left;
  color: #555;
  font-style: italic;
  font-weight: 500;
  height: 1.2em; /* Reserve space to prevent layout shift */
  min-height: 16px; /* Ensure consistent spacing */
}

.woocommerce ul.products li.product .mlvf-action-row .mlvf-subtotal-container {
  margin-top: 0;
  text-align: left;
}

/* Larger, clearer font for the subtotal amount */
.woocommerce ul.products li.product .mlvf-subtotal-amount {
  font-size: 1.4em !important;
  font-weight: 600;
  color: #1f1f1f;
}

.woocommerce ul.products li.product .mlvf-subtotal-label {
  font-size: 1em;
}

/* =======================================================================
    RESPONSIVE ADJUSTMENTS FOR SMALL SCREENS
   ======================================================================= */
@media (max-width: 480px) {
  /* Keep heart positioning consistent on very small screens */
  .woocommerce ul.products li.product .mlvf-image-wrapper .mlvf-favorite-trigger {
    top: 6px;
    right: 6px;
  }
  
  /* Products WITH images - standalone trigger */
  .woocommerce ul.products li.product .mlvf-product-wrapper:not(.mlvf-no-image) .mlvf-favorite-trigger--standalone {
    top: 6px;
    right: 6px;
  }
  
  /* Products WITHOUT images - keep inside card */
  .woocommerce ul.products li.product .mlvf-product-wrapper.mlvf-no-image .mlvf-favorite-trigger--standalone {
    top: 6px;
    right: 6px;
  }

  .woocommerce ul.products li.product .mlvf-quantity-box .qty,
  .woocommerce ul.products li.product .mlvf-quantity-box .button {
    height: 38px !important;
    line-height: 38px !important;
  }

  .woocommerce ul.products li.product .mlvf-quantity-row {
    flex-wrap: nowrap;
  }

  .woocommerce ul.products li.product .mlvf-quantity-row .add_to_cart_button {
    margin-left: 0;
  }

  .woocommerce ul.products li.product .mlvf-quantity-box .qty {
    font-size: 14px !important;
  }

  .woocommerce ul.products li.product .mlvf-subtotal-container {
    margin-top: 0 !important;
    font-size: 0.9em;
  }

  /* Mobile 2-col typography scaling */
  .woocommerce ul.products li.product .mlvf-product-title {
    font-size: 13px !important;
    line-height: 1.25;
    font-weight: 600;
    margin-bottom: 2px;
  }
  .woocommerce ul.products li.product .mlvf-brand {
    font-size: 11px !important;
  }
  .woocommerce ul.products li.product .price-container,
  .woocommerce ul.products li.product .price-container .price {
    font-size: 13px;
  }
  .woocommerce ul.products li.product .mlvf-special-button {
    font-size: 0.72rem;
    padding: 5px 8px;
    margin-bottom: 4px;
  }
}

/* =======================================================================
    VARIABLE PRODUCT DROPDOWN RE-STYLED (FINAL)
   ======================================================================= */

/* Main dropdown container */
.woocommerce ul.products li.product .mlvf-var-overlay {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
  margin-top: 0 !important;
}

/* The form inside the container */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_form {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important; /* Reduced from 10px */
}

/* Attribute rows (e.g., "style") */
.woocommerce ul.products li.product .mlvf-var-overlay .variations {
  display: block !important;
  width: 100% !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  margin-bottom: 4px !important; /* Reduced from 8px */
}
.woocommerce ul.products li.product .mlvf-var-overlay .variations td {
  padding: 0 !important;
}
.woocommerce ul.products li.product .mlvf-var-overlay .variations .label {
  display: none !important; /* Hide original labels since we're using custom ones */
}

/* Swatch buttons container */
.woocommerce ul.products li.product .mlvf-var-overlay .value {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  margin-bottom: 4px !important; /* Reduced from 8px */
}

/* Quantity and "ADD" button row */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 2px !important; /* Reduced from 6px */
  justify-content: flex-end !important;
}

/* Quantity input in the dropdown */
.woocommerce ul.products li.product .mlvf-var-overlay .quantity .qty {
  width: 55px !important;
  flex-grow: 0 !important;
  height: 38px !important;
}

/* REMOVED: Old conflicting variable product button styling - now using add_to_cart_button class */

/* Hide item notes in product loops - only show on single product pages */
.woocommerce ul.products li.product .mlvf-var-overlay .eg-item-notes,
.woocommerce ul.products li.product .eg-item-notes,
.woocommerce ul.products li.product .mlvf-var-overlay .item-notes,
.woocommerce ul.products li.product .item-notes,
.woocommerce ul.products li.product .mlvf-var-overlay .product-notes,
.woocommerce ul.products li.product .product-notes,
.woocommerce ul.products li.product .mlvf-var-overlay .variation-notes,
.woocommerce ul.products li.product .variation-notes,
.woocommerce ul.products li.product .mlvf-var-overlay .cce-item-note,
.woocommerce ul.products li.product .cce-item-note,
.mini-cart-panel .eg-item-notes,
.mini-cart-panel .item-notes,
.mini-cart-panel .product-notes,
.mini-cart-panel .variation-notes,
.mini-cart-panel .cce-item-note,
.mini-cart-panel .cce-item-note-toggle,
.mini-cart-panel details.cce-item-note,
.mini-cart-panel summary.cce-item-note-toggle,
.woocommerce-mini-cart .eg-item-notes,
.woocommerce-mini-cart .item-notes,
.woocommerce-mini-cart .product-notes,
.woocommerce-mini-cart .variation-notes,
.woocommerce-mini-cart .cce-item-note,
.woocommerce-mini-cart .cce-item-note-toggle,
.woocommerce-mini-cart details.cce-item-note,
.woocommerce-mini-cart summary.cce-item-note-toggle {
  display: none !important;
}

/* Custom attribute label inserted via JS */
.woocommerce ul.products li.product .mlvf-attr-label {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0 0 8px 0;
  padding: 0;
  color: #222;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  display: block;
  width: 100%;
}

/* Remove the "Choose" prefix styling since we're not using it */
.woocommerce ul.products li.product .mlvf-attr-label b {
  font-family: inherit;
  font-weight: inherit;
  font-size: inherit;
  color: inherit;
  text-transform: inherit;
}

/* Button container styling */
.woocommerce ul.products li.product .mlvf-variation-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

/* Individual variation buttons */
.woocommerce ul.products li.product .mlvf-variation-buttons .mlvf-option-btn {
  display: inline-block;
  padding: 4px 9px;
  margin: 0;
  background: #f8fafb;
  border: 1.5px solid #d3d6da;
  border-radius: 6px;
  color: #555;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  text-transform: capitalize;
}

/* Hover state for buttons */
.woocommerce ul.products li.product .mlvf-variation-buttons .mlvf-option-btn:hover {
  border-color: #a5ccbc;
  background: #f0f7f5;
  color: #2c5e54;
}

/* Active/Selected state for buttons — survey-style */
.woocommerce ul.products li.product .mlvf-variation-buttons .mlvf-option-btn.active:not(.mlvf-color-dot) {
  background: linear-gradient(135deg, #e8f5f3 0%, #dce8e4 50%, #e0eef0 100%);
  border-color: #2c5e54;
  box-shadow: 0 0 0 2px #bfe2dc;
  color: #2c5e54;
}

/* Sold out state for buttons */
.woocommerce ul.products li.product .mlvf-variation-buttons .mlvf-option-btn.sold-out {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #bbb;
  cursor: not-allowed;
  text-decoration: line-through;
  opacity: 0.6;
}

/* Disabled dropdown options */
.woocommerce ul.products li.product .mlvf-var-overlay select option.mlvf-option-disabled {
  color: #bbb !important;
  background: #f5f5f5 !important;
  text-decoration: line-through !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* Disabled swatch buttons */
.woocommerce ul.products li.product .mlvf-option-btn.sold-out {
  color: #bbb !important;
  background: #f5f5f5 !important;
  text-decoration: line-through !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* ── Faire-style color dot overrides for loop ── */
.woocommerce ul.products li.product .mlvf-option-btn.mlvf-color-dot {
  width: 24px;
  height: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  font-size: 0;
  line-height: 0;
  overflow: visible;
  position: relative;
  margin: 0 4px 4px 0;
}
.woocommerce ul.products li.product .mlvf-option-btn.mlvf-color-dot:hover {
  border-color: #999;
}
.woocommerce ul.products li.product .mlvf-option-btn.mlvf-color-dot.active,
.woocommerce .mlvf-option-btn.mlvf-color-dot.active,
.woocommerce .mlvf-inline-color-dot.active {
  outline: 2px solid #333;
  outline-offset: 2px;
  transform: none;
  box-shadow: none;
  border-color: transparent;
  color: transparent !important;
}
.woocommerce ul.products li.product .mlvf-option-btn.mlvf-color-dot.sold-out {
  background: inherit !important;
  color: transparent !important;
  text-decoration: none !important;
  opacity: 0.35 !important;
}
.woocommerce ul.products li.product .mlvf-option-btn.mlvf-color-dot.mlvf-light-color {
  border-color: #ccc;
}

/* ── Inline color swatches (shown outside OPTIONS toggle) ── */
.mlvf-inline-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0 6px;
  justify-content: center;
}
/* When inline color dots are present, hide the duplicate color section inside the overlay */
.mlvf-has-inline-colors .mlvf-var-overlay .mlvf-attribute-group[data-attribute_name="pa_color"] {
  display: none;
}
/* For color-only products, hide the entire variations/buttons section in the overlay */
.mlvf-color-only .mlvf-var-overlay .variations,
.mlvf-color-only .mlvf-var-overlay .mlvf-attribute-buttons,
.mlvf-color-only .mlvf-var-overlay .mlvf-reset-btn {
  display: none;
}

/* ============================================================================
   PRODUCT TIP & QUICK INFO
   =========================================================================== */
.woocommerce ul.products li.product .mlvf-herbal-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 8px 0 4px;
  align-items: center;
}

.woocommerce ul.products li.product .mlvf-product-details .hbe-product-badges,
.woocommerce ul.products li.product .mlvf-product-details .bsb-product-badges {
  justify-content: flex-start;
}

.woocommerce ul.products li.product .bsb-product-badges--loop {
  margin: 8px 0 4px;
}

.woocommerce ul.products li.product .mlvf-herbal-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(215, 237, 230, 0.35);
  border: 1px solid rgba(44, 94, 84, 0.18);
  font-size: 12px;
}

.woocommerce ul.products li.product .mlvf-herbal-group-label {
  font-weight: 600;
  color: #2c5e54;
  letter-spacing: 0.2px;
}

.woocommerce ul.products li.product .mlvf-herbal-footnote {
  font-size: 0.75em;
  vertical-align: super;
  margin-left: 1px;
  color: #2c5e54;
}

.woocommerce ul.products li.product .mlvf-herbal-group-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.woocommerce ul.products li.product .mlvf-herbal-icon {
  font-size: 16px;
  line-height: 1;
  cursor: default;
  position: relative;
}

/* Tooltip for flavor/traditional-use icons (matches eg-badge tooltip style) */
.woocommerce ul.products li.product .mlvf-herbal-icon[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  font-family: brandon-grotesque, sans-serif;
}

.woocommerce ul.products li.product .mlvf-herbal-icon[data-tooltip]:hover::after,
.woocommerce ul.products li.product .mlvf-herbal-icon[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

/* Tooltip for bath/scent/benefit icons in loop (use title attribute) */
.woocommerce ul.products li.product .bsb-product-badges--loop .bsb-icon {
  position: relative;
  cursor: default;
}

.woocommerce ul.products li.product .bsb-product-badges--loop .bsb-icon[title]::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  font-family: brandon-grotesque, sans-serif;
}

.woocommerce ul.products li.product .bsb-product-badges--loop .bsb-icon[title]:hover::after,
.woocommerce ul.products li.product .bsb-product-badges--loop .bsb-icon[title]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.woocommerce ul.products li.product .mlvf-herbal-text {
  font-size: 11px;
  color: #555;
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 6px;
  border-radius: 10px;
}

.woocommerce ul.products li.product .mlvf-tip {
  font-family: 'blanket', sans-serif !important;
  font-size: 15px !important;
  font-style: normal !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  margin-top: 6px !important;
  padding: 8px 10px;
  color: #555;
  background: rgba(165, 204, 188, 0.08);
  border-left: 3px solid #a5ccbc;
  border-radius: 4px;
}

/* Closed loop icon enhancement */
.woocommerce ul.products li.product .closed-loop-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-left: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.woocommerce ul.products li.product .mlvf-product-title:hover .closed-loop-icon {
  opacity: 1;
}

/* -------------------------------------------------------------
   MOBILE CLEANUP
   ------------------------------------------------------------- */
@media (max-width: 600px) {
  /* Keep the card treatment on mobile so each product still feels intentional */
  .woocommerce ul.products li.product .mlvf-product-wrapper {
    background: #ffffff;
    border: 1px solid rgba(16, 19, 38, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(16, 19, 38, 0.08);
    padding: 16px 14px;
    margin: 0 clamp(6px, 2vw, 16px) 20px;
  }

  /* Give the variation panel a soft container so it still feels connected to the card */
  .woocommerce ul.products li.product .mlvf-var-form-wrapper {
    border: 1px solid rgba(16, 19, 38, 0.08);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(246, 248, 247, 0.9), rgba(255, 255, 255, 0.95));
    padding: 12px;
  }

  .woocommerce ul.products li.product .mlvf-var-overlay {
    box-shadow: none !important;
    border: none !important;
    padding: 6px 0 !important;
  }

  /* Prevent the price + unit text from spilling outside the card */
  .woocommerce ul.products li.product .price-container {
    display: flex;
    align-items: baseline;
    gap: 4px;
    width: 100%;
    font-size: clamp(0.85rem, 3.2vw, 1rem);
    line-height: 1.35;
  }

  .woocommerce ul.products li.product .price-container .price {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    width: 100%;
    letter-spacing: -0.01em;
    white-space: nowrap;
  }

  .woocommerce ul.products li.product .price-container .price > * {
    white-space: nowrap;
  }

  .woocommerce ul.products li.product .price-container .price .woocommerce-price-suffix,
  .woocommerce ul.products li.product .price-container .price .unit-price-regular,
  .woocommerce ul.products li.product .price-container .price .unit-price-sale {
    font-size: 0.92em;
  }
}

/* Add this to ensure the variation overlay is properly hidden by default */
.mlvf-var-overlay {
    display: none;
}

/* 7. (Optional) Hide out-of-stock options completely - uncomment if desired */
.woocommerce ul.products li.product .mlvf-option-btn.sold-out {
  display: none !important;
}
.woocommerce ul.products li.product .mlvf-var-overlay select option.mlvf-option-disabled {
  display: none !important;
}

/* === AI FIX: Variation Popup Layout, Button Visibility, and Subtotal Consistency === */

/* Stack attribute label and dropdown vertically */
.woocommerce ul.products li.product .mlvf-var-form-wrapper .variations td.value,
.woocommerce ul.products li.product .mlvf-var-overlay .value {
  flex-direction: column !important;
  align-items: flex-start !important;
  white-space: normal !important;
  gap: 0.25em !important;
}

/* Show add-to-cart and quantity when variation is selected */
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled .single_variation_wrap,
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled .variations_button,
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled .single_add_to_cart_button {
  display: flex !important;
}

/* Hide controls until a variation is chosen */
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-disabled .mlvf-variation-controls {
  display: none;
}
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-disabled .variations_button,
.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-disabled .single_variation_wrap {
  display: none !important;
}

.mlvf-variation-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.variations_form .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled .mlvf-variation-controls {
  opacity: 1;
}

/* Prevent duplicate subtotal display - only in product loops, not single product pages */
.woocommerce ul.products li.product .woocommerce-variation-add-to-cart .mlvf-subtotal-container:not(:first-of-type) {
  display: none !important;
}

/* Standardize subtotal font size and style */
.woocommerce ul.products li.product .mlvf-var-subtotal-container,
.woocommerce ul.products li.product .mlvf-subtotal-container {
  font-size: 14px !important;
  font-style: italic;
  color: #555;
  text-align: left;
  margin-top: 8px;
  font-weight: 500;
  height: 1.2em;
}

/* === AI/USER FIX: Improved Variation Formatting, Clear Button, and Subtotal Display === */

/* Attribute label full width and inline block */
.woocommerce ul.products li.product .mlvf-var-overlay .variations .label {
  width: 100% !important;
  display: inline-block !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
}

/* Make the Clear button small, subtle, and icon-like */
.woocommerce ul.products li.product .reset_variations {
  font-size: 0 !important;
  background: none !important;
  border: none !important;
  color: #888 !important;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  padding: 2px 4px !important;
  display: inline-block !important;
}
.woocommerce ul.products li.product .reset_variations::after {
  content: '\21BA'; /* Unicode for a circular arrow */
  font-size: 16px;
  color: #888;
  display: inline-block;
}
.woocommerce ul.products li.product .reset_variations:hover::after {
  color: #222;
}

/* Remove extra margin between variations and price */
.woocommerce ul.products li.product .mlvf-var-overlay .single_variation_wrap {
  margin-top: 0 !important;
}

/* Prevent subtotal word wrap and only show if quantity >= 2 (handled in JS) */
.woocommerce ul.products li.product .mlvf-var-subtotal-container {
  white-space: nowrap !important;
  word-break: normal !important;
}

/* Hide item notes in simple product loop overlays */
.woocommerce ul.products li.product .mlvf-simple-overlay .eg-item-notes {
  display: none !important;
}

/* Hide WooCommerce variation description in loop — we show it in the short description area instead */
.woocommerce ul.products li.product .mlvf-var-overlay .single_variation .woocommerce-variation-description {
  display: none !important;
}

/* See more/less links for truncated variation descriptions in loop */
.mlvf-desc-more,
.mlvf-desc-less {
  color: #4a7c59;
  text-decoration: none;
  font-style: italic;
  font-size: 0.9em;
}
.mlvf-desc-more:hover,
.mlvf-desc-less:hover {
  text-decoration: underline;
}

/* Comprehensive rule to hide all item notes in product loops */
/* BUT preserve product tips (.mlvf-tip, .handwriting-notes-top) */
.woocommerce ul.products li.product *[class*="item-note"],
.woocommerce ul.products li.product *[class*="notes"]:not(.mlvf-tip):not(.handwriting-notes-top):not(.handwriting-notes),
.woocommerce ul.products li.product .woocommerce-variation-add-to-cart *[class*="note"]:not(.mlvf-tip):not(.handwriting-notes-top):not(.handwriting-notes) {
  display: none !important;
}

/* Ensure product tips are visible */
.woocommerce ul.products li.product .mlvf-tip,
.woocommerce ul.products li.product .handwriting-notes-top {
  display: block !important;
}

/* Single subtotal for weight-based products: only .mlvf-subtotal-container is used (converts and goes through). */
/* Hide any other subtotal outputs so we never show duplicates. */
.eg-subtotal {
  display: none !important;
}

/* Hide any subtotal that appears in the quantity row (e.g. near "That's all we've got");
   only the subtotal in .mlvf-action-row (lower right) should show.
   High specificity so it wins over any show rule. */
.woocommerce ul.products li.product .mlvf-quantity-row .mlvf-subtotal-container,
.woocommerce ul.products li.product .mlvf-quantity-row .eg-subtotal,
.woocommerce ul.products li.product .mlvf-quantity-box .quantity .eg-subtotal,
.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-quantity-row .quantity .eg-subtotal {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

/* Hide PBV subtotal everywhere – products are sold by weight; only .mlvf-subtotal-container is shown */
.woocommerce ul.products li.product .pbv-subtotal-container,
.woocommerce ul.products li.product .mlvf-quantity-box .pbv-subtotal-container,
body.single-product .pbv-subtotal-container,
body.woocommerce .pbv-subtotal-container {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

/* =========================================================================
   FORCE SUBTOTAL CONTAINER TO ALWAYS BE VISIBLE IN PRODUCT LOOP
   ========================================================================= */
/* Override any other CSS that might be hiding the subtotal container */
.woocommerce ul.products li.product .mlvf-subtotal-container,
.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-subtotal-container,
body.woocommerce ul.products li.product .mlvf-subtotal-container,
body.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-subtotal-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
}

/* Ensure the subtotal container appears above the action row */
.woocommerce ul.products li.product .mlvf-quantity-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-subtotal-container {
  order: 2;
}

.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-action-row {
  order: 3;
}

.woocommerce ul.products li.product .mlvf-quantity-box .mlvf-quantity-row {
  order: 1;
}

/* ========================================================================
   FIX VARIATION OVERLAY ORDERING AND SPACING
   ======================================================================== */

/* Ensure proper ordering: label -> buttons -> quantity -> ADD/subtotal */
.woocommerce ul.products li.product .mlvf-var-overlay .variations td.value {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

/* Attribute label should be first */
.woocommerce ul.products li.product .mlvf-attr-label {
  order: 1 !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
}

/* Variation buttons container should be second */
.woocommerce ul.products li.product .mlvf-variation-buttons {
  order: 2 !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
}

/* Reset button should be third */
.woocommerce ul.products li.product .reset_variations {
  order: 3 !important;
  margin: 0 0 8px 0 !important;
  padding: 2px 4px !important;
  align-self: flex-start !important;
}

/* Ensure the add-to-cart section appears after all attribute selections */
.woocommerce ul.products li.product .mlvf-var-overlay .single_variation_wrap {
  order: 4 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure the quantity/add section has proper spacing */
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart {
  order: 5 !important;
  margin-top: 8px !important;
  margin-bottom: 0 !important;
  gap: 8px !important;
}

/* SIMPLIFIED: Show ADD button when variation is selected - use simpler selectors */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_button {
  display: none !important;
}

/* Show the variations_button when any variation data is present */
.woocommerce ul.products li.product .mlvf-var-overlay .single_variation_wrap:not(:empty) ~ .woocommerce-variation-add-to-cart .variations_button,
.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled .variations_button {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Ensure ADD button is always visible when variation container is enabled */
.woocommerce ul.products li.product .mlvf-var-overlay .single_add_to_cart_button {
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure subtotal appears consistently on the left */
.woocommerce ul.products li.product .mlvf-var-subtotal-container {
  text-align: left !important;
  font-size: 14px !important;
  font-style: italic !important;
  color: #555 !important;
  font-weight: 500 !important;
  min-height: 1.2em !important;
  flex-shrink: 0 !important;
  flex-grow: 1 !important;
  margin-left: 0 !important;
}

/* Make sure ADD button stays on the left */
.woocommerce ul.products li.product .mlvf-var-overlay .single_add_to_cart_button {
  flex-shrink: 0 !important;
  margin-right: 8px !important;
}

/* Remove all extra spacing in the variation form */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_form {
  gap: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Remove spacing from variation table */
.woocommerce ul.products li.product .mlvf-var-overlay .variations {
  margin-bottom: 0 !important;
  padding: 0 !important;
}

/* Hide the variation price that appears by default, we use our own subtotal */
.woocommerce ul.products li.product .woocommerce-variation-price {
  display: none !important;
}

/* =========================================================================
   FINAL OVERRIDES - ENSURE VARIABLE PRODUCTS MATCH SIMPLE PRODUCTS
   ========================================================================= */

/* CRITICAL: Override any conflicting rules for variable product layout */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-box {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
}

/* Force quantity row to be first and full width */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-row {
  order: 1 !important;
  display: flex !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
}

/* Force action row to be second with button left, subtotal right */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-action-row {
  order: 2 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
}

/* Variable product button styling - EXACTLY THE SAME as simple product button */
.woocommerce ul.products li.product .mlvf-var-overlay .add_to_cart_button {
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  order: 1 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  /* Use identical styling as simple product button */
  min-width: 60px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #e0f7f9 0%, #ddedeb 100%);
  color: #101326;
  border: 2px solid #101326;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Variable product button hover state - EXACTLY THE SAME as simple product button */
.woocommerce ul.products li.product .mlvf-var-overlay .add_to_cart_button:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Variable product button disabled state */
.woocommerce ul.products li.product .mlvf-var-overlay .add_to_cart_button:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}

/* Override any rules that might be hiding or repositioning the subtotal */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-subtotal-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  order: 2 !important;
  flex-grow: 1 !important;
  text-align: left !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #333 !important;
}

/* Hide ALL old structure elements that might interfere */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_button:not(.mlvf-action-row) {
  display: none !important;
}

.woocommerce ul.products li.product .mlvf-var-overlay .woocommerce-variation-add-to-cart:not(.mlvf-quantity-box) {
  display: none !important;
}

/* Make sure our new structure is always visible */
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-box,
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-quantity-row,
.woocommerce ul.products li.product .mlvf-var-overlay .mlvf-action-row {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Custom style from codex modification - IMPROVED HIERARCHY */
.woocommerce ul.products li.product .mlvf-product-title {
  font-size: 16px !important;
  margin-bottom: 4px;
  line-height: 1.3;
  font-weight: 600;
}

.woocommerce ul.products li.product .mlvf-product-title .egc-heat-inline {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.woocommerce ul.products li.product .mlvf-product-title .egc-heat-inline .egc-heat-icons {
  line-height: 1;
}

.woocommerce ul.products li.product .mlvf-product-title a {
  color: #222;
  text-decoration: none;
  transition: color 0.2s;
}

.woocommerce ul.products li.product .mlvf-product-title a:hover {
  color: #a5ccbc;
}

.woocommerce ul.products li.product .mlvf-product-title .eg-badge--caffeinated-inline {
  display: inline;
  vertical-align: middle;
  margin-left: 2px;
}

.woocommerce ul.products li.product .mlvf-product-title .eg-badge--caffeinated-inline .eg-badge-icon,
.woocommerce ul.products li.product .mlvf-product-title .eg-badge--housemade-inline .eg-badge-icon {
  width: 1em;
  height: 1em;
  vertical-align: middle;
}

.woocommerce ul.products li.product .mlvf-product-title .eg-badge--housemade-inline {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 2px;
  width: auto;
  height: auto;
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

.woocommerce ul.products li.product .mlvf-product-title .eg-badge--caffeinated-inline {
  width: auto;
  height: auto;
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

.woocommerce ul.products li.product .price-container {
  margin: 6px 0 8px 0;
}

.woocommerce ul.products li.product .price-container,
.woocommerce ul.products li.product .price-container .price {
  white-space: nowrap;
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  color: #2d5016;
}


/* ============================================================================
   SUCCESS BUTTON STYLING & ALIGNMENT
   =========================================================================== */

/* SUCCESS STATE - IMPROVED FEEDBACK */
.woocommerce ul.products li.product .add_to_cart_button.added,
.woocommerce ul.products li.product .mlvf-custom-add-button.added,
.woocommerce ul.products li.product .single_add_to_cart_button.added,
.woocommerce ul.products li.product .ajax_add_to_cart.added {
  background: #a5ccbc !important;
  border-color: #a5ccbc !important;
  color: #fff !important;
  cursor: default !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  position: relative;
  animation: mlvf-success-pulse 0.4s ease;
}

@keyframes mlvf-success-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Remove checkmark from before text */
.woocommerce ul.products li.product .add_to_cart_button.added::before,
.woocommerce ul.products li.product .mlvf-custom-add-button.added::before,
.woocommerce ul.products li.product .single_add_to_cart_button.added::before,
.woocommerce ul.products li.product .ajax_add_to_cart.added::before {
  content: none !important;
  display: none !important;
}

/* Add checkmark AFTER text (to the right of "ADDED") */
.woocommerce ul.products li.product .add_to_cart_button.added::after,
.woocommerce ul.products li.product .mlvf-custom-add-button.added::after,
.woocommerce ul.products li.product .single_add_to_cart_button.added::after,
.woocommerce ul.products li.product .ajax_add_to_cart.added::after {
  content: '✓' !important;
  display: inline !important;
  font-weight: 700 !important;
  font-size: 16px !important;
  margin-left: 6px !important; /* Extra spacing after "ADDED" */
}

/* Success state hover - slightly darker */
.woocommerce ul.products li.product .add_to_cart_button.added:hover,
.woocommerce ul.products li.product .mlvf-custom-add-button.added:hover,
.woocommerce ul.products li.product .single_add_to_cart_button.added:hover,
.woocommerce ul.products li.product .ajax_add_to_cart.added:hover {
  background: #94b8a6 !important;
  border-color: #94b8a6 !important;
}

/* Loading state - clearer feedback */
.woocommerce ul.products li.product .add_to_cart_button.loading,
.woocommerce ul.products li.product .mlvf-custom-add-button.loading {
  opacity: 0.7 !important;
  cursor: wait !important;
  position: relative;
}

.woocommerce ul.products li.product .add_to_cart_button.loading::before,
.woocommerce ul.products li.product .mlvf-custom-add-button.loading::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mlvf-spin 0.6s linear infinite;
}

@keyframes mlvf-spin {
  to { transform: rotate(360deg); }
}

/* ERROR STATE - Clear visual feedback for add-to-cart errors */
.woocommerce ul.products li.product .add_to_cart_button.error,
.woocommerce ul.products li.product .mlvf-custom-add-button.error,
.woocommerce ul.products li.product .single_add_to_cart_button.error,
.woocommerce ul.products li.product .ajax_add_to_cart.error {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  cursor: default !important;
}

.woocommerce ul.products li.product .add_to_cart_button.error::after,
.woocommerce ul.products li.product .mlvf-custom-add-button.error::after,
.woocommerce ul.products li.product .single_add_to_cart_button.error::after,
.woocommerce ul.products li.product .ajax_add_to_cart.error::after {
  content: none !important; /* Don't show checkmark for errors */
}

/* Button + View Cart alignment - ADDED left, View cart right */
.woocommerce ul.products li.product .mlvf-action-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.woocommerce ul.products li.product .mlvf-action-row .add_to_cart_button,
.woocommerce ul.products li.product .mlvf-action-row .mlvf-custom-add-button,
.woocommerce ul.products li.product .mlvf-action-row .single_add_to_cart_button {
  order: 1;
  flex-shrink: 0;
}

.woocommerce ul.products li.product .mlvf-action-row .added_to_cart.wc-forward {
  order: 3;
  margin-left: auto;
  text-decoration: none;
  color: #101326;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 19, 38, 0.35);
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 19, 38, 0.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce ul.products li.product .mlvf-action-row .added_to_cart.wc-forward:hover,
.woocommerce ul.products li.product .mlvf-action-row .added_to_cart.wc-forward:focus-visible {
  color: #0b0d1a;
  background: #f3f7f7;
  border-color: rgba(16, 19, 38, 0.6);
  box-shadow: 0 2px 6px rgba(16, 19, 38, 0.12);
}

.woocommerce ul.products li.product .mlvf-action-row .mlvf-subtotal-container,
.woocommerce ul.products li.product .mlvf-action-row .mlvf-var-subtotal-container {
  order: 2;
  flex-grow: 1;
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

/* Variable product button alignment */
.woocommerce ul.products li.product .mlvf-var-overlay .variations_button {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
}

.woocommerce ul.products li.product .mlvf-var-overlay .variations_button .single_add_to_cart_button {
  order: 1;
  flex-shrink: 0;
}

.woocommerce ul.products li.product .mlvf-var-overlay .variations_button .added_to_cart.wc-forward {
  order: 3;
  margin-left: auto;
  text-decoration: none;
  color: #101326;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 19, 38, 0.35);
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 19, 38, 0.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce ul.products li.product .mlvf-var-overlay .variations_button .added_to_cart.wc-forward:hover,
.woocommerce ul.products li.product .mlvf-var-overlay .variations_button .added_to_cart.wc-forward:focus-visible {
  color: #0b0d1a;
  background: #f3f7f7;
  border-color: rgba(16, 19, 38, 0.6);
  box-shadow: 0 2px 6px rgba(16, 19, 38, 0.12);
}

.woocommerce ul.products li.product .mlvf-var-overlay .variations_button .mlvf-var-subtotal-container {
  order: 2;
  flex-grow: 1;
  text-align: left;
  margin-left: 0;
  margin-right: 0;
}

/* Disabled button styling with light blue transparency */
.woocommerce ul.products li.product .add_to_cart_button:disabled,
.woocommerce ul.products li.product .mlvf-custom-add-button:disabled,
.woocommerce ul.products li.product .single_add_to_cart_button:disabled,
.woocommerce ul.products li.product .ajax_add_to_cart:disabled,
.woocommerce ul.products li.product .add_to_cart_button.disabled,
.woocommerce ul.products li.product .mlvf-custom-add-button.disabled,
.woocommerce ul.products li.product .single_add_to_cart_button.disabled,
.woocommerce ul.products li.product .ajax_add_to_cart.disabled {
  background: rgba(224, 247, 249, 0.5) !important;
  border-color: rgba(16, 19, 38, 0.3) !important;
  color: rgba(16, 19, 38, 0.5) !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* ==========================================================================
   "NOT LOCAL" BADGE — shown on product images for non-local produce
   ========================================================================== */
.mlvf-not-local-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 3px 6px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(31, 74, 66, 0.12);
  border-radius: 4px;
  font-family: brandon-grotesque, sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #5a6e68;
  line-height: 1;
  pointer-events: none;
}

.mlvf-not-local-badge svg {
  flex-shrink: 0;
  color: #8a9e96;
}
