/* =============================================================================
   EMAGCY — Cart + Checkout authoritative system
   Scope: WooCommerce Cart/Checkout (Blocks + classic fallback) ONLY.
   Everything is scoped to body.woocommerce-cart / body.woocommerce-checkout so
   Homepage, Shop, PDP, Header and Footer are never affected.

   Root causes neutralised here (measured on the live site):
     - hello-elementor reset: button{background:transparent;color:#c36} -> pink CTA
     - WP core :where(.wp-element-button){background:#32373c} -> grey CTA
     - a:hover{color:#333366} on the grey CTA -> ~1.7:1 contrast, unreadable
     - focus outline resolving to transparent
   ========================================================================== */

body.woocommerce-cart,
body.woocommerce-checkout {
  --emagcy-bg-primary: #071826;
  --emagcy-bg-secondary: #0E2438;
  --emagcy-card: #132D45;
  --emagcy-orange: #FF6200;
  --emagcy-orange-hover: #FF7A2F;
  --emagcy-orange-active: #E85800;
  --emagcy-steel: #6E88AD;
  --emagcy-text-primary: #FFFFFF;
  --emagcy-text-secondary: #A6B6C8;
  --emagcy-border: rgba(255, 255, 255, 0.08);
  --emagcy-border-strong: rgba(255, 255, 255, 0.16);
  --emagcy-on-orange: #071826;
  --emagcy-error: #FF6B6B;
  --emagcy-error-bg: rgba(255, 107, 107, 0.10);
  --emagcy-success: #4ED8A0;
  --emagcy-success-bg: rgba(78, 216, 160, 0.10);
  --emagcy-radius: 14px;
  --emagcy-radius-sm: 10px;
  --emagcy-font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --emagcy-font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --emagcy-ease: cubic-bezier(0.16, 1, 0.3, 1);

  background: var(--emagcy-bg-primary);
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-body);
}

/* ---------- page shell ---------------------------------------------------- */

body.woocommerce-cart .site-main,
body.woocommerce-checkout .site-main,
body.woocommerce-cart main.site-main,
body.woocommerce-checkout main.site-main {
  width: min(100% - 40px, 1280px);
  margin-inline: auto;
  padding-block: 40px 64px;
  background: transparent;
  color: var(--emagcy-text-primary);
}

body.woocommerce-cart .entry-title,
body.woocommerce-checkout .entry-title,
body.woocommerce-cart .page-header .entry-title,
body.woocommerce-checkout .page-header .entry-title {
  margin: 0 0 28px;
  font-family: var(--emagcy-font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--emagcy-text-primary);
}

body.woocommerce-cart h1, body.woocommerce-checkout h1,
body.woocommerce-cart h2, body.woocommerce-checkout h2,
body.woocommerce-cart h3, body.woocommerce-checkout h3 {
  font-family: var(--emagcy-font-display);
  color: var(--emagcy-text-primary);
}

body.woocommerce-cart p,
body.woocommerce-checkout p,
body.woocommerce-cart li,
body.woocommerce-checkout li,
body.woocommerce-cart td,
body.woocommerce-checkout td,
body.woocommerce-cart th,
body.woocommerce-checkout th,
body.woocommerce-cart label,
body.woocommerce-checkout label,
body.woocommerce-cart span,
body.woocommerce-checkout span {
  color: inherit;
}

/* =============================================================================
   1. PRIMARY COMMERCE CTA — permanent state lock
   Applies to: Proceed to Checkout, Place Order, Apply/Update actions.
   !important is used deliberately and narrowly: these exact properties are the
   ones the theme reset and WP core button defaults hijack.
   ========================================================================== */

body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart a.checkout-button,
body.woocommerce-cart .wc-proceed-to-checkout a.button,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout #place_order,
body.woocommerce-checkout button#place_order {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid var(--emagcy-orange) !important;
  border-radius: var(--emagcy-radius-sm) !important;
  background: var(--emagcy-orange) !important;
  background-color: var(--emagcy-orange) !important;
  background-image: none !important;
  color: var(--emagcy-on-orange) !important;
  font-family: var(--emagcy-font-body) !important;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 12px 26px -16px rgba(255, 98, 0, 0.9);
  transition: background-color 180ms var(--emagcy-ease),
              border-color 180ms var(--emagcy-ease),
              transform 180ms var(--emagcy-ease);
}

