/* === Reset === */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

:root {
  --bg-page: #e6ecfe;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --red: #ef4444;
  --green: #10b981;
  --green-dark: #059669;
  --green-soft: #ecfdf5;
  --indigo: #4f46e5;
  --field-bg: #ffffff;
}

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.4;
}

.page { min-height: 100vh; background: var(--bg-page); }
.container { max-width: 420px; margin: 0 auto; padding: 16px 12px 24px; }

/* === Card === */
.card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.card-title-red {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}

/* === Produto principal === */
.product-row { display: flex; gap: 12px; align-items: flex-start; }
.product-thumb {
  width: 64px; height: 64px;
  border-radius: 6px; object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}
.product-info { flex: 1; min-width: 0; }
.product-name {
  margin: 0 0 8px;
  font-size: 14px; font-weight: 700; color: var(--text);
  line-height: 1.3;
}
.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-label { font-size: 13px; color: var(--text); }
.qty-control {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden;
}
.qty-btn {
  background: #f3f4f6; color: var(--text); border: 0;
  width: 30px; height: 30px;
  font-size: 18px; line-height: 1; font-weight: 500;
}
.qty-btn:hover { background: #e5e7eb; }
.qty-value {
  min-width: 36px; text-align: center;
  font-size: 14px; font-weight: 600;
  background: #fff;
  padding: 0 6px;
}
.product-price {
  margin-top: 14px;
  font-size: 22px; font-weight: 800; color: #0f172a;
}

/* === Step header === */
.step-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step-badge {
  background: var(--green); color: #fff;
  width: 28px; height: 28px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.step-title {
  margin: 0;
  font-size: 14px; font-weight: 800;
  color: #0f172a; letter-spacing: .02em;
  background: var(--green-soft);
  padding: 4px 12px; border-radius: 999px;
}

/* === Fields === */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 11px; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
  letter-spacing: .04em;
}
.input-wrap {
  position: relative;
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--field-bg);
  transition: border-color .15s;
}
.input-wrap:focus-within { border-color: var(--indigo); }
.input-wrap.plain { padding: 0; }
.input-icon {
  width: 18px; height: 18px;
  color: var(--muted-2);
  margin-left: 12px;
  flex-shrink: 0;
}
.input-wrap input {
  border: 0; outline: none; background: transparent;
  flex: 1; min-width: 0;
  padding: 12px 12px;
  font-size: 14px; color: var(--text);
}
.input-wrap input::placeholder { color: var(--muted-2); }

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.field-hint.is-loading { color: var(--indigo); }
.field-hint.is-error { color: var(--red); }

/* === Shipping === */
.frete-title { margin: 10px 0 8px; font-size: 15px; font-weight: 700; color: var(--text); }
.shipping-option {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--green);
  background: var(--green-soft);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}
.radio-dot {
  width: 16px; height: 16px;
  border-radius: 999px;
  border: 1.5px solid var(--green);
  background: #fff;
  position: relative;
  flex-shrink: 0;
}
.shipping-option.selected .radio-dot::after {
  content: '';
  position: absolute; inset: 3px;
  background: var(--green);
  border-radius: 999px;
}
.ship-name { font-weight: 700; color: var(--green-dark); font-size: 14px; }
.ship-sub { font-size: 12px; color: var(--muted); }

