/* ===== Checkout — segue o design system da LP (--ui-*, Inter, btn-primary preto pill) ===== */

.checkout-page {
  background: var(--ui-white, #fafafb);
  min-height: 100vh;
}

/* HEADER */
.co-header {
  border-bottom: 1px solid var(--ui-surface-2, #e6e6ec);
  background: #fff;
}
.co-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.co-logo img { display: block; height: 28px; width: auto; }
.co-secure {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ui-muted, #666674);
}

/* LAYOUT */
.co-main { padding: 32px 20px 80px; }
.co-container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .co-container { grid-template-columns: 1fr; }
  .co-summary-col { order: -1; }
}

/* PROGRESS */
.co-progress {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}
.co-progress li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ui-muted, #666674);
  padding: 10px 12px;
  background: #fff;
  border-radius: 999px;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
}
.co-progress li.is-active,
.co-progress li.is-done {
  color: var(--ui-text, #1f1f27);
  border-color: var(--ui-text, #1f1f27);
}
.co-progress-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ui-surface, #f1f1f4);
  color: var(--ui-muted, #666674);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.co-progress li.is-active .co-progress-num,
.co-progress li.is-done .co-progress-num {
  background: rgb(0, 0, 0);
  color: #fff;
}

/* STEP ACCORDION */
.co-step {
  background: #fff;
  border-radius: 20px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
  transition: border-color 0.2s;
}
.co-step.is-open { border-color: var(--ui-text, #1f1f27); }
.co-step-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.co-step-head:disabled { cursor: default; opacity: 0.55; }
.co-step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ui-text, #1f1f27);
}
.co-step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ui-surface, #f1f1f4);
  color: var(--ui-text, #1f1f27);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.co-step.is-open .co-step-badge,
.co-step.is-done .co-step-badge {
  background: rgb(0, 0, 0);
  color: #fff;
}
.co-chevron { color: var(--ui-muted, #666674); transition: transform 0.25s; flex-shrink: 0; }
.co-step.is-open .co-chevron { transform: rotate(180deg); }

.co-step-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 22px;
}
.co-step.is-open .co-step-body {
  max-height: 3000px;
  padding: 0 22px 24px;
}

/* FORM FIELDS */
.co-field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.co-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .co-row { grid-template-columns: 1fr; } }
.co-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text, #1f1f27);
}
.co-field input {
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
  padding: 0 14px;
  font-size: 15px;
  font-family: inherit;
  background: var(--ui-white, #fafafb);
  color: var(--ui-text, #1f1f27);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.co-field input:focus {
  outline: none;
  border-color: var(--ui-text, #1f1f27);
  box-shadow: 0 0 0 3px rgba(31, 31, 39, 0.08);
}
.co-field input.is-invalid { border-color: #e5484d; }
.co-hint { font-size: 12px; color: var(--ui-muted, #666674); }
.co-error {
  font-size: 12px;
  color: #e5484d;
  min-height: 14px;
  display: block;
}

.co-btn-next {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
  border: 0;
  font-size: 15px;
  cursor: pointer;
}

/* ADDRESS FIELDS (CEP autocomplete) */
.co-field-cep { max-width: 220px; }
.co-cep-row { position: relative; display: flex; align-items: center; }
.co-cep-row input { width: 100%; }
.co-cep-spinner {
  position: absolute;
  right: 12px;
  width: 16px; height: 16px;
  border: 2px solid var(--ui-surface-2, #e6e6ec);
  border-top-color: var(--ui-text, #1f1f27);
  border-radius: 50%;
  animation: co-spin 0.8s linear infinite;
}
.co-optional { font-weight: 400; color: var(--ui-muted, #666674); }
.co-row-address { grid-template-columns: 1fr 2fr; }
.co-field-uf input { text-transform: uppercase; }
@media (max-width: 480px) {
  .co-field-cep { max-width: none; }
  .co-row-address { grid-template-columns: 1fr; }
}

/* REVIEW STEP */
.co-review-summary { padding-top: 4px; margin-bottom: 8px; }
.co-review-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ui-surface, #f1f1f4);
  font-size: 14px;
}
.co-review-label { color: var(--ui-muted, #666674); }
.co-review-value { color: var(--ui-text, #1f1f27); font-weight: 500; text-align: right; }
.co-edit-link { margin-top: 12px; font-size: 13px; cursor: pointer; background: none; border: 0; padding: 0; }

/* PIX PAYMENT */
.co-pix-state { text-align: center; padding: 30px 10px 10px; }
.co-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--ui-surface-2, #e6e6ec);
  border-top-color: var(--ui-text, #1f1f27);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: co-spin 0.8s linear infinite;
}
@keyframes co-spin { to { transform: rotate(360deg); } }

.co-error-title { font-weight: 600; color: var(--ui-text, #1f1f27); margin-bottom: 4px; }
.co-error-msg { color: var(--ui-muted, #666674); font-size: 14px; margin-bottom: 16px; }

.co-pix-content { padding-top: 6px; text-align: center; }
.co-pix-qr-wrap {
  display: inline-flex;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
  border-radius: 16px;
  margin-bottom: 14px;
}
.co-pix-qr { display: block; width: 200px; height: 200px; object-fit: contain; }
.co-pix-amount { font-size: 24px; font-weight: 600; color: var(--ui-text, #1f1f27); margin: 0 0 4px; }
.co-pix-timer { font-size: 13px; color: var(--ui-muted, #666674); margin: 0 0 20px; }
.co-pix-timer strong { color: var(--ui-text, #1f1f27); }

.co-pix-code-label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ui-text, #1f1f27);
}
.co-pix-code-row { display: flex; gap: 8px; margin-bottom: 20px; }
.co-pix-code-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
  padding: 0 12px;
  font-size: 12px;
  font-family: monospace;
  background: var(--ui-surface, #f1f1f4);
  color: var(--ui-text, #1f1f27);
}
.co-copy-btn { flex-shrink: 0; border: 0; cursor: pointer; padding: 0 20px; }
.co-copy-btn.is-copied { background: rgb(16, 185, 129); }

.co-pix-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ui-muted, #666674);
  padding: 12px;
  background: var(--ui-surface, #f1f1f4);
  border-radius: 10px;
  margin-bottom: 20px;
}
.co-pix-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgb(0, 140, 255);
  animation: co-pulse 1.4s ease-in-out infinite;
}
@keyframes co-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.co-pix-howto {
  text-align: left;
  font-size: 13px;
  color: var(--ui-muted, #666674);
  padding-left: 18px;
  margin: 0;
}
.co-pix-howto li { margin-bottom: 4px; }

/* Desconto por pagar com Pix */
.co-pix-discount-badge {
  display: flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: rgb(16, 150, 105);
  background: rgba(16, 185, 129, 0.12);
  border-radius: 999px;
  padding: 6px 14px;
  margin: 0 auto 14px;
}
.co-pix-discount-badge[hidden] { display: none; }
.co-pix-discount-badge strong { font-weight: 700; }

/* Badges de confiança */
.co-trust {
  text-align: left;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--ui-surface, #f1f1f4);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.co-trust-item { display: flex; gap: 12px; align-items: flex-start; }
.co-trust-icon {
  flex-shrink: 0;
  color: var(--ui-text, #1f1f27);
  opacity: 0.55;
  margin-top: 1px;
}
.co-trust-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text, #1f1f27);
  margin: 0 0 2px;
}
.co-trust-desc {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ui-muted, #666674);
  margin: 0;
}

.co-trust-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 12px;
  border-radius: 10px;
  background: var(--ui-surface, #f1f1f4);
  color: var(--ui-text, #1f1f27);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}
.co-trust-whatsapp:hover { background: var(--ui-surface-2, #e6e6ec); }
.co-trust-whatsapp svg { color: rgb(37, 211, 102); flex-shrink: 0; }

@media (max-width: 600px) {
  .co-trust { gap: 14px; margin-top: 20px; padding-top: 16px; }
  .co-trust-title { font-size: 12.5px; }
  .co-trust-desc { font-size: 11.5px; }
}

.co-check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgb(16, 185, 129);
  color: #fff;
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.co-paid-title { font-size: 18px; font-weight: 600; color: var(--ui-text, #1f1f27); margin-bottom: 4px; }

/* ORDER SUMMARY */
.co-summary-card {
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--ui-surface-2, #e6e6ec);
  padding: 22px;
  position: sticky;
  top: 20px;
}
.co-summary-title { font-size: 16px; font-weight: 500; margin: 0 0 16px; color: var(--ui-text, #1f1f27); }
.co-summary-product { display: flex; gap: 12px; margin-bottom: 18px; }
.co-summary-media {
  width: 64px; height: 64px;
  border-radius: 12px;
  background: var(--ui-surface, #f1f1f4);
  overflow: hidden;
  flex-shrink: 0;
}
.co-summary-media img { width: 100%; height: 100%; object-fit: cover; }
.co-summary-info { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.co-summary-name { font-size: 14px; font-weight: 500; color: var(--ui-text, #1f1f27); margin: 0; }
.co-summary-badge { font-size: 12px; color: var(--ui-muted, #666674); margin: 0; }

/* COUPON */
.co-coupon { margin-bottom: 16px; }
.co-coupon-row { display: flex; gap: 8px; }
.co-coupon-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 10px;
  border: 1px dashed var(--ui-muted, #666674);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-family: inherit;
  background: var(--ui-surface, #f1f1f4);
  color: var(--ui-text, #1f1f27);
}
.co-coupon-input:focus { outline: none; border-color: var(--ui-text, #1f1f27); }
.co-coupon-btn {
  flex-shrink: 0;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 0;
  background: rgb(0, 0, 0);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}
.co-coupon-btn:hover { opacity: 0.85; }
.co-coupon-btn:disabled { opacity: 0.5; cursor: default; }
.co-coupon-msg { font-size: 12px; margin: 6px 0 0; min-height: 14px; }
.co-coupon-msg.is-success { color: rgb(16, 185, 129); font-weight: 500; }
.co-coupon-msg.is-error { color: #e5484d; }
.co-discount { color: rgb(16, 185, 129); font-weight: 500; }

.co-summary-totals { border-top: 1px solid var(--ui-surface, #f1f1f4); padding-top: 14px; }
.co-summary-row {
  display: flex; justify-content: space-between;
  font-size: 14px; color: var(--ui-muted, #666674);
  padding: 4px 0;
}
.co-summary-row[hidden] { display: none; }
.co-free { color: rgb(16, 185, 129); font-weight: 500; }
.co-summary-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--ui-text, #1f1f27);
  border-top: 1px solid var(--ui-surface, #f1f1f4);
  margin-top: 8px;
  padding-top: 12px;
}

.co-summary-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }

/* FOOTER */
.co-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--ui-muted, #666674);
}

/* ===== MOBILE (foco em conversão: toque grande, sem zoom de input, menos scroll) ===== */
@media (max-width: 600px) {
  .co-header-inner { padding: 12px 16px; }
  .co-logo img { height: 24px; }
  .co-secure { font-size: 11px; }
  .co-secure svg { width: 14px; height: 14px; }

  .co-main { padding: 16px 12px 100px; }
  .co-container { gap: 14px; }

  /* Resumo do pedido primeiro, compacto — reforça o que está comprando sem empurrar o form pra baixo */
  .co-summary-card { padding: 14px 16px; position: static; border-radius: 16px; }
  .co-summary-title { font-size: 14px; margin-bottom: 10px; }
  .co-summary-media { width: 48px; height: 48px; border-radius: 10px; }
  .co-summary-name { font-size: 13px; }
  .co-summary-product { margin-bottom: 10px; }
  .co-summary-totals { padding-top: 10px; }
  .co-summary-badges { margin-top: 12px; }

  .co-progress { gap: 6px; margin-bottom: 14px; }
  .co-progress li { padding: 8px; font-size: 0; gap: 0; justify-content: center; }
  .co-progress li span:not(.co-progress-num) { display: none; }
  .co-progress-num { width: 24px; height: 24px; font-size: 12px; }

  .co-step { border-radius: 16px; margin-bottom: 10px; }
  .co-step-head { padding: 16px; min-height: 56px; }
  .co-step-title { font-size: 15px; gap: 10px; }
  .co-step.is-open .co-step-body { padding: 0 16px 18px; }
  .co-step-body { padding: 0 16px; }

  .co-row { grid-template-columns: 1fr; gap: 14px; }

  /* 16px+ evita o zoom automático de foco no iOS Safari — crítico pra não quebrar o fluxo de digitação */
  .co-field input {
    height: 50px;
    font-size: 16px;
    padding: 0 16px;
  }
  .co-field { margin-bottom: 14px; }

  .co-btn-next {
    height: 52px;
    font-size: 16px;
  }

  .co-review-row { font-size: 13px; padding: 9px 0; }

  .co-pix-qr-wrap { padding: 10px; }
  .co-pix-qr { width: 100%; max-width: 220px; height: auto; aspect-ratio: 1 / 1; }
  .co-pix-amount { font-size: 22px; }

  .co-pix-code-row { flex-direction: column; gap: 10px; }
  .co-pix-code-row input {
    height: 48px;
    font-size: 13px;
    text-align: center;
  }
  .co-copy-btn { width: 100%; height: 48px; font-size: 15px; }

  .co-pix-status { font-size: 12px; padding: 10px; }
  .co-pix-howto { font-size: 12px; }

  .co-edit-link, .co-summary-badges .product-tag { min-height: 32px; display: inline-flex; align-items: center; }
}

/* Telas bem pequenas (iPhone SE e afins) — aperta ainda mais sem perder legibilidade */
@media (max-width: 360px) {
  .co-main { padding: 12px 8px 100px; }
  .co-step-head { padding: 14px; }
  .co-step-body { padding: 0 14px; }
  .co-step.is-open .co-step-body { padding: 0 14px 16px; }
  .co-summary-card { padding: 12px; }
}

/* ===== EXIT-INTENT POPUP (black, alta conversão) ===== */
.exit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: exit-fade-in 0.25s ease forwards;
}
/* [hidden] tem especificidade menor que .exit-overlay e seria ignorado sem isto —
   sem essa regra o popup fica sempre visível, mesmo com o atributo hidden setado via JS. */
.exit-overlay[hidden] {
  display: none;
}
@keyframes exit-fade-in { to { opacity: 1; } }

.exit-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgb(15, 15, 18);
  color: #fff;
  border-radius: 24px;
  padding: 36px 32px 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.94) translateY(8px);
  animation: exit-pop-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes exit-pop-in { to { transform: scale(1) translateY(0); } }

.exit-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.exit-close:hover { background: rgba(255, 255, 255, 0.16); }

.exit-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgb(255, 92, 92);
  margin-bottom: 14px;
}
.exit-title {
  font-family: Inter, sans-serif;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: #fff;
}
.exit-body {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 22px;
}

.exit-offer {
  background: linear-gradient(135deg, rgba(0, 140, 255, 0.16), rgba(133, 58, 255, 0.16));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  margin-bottom: 20px;
}
.exit-offer-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(0, 200, 255);
  margin-bottom: 8px;
}
.exit-offer-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
  line-height: 1.15;
}
.exit-offer-value span {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
}
.exit-offer-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}

.exit-cta {
  width: 100%;
  height: 54px;
  border-radius: 999px;
  border: 0;
  background: #fff;
  color: rgb(0, 0, 0);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.2s;
  margin-bottom: 10px;
}
.exit-cta:hover { transform: scale(1.015); opacity: 0.92; }
.exit-cta:disabled {
  background: rgb(16, 185, 129);
  color: #fff;
  cursor: default;
  transform: none;
  opacity: 1;
}
.exit-cta .arrow::after { content: "→"; }

.exit-decline {
  width: 100%;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.exit-decline:hover { color: rgba(255, 255, 255, 0.65); }

@media (max-width: 480px) {
  .exit-modal { padding: 28px 22px 24px; border-radius: 20px; }
  .exit-title { font-size: 20px; }
  .exit-offer-value { font-size: 24px; }
}
