/* BF Ultra — checkout/carrinho/conta (WooCommerce). Carregado só nas páginas do WooCommerce e nas de perfil "completo" (ver bfu_css_profile em inc/setup.php). */
/* ============================================================
   CHECKOUT — responsivo mobile
   Ordem: 1=notificações, título, 2=pedido, 3=dados, 4=obs, 5=pagamento
   ============================================================ */
@media(max-width:900px){
  /* Wrap: sem padding extra */
  .bfu-checkout-wrap {
    padding:0 0 60px !important;
    max-width:100% !important;
  }

  /* 1. Notificações: 16px abaixo do header (padding-top:0 no wrap garante isso) */
  .bfu-checkout-notices {
    margin-top:0 !important;
    margin-bottom:0 !important;
    padding:0 !important;
  }
  .bfu-checkout-notices:empty { display:none !important; }

  /* Título: 16px abaixo das notificações, 32px se não houver notificações */
  .bfu-checkout-title {
    margin-top:16px !important;
    margin-bottom:20px !important;
    padding:0 !important;
    font-size:22px !important;
  }

  /* Grid → flex coluna */
  .bfu-checkout-grid {
    display:flex !important;
    flex-direction:column !important;
    gap:0 !important;
  }

  /* display:contents para reordenar entre colunas */
  .bfu-checkout-col-form,
  .bfu-checkout-col-summary {
    display:contents !important;
  }

  /* Ordens */
  .bfu-checkout-col-summary > div:first-child { order:2; } /* 2. Seu pedido */
  .bfu-checkout-col-summary > p               { order:2; margin-top:6px !important; margin-bottom:17px !important; } /* texto segurança */
  .bfu-checkout-dados                         { order:3; }
  .bfu-checkout-obs                           { order:4; }
  .bfu-checkout-payment                       { order:5; }

  /* Cards: margin lateral + sem sticky */
  .bfu-checkout-section,
  .bfu-checkout-col-summary > div:first-child {
    margin-bottom:12px !important;
    width:100% !important;
    box-sizing:border-box !important;
  }
  .bfu-checkout-col-summary {
    position:static !important;
    top:auto !important;
  }
  .bfu-checkout-col-summary > div:first-child {
    position:static !important;
  }

  /* Grid 2col dos campos de dados → 1 coluna */
  .bfu-checkout-dados [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns:1fr !important;
  }
}

/* ============================================================
   CHECKOUT — espaçamento notificações + Stripe fixes
   ============================================================ */

/* Notificações: 16px abaixo do header (removendo espaço anterior de 64px) */
@media(max-width:900px){
  .bfu-checkout-wrap {
    padding-top:0 !important;
  }
  .bfu-checkout-notices {
    margin-top:16px !important;
  }
  /* Stripe Express Checkout (Link button) — conter no fluxo do layout */
  #wc-stripe-express-checkout-element,
  .wc-stripe-express-checkout-element-container,
  .wc-stripe-express-checkout-wrapper {
    max-width:100% !important;
    overflow:hidden !important;
    box-sizing:border-box !important;
  }
  /* O iframe do botão Stripe Link injetado diretamente no body */
  body > iframe[src*="stripe.com/v3/elements-inner-easel"],
  body > iframe[src*="stripe.com"][style*="163px"],
  body > iframe[src*="stripe.com"][style*="position: fixed"] {
    max-width:calc(100vw - 32px) !important;
    right:16px !important;
    left:auto !important;
    border-radius:8px !important;
  }
  /* Stripe UPE form — sem overflow */
  #wc-stripe-upe-form,
  .wc-upe-form,
  .wc-payment-form,
  .StripeElement,
  .wc-stripe-upe-element {
    max-width:100% !important;
    overflow:hidden !important;
    box-sizing:border-box !important;
  }
  /* Input oculto do Stripe que tem width:100vw */
  #wc-stripe-hidden-style-input {
    width:1px !important;
    height:1px !important;
    position:absolute !important;
    opacity:0 !important;
    pointer-events:none !important;
  }
}