/* === Payment grid === */
.payment-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.pay-option {
  border: 1.5px solid var(--border);
  background: #f9fafb;
  border-radius: 10px;
  padding: 14px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.pay-option .pay-icon, .pay-option .pay-icon-pix { width: 26px; height: 26px; }
.pay-option .pay-icon-pix { width: 30px; height: 30px; }
.pay-option.selected {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}
.pay-option:hover:not(.selected) { border-color: #cbd5e1; }

/* === Painéis de pagamento === */
.pay-panel[hidden] { display: none; }
.pay-panel { margin-bottom: 6px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field-row .field { margin-bottom: 14px; min-width: 0; }
.field-row .input-wrap { width: 100%; }
.field-row .input-wrap input { width: 100%; }

.input-wrap.plain input,
.input-wrap.plain select {
  padding: 12px;
}
.select-input {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 14px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  padding: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* === How-to PIX === */
.pay-howto-title {
  margin: 0 0 12px;
  font-size: 16px; font-weight: 700; color: var(--text);
}
.howto-list {
  list-style: none; padding: 0; margin: 0 0 22px;
  display: flex; flex-direction: column; gap: 14px;
}
.howto-list li { display: flex; gap: 12px; align-items: flex-start; }
.howto-badge {
  background: #d1fae5; color: var(--green-dark);
  width: 26px; height: 26px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.howto-title { font-weight: 700; font-size: 14px; color: var(--text); }
.howto-desc { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

/* === Order bump === */
.orderbump-title {
  margin: 6px 0 14px;
  font-size: 15px; font-weight: 700; color: var(--text);
  line-height: 1.3;
}
.orderbump {
  border: 1.5px dashed var(--red);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
  background: #fff;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.orderbump.is-selected {
  background: var(--green-soft);
  border-style: solid;
  border-color: var(--green);
}
.orderbump.is-selected .orderbump-head {
  background: transparent;
}
.orderbump-head {
  display: flex; align-items: center; gap: 8px;
  background: #f9fafb;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.bump-arrow { width: 22px; height: 22px; flex-shrink: 0; }
.bump-arrow-fallback {
  color: var(--red); font-size: 18px; line-height: 1;
  display: none;
  font-weight: 700;
}
/* Show fallback when SVG image missing */
.bump-arrow[style*="display: none"] + .bump-arrow-fallback { display: inline; }

.bump-check { width: 18px; height: 18px; accent-color: var(--green); flex-shrink: 0; }
.bump-cta {
  font-weight: 700; font-size: 14px; color: #0f172a;
}
.bump-body { display: flex; gap: 10px; padding: 12px 6px 6px; }
.bump-thumb {
  width: 70px; height: 70px;
  border-radius: 6px; object-fit: cover;
  flex-shrink: 0; background: #f3f4f6;
}
.bump-info { flex: 1; min-width: 0; }
.bump-name {
  margin: 0 0 4px;
  font-size: 14px; font-weight: 700;
  color: var(--indigo); line-height: 1.25;
}
.bump-desc { margin: 0 0 6px; font-size: 13px; color: var(--text); line-height: 1.35; }
.bump-price { font-size: 13px; color: var(--text); }
.bump-price strong { color: var(--text); }

/* === Total + botão === */
.total-row {
  margin-top: 8px;
  font-size: 16px; font-weight: 800;
  color: var(--green-dark);
}
.total-row span:first-child { margin-right: 4px; }
.buy-btn {
  margin-top: 14px;
  width: 100%;
  background: var(--green);
  color: #fff;
  border: 0;
  padding: 16px;
  border-radius: 8px;
  font-size: 16px; font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
  transition: background .15s;
}
.buy-btn:hover { background: #0a8b5e; }
.secure-text {
  text-align: center;
  margin: 10px 0 0;
  font-size: 12px; color: var(--muted);
}

/* === Footer === */
.page-footer { padding: 14px 4px 8px; text-align: center; }
.footer-badges {
  display: flex; justify-content: center; gap: 18px;
  margin-bottom: 10px;
}
.footer-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text);
  font-weight: 500;
}
.footer-copy {
  margin: 0;
  font-size: 12px; color: var(--muted);
  line-height: 1.4;
}

/* === Card element (Pagou Payment Element) === */
.card-element {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field-bg);
  padding: 12px;
  min-height: 44px;
}
.card-element.is-focused { border-color: var(--indigo); }
.card-element.is-invalid { border-color: var(--red); }

/* === Modal === */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal[hidden] { display: none; }
.modal-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  background: transparent; border: 0;
  font-size: 28px; line-height: 1; color: var(--muted);
  padding: 4px 8px;
}
.modal-title {
  margin: 0 0 6px;
  font-size: 18px; font-weight: 800; color: var(--text);
}
.modal-sub {
  margin: 0 0 14px;
  font-size: 13px; color: var(--muted);
}
.pix-qr {
  display: flex; justify-content: center;
  padding: 8px;
  background: #f9fafb;
  border-radius: 10px;
}
.pix-qr canvas { display: block; max-width: 100%; height: auto; }
.pix-copy {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: none;
  background: #f9fafb;
}

.buy-btn[disabled] {
  opacity: .6; cursor: not-allowed;
}

/* === Página PIX === */
.pix-page { padding-top: 24px; }
.pix-greeting {
  text-align: center;
  margin: 0 0 4px;
  font-size: 16px; font-weight: 500;
  color: var(--text);
}
.pix-greeting strong { font-weight: 800; }
.pix-tx-id {
  text-align: center;
  margin: 0 0 16px;
  font-size: 12px; color: var(--muted);
}
.pix-card { padding: 18px 16px; }
.pix-step-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.pix-step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--green); color: #fff;
  border-radius: 4px;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.pix-step-label { font-weight: 700; font-size: 14px; color: var(--text); }

.pix-code-input {
  width: 100%;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  margin-bottom: 10px;
  background: #fff;
  color: var(--text);
  text-overflow: ellipsis;
}
.pix-copy-btn {
  margin-top: 0;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
}
.pix-qr-wrap {
  display: flex; justify-content: center;
  padding: 22px 0 6px;
}
.pix-qr-wrap canvas { display: block; max-width: 100%; height: auto; }
.pix-amount {
  text-align: center;
  margin: 6px 0 16px;
  font-size: 14px; color: var(--text);
}
.pix-amount strong { font-weight: 800; }

.pix-steps {
  list-style: none;
  padding: 0;
  margin: 12px 0 14px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.pix-steps li {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text);
}

.pix-waiting {
  background: #fef3c7;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-size: 15px; font-weight: 700;
  color: #92400e;
}
.pix-waiting.is-paid {
  background: var(--green-soft);
  color: var(--green-dark);
}
.pix-waiting.is-error {
  background: #fee2e2;
  color: #991b1b;
}
.pix-dots {
  display: inline-flex; gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.pix-dots span {
  width: 6px; height: 6px;
  background: #d97706;
  border-radius: 50%;
  animation: pix-blink 1.4s infinite ease-in-out both;
  display: inline-block;
}
.pix-dots span:nth-child(1) { animation-delay: -0.32s; }
.pix-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes pix-blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* === Responsivo: tablets/desktops mantêm largura mobile === */
@media (min-width: 640px) {
  .container { max-width: 460px; }
}
