/* Cart and checkout only (is_cart() / is_checkout(), body.woocommerce-cart / .woocommerce-checkout).
 * jp_woocommerce_styles() prints it after woocommerce.css; rules retain their original order here. */

/* Cart & checkout basics */
.woocommerce-cart .cart-collaterals,
.woocommerce-checkout {
  color: var(--jp-text);
}

/* Cart + checkout (Woo Blocks) — match PDP white cards + green CTA */
body.woocommerce-cart .entry-title,
body.woocommerce-checkout .entry-title {
  max-width: 920px;
  margin: 0 auto 1.25rem;
  padding: 0 1.25rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--jp-text);
}

body.woocommerce-cart .wp-block-woocommerce-cart,
body.woocommerce-checkout .wp-block-woocommerce-checkout {
  max-width: 920px;
  margin: 0 auto 3rem;
  padding: 0 1.25rem;
}

body.woocommerce-cart .wc-block-cart,
body.woocommerce-checkout .wc-block-checkout {
  gap: 1rem;
}

body.woocommerce-cart .wc-block-cart.is-large,
body.woocommerce-checkout .wc-block-checkout.is-large {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

body.woocommerce-cart .wc-block-cart.is-large > .wc-block-cart__main,
body.woocommerce-checkout .wc-block-checkout.is-large > .wc-block-checkout__main {
  grid-column: 1;
  width: 100%;
}

body.woocommerce-cart .wc-block-cart.is-large > .wc-block-cart__sidebar,
body.woocommerce-checkout .wc-block-checkout.is-large > .wc-block-checkout__sidebar {
  grid-column: 2;
  width: 360px;
  max-width: 100%;
}

body.woocommerce-cart .wc-block-cart__sidebar {
  position: sticky;
  top: 5.5rem;
}

body.woocommerce-cart .wc-block-cart__submit-button {
  white-space: nowrap !important;
  width: 100% !important;
}

/* Empty cart (Woo empty-cart block content): themed message, actions and product cards. */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block { padding: 1rem 0 2rem; }

body.woocommerce-cart .wc-block-cart__empty-cart__title {
  margin: 0.5rem 0 0.4rem;
  color: var(--jp-text);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.2;
}

body.woocommerce-cart .wc-block-cart__empty-cart__title.with-empty-cart-icon::before {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1.25rem;
  background-color: var(--jp-green);
  -webkit-mask-size: 4rem;
  mask-size: 4rem;
}

body.woocommerce-cart .jp-empty-cart__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0;
}

/* .jp-content a would paint the label green on the green button. */
body.woocommerce-cart .jp-empty-cart__actions .jp-btn--primary { color: var(--jp-black); }

body.woocommerce-cart .jp-empty-cart__actions .jp-btn--ghost {
  border: 1px solid var(--jp-border);
  background: var(--jp-surface-2);
  color: var(--jp-text);
}

body.woocommerce-cart .jp-empty-cart__actions .jp-btn--ghost:hover { border-color: rgba(61, 255, 110, 0.45); color: var(--jp-green); }

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-separator.is-style-dots { display: none; }

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block > h2:not(.wc-block-cart__empty-cart__title) {
  margin: 3rem 0 1.25rem;
  font-size: 1.25rem;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
}