/* WooCommerce ships body:not(...) .wc-block-components-button:not(.is-link){min-height:3em}
   at specificity (0,3,1); match past it instead of reaching for !important. */
body.woocommerce-cart .wc-block-cart__submit-button.wc-block-components-button:not(.is-link),
body.woocommerce-checkout .wc-block-components-checkout-place-order-button.wc-block-components-button:not(.is-link) {
  min-height: 54px;
  padding: 0 24px;
}

/* text nodes inside the block button must never inherit a foreign colour */
body.woocommerce-cart .wc-block-cart__submit-button *,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button * {
  color: var(--emagcy-on-orange) !important;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart .wc-block-cart__submit-button:focus,
body.woocommerce-cart .wc-block-cart__submit-button:focus-visible,
body.woocommerce-cart .wc-block-cart__submit-button:active,
body.woocommerce-cart a.checkout-button:hover,
body.woocommerce-cart a.checkout-button:focus,
body.woocommerce-cart a.checkout-button:active,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:focus,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:focus-visible,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:active,
body.woocommerce-checkout #place_order:hover,
body.woocommerce-checkout #place_order:focus,
body.woocommerce-checkout #place_order:active {
  color: var(--emagcy-on-orange) !important;
  background-image: none !important;
  text-decoration: none !important;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover *,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover *,
body.woocommerce-cart .wc-block-cart__submit-button:focus *,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:focus *,
body.woocommerce-cart .wc-block-cart__submit-button:active *,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:active * {
  color: var(--emagcy-on-orange) !important;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart a.checkout-button:hover,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover,
body.woocommerce-checkout #place_order:hover {
  background: var(--emagcy-orange-hover) !important;
  background-color: var(--emagcy-orange-hover) !important;
  border-color: var(--emagcy-orange-hover) !important;
  transform: translateY(-1px);
}

body.woocommerce-cart .wc-block-cart__submit-button:active,
body.woocommerce-cart a.checkout-button:active,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:active,
body.woocommerce-checkout #place_order:active {
  background: var(--emagcy-orange-active) !important;
  background-color: var(--emagcy-orange-active) !important;
  border-color: var(--emagcy-orange-active) !important;
  transform: translateY(0) scale(0.995);
}

body.woocommerce-cart .wc-block-cart__submit-button:focus-visible,
body.woocommerce-cart a.checkout-button:focus-visible,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:focus-visible,
body.woocommerce-checkout #place_order:focus-visible {
  outline: 2px solid #FFFFFF !important;
  outline-offset: 3px !important;
}

body.woocommerce-cart .wc-block-cart__submit-button:disabled,
body.woocommerce-cart .wc-block-cart__submit-button[aria-disabled="true"],
body.woocommerce-checkout .wc-block-components-checkout-place-order-button:disabled,
body.woocommerce-checkout .wc-block-components-checkout-place-order-button[aria-disabled="true"],
body.woocommerce-checkout #place_order:disabled {
  background: rgba(255, 98, 0, 0.32) !important;
  background-color: rgba(255, 98, 0, 0.32) !important;
  border-color: rgba(255, 98, 0, 0.32) !important;
  color: rgba(7, 24, 38, 0.72) !important;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* =============================================================================
   2. SECONDARY ACTIONS — must not compete with the primary CTA
   ========================================================================== */

body.woocommerce-cart .wc-block-cart__submit-container a:not(.wc-block-cart__submit-button),
body.woocommerce-cart .wc-block-components-totals-coupon__button,
body.woocommerce-checkout .wc-block-components-address-card__edit,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-button__link,
body.woocommerce-cart a.button:not(.checkout-button):not(.wc-block-cart__submit-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--emagcy-border-strong) !important;
  border-radius: var(--emagcy-radius-sm) !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-body);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  transition: border-color 180ms var(--emagcy-ease), color 180ms var(--emagcy-ease), background-color 180ms var(--emagcy-ease);
}

body.woocommerce-cart .wc-block-components-totals-coupon__button:hover,
body.woocommerce-checkout .wc-block-components-address-card__edit:hover,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-button__link:hover,
body.woocommerce-cart a.button:not(.checkout-button):not(.wc-block-cart__submit-button):hover {
  border-color: var(--emagcy-orange) !important;
  background-color: rgba(255, 98, 0, 0.08) !important;
  color: var(--emagcy-text-primary) !important;
}

body.woocommerce-cart .wc-block-components-totals-coupon__button:focus-visible,
body.woocommerce-checkout .wc-block-components-address-card__edit:focus-visible {
  outline: 2px solid var(--emagcy-orange) !important;
  outline-offset: 2px;
}

