/* ============================================================
   TikTok Bônus — Checkout PIX
   Estilo enxuto, mobile-first. Variáveis no :root para tema.
   Paleta TikTok: preto + magenta (#FE2C55) + ciano (#25F4EE).
   ============================================================ */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink-900: #0b0b10;
  --ink-700: #2a2a33;
  --ink-600: #3f3f4a;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-200: #e5e7eb;
  --ink-100: #f0f0f0;

  /* Brand TikTok */
  --brand: #fe2c55;          /* magenta TikTok (CTAs) */
  --brand-strong: #d61f48;
  --brand-soft: #ffe9ee;
  --brand-soft-border: #ffc0d0;
  --brand-accent: #25f4ee;   /* ciano TikTok (detalhes) */

  --green: #16a34a;
  --green-light: #f0fdf4;
  --green-border: #d1fae5;
  --green-soft: #10b981;
  --pix-green: #10b981;

  --danger: #ef4444;
  --max: 480px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
  line-height: 1.5;
  font-size: 16px;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select { font-family: inherit; font-size: 14px; }
input:focus, select:focus { outline: none; }
.hidden { display: none !important; }

/* ----- Header ----- */
.checkout-header {
  background: var(--surface);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid var(--ink-100);
}
.header-brand { display: inline-flex; align-items: center; }
.header-brand-logo {
  height: 30px;
  width: auto;
  max-width: 140px;
  display: block;
  object-fit: contain;
}
.header-secure { height: 32px; width: auto; }

/* ----- Page ----- */
.page-wrap { max-width: var(--max); margin: 0 auto; padding: 12px 0 28px; }

/* ----- Resumo da regularização (cart) ----- */
.cart-toggle {
  background: var(--surface);
  margin: 0 10px;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
  border-bottom: 1px solid var(--ink-100);
  border-radius: 12px 12px 0 0;
}
.cart-toggle-left {
  font-size: 16px; font-weight: 600;
  color: var(--ink-900);
  display: inline-flex; align-items: center; gap: 8px;
}
.cart-toggle-left svg { color: var(--brand); }
.cart-toggle-right { display: flex; align-items: center; gap: 8px; }
.cart-count-badge {
  width: 22px; height: 22px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.cart-body {
  background: var(--surface);
  padding: 0 16px 16px;
  margin: 0 10px 12px;
  border-radius: 0 0 12px 12px;
}
.cart-item {
  display: flex; gap: 12px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--ink-100);
}
.cart-item:last-child { border-bottom: none; }
.cart-img {
  width: 78px; height: 78px;
  border-radius: 12px; object-fit: cover;
  flex-shrink: 0;
  background: #000;
}
.cart-info { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.cart-product-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.cart-meta {
  font-size: 13px; color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}
.cart-guarantee {
  margin-top: 4px;
  font-size: 12px; color: var(--ink-400);
  display: flex; align-items: center; gap: 4px;
}
.cart-guarantee svg { width: 14px; height: 14px; }
.cart-summary { padding: 14px 0 0; }
.cart-summary-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  font-size: 17px; color: var(--ink-500);
}
.cart-summary-row.total {
  font-size: 18px; font-weight: 700; color: var(--ink-900);
  padding-top: 10px; margin-top: 6px;
  border-top: 1px solid #eee;
}

