*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  border-bottom: 2px solid #1877F2;
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.site-header img {
  height: 110px;
  width: auto;
  max-width: 420px;
}

/* ── Main ── */
main {
  flex: 1;
  padding: 48px 24px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

/* ── Card da apostila ── */
.apostila-card {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.apostila-card .capa {
  flex-shrink: 0;
  width: 280px;
}

.apostila-card .capa img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.apostila-card .info {
  flex: 1;
}

.apostila-card h1 {
  font-size: 1.8rem;
  color: #1877F2;
  margin-bottom: 16px;
}

.apostila-card .descricao {
  font-size: 1rem;
  line-height: 1.7;
  color: #333;
  white-space: pre-line;
  margin-bottom: 24px;
}

/* ── Preço ── */
.preco-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.preco-original {
  font-size: 1.1rem;
  color: #888;
  text-decoration: line-through;
}

.preco-atual {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a1a;
}

.badge-off {
  background: #1877F2;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Botões ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.88; }

.btn-comprar {
  background: #25D366;
  color: #fff;
  margin-right: 12px;
  margin-bottom: 12px;
}

.btn-whatsapp {
  background: #fff;
  color: #25D366;
  border: 2px solid #25D366;
  margin-bottom: 12px;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #555;
  line-height: 1;
}

.modal h2 {
  font-size: 1.4rem;
  color: #1877F2;
  margin-bottom: 24px;
}

/* ── Formulário ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #1877F2;
}

.form-group input.error {
  border-color: #e53935;
}

.field-error {
  color: #e53935;
  font-size: 0.82rem;
  margin-top: 4px;
  display: none;
}

.field-error.visible { display: block; }

/* ── Checkbox termos ── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
}

.checkbox-group input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #1877F2;
}

.checkbox-group label {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #444;
}

.checkbox-group a {
  color: #1877F2;
  text-decoration: underline;
}

.checkbox-error {
  color: #e53935;
  font-size: 0.82rem;
  margin-top: -18px;
  margin-bottom: 18px;
  display: none;
}

.checkbox-error.visible { display: block; }

/* ── Botão submit ── */
.btn-submit {
  width: 100%;
  background: #1877F2;
  color: #fff;
  padding: 14px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-submit:hover { opacity: 0.88; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Tela de Sucesso ── */
.sucesso {
  display: none;
  text-align: center;
}

.sucesso.active { display: block; }

.sucesso h2 {
  color: #25D366;
  margin-bottom: 16px;
}

.sucesso p {
  color: #444;
  margin-bottom: 12px;
  line-height: 1.6;
}

.pix-destaque {
  background: #f0f7ff;
  border: 2px solid #1877F2;
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  box-sizing: border-box;
}

.pix-qrcode {
  width: calc(100% - 16px);
  max-width: 200px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 4px;
  display: block;
}

.pix-label {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: -4px;
}

.pix-destaque .pix-chave {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1877F2;
  word-break: break-all;
}

.pix-destaque .pix-nome {
  font-size: 0.95rem;
  color: #555;
}

.pix-infinitepay {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #d0e4ff;
  width: 100%;
}

.logo-infinitipay {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.btn-comprovante {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  margin-top: 12px;
  transition: opacity 0.2s;
}

.btn-comprovante:hover { opacity: 0.88; }

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
  color: #888;
  border-top: 1px solid #eee;
}

/* ── Termos page ── */
.termos-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px;
}

.termos-content h1 {
  color: #1877F2;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.termos-content .vigencia {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.termos-content h2 {
  font-size: 1.1rem;
  margin: 24px 0 8px;
  color: #1a1a1a;
}

.termos-content p {
  line-height: 1.8;
  color: #444;
  margin-bottom: 12px;
}

/* ── Responsividade ── */
@media (max-width: 768px) {
  .apostila-card {
    flex-direction: column;
    gap: 28px;
  }

  .apostila-card .capa {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .apostila-card h1 {
    font-size: 1.4rem;
  }

  .modal {
    padding: 28px 20px;
  }
}