/* Empty-cart CTA is the one secondary that reads as primary intent */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-button__link {
  min-height: 52px;
  padding: 0 28px;
  border-color: var(--emagcy-orange) !important;
  background: var(--emagcy-orange) !important;
  background-color: var(--emagcy-orange) !important;
  color: var(--emagcy-on-orange) !important;
  font-weight: 700;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wp-block-button__link:hover {
  background-color: var(--emagcy-orange-hover) !important;
  color: var(--emagcy-on-orange) !important;
}

/* =============================================================================
   3. SHARED SURFACE — cart + checkout two-column composition
   ========================================================================== */

body.woocommerce-cart .wc-block-components-sidebar-layout,
body.woocommerce-checkout .wc-block-components-sidebar-layout {
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(24px, 2.6vw, 44px);
  align-items: flex-start;
}

body.woocommerce-cart .wc-block-components-main,
body.woocommerce-checkout .wc-block-components-main {
  flex: 1 1 0;
  min-width: 0;
  padding-right: 0;
}

/* WooCommerce sizes main+sidebar to exactly 100%, which leaves no room for the
   column gap and wraps the summary onto its own row. Pin the sidebar instead. */
body.woocommerce-cart .wc-block-components-sidebar,
body.woocommerce-checkout .wc-block-components-sidebar {
  flex: 0 0 clamp(300px, 32%, 400px);
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--emagcy-border);
  border-radius: var(--emagcy-radius);
  background: var(--emagcy-bg-secondary);
}

/* the empty-cart CTA belongs to the empty state only */
body.woocommerce-cart .wp-block-woocommerce-filled-cart-block .emagcy-empty-cart-actions {
  display: none;
}

/* =============================================================================
   4. CART — product rows
   ========================================================================== */

/* The theme gives .alignwide a -80px side margin, which drags the whole block
   off-canvas on small screens. Cart/Checkout follow the page shell instead. */
body.woocommerce-cart .wp-block-woocommerce-cart,
body.woocommerce-cart .wp-block-woocommerce-cart.alignwide,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block.alignwide,
body.woocommerce-checkout .wp-block-woocommerce-checkout,
body.woocommerce-checkout .wp-block-woocommerce-checkout.alignwide {
  width: auto;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

body.woocommerce-cart .wc-block-cart-items {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: transparent;
}

body.woocommerce-cart .wc-block-cart-items__header {
  border-bottom: 1px solid var(--emagcy-border);
  color: var(--emagcy-text-secondary);
  font-family: var(--emagcy-font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.woocommerce-cart .wc-block-cart-items__header th {
  padding-bottom: 12px;
  border: 0;
  color: var(--emagcy-text-secondary);
}

body.woocommerce-cart .wc-block-cart-items__row {
  border-bottom: 1px solid var(--emagcy-border);
}

body.woocommerce-cart .wc-block-cart-items__row td {
  padding-block: 20px;
  border: 0;
  vertical-align: top;
  background: transparent;
}

body.woocommerce-cart .wc-block-cart-item__image {
  width: 104px;
  padding-right: 18px;
}

body.woocommerce-cart .wc-block-cart-item__image img {
  width: 88px;
  height: 88px;
  padding: 8px;
  border: 1px solid var(--emagcy-border);
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-card);
  object-fit: contain;
}

body.woocommerce-cart .wc-block-components-product-name {
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none !important;
}

body.woocommerce-cart .wc-block-components-product-name:hover {
  color: var(--emagcy-orange) !important;
}

body.woocommerce-cart .wc-block-cart-item__product .wc-block-components-product-price,
body.woocommerce-cart .wc-block-components-product-metadata {
  color: var(--emagcy-text-secondary);
  font-size: 0.85rem;
}

body.woocommerce-cart .wc-block-components-product-metadata__description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  color: var(--emagcy-text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

body.woocommerce-cart .wc-block-cart-item__total,
body.woocommerce-cart .wc-block-cart-item__total .wc-block-components-product-price__value {
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-display);
  font-size: 1.02rem;
  font-weight: 700;
  text-align: right;
}

/* remove — subtle, never aggressive red text */
body.woocommerce-cart .wc-block-cart-item__remove-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 0;
  border: 0 !important;
  background: transparent !important;
  color: var(--emagcy-text-secondary) !important;
  font-size: 0.78rem;
  text-decoration: none !important;
  cursor: pointer;
  transition: color 160ms var(--emagcy-ease);
}

body.woocommerce-cart .wc-block-cart-item__remove-link:hover {
  color: var(--emagcy-orange) !important;
}

body.woocommerce-cart .wc-block-cart-item__remove-link:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================================
   5. QUANTITY CONTROL  [-] n [+]   (native block logic preserved)
   ========================================================================== */

body.woocommerce-cart .wc-block-components-quantity-selector {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 128px;
  margin-top: 12px;
  border: 1px solid var(--emagcy-border-strong);
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-card);
  overflow: hidden;
}