/* ----- Steps ----- */
.steps-indicator {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 16px 14px 8px; margin-top: 2px;
}
.step-group { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0; transition: all .3s;
}
.step-circle.active, .step-circle.completed { background: var(--brand); }
.step-circle.inactive { background: #d1d5db; }
.step-label { font-size: 13px; color: var(--ink-400); white-space: nowrap; }
.step-label.active { color: var(--ink-900); font-weight: 700; }
.step-label.completed { color: var(--ink-900); font-weight: 600; }
.step-line {
  width: 80px; height: 2px;
  background: #d1d5db; margin: 15px 8px 0;
  flex-shrink: 0;
}
.step-line.done { background: var(--brand); }

/* ----- Step content card ----- */
.step-content {
  background: var(--surface);
  margin: 12px 10px;
  border-radius: 12px;
  padding: 18px 16px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.section-title { font-size: 28px; font-weight: 700; margin-bottom: 18px; }

/* ----- Form ----- */
.form-group { margin-bottom: 16px; position: relative; }
.form-group label {
  display: block;
  font-size: 16px; font-weight: 500; color: var(--ink-700);
  margin-bottom: 7px;
}
.form-group input, .form-group select {
  width: 100%; height: 52px; padding: 0 14px;
  border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 16px; color: var(--ink-900); background: var(--surface);
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--brand); }
.form-group input.error, .form-group select.error { border-color: var(--danger); }
.form-group .error-msg {
  font-size: 12px; color: var(--danger);
  margin-top: 4px; display: none;
}
.form-group input::placeholder { color: var(--ink-400); }

/* ----- Email autocomplete ----- */
.email-suggestions {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid #d1d5db; border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 50;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
  max-height: 200px; overflow-y: auto;
}
.email-suggestions.show { display: block; }
.email-suggestion {
  padding: 12px;
  font-size: 15px; color: var(--ink-700);
  cursor: pointer; transition: background .1s;
}
.email-suggestion:hover { background: #f3f4f6; }

/* ----- Trust box ----- */
.trust-box {
  background: var(--green-light);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 14px;
  margin: 18px 0 4px;
}
.trust-box p {
  font-size: 14px; color: var(--ink-700);
  margin-bottom: 10px; line-height: 1.45;
}
.trust-item {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 7px;
  font-size: 14px; color: var(--ink-700);
  line-height: 1.45;
}
.trust-item:last-child { margin-bottom: 0; }
.trust-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--green); margin-top: 1px; }

/* ----- Buttons ----- */
.btn-primary {
  width: 100%; height: 56px;
  background: var(--brand); color: #fff;
  border-radius: 8px;
  font-size: 18px; font-weight: 700;
  letter-spacing: .2px;
  transition: all .2s;
  margin-top: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(254, 44, 85, .28);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary .spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.back-link {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  margin-top: 12px;
  font-size: 16px; color: var(--ink-400);
  cursor: pointer; padding: 6px 0;
}
.back-link:hover { color: var(--ink-900); }
.back-link svg { width: 14px; height: 14px; }

/* ----- Payment ----- */
.payment-option {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 20px 16px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: var(--surface);
}
.payment-option input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); }
.payment-option .pix-label {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.payment-option .pix-label img { height: 36px; width: auto; }
.payment-note {
  font-size: 16px; color: var(--ink-500);
  margin-top: 14px; line-height: 1.55;
  padding: 16px 14px;
  border: 1px solid #ececec;
  border-radius: 8px;
}

/* ----- Footer ----- */
.checkout-footer {
  max-width: var(--max); margin: 22px auto 0;
  padding: 16px; text-align: center;
}
.footer-payments {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; color: #7b7b7b;
  margin-bottom: 8px;
}
.footer-payments img { height: 29px; width: auto; }
.footer-copy { font-size: 13px; color: #7b7b7b; margin-bottom: 8px; }
.footer-secure {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 13px; color: var(--green);
}

/* ----- Loading overlay ----- */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, .9);
  z-index: 9999;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
}
.loading-overlay.show { display: flex; }
.loading-overlay img { width: 150px; height: auto; }
.loading-overlay span { font-size: 16px; font-weight: 600; }

/* ----- PIX screen ----- */
.pix-screen { display: none; }
.pix-screen.show { display: block; }
.checkout-screen { display: block; }
.checkout-screen.hide { display: none; }