/* .wc-block-grid__products in the selector outranks all-products.css (0,4,0) card padding rules. */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__products .wc-block-grid__product {
  display: flex;
  flex-direction: column;
  max-width: none;
  margin: 0;
  padding: 0.75rem 0.75rem 1rem;
  border: 1px solid var(--jp-border);
  border-radius: 16px;
  background: var(--jp-surface);
  text-align: left;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-link,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-image {
  display: block;
  width: 100%;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-image { margin: 0 0 0.75rem; }

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-image img {
  width: 100%;
  border-radius: 12px;
  background: #fff;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-title {
  margin: 0 0 0.25rem;
  color: var(--jp-text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-price {
  margin: 0 0 0.85rem;
  color: var(--jp-muted);
  font-size: 0.88rem;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-add-to-cart {
  width: 100%;
  margin: auto 0 0;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-add-to-cart .wp-block-button__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 0 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--jp-green);
  color: var(--jp-black);
  font-size: 0.88rem;
  font-weight: 600;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-add-to-cart .wp-block-button__link:hover { background: #52ff82; }

@media (max-width: 768px) {
  body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
}

body.woocommerce-cart .wc-block-cart__main,
body.woocommerce-checkout .wc-block-checkout__main {
  width: 100%;
}

body.woocommerce-cart .wc-block-cart__main,
body.woocommerce-cart .wc-block-cart__sidebar,
body.woocommerce-checkout .wc-block-checkout__main,
body.woocommerce-checkout .wc-block-checkout__sidebar {
  background: #ffffff;
  color: #111827;
  border-radius: 24px;
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

body.woocommerce-cart .wc-block-cart-items,
body.woocommerce-cart .wc-block-cart-items thead,
body.woocommerce-cart .wc-block-cart-items tbody,
body.woocommerce-cart .wc-block-cart-items tr,
body.woocommerce-cart .wc-block-cart-items th,
body.woocommerce-cart .wc-block-cart-items td {
  background: transparent !important;
  border-color: #ecece8 !important;
  color: #111827;
}

body.woocommerce-cart .wc-block-cart-items__header span {
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart-item__image img {
  border-radius: 12px;
  background: #f7f7f5;
}

body.woocommerce-cart .wc-block-components-product-name,
body.woocommerce-checkout .wc-block-components-product-name {
  color: #111827 !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  line-height: 1.3;
}

body.woocommerce-cart .wc-block-components-product-name:hover,
body.woocommerce-checkout .wc-block-components-product-name:hover {
  color: #111827 !important;
  text-decoration: underline;
}

body.woocommerce-cart .wc-block-components-product-price {
  color: #6b7280 !important;
  font-size: 0.88rem;
}

body.woocommerce-cart .wc-block-components-product-metadata,
body.woocommerce-cart .wc-block-components-product-metadata p {
  color: #73736e !important;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.15rem 0 0;
}

body.woocommerce-cart .wc-block-components-quantity-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  background: #f7f7f5;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button,
body.woocommerce-cart .wc-block-components-quantity-selector__input {
  background: transparent !important;
  color: #111827 !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.woocommerce-cart .wc-block-cart-item__remove-link {
  color: #9ca3af !important;
}

body.woocommerce-cart .wc-block-cart-item__remove-link:hover {
  color: #111827 !important;
}

body.woocommerce-cart .wc-block-components-totals-wrapper,
body.woocommerce-checkout .wc-block-components-totals-wrapper {
  border-color: #ecece8 !important;
}

body.woocommerce-cart .wc-block-components-totals-item,
body.woocommerce-checkout .wc-block-components-totals-item {
  color: #111827;
}

body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
}

body.woocommerce-cart .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-cart .wc-block-components-totals-coupon input {
  background: #f7f7f5 !important;
  color: #111827 !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
}

body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-components-button.contained.wc-block-cart__submit-button,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button.contained {
  background: var(--jp-green) !important;
  color: var(--jp-black) !important;
  border: 0 !important;
  border-radius: 999px !important;
  min-height: 52px;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  box-shadow: 0 0 24px var(--jp-green-glow);
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover {
  background: #52ff82 !important;
  color: var(--jp-black) !important;
}

body.woocommerce-cart .wc-block-components-totals-coupon__button,
body.woocommerce-checkout .wc-block-components-totals-coupon__button {
  background: #111827 !important;
  color: #ffffff !important;
  border-radius: 999px !important;
  border: 0 !important;
}

body.woocommerce-checkout .wc-block-components-checkout-return-to-cart-button {
  color: #111827 !important;
}

/* Checkout: one radius everywhere */
body.woocommerce-checkout input,
body.woocommerce-checkout select,
body.woocommerce-checkout textarea,
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-textarea,
body.woocommerce-checkout .wc-blocks-components-select,
body.woocommerce-checkout .wc-blocks-components-select__select,
body.woocommerce-checkout .wc-blocks-components-select__container,
body.woocommerce-checkout .wc-blocks-components-select__select {
  border-color: #e5e7eb !important;
}

body.woocommerce-checkout .wc-blocks-components-select__select,
body.woocommerce-checkout .wc-blocks-components-select__container,
body.woocommerce-checkout .wc-block-components-combobox input,
body.woocommerce-checkout .wc-block-components-combobox-control input,
body.woocommerce-checkout .components-input-control__container,
body.woocommerce-checkout .components-input-control__backdrop,
body.woocommerce-checkout .wc-block-components-state-input select {
  border-radius: 12px !important;
}

body.woocommerce-checkout .wc-block-components-checkbox__input {
  border-radius: 6px !important;
}

body.woocommerce-checkout .wc-block-checkout__payment-method,
body.woocommerce-checkout .wc-block-components-radio-control,
body.woocommerce-checkout .wc-block-components-radio-control--highlight-checked {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
}

body.woocommerce-checkout .wc-block-components-radio-control::after,
body.woocommerce-checkout .wc-block-components-radio-control-accordion-option::after {
  content: none !important;
  display: none !important;
}

body.woocommerce-checkout .wc-block-components-address-card {
  border-radius: 12px !important;
  border-color: #e5e7eb !important;
}

body.woocommerce-checkout .wc-block-components-radio-control-accordion-option {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  overflow: visible !important;
  background: transparent !important;
}

/* Single Stripe method: drop the dummy "Payment methods" radio row */
body.woocommerce-checkout .wc-block-components-radio-control-accordion-option:only-child > .wc-block-components-radio-control__option {
  display: none !important;
}

body.woocommerce-checkout .wc-block-components-radio-control__option {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

body.woocommerce-checkout .wc-block-components-order-summary,
body.woocommerce-checkout .wp-block-woocommerce-checkout-order-summary-block {
  border-radius: 16px !important;
}

body.woocommerce-checkout .wc-block-components-radio-control-accordion-content,
body.woocommerce-checkout #wc-stripe-card-element {
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

body.woocommerce-checkout .wc-block-components-express-payment,
body.woocommerce-checkout .wc-block-components-express-payment-continue-rule {
  margin: 0 0 1.25rem;
}

body.woocommerce-checkout .wc-block-components-express-payment {
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0;
  overflow: visible;
  background: transparent;
}

body.woocommerce-checkout .wc-block-components-express-payment__title-container,
body.woocommerce-checkout .wc-block-components-express-payment__content {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
}

body.woocommerce-checkout .wc-block-components-express-payment .wc-block-components-express-payment__title-container,
body.woocommerce-checkout .wc-block-components-express-payment--checkout .wc-block-components-express-payment__title-container {
  display: block !important;
  visibility: visible !important;
  height: auto !important;
  margin: 0 0 12px !important;
  padding: 0 !important;
  position: static !important;
  text-align: center;
}

body.woocommerce-checkout .wc-block-components-express-payment__title {
  display: block !important;
  position: static !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em;
  color: #6b7280 !important;
  text-align: center;
}

body.woocommerce-checkout .wc-block-components-express-payment__title-container::before,
body.woocommerce-checkout .wc-block-components-express-payment__title-container::after {
  content: none !important;
  display: none !important;
  border: 0 !important;
  width: 0 !important;
}

body.woocommerce-checkout .wc-block-components-express-payment__event-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: visible;
}

body.woocommerce-checkout .wc-block-components-express-payment__event-buttons li {
  display: block;
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  line-height: 0;
  border-radius: 999px !important;
  overflow: hidden !important;
}

body.woocommerce-checkout #express-payment-method-express_checkout_element_amazonPay {
  display: none !important;
}

body.woocommerce-checkout #express-payment-method-express_checkout_element_applePay {
  order: 1;
}

body.woocommerce-checkout #express-payment-method-express_checkout_element_googlePay {
  order: 2;
}

body.woocommerce-checkout #express-payment-method-express_checkout_element_link {
  order: 3;
}

/* Address grid: Eircode high + full width, then street, then city/county. */
@media (min-width: 700px) {
  body.woocommerce-checkout .wc-block-components-address-form:has(.wc-block-components-address-form__address_1) {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
  }

  /* Woo wraps address_1 in this container — it is the grid item, not __address_1. */
  body.woocommerce-checkout .wc-block-components-address-autocomplete-container,
  body.woocommerce-checkout .wc-block-components-address-form__country,
  body.woocommerce-checkout .wc-block-components-address-form__postcode,
  body.woocommerce-checkout .wc-block-components-address-form__address_1,
  body.woocommerce-checkout .wc-block-components-address-form__address_2,
  body.woocommerce-checkout .wc-block-components-address-form__address_2-toggle,
  body.woocommerce-checkout .wc-block-components-address-form__phone {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.woocommerce-checkout .wc-block-components-address-form__first_name {
    grid-column: 1 / 4;
  }

  body.woocommerce-checkout .wc-block-components-address-form__last_name {
    grid-column: 4 / 7;
  }

  body.woocommerce-checkout .wc-block-components-address-form__city {
    grid-column: 1 / 4;
  }

  body.woocommerce-checkout .wc-block-components-address-form__state {
    grid-column: 4 / 7;
  }
}

/* Eircode search cue + helper copy — icon on wrapper, not input bg (avoids clashing with value).
   Scoped to .jp-eircode-field: the IE-decorated field only, never a GB/US postcode input. */
body.woocommerce-checkout .wc-block-components-address-form__postcode.jp-eircode-field {
  position: relative;
}

body.woocommerce-checkout .wc-block-components-address-form__postcode.jp-eircode-field input {
  padding-right: 2.75rem !important;
  background-image: none !important;
}

body.woocommerce-checkout .wc-block-components-address-form__postcode.jp-eircode-field::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  right: 0.95rem;
  width: 1.15rem;
  height: 1.15rem;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") center / contain no-repeat;
  z-index: 2;
}

body.woocommerce-checkout .wc-block-components-address-form__postcode.jp-eircode-field:focus-within::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

body.woocommerce-checkout .jp-eircode-hint {
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #6b7280;
  font-weight: 500;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.woocommerce-checkout .jp-eircode-hint::before {
  content: "";
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.35rem;
  vertical-align: -0.1rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Ccircle cx='12' cy='16' r='0.6' fill='%2316a34a' stroke='none'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Woo scrolls validation notices into view; leave room for the sticky header. */
body.woocommerce-checkout .wc-block-components-notices,
body.woocommerce-checkout .with-scroll-to-top__scroll-point,
body.woocommerce-checkout .wc-block-components-notice-banner,
body.woocommerce-checkout .wc-block-components-validation-error,
body.woocommerce-checkout .wc-block-components-text-input,
body.woocommerce-checkout .wc-block-components-checkout-step {
  scroll-margin-top: calc(var(--jp-header-h, 72px) + 16px);
}

body.woocommerce-checkout .wc-block-components-checkout-step {
  min-inline-size: 0;
}

body.woocommerce-checkout .wc-block-components-address-form:has(.wc-block-components-address-form__address_2.wc-block-components-text-input) .wc-block-components-address-form__address_2-toggle {
  display: none;
}

body.woocommerce-checkout .wc-block-components-address-form__address_2-hidden-input {
  position: absolute !important;
  clip: rect(0, 0, 0, 0);
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
}

/* Stripe iframe is buttonHeight+8 with margin:-4px. Never force 48px or auto (auto = 150px). */
body.woocommerce-checkout .wc-block-components-express-payment iframe {
  display: block !important;
  width: calc(100% + 8px) !important;
  height: 56px !important;
  min-height: 56px !important;
  margin: -4px !important;
  border-radius: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

body.woocommerce-checkout .wc-block-components-express-payment .StripeElement,
body.woocommerce-checkout .wc-block-components-express-payment .__PrivateStripeElement {
  background: transparent !important;
  overflow: visible !important;
  border-radius: 0 !important;
  height: 48px !important;
  min-height: 48px !important;
}