body.woocommerce-cart .wc-block-components-quantity-selector::after {
  display: none;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  color: var(--emagcy-text-primary) !important;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  opacity: 1;
  cursor: pointer;
  transition: background-color 160ms var(--emagcy-ease), color 160ms var(--emagcy-ease);
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:hover {
  background-color: rgba(255, 98, 0, 0.14) !important;
  color: var(--emagcy-orange) !important;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: -2px;
}

body.woocommerce-cart .wc-block-components-quantity-selector__button:disabled,
body.woocommerce-cart .wc-block-components-quantity-selector__button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input {
  width: 44px;
  min-width: 44px;
  height: 42px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  box-shadow: none !important;
}

body.woocommerce-cart .wc-block-components-quantity-selector__input:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: -2px;
}

/* =============================================================================
   6. TOTALS PANEL (cart + checkout share the tokens)
   ========================================================================== */

body.woocommerce-cart .wc-block-cart__totals-title,
body.woocommerce-checkout .wc-block-components-checkout-order-summary__title {
  display: block;
  margin-bottom: 14px;
  padding-bottom: 0;
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body.woocommerce-cart .wc-block-components-totals-wrapper,
body.woocommerce-checkout .wc-block-components-totals-wrapper {
  padding-block: 14px;
  border-top: 1px solid var(--emagcy-border);
}

body.woocommerce-cart .wc-block-components-totals-wrapper:first-child,
body.woocommerce-checkout .wc-block-components-totals-wrapper:first-child {
  border-top: 0;
}

body.woocommerce-cart .wc-block-components-totals-item,
body.woocommerce-checkout .wc-block-components-totals-item {
  color: var(--emagcy-text-secondary);
  font-size: 0.9rem;
}

body.woocommerce-cart .wc-block-components-totals-item__label,
body.woocommerce-checkout .wc-block-components-totals-item__label {
  color: var(--emagcy-text-secondary);
  font-weight: 500;
}

body.woocommerce-cart .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-totals-item__value {
  color: var(--emagcy-text-primary);
  font-weight: 600;
}

body.woocommerce-cart .wc-block-components-totals-item__description,
body.woocommerce-checkout .wc-block-components-totals-item__description {
  color: var(--emagcy-steel);
  font-size: 0.76rem;
}

/* TOTAL — visually strongest row */
body.woocommerce-cart .wc-block-components-totals-footer-item,
body.woocommerce-checkout .wc-block-components-totals-footer-item {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--emagcy-border-strong);
}

body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* WooCommerce also puts the tax-value class on the real total amount, so the
   money element inside the footer value must follow the TOTAL styling. */
body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value .wc-block-formatted-money-amount,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value .wc-block-formatted-money-amount {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

body.woocommerce-cart .wc-block-components-totals-footer-item-tax-value:not(.wc-block-formatted-money-amount),
body.woocommerce-checkout .wc-block-components-totals-footer-item-tax-value:not(.wc-block-formatted-money-amount) {
  color: var(--emagcy-steel);
  font-size: 0.74rem;
}

/* =============================================================================
   7. COUPON — restrained, never dominates the summary
   ========================================================================== */

body.woocommerce-cart .wc-block-components-totals-coupon,
body.woocommerce-checkout .wc-block-components-totals-coupon {
  padding-block: 12px;
}

body.woocommerce-cart .wc-block-components-panel__button,
body.woocommerce-checkout .wc-block-components-panel__button {
  padding: 6px 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--emagcy-text-secondary) !important;
  font-family: var(--emagcy-font-body) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  text-align: left;
  cursor: pointer;
}

body.woocommerce-cart .wc-block-components-panel__button:hover,
body.woocommerce-checkout .wc-block-components-panel__button:hover {
  color: var(--emagcy-orange) !important;
}