.pix-header {
  background: var(--surface);
  padding: 14px 16px;
  text-align: center;
  border-bottom: 1px solid var(--ink-200);
}
.pix-header .header-brand { justify-content: center; }
.pix-wrap { max-width: var(--max); margin: 0 auto; padding: 16px; }
.pix-title {
  font-size: 20px; font-weight: 700;
  text-align: center;
  margin-bottom: 16px; line-height: 1.35;
}
.pix-timer { text-align: center; margin-bottom: 16px; }
.pix-timer span { font-size: 16px; color: var(--ink-500); }
.pix-timer .timer-value {
  font-size: 24px; font-weight: 700;
  color: var(--danger);
  display: inline-block; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.pix-qr-wrap {
  display: flex; justify-content: center;
  margin-bottom: 16px;
}
.pix-qr-wrap img,
.pix-qr-wrap canvas { border-radius: 8px; }
.pix-copy-label {
  font-size: 16px; color: var(--ink-700);
  text-align: center;
  margin-bottom: 10px; line-height: 1.35;
}
.pix-code-box {
  position: relative;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.45;
  margin-bottom: 12px;
  font-family: 'Courier New', monospace;
  /* Trava: sem seleção, sem cursor de texto, sem context-menu nativo de copiar */
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
  pointer-events: none;
  /* Mantém o visual com altura controlada e preview "borrado" no fim */
  max-height: 60px;
  overflow: hidden;
  word-break: break-all;
  white-space: normal;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, rgba(0,0,0,.25) 100%);
          mask-image: linear-gradient(to bottom, #000 60%, rgba(0,0,0,.25) 100%);
}
.pix-code-box::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 18px;
  background: linear-gradient(to bottom, transparent, #f8fafc);
  pointer-events: none;
  border-radius: 0 0 8px 8px;
}
.btn-copy {
  width: 100%; height: 56px;
  background: var(--green-soft); color: #fff;
  border-radius: 8px;
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s;
  margin-bottom: 16px;
}
.btn-copy:hover { background: var(--green); transform: translateY(-1px); }
.btn-copy:active { transform: translateY(0); }
.btn-copy svg { width: 18px; height: 18px; }
.pix-amount {
  text-align: center;
  font-size: 18px; font-weight: 500;
  margin-bottom: 12px;
}
.pix-amount span { color: var(--pix-green); font-weight: 700; }
.pix-status {
  text-align: center;
  font-size: 14px; color: var(--ink-500);
  margin-bottom: 18px;
}
.pix-status.ok { color: var(--green); font-weight: 600; }

.pix-card {
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.pix-card-header {
  padding: 12px 14px;
  font-size: 16px; font-weight: 500;
  background: var(--surface);
}
.pix-card-body { padding: 0 14px 14px; background: var(--surface); }
.pix-step {
  display: flex; gap: 10px;
  margin-bottom: 14px;
  font-size: 15px; color: var(--ink-500);
  line-height: 1.45;
}
.pix-step:last-child { margin-bottom: 0; }
.pix-step-num {
  width: 22px; height: 22px;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pix-detail-row {
  display: flex; justify-content: space-between;
  padding: 6px 0;
  font-size: 15px; color: var(--ink-500);
}
.pix-detail-row.total {
  font-weight: 700; color: var(--ink-900); font-size: 16px;
  border-top: 1px solid #eee;
  padding-top: 10px; margin-top: 6px;
}
.pix-footer {
  text-align: center;
  padding: 20px 16px;
  border-top: 1px solid #eee;
  margin-top: 20px;
}
.pix-footer-icons {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pix-footer-icons img { height: 28px; width: auto; }
.pix-footer-icons .pix-footer-bradesco { height: 22px; }
.pix-footer-secure {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; color: var(--ink-500);
}

/* ----- Success ----- */
.success-wrap { padding: 40px 16px; }
.success-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
}
.success-check {
  width: 64px; height: 64px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
}
.success-check svg { width: 32px; height: 32px; }
.success-card h1 { font-size: 24px; margin-bottom: 8px; }
.success-card p { color: var(--ink-500); margin-bottom: 20px; }
.success-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
  text-align: left;
}
.success-meta > div {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
}
.success-meta span {
  display: block;
  font-size: 11px; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 4px;
}
.success-meta strong {
  font-size: 14px; color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

/* ----- Animations ----- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease; }
