/* =====================================================
   Woo Order Context Suppression
   Scope: Checkout + order-pay lifecycle
   Reason: Duplicate, low-signal, theme-styled block
   ===================================================== */

body.woocommerce-checkout .woocommerce-order {
  display: none !important;
}
body.woocommerce-checkout .woocommerce-order-overview {
  display: none !important;
}

/* =====================================================
   Re-enable Flow for JS-Owned Checkout Stack
   Scope: ORDER-PAY only
   Reason: Legacy Shoptimizer styles collapse height,
           overflow, and break JS-owned layout
   ===================================================== */

body.woocommerce-checkout.woocommerce-order-pay
.bp-fx-checkout-body,
body.woocommerce-checkout.woocommerce-order-pay
.bp-payment-section {
  display: block !important;
  height: auto !important;
  overflow: visible !important;
}

/* =========================================================
   FX DISCLOSURE DESKTOP LAYOUT (PHASE A)
   ---------------------------------------------------------
   - JS owns structure and state
   - Desktop-only two-column authority layout
   - FX context renders before payment CTA
   ========================================================= */

.bp-fx-checkout-body {
  display: block;
  width: 100%;
  margin: 0;
}

@media (min-width: 1024px) {
  .bp-fx-checkout-body {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.2fr);
    gap: 24px;
    align-items: start;
  }
}

@media (max-width: 1023px) {
  .bp-fx-checkout-body {
    display: block;
  }
}

@media (min-width: 1024px) {
  .bp-fx-context {
    width: 100%;
    max-width: 520px;
  }

  .bp-fx-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 18px 20px;
    border: 1px solid #d9dee8;
    border-radius: 12px;
    background: #ffffff;
    color: #0b1424;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
      "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 10px 22px rgba(11, 20, 36, 0.08);
  }

  .bp-fx-context-summary {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #0b1424;
  }

  .bp-fx-context-details {
    display: flex;
    flex-direction: column;
    user-select: none;
    gap: 8px;
    margin: 0;
    padding: 0;
  }

  .bp-fx-context-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .bp-fx-context-label {
    font-size: 12px;
    font-weight: 600;
    color: #5b667a;
  }

  .bp-fx-context-value {
    font-size: 12px;
    font-weight: 600;
    color: #0b1424;
    text-align: right;
  }

  .bp-fx-context-lock {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e4e8f2;
    font-size: 12px;
    font-weight: 600;
    color: #1f2b3f;
  }
}

/* =========================================================
   FX DISCLOSURE PILL (V6.1 — CANONICAL)
   ---------------------------------------------------------
   - JS owns structure and state
   - CSS styles ONLY what JS emits
   - Visibility controlled via [hidden]
   - Open state signaled via .bp-fx-pill--open + aria-expanded
   ========================================================= */

.bp-fx-pill,
.bp-fx-pill * {
  box-sizing: border-box;
}

/* ---------------------------------------------------------
   PILL CONTAINER
   --------------------------------------------------------- */

.bp-fx-pill {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 520px;
  padding: 12px 14px;
  margin: 0;
  border: 1px solid #d9dee8;
  border-radius: 14px;
  background: #ffffff;
  color: #0b1424;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 6px 16px rgba(11, 20, 36, 0.08);
}

.bp-fx-pill--nonusd {
  border-color: #cfd6e4;
}

.bp-fx-pill--open {
  border-color: #b6c3da;
  box-shadow: 0 8px 20px rgba(11, 20, 36, 0.12);
}

/* ---------------------------------------------------------
   SUMMARY (BUTTON OR DIV — JS DECIDES)
   --------------------------------------------------------- */

.bp-fx-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

/* Chevron rotation is driven by aria-expanded ONLY */
.bp-fx-summary[aria-expanded="true"] .bp-fx-chevron {
  transform: rotate(180deg);
}

/* ---------------------------------------------------------
   SUMMARY COPY
   --------------------------------------------------------- */

.bp-fx-summary-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bp-fx-summary-text {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #0b1424;
}

.bp-fx-summary-amount {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: #0b1424;
}

.bp-fx-summary-confirmation {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  color: #5b667a;
  opacity: 0.85;
}

/* ---------------------------------------------------------
   CTA + CHEVRON
   --------------------------------------------------------- */

.bp-fx-summary-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1b4fd9;
  cursor: pointer;
  border-radius: 999px;
  transition:
    color 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.bp-fx-summary:hover .bp-fx-summary-cta {
  color: #163ea8;
  background-color: rgba(27, 79, 217, 0.08);
}

.bp-fx-summary:focus-visible .bp-fx-summary-cta {
  color: #163ea8;
  background-color: rgba(27, 79, 217, 0.1);
  box-shadow: 0 0 0 2px rgba(27, 79, 217, 0.25);
}

.bp-fx-chevron {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-right: 2.25px solid currentColor;
  border-bottom: 2.25px solid currentColor;
  transform: rotate(45deg);
  transform-origin: 50% 50%;
  transition: transform 140ms ease-out;
}

/* ---------------------------------------------------------
   DETAILS PANEL
   --------------------------------------------------------- */

.bp-fx-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #e4e8f2;
  font-size: 14px;
  color: #444;
}

/* Visibility is controlled exclusively via [hidden] */
.bp-fx-details[hidden] {
  display: none;
}

/* ---------------------------------------------------------
   DETAILS ROWS
   --------------------------------------------------------- */

.bp-fx-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.bp-fx-label {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
  color: #5b667a;
}

.bp-fx-value {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: #0b1424;
  text-align: right;
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 480px) {
  .bp-fx-pill {
    padding: 10px 12px;
  }

  .bp-fx-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .bp-fx-summary-copy {
    gap: 3px;
  }

  .bp-fx-summary-cta {
    align-self: flex-start;
  }

  .bp-fx-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .bp-fx-value {
    text-align: left;
  }
}