body.woocommerce-cart .wc-block-components-panel__button:focus-visible,
body.woocommerce-checkout .wc-block-components-panel__button:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: 3px;
  border-radius: 4px;
}

body.woocommerce-cart .wc-block-components-panel__button-icon,
body.woocommerce-checkout .wc-block-components-panel__button-icon {
  fill: currentColor;
}

body.woocommerce-cart .wc-block-components-totals-coupon__form,
body.woocommerce-checkout .wc-block-components-totals-coupon__form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 10px;
}

body.woocommerce-cart .wc-block-components-totals-coupon__input,
body.woocommerce-checkout .wc-block-components-totals-coupon__input {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

body.woocommerce-cart .wc-block-components-totals-coupon__button,
body.woocommerce-checkout .wc-block-components-totals-coupon__button {
  flex: 0 0 auto;
  min-height: 46px;
}

/* applied coupon chips */
body.woocommerce-cart .wc-block-components-chip,
body.woocommerce-checkout .wc-block-components-chip {
  border: 1px solid var(--emagcy-border-strong) !important;
  border-radius: 999px !important;
  background: var(--emagcy-card) !important;
  color: var(--emagcy-text-primary) !important;
}

body.woocommerce-cart .wc-block-components-chip__remove,
body.woocommerce-checkout .wc-block-components-chip__remove {
  fill: var(--emagcy-text-secondary);
}

/* =============================================================================
   8. FORM CONTROLS — inputs, selects, checkboxes, textarea
   ========================================================================== */

body.woocommerce-cart .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-blocks-components-select__select,
body.woocommerce-checkout .wc-block-components-textarea,
body.woocommerce-checkout input[type="text"],
body.woocommerce-checkout input[type="email"],
body.woocommerce-checkout input[type="tel"],
body.woocommerce-checkout input[type="number"],
body.woocommerce-checkout input[type="password"],
body.woocommerce-checkout textarea,
body.woocommerce-checkout select {
  width: 100%;
  min-height: 52px;
  padding: 18px 14px 6px;
  border: 1px solid var(--emagcy-border-strong) !important;
  border-radius: var(--emagcy-radius-sm) !important;
  background: var(--emagcy-card) !important;
  background-color: var(--emagcy-card) !important;
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-body) !important;
  font-size: 0.95rem;
  box-shadow: none !important;
  transition: border-color 160ms var(--emagcy-ease), box-shadow 160ms var(--emagcy-ease);
}

body.woocommerce-checkout textarea {
  min-height: 96px;
  padding-top: 14px;
  line-height: 1.6;
}

body.woocommerce-cart .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-blocks-components-select__select:focus,
body.woocommerce-checkout input:focus,
body.woocommerce-checkout textarea:focus,
body.woocommerce-checkout select:focus {
  border-color: var(--emagcy-orange) !important;
  box-shadow: 0 0 0 3px rgba(255, 98, 0, 0.16) !important;
  outline: none !important;
}

body.woocommerce-checkout input::placeholder,
body.woocommerce-checkout textarea::placeholder {
  color: var(--emagcy-steel);
}

body.woocommerce-cart .wc-block-components-text-input label,
body.woocommerce-checkout .wc-block-components-text-input label,
body.woocommerce-checkout .wc-blocks-components-select__label {
  color: var(--emagcy-steel) !important;
  font-family: var(--emagcy-font-body);
  font-size: 0.86rem;
}

body.woocommerce-checkout .wc-block-components-text-input.is-active label,
body.woocommerce-checkout .wc-blocks-components-select__label {
  font-size: 0.72rem;
}

body.woocommerce-checkout .wc-blocks-components-select__expand {
  fill: var(--emagcy-steel);
}

/* select needs room for the native chevron */
body.woocommerce-checkout .wc-blocks-components-select__select {
  padding-right: 40px;
  appearance: none;
}

/* validation — clear but restrained */
body.woocommerce-checkout .wc-block-components-text-input.has-error input,
body.woocommerce-checkout .has-error input,
body.woocommerce-checkout input[aria-invalid="true"] {
  border-color: var(--emagcy-error) !important;
  background-color: var(--emagcy-error-bg) !important;
}

body.woocommerce-checkout .wc-block-components-validation-error,
body.woocommerce-checkout .wc-block-components-validation-error p {
  color: var(--emagcy-error) !important;
  font-size: 0.78rem;
}

