/* ==========================================================
   Cospty Checkout UX v1.0.3 — carrito y checkout sin ruido
   ========================================================== */

/* 0) Cookie bar compacta para no tapar el boton de compra */
#cospty-pwa-banner { display: none !important; }
#cospty-cookie-bar {
  font-size: 12px !important;
  padding: 8px 12px !important;
  gap: 8px !important;
  max-height: 36vh;
  overflow-y: auto;
}
#cospty-cookie-bar .ccb-text {
  flex: 1 1 100% !important;
  min-width: 0 !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
#cospty-cookie-bar button {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

/* 1) Quitar bloques de ruido (solo carrito y checkout) */
body#cart section.ps-emailsubscription,
body#cart #footer,
body#cart #back-to-top,
body#checkout section.ps-emailsubscription,
body#checkout #footer,
body#checkout #back-to-top,
body#checkout #cospty-cookie-bar,
body#checkout .cospty-sh-sticky,
body#checkout .cospty-sh-root {
  display: none !important;
}

/* 2) Campos opcionales fuera del formulario (menos friccion) */
body#checkout .mb-3:has(input[name="birthday"]),
body#checkout .mb-3:has(input[name="optin"]),
body#checkout .mb-3:has(input[name="company"]),
body#checkout .mb-3:has(input[name="vat_number"]),
body#checkout .mb-3:has(input[name="address2"]),
body#checkout .mb-3:has(input[name="whatsapp"]),
body#checkout .mb-3:has(input[name="submitNewsletter"]) {
  display: none !important;
}

/* 3) Comentario de regalo fuera */
body#checkout #delivery_message,
body#checkout .mb-3:has(#delivery_message) {
  display: none !important;
}

/* 4) Transportista: logo pequeno y fila compacta */
body#checkout .delivery-option img {
  max-height: 16px;
  width: auto;
}
body#checkout .carrier-extra-content {
  display: none !important;
}

/* 5) Paso de pago: quitar resumen inferior duplicado (clase puesta por JS) */
body#checkout.cospty-payment-step .js-checkout-summary,
body#checkout.cospty-payment-step .checkout__summary-accordion-wrapper {
  display: none !important;
}

/* En el resumen final del pago, logos de transportista pequenos */
body#checkout #order-summary-content img {
  max-height: 16px;
  width: auto;
}

/* 6) Insignia compacta del transportista en el paso de direccion */
.cospty-gls-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5a6772;
  background: #f4f6f8;
  border: 1px solid #e3e7ea;
  border-radius: 6px;
  padding: 4px 8px;
  margin: 8px 0;
  line-height: 1.3;
}
.cospty-gls-badge img {
  max-height: 14px;
  width: auto;
}

/* ===== v1.0.7: cosptyapp 图标无宽高约束 => 巨型黑三角/黑块破坏结账页 =====
   .cpa-pay-chev(支付卡片箭头) / .cpa-co-back(返回箭头) / .cpa-co-secure(盾牌)
   SVG 无 width/height 属性且无 CSS 约束，被渲染为 342~1440px 黑色图形 */
.cpa-pay-chev svg,
.cpa-co-back svg,
.cpa-co-secure svg,
.cpa-co-head svg,
.cpa-pay-option svg,
.cpa-app-float svg,
.cpa-pwa-banner svg {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  flex: 0 0 auto;
}
.cpa-co-back svg { width: 18px !important; height: 18px !important; max-width: 18px !important; max-height: 18px !important; }
/* 兜底：任何 cpa-* 容器内未显式定尺寸的 svg 不允许超过 48px */
[class^="cpa-"] svg:not([width]):not([height]),
[class*=" cpa-"] svg:not([width]):not([height]) {
  max-width: 48px !important;
  max-height: 48px !important;
}

/* ===== v1.0.8: 桌面端不加载 cosptyapp 手机支付浮层 =====
   手机结账浮层（cpa-cf-* 卡片/条 + cpa-co-head 头）在 >=768px 视口一律隐藏，
   桌面只保留 PrestaShop 原生结算区（原生 TOS、原生 payment-option、原生提交按钮） */
@media (min-width: 768px) {
  .cpa-co-head,
  .cpa-cf-addr, .cpa-cf-addr-txt, .cpa-cf-addr-go,
  .cpa-cf-ship, .cpa-cf-card, .cpa-cf-title, .cpa-cf-summary,
  .cpa-cf-pay, .cpa-cf-terms,
  .cpa-cf-bar, .cpa-cf-bar-t, .cpa-cf-submit {
    display: none !important;
  }
}

/* ===== v1.0.9: 桌面端保证 PS 原生一页结账可见 ===== */
@media (min-width: 768px) {
  #checkout, #js-checkout-summary { display: block !important; visibility: visible !important; }
  #checkout .checkout-step, #checkout section { display: block !important; }
}
