/* EDD Brand Dashboard Beta 13 — checkout layout, brand-safe, native EDD/Stripe.
   Supports .edd-brand on checkout block itself OR an ancestor Group.
   Add .ebd-exclude to the entire checkout or a section to keep its native styling.
   Stripe's embedded iframe is intentionally never styled. */
:where(.edd-brand:not(.ebd-exclude)) {
  --ebd-checkout-gap: clamp(24px, 3.4vw, 44px);
  --ebd-checkout-padding: clamp(20px, 2.5vw, 32px);
  --ebd-checkout-field: 48px;
  color: var(--edd-ink, #24243b);
  font-size: 16px;
}
/* Content width: ensure both placements are supported. */
:where(.edd-brand:not(.ebd-exclude)) :is(#edd_checkout_form_wrap,.wp-block-edd-checkout):not(.ebd-exclude),
:is(#edd_checkout_form_wrap,.wp-block-edd-checkout).edd-brand:not(.ebd-exclude) {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 1180px !important;
  margin-inline: auto;
  min-width: 0;
}
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form,
.edd-brand:not(.ebd-exclude) #edd_purchase_form {width:100%; min-width:0; max-width:100%; margin:0; box-sizing:border-box; color:var(--edd-ink,#24243b);}
/* Full responsive columns. EDD assigns 50% flex columns; override those. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form > .wp-block-columns:not(.ebd-exclude),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form > .wp-block-columns:not(.ebd-exclude) {
  display:grid !important;
  grid-template-columns:minmax(0, 1.28fr) minmax(310px, 0.9fr) !important;
  gap:var(--ebd-checkout-gap) !important;
  align-items:start !important;
  margin:0 !important;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form > .wp-block-columns > .wp-block-column:not(.ebd-exclude),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form > .wp-block-columns > .wp-block-column:not(.ebd-exclude) {
  flex:none !important; flex-basis:auto !important; width:100% !important;
  min-width:0 !important; max-width:none !important; margin:0 !important;
}
/* Group personal and payment areas into related, accessible cards. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form :is(#edd_checkout_user_info,#edd_cc_fields):not(.ebd-exclude):not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form :is(#edd_checkout_user_info,#edd_cc_fields):not(.ebd-exclude):not(.ebd-exclude *) {
  box-sizing:border-box; width:100%; min-width:0;
  padding:var(--ebd-checkout-padding) !important;
  margin:0 0 22px !important;
  border:1px solid var(--edd-border,#ddd) !important;
  border-radius:var(--edd-radius,14px) !important;
  background:var(--edd-surface,#fff) !important;
  box-shadow:none !important;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form :is(#edd_checkout_user_info,#edd_cc_fields) legend:not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form :is(#edd_checkout_user_info,#edd_cc_fields) legend:not(.ebd-exclude *) {
  padding:0 10px; font-size:1.15em; font-weight:700; line-height:1.3; color:var(--edd-ink,#24243b);
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-form__group:not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form .edd-blocks-form__group:not(.ebd-exclude *) {margin:0 0 18px !important;min-width:0;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-label:not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form .edd-label:not(.ebd-exclude *) {display:block;margin:0 0 7px;color:var(--edd-ink,#24243b);font-size:.95em;font-weight:600;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-description:not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form .edd-description:not(.ebd-exclude *) {font-size:.84em;line-height:1.5;color:var(--edd-muted,#667085);margin:6px 0 0;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form :is(input.edd-input,select.edd-select):not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form :is(input.edd-input,select.edd-select):not(.ebd-exclude *) {
  box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:var(--ebd-checkout-field);
  padding:11px 14px; border:1px solid var(--edd-border,#ddd) !important;
  border-radius:min(var(--edd-radius,14px),12px) !important;
  background:var(--edd-surface,#fff) !important;color:var(--edd-ink,#24243b) !important;
  font:inherit;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form :is(input.edd-input,select.edd-select):focus-visible {outline:2px solid var(--edd-primary,#7042da);outline-offset:2px;}
/* Friendly security note, without changing gateway implementation. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd_secure_site_wrapper:not(.ebd-exclude):not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form #edd_secure_site_wrapper:not(.ebd-exclude):not(.ebd-exclude *) {
  display:flex;align-items:center;gap:12px;min-height:0;
  padding:12px 14px;margin:4px 0 22px;border:1px solid var(--edd-border,#ddd);
  border-radius:10px;background:var(--edd-page,#fafafa);color:var(--edd-ink,#24243b);
  font-size:.91em;line-height:1.5;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd_secure_site_wrapper .padlock {display:inline-flex;flex:none;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd_secure_site_wrapper svg {width:18px;height:21px;fill:currentColor;}
/* Payment Element stays fluid; never alter the iframe itself. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form :is(.edd-stripe-new-card,#edd-card-wrap,#edd-stripe-payment-element):not(.ebd-exclude *) {
  width:100%;max-width:100%;min-width:0;box-sizing:border-box;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edds-field-spacer-shim {margin:0;min-height:0;}
/* Purchase button follows payment fields, full width and consistent across themes. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd_purchase_submit:not(.ebd-exclude):not(.ebd-exclude *) {
  border:0 !important;background:transparent !important;box-shadow:none !important;
  padding:0 !important;margin:2px 0 0 !important;min-width:0;max-width:100%;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd-purchase-button:not(.ebd-exclude *) {
  box-sizing:border-box;display:block;width:100% !important;max-width:100% !important;
  padding:15px 24px !important;min-height:52px;border-radius:min(var(--edd-radius,14px),12px) !important;
  background:var(--edd-primary,#7042da) !important;border:1px solid var(--edd-primary,#7042da) !important;
  color:#fff !important;font:inherit !important;font-weight:700 !important;letter-spacing:0 !important;
  cursor:pointer;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd-purchase-button:not([disabled]):hover {background:var(--edd-primary-dark,#5530ab) !important;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd-purchase-button[disabled] {cursor:not-allowed;opacity:.55;}
/* Cart: clear heading, neutral pricing rows and strong total. */
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks__cart:not(.ebd-exclude):not(.ebd-exclude *),
:where(.edd-brand:not(.ebd-exclude)) #edd_purchase_form .edd-blocks__cart:not(.ebd-exclude):not(.ebd-exclude *) {
  min-width:0;overflow:hidden;border:1px solid var(--edd-border,#ddd) !important;
  border-radius:var(--edd-radius,14px) !important;background:var(--edd-surface,#fff) !important;
  box-shadow:none !important;
}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row:not(.ebd-exclude *) {box-sizing:border-box;padding:18px 20px;gap:14px;min-width:0;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row-header:not(.ebd-exclude *) {background:var(--edd-page,#f7f6fc) !important;color:var(--edd-ink,#24243b) !important;font-weight:700;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row-header :is(div,span):not(.ebd-exclude *) {color:var(--edd-ink,#24243b) !important;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row-item:not(.ebd-exclude *) {border-top:1px solid var(--edd-border,#ddd);background:var(--edd-surface,#fff);line-height:1.45;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row-footer:not(.ebd-exclude *) {background:var(--edd-page,#f7f6fc) !important;border-top:1px solid var(--edd-border,#ddd);}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd_cart_total:not(.ebd-exclude *) {font-size:1.12em;font-weight:750;color:var(--edd-ink,#24243b);}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd_cart_amount:not(.ebd-exclude *) {font-weight:750;color:var(--edd-ink,#24243b);}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__discount:not(.ebd-exclude *) {min-width:0;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd_discount_link:not(.ebd-exclude *) {color:var(--edd-primary,#7042da);background:transparent;border:0;text-decoration:underline;text-underline-offset:3px;font:inherit;cursor:pointer;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form #edd-discount-code-wrap:not(.ebd-exclude *) {max-width:100%;}
.edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks__logged-in:not(.ebd-exclude):not(.ebd-exclude *) {padding:14px 18px;margin:0 0 24px;border:1px solid var(--edd-border,#ddd);border-radius:12px;background:var(--edd-page,#fafafa);color:var(--edd-ink,#24243b);}
/* Don't let columns collapse, and never overflow on mobile. */
@media(max-width:880px) {
 .edd-brand:not(.ebd-exclude) #edd_purchase_form > .wp-block-columns:not(.ebd-exclude) {display:flex!important;flex-direction:column!important;gap:22px!important;}
 .edd-brand:not(.ebd-exclude) #edd_purchase_form > .wp-block-columns > .wp-block-column:not(.ebd-exclude) {width:100%!important;}
}
@media(max-width:480px) {
 .edd-brand:not(.ebd-exclude) {--ebd-checkout-padding:18px;}
 .edd-brand:not(.ebd-exclude) #edd_purchase_form .edd-blocks-cart__row:not(.ebd-exclude *) {padding:14px;}
}

/* Beta 17: Stackless EDD modal checkout compatibility.
   The modal frame is a separate document (not a child of .stackless-mc).
   Do not style Stripe's secured iframe contents from here. */
body.stackless-checkout-frame .stackless-checkout-frame__main {
  padding: clamp(18px, 3vw, 28px) !important;
  color: var(--edd-ink, #24243b);
}
/* The iframe is typically only ~680px wide: never force two checkout columns. */
body.stackless-checkout-frame #edd_purchase_form > .wp-block-columns {
  display: flex !important;
  flex-direction: column !important;
  gap: 26px !important;
  margin: 0 !important;
}
body.stackless-checkout-frame #edd_purchase_form > .wp-block-columns > .wp-block-column {
  width:100% !important; flex: 0 0 auto !important; min-width:0 !important;
  max-width:100% !important; margin:0 !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(#edd_checkout_user_info,#edd_cc_fields) {
  margin-bottom: 24px !important;
  padding: clamp(18px, 3vw, 28px) !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(.edd-blocks__cart,#edd_checkout_cart_form) {
  margin-bottom: 26px !important;
}
body.stackless-checkout-frame #edd_purchase_form .edd-blocks-cart__row-item {
  padding-block: 20px !important;
}
/* EDD gateway selector is separate from the Stripe Payment Element. */
body.stackless-checkout-frame #edd_purchase_form :is(#edd_payment_mode_select,#edd-payment-mode-wrap,.edd-blocks__gateways) {
  min-width:0 !important; max-width:100% !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(#edd-payment-mode-wrap,.edd-blocks__gateways) {
  display:flex !important; flex-wrap:wrap !important;
  gap:12px !important; margin:12px 0 24px !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(.edd-gateway-option,.edd-blocks__gateway) {
  box-sizing:border-box; flex: 1 1 175px !important;
  width:auto !important; min-width:0 !important;
  padding:14px 16px !important; margin:0 !important;
  line-height:1.5; white-space:normal !important;
  border-radius:min(var(--edd-radius,14px),12px);
}
body.stackless-checkout-frame #edd_purchase_form :is(.edd-gateway-option,.edd-blocks__gateway) label {
  white-space:normal !important; overflow-wrap:anywhere;
}
/* Larger, less crowded secure payment and submit area. */
body.stackless-checkout-frame #edd_purchase_form #edd_secure_site_wrapper {
  margin-bottom:24px !important;
}
body.stackless-checkout-frame #edd_purchase_form #edd_purchase_submit {
  margin-top:20px !important;
}
/* A slightly wider modal shell on desktops; iframe height remains Stackless-controlled. */
@media (min-width: 800px) {
  .stackless-mc .stackless-mc__panel {max-width:min(800px,calc(100vw - 48px));}
}
@media (max-width: 480px) {
  body.stackless-checkout-frame .stackless-checkout-frame__main {padding:14px !important;}
  body.stackless-checkout-frame #edd_purchase_form :is(.edd-gateway-option,.edd-blocks__gateway) {flex-basis:100% !important;}
}


/* Beta 18 — gateway choices: readable, stacked inside Stackless modal.
   Targets EDD's outer gateway selector only, not the Stripe Payment Element. */
body.stackless-checkout-frame #edd_purchase_form :is(#edd_payment_mode_select, #edd-payment-mode-wrap, .edd-blocks__gateways, .edd-gateway-options, ul.edd-payment-mode-selector):not(.ebd-exclude *) {
  display:flex !important;
  flex-direction:column !important;
  flex-wrap:nowrap !important;
  align-items:stretch !important;
  gap:12px !important;
  width:100% !important;
  margin-block:16px 26px !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(#edd_payment_mode_select, #edd-payment-mode-wrap, .edd-blocks__gateways, .edd-gateway-options, ul.edd-payment-mode-selector) :is(li, .edd-gateway-option, .edd-blocks__gateway):not(.ebd-exclude *) {
  display:block !important;
  flex:0 0 auto !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  box-sizing:border-box;
}
body.stackless-checkout-frame #edd_purchase_form :is(.edd-gateway-option, .edd-blocks__gateway):not(.ebd-exclude *) {
  flex:0 0 auto !important;
  width:100% !important;
  min-height:52px;
  padding:14px 18px !important;
  font-size:15px;
}
body.stackless-checkout-frame #edd_purchase_form :is(#edd_payment_mode_select, #edd-payment-mode-wrap, .edd-blocks__gateways, .edd-gateway-options) label:not(.ebd-exclude *) {
  white-space:normal !important;
  overflow-wrap:break-word !important;
  line-height:1.45 !important;
}
/* Spacing between the order and payment method fieldsets. */
body.stackless-checkout-frame #edd_purchase_form :is(.edd-blocks__cart, #edd_checkout_cart_form) {
  margin-bottom:26px !important;
}
body.stackless-checkout-frame #edd_purchase_form :is(#edd_payment_mode_select, #edd-payment-mode-wrap) legend {
  margin-bottom:14px;
}
/* Let Stripe own the outer payment-element appearance. Do not touch its iframe. */
body.stackless-checkout-frame #edd_purchase_form :is(.edd-stripe-new-card, #edd-card-wrap, #edd-stripe-payment-element):not(.ebd-exclude *) {
  background:transparent !important;
  border:0 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  padding:0 !important;
  max-width:100% !important;
  min-width:0 !important;
}
body.stackless-checkout-frame #edd_purchase_form .edd-stripe-new-card {
  margin-top:14px;
}
/* Avoid generic input rules stretching gateway radio controls. */
body.stackless-checkout-frame #edd_purchase_form input[type=radio],
body.stackless-checkout-frame #edd_purchase_form input[type=checkbox] {
  width:auto !important;
  min-height:0 !important;
  padding:0 !important;
  flex:none !important;
}