/* checkboxes + radios */
body.woocommerce-checkout .wc-block-components-checkbox__input,
body.woocommerce-checkout input[type="checkbox"],
body.woocommerce-checkout input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid var(--emagcy-border-strong) !important;
  border-radius: 5px !important;
  background: var(--emagcy-card) !important;
  accent-color: var(--emagcy-orange);
  cursor: pointer;
}

body.woocommerce-checkout input[type="radio"] {
  border-radius: 50% !important;
}

body.woocommerce-checkout .wc-block-components-checkbox__input:checked,
body.woocommerce-checkout input[type="checkbox"]:checked {
  border-color: var(--emagcy-orange) !important;
  background: var(--emagcy-orange) !important;
}

body.woocommerce-checkout .wc-block-components-checkbox__mark {
  fill: var(--emagcy-on-orange);
}

body.woocommerce-checkout .wc-block-components-checkbox__label,
body.woocommerce-checkout .wc-block-components-checkbox label {
  color: var(--emagcy-text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
}

body.woocommerce-checkout .wc-block-components-checkbox__input:focus-visible,
body.woocommerce-checkout input[type="checkbox"]:focus-visible,
body.woocommerce-checkout input[type="radio"]:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: 2px;
}

/* =============================================================================
   9. CHECKOUT — steps, address cards, payment
   ========================================================================== */

body.woocommerce-checkout .wc-block-components-checkout-step {
  margin-bottom: 20px;
  padding: 24px;
  border: 1px solid var(--emagcy-border);
  border-radius: var(--emagcy-radius);
  background: var(--emagcy-bg-secondary);
}

body.woocommerce-checkout .wc-block-components-checkout-step__title,
body.woocommerce-checkout .wc-block-components-title {
  margin: 0;
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-display) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
}

body.woocommerce-checkout .wc-block-components-checkout-step__description,
body.woocommerce-checkout .wc-block-components-checkout-step__heading-content {
  color: var(--emagcy-text-secondary);
  font-size: 0.86rem;
}

body.woocommerce-checkout .wc-block-components-checkout-step__content {
  margin-top: 18px;
  padding-bottom: 0;
}

body.woocommerce-checkout .wc-block-components-address-card {
  padding: 16px;
  border: 1px solid var(--emagcy-border) !important;
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-card);
  color: var(--emagcy-text-secondary);
}

body.woocommerce-checkout .wc-block-components-address-card__address-section--primary {
  color: var(--emagcy-text-primary);
  font-weight: 600;
}

body.woocommerce-checkout .wc-block-checkout__actions,
body.woocommerce-checkout .wc-block-checkout__actions_row {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
}

body.woocommerce-checkout .wc-block-checkout__terms,
body.woocommerce-checkout .wc-block-checkout__terms--with-separator {
  border-color: var(--emagcy-border) !important;
  color: var(--emagcy-text-secondary);
  font-size: 0.84rem;
}

