/**
 * SAH Weight Pricing — Frontend styles
 * Reuses native WooCommerce quantity stepper (wc-block-components-quantity-selector).
 */

/* Weight selector container */
.sah-weight-options {
  margin: 1.5em 0;
}

.sah-weight-selector .sah-weight-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5em;
  font-size: 0.95em;
}

/*
 * Weight stepper — uses WC wrapper class so most styles are inherited.
 * Only override what WC can't provide for span/div elements.
 */

/* Vertically center all flex children (buttons are divs, not native buttons) */
.sah-weight-options .wc-block-components-quantity-selector {
  align-items: center;
}

/* Span display: replicate the native input[type=number].qty rules
   from add-to-cart-with-options-style.css (:where selectors target input,
   so we must repeat for our span) */
.sah-weight-display {
  -moz-appearance: textfield;
  background-color: transparent;
  border: unset;
  box-sizing: content-box;
  color: currentColor;
  font-size: 0.8em;
  font-weight: 600;
  margin: 0;
  max-width: 3.631em;
  order: 2;
  padding: 0.7rem 0;
  text-align: center;
  user-select: none;
}

/* Div-buttons: cursor (native buttons get it free) */
.sah-weight-options .wc-block-components-quantity-selector__button {
  cursor: pointer;
  user-select: none;
}

/* Remove all focus/active/hover effects */
.sah-weight-options .wc-block-components-quantity-selector__button:focus,
.sah-weight-options .wc-block-components-quantity-selector__button:active,
.sah-weight-options .wc-block-components-quantity-selector__button:hover,
.sah-weight-display:focus,
.sah-weight-display:active {
  box-shadow: none !important;
  outline: none !important;
}

/* Disabled state */
.sah-weight-options
  .wc-block-components-quantity-selector__button[aria-disabled='true'] {
  opacity: 0.3 !important;
  cursor: default;
  pointer-events: none;
}

/* Vacuum toggle (span, not checkbox) */
.sah-vacuum-option {
  margin-top: 1em;
}

.sah-vacuum-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
  font-size: 0.95em;
  user-select: none;
}

.sah-checkbox-visual {
  font-size: 1.2em;
  line-height: 1;
}

/* Calculated price */
.sah-calculated-price {
  margin-top: 1.2em;
  padding: 0.8em 1em;
  background: #f8faf8;
  border-radius: 8px;
  border: 1px solid #e0e8e0;
}

.sah-calc-label {
  font-weight: 600;
  font-size: 0.9em;
  color: #555;
}

.sah-calc-amount {
  font-size: 1.4em;
  font-weight: 700;
  color: #2c6e49;
  margin-left: 0.3em;
}

.sah-calc-breakdown {
  display: block;
  color: #888;
  font-size: 0.85em;
  margin-top: 0.2em;
}

/* Price suffix */
.sah-price-suffix {
  font-size: 0.8em;
  color: #888;
  font-weight: 400;
}

/* Shop page */
.sah-shop-price {
  display: block;
}

.sah-min-weight {
  color: #888;
  font-size: 0.85em;
}

/* Cart weight stepper */
.sah-cart-weight-control {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.sah-cart-stepper {
  width: 140px;
}

.sah-cart-vacuum {
  font-size: 0.85em;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  cursor: pointer;
}

.sah-cart-breakdown {
  display: block;
  color: #888;
  font-size: 0.8em;
}

/* Mini-cart */
.sah-mini-weight {
  font-weight: 600;
}

.sah-mini-vacuum {
  font-size: 0.9em;
}

/* Add-to-cart button loading state */
.sah-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Inline notices */
.sah-notice {
  padding: 0.6em 1em;
  margin-top: 0.8em;
  border-radius: 6px;
  font-size: 0.9em;
  animation: sah-fade-in 0.2s ease;
}

.sah-notice--error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

@keyframes sah-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  .sah-stepper-btn {
    width: 40px;
    height: 40px;
  }

  .sah-stepper-input {
    width: 60px;
  }

  .sah-calc-amount {
    font-size: 1.2em;
  }
}

.sah-shop-options-button .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  min-height: 0;
  border-width: 1px;
  border-style: solid;
  border-color: currentColor;
  text-decoration: none;
}