body.woocommerce-checkout .wc-block-checkout__terms a {
  color: var(--emagcy-text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.woocommerce-checkout .wc-block-checkout__terms a:hover {
  color: var(--emagcy-orange);
}

/* order summary items */
body.woocommerce-checkout .wc-block-components-order-summary-item {
  padding-block: 14px;
  border-bottom: 1px solid var(--emagcy-border);
}

body.woocommerce-checkout .wc-block-components-order-summary-item__image img {
  border: 1px solid var(--emagcy-border);
  border-radius: 8px;
  background: var(--emagcy-card);
  object-fit: contain;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__quantity {
  border: 1px solid var(--emagcy-border-strong) !important;
  background: var(--emagcy-orange) !important;
  color: var(--emagcy-on-orange) !important;
  font-weight: 700;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__description .wc-block-components-product-name {
  color: var(--emagcy-text-primary) !important;
  font-family: var(--emagcy-font-display);
  font-size: 0.92rem;
  font-weight: 700;
}

body.woocommerce-checkout .wc-block-components-order-summary-item__total-price {
  color: var(--emagcy-text-primary);
  font-weight: 700;
}

/* payment area — style, never hide, the gateway state */
body.woocommerce-checkout .wc-block-checkout__no-payment-methods-notice,
body.woocommerce-checkout .wc-block-components-notice-banner.is-error,
body.woocommerce-checkout .wc-block-components-notice-banner.is-warning {
  border: 1px solid rgba(255, 107, 107, 0.4) !important;
  border-radius: var(--emagcy-radius-sm) !important;
  background: var(--emagcy-error-bg) !important;
  color: var(--emagcy-text-primary) !important;
}

body.woocommerce-checkout .wc-block-components-radio-control-accordion-option {
  border: 1px solid var(--emagcy-border) !important;
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-card);
  margin-bottom: 10px;
}

/* =============================================================================
   10. NOTICES — semantic meaning preserved
   ========================================================================== */

body.woocommerce-cart .wc-block-components-notice-banner,
body.woocommerce-checkout .wc-block-components-notice-banner,
body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart .woocommerce-error {
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-bg-secondary);
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-body);
  font-size: 0.9rem;
}

body.woocommerce-cart .wc-block-components-notice-banner.is-success,
body.woocommerce-checkout .wc-block-components-notice-banner.is-success,
body.woocommerce-cart .woocommerce-message {
  border: 1px solid rgba(78, 216, 160, 0.4) !important;
  background: var(--emagcy-success-bg) !important;
}

body.woocommerce-cart .wc-block-components-notice-banner.is-info,
body.woocommerce-checkout .wc-block-components-notice-banner.is-info,
body.woocommerce-cart .woocommerce-info {
  border: 1px solid var(--emagcy-border-strong) !important;
  background: var(--emagcy-card) !important;
}

body.woocommerce-cart .wc-block-components-notice-banner__content,
body.woocommerce-checkout .wc-block-components-notice-banner__content {
  color: var(--emagcy-text-primary);
}

body.woocommerce-cart .wc-block-components-notice-banner a,
body.woocommerce-checkout .wc-block-components-notice-banner a {
  color: var(--emagcy-orange);
}

/* =============================================================================
   11. EMPTY CART
   ========================================================================== */

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block {
  max-width: 560px;
  margin-inline: auto;
  padding: 40px 28px;
  border: 1px solid var(--emagcy-border);
  border-radius: var(--emagcy-radius);
  background: var(--emagcy-bg-secondary);
  text-align: center;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block h2,
body.woocommerce-cart .cart-empty {
  margin: 0 0 10px;
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block p {
  color: var(--emagcy-text-secondary);
  font-size: 0.92rem;
}

body.woocommerce-cart .emagcy-empty-cart-actions {
  margin: 4px 0 0;
  text-align: center;
}

body.woocommerce-cart .emagcy-empty-cart-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 30px;
  border: 1px solid var(--emagcy-orange) !important;
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-orange) !important;
  color: var(--emagcy-on-orange) !important;
  font-family: var(--emagcy-font-body);
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background-color 180ms var(--emagcy-ease), transform 180ms var(--emagcy-ease);
}

body.woocommerce-cart .emagcy-empty-cart-cta:hover {
  background: var(--emagcy-orange-hover) !important;
  color: var(--emagcy-on-orange) !important;
  transform: translateY(-1px);
}

body.woocommerce-cart .emagcy-empty-cart-cta:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 3px;
}

/* "New in store" suggestions inside the empty cart stay secondary */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-title,
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-components-product-title {
  color: var(--emagcy-text-primary);
  font-family: var(--emagcy-font-display);
  font-size: 0.9rem;
}

body.woocommerce-cart .wp-block-woocommerce-empty-cart-block .wc-block-grid__product-price {
  color: var(--emagcy-text-secondary);
}

/* =============================================================================
   12. EMAGCY trust strip (rendered after the checkout block, outside React)
   ========================================================================== */

.emagcy-checkout-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  width: min(100% - 40px, 1280px);
  margin: 20px auto 48px;
  padding: 16px 20px;
  border: 1px solid var(--emagcy-border, rgba(255,255,255,0.08));
  border-radius: 12px;
  background: #0E2438;
  color: #A6B6C8;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
}

.emagcy-checkout-trust span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.emagcy-checkout-trust span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FF6200;
}

.emagcy-checkout-edit-cart {
  margin: 0 0 12px;
}

.emagcy-checkout-edit-cart a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--emagcy-border-strong);
  border-radius: var(--emagcy-radius-sm);
  background: var(--emagcy-bg-secondary);
  color: var(--emagcy-text-primary) !important;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none !important;
}

.emagcy-checkout-edit-cart a:hover,
.emagcy-checkout-edit-cart a:active {
  border-color: var(--emagcy-orange);
  background: var(--emagcy-card);
  color: var(--emagcy-text-primary) !important;
}

.emagcy-checkout-edit-cart a:focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: 3px;
}

/* =============================================================================
   13. RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
  body.woocommerce-cart .site-main,
  body.woocommerce-checkout .site-main {
    width: min(100% - 32px, 1280px);
  }
}

/* tablet / small laptop — stack the sidebar layout */
@media (max-width: 900px) {
  body.woocommerce-cart .wc-block-components-sidebar-layout,
  body.woocommerce-checkout .wc-block-components-sidebar-layout {
    display: block;
  }

  body.woocommerce-cart .wc-block-components-sidebar,
  body.woocommerce-checkout .wc-block-components-sidebar {
    width: 100%;
    margin-top: 24px;
    padding: 20px;
  }

  body.woocommerce-cart .wc-block-components-main,
  body.woocommerce-checkout .wc-block-components-main {
    width: 100%;
  }
}

/* mobile — cart becomes stacked cards, never a squeezed table */
@media (max-width: 640px) {
  body.woocommerce-cart .site-main,
  body.woocommerce-checkout .site-main {
    width: min(100% - 24px, 1280px);
    padding-block: 24px 40px;
  }

  /* WooCommerce already ships a responsive grid for the block cart rows.
     Only the EMAGCY card treatment is layered on; overriding their
     grid-template-columns here pushed rows outside the viewport. */
  body.woocommerce-cart .wc-block-cart-items__header {
    display: none;
  }

  body.woocommerce-cart .wc-block-cart-items__row {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--emagcy-border);
    border-radius: var(--emagcy-radius);
    background: var(--emagcy-bg-secondary);
  }

  body.woocommerce-cart .wc-block-cart-items__row td {
    border: 0;
  }

  /* fixed columns clip the line total on narrow screens */
  body.woocommerce-cart .wc-block-cart-items {
    table-layout: auto;
  }

  body.woocommerce-cart .wc-block-cart-item__total,
  body.woocommerce-cart .wc-block-cart-item__total .wc-block-components-product-price__value,
  body.woocommerce-cart .wc-block-cart-item__total .wc-block-formatted-money-amount {
    font-size: 0.88rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.woocommerce-cart .wc-block-cart-item__image img {
    width: 100%;
    height: auto;
    max-width: 84px;
  }

  body.woocommerce-cart .wc-block-components-product-metadata__description {
    display: none;
  }

  body.woocommerce-checkout .wc-block-components-checkout-step {
    padding: 18px 16px;
  }

  body.woocommerce-cart .wc-block-cart__submit-button.wc-block-components-button:not(.is-link),
  body.woocommerce-checkout .wc-block-components-checkout-place-order-button.wc-block-components-button:not(.is-link) {
    min-height: 54px;
    max-height: 58px;
    font-size: 0.98rem;
  }

  /* never sticky-trap a tall summary on mobile */
  body.woocommerce-cart .wc-block-components-sidebar,
  body.woocommerce-checkout .wc-block-components-sidebar {
    position: static !important;
    top: auto !important;
  }
}

@media (max-width: 380px) {
  body.woocommerce-cart .site-main,
  body.woocommerce-checkout .site-main {
    width: min(100% - 16px, 1280px);
  }

  body.woocommerce-cart .wc-block-cart-items__row {
    padding: 12px;
  }

  body.woocommerce-cart .wc-block-components-quantity-selector {
    min-width: 116px;
  }

  body.woocommerce-cart .wc-block-components-totals-footer-item .wc-block-components-totals-item__value,
  body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 1.28rem;
  }
}

/* nothing may overflow horizontally at any width.
   Shop/PDP clip the header's off-canvas drawer via html{overflow-x:hidden};
   setting it on body alone propagates to the viewport and stops clipping, so
   the root element is matched here the same way. */
html:has(body.woocommerce-cart),
html:has(body.woocommerce-checkout) {
  overflow-x: hidden;
}

body.woocommerce-cart,
body.woocommerce-checkout {
  overflow-x: hidden;
}

body.woocommerce-cart img,
body.woocommerce-checkout img {
  max-width: 100%;
  height: auto;
}

/* =============================================================================
   14. ACCESSIBILITY
   ========================================================================== */

body.woocommerce-cart :focus-visible,
body.woocommerce-checkout :focus-visible {
  outline: 2px solid var(--emagcy-orange);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  body.woocommerce-cart *,
  body.woocommerce-checkout * {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }

  body.woocommerce-cart .wc-block-cart__submit-button:hover,
  body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover {
    transform: none;
  }
}
