/* ===== Custom COD form (substitui o Releasit que ficava a carregar) ===== */
#cod-custom-floating {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 600px;
  z-index: 99990;
}

.cod-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.2;
  color: #fff;
  background: rgba(54, 235, 10, 1);
  border-radius: 14px;
  padding: 15px 20px;
  min-height: 54px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  transition: transform .08s ease, filter .15s ease;
}
.cod-btn:hover { filter: brightness(1.05); }
.cod-btn:active { transform: scale(.99); }
.cod-btn[disabled] { opacity: .7; cursor: progress; }

#cod-custom-inline .cod-btn { margin-top: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.18); }

.cod-btn .cod-arrow { font-size: 20px; line-height: 1; }

/* ---------- Overlay + modal ---------- */
#cod-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100000;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#cod-modal-overlay.open { display: block; }

.cod-modal {
  background: #fff;
  width: calc(100% - 24px);
  max-width: 480px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: cod-pop .18s ease;
  margin: 24px auto;
}
@keyframes cod-pop { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.cod-modal__header {
  position: relative;
  padding: 18px 44px;
  text-align: center;
  border-bottom: 1px solid #eee;
}
.cod-modal__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #000;
}
.cod-modal__close {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #f1f1f1;
  color: #333;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.cod-modal__close:hover { background: #e3e3e3; }

.cod-modal__body { padding: 16px; }

/* ---------- Order summary ---------- */
.cod-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 2px solid #e8e8eb;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 14px;
}
.cod-summary img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.cod-summary__info { flex: 1; min-width: 0; }
.cod-summary__title { font-size: 13px; font-weight: 600; color: #000; line-height: 1.25; }
.cod-summary__variant { font-size: 12px; color: #666; margin-top: 2px; }
.cod-summary__price { font-size: 15px; font-weight: 700; color: #000; white-space: nowrap; }

.cod-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 6px;
}
.cod-qty button {
  width: 28px; height: 28px; border: 0; background: #f4f4f4; cursor: pointer; font-size: 16px; color: #333;
}
.cod-qty span { width: 34px; text-align: center; font-size: 14px; font-weight: 600; }

.cod-totals {
  border: 2px solid #e8e8eb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: #ebebeb;
}
.cod-totals__row { display: flex; justify-content: space-between; font-size: 13px; color: #333; padding: 3px 0; }
.cod-totals__row--total { font-size: 16px; font-weight: 700; color: #000; border-top: 1px solid #d4d4d4; margin-top: 4px; padding-top: 7px; }

/* ---------- Fields ---------- */
.cod-note {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #000;
  margin: 4px 0 12px;
}
.cod-field { margin-bottom: 10px; }
.cod-field label { display: block; font-size: 12px; font-weight: 600; color: #333; margin-bottom: 4px; }
.cod-field input,
.cod-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(203, 203, 203, 1);
  background: rgba(169, 181, 211, 0.09);
  border-radius: 9px;
  padding: 12px 12px;
  font-size: 15px;
  font-family: inherit;
  color: #000;
  outline: none;
}
.cod-field input:focus,
.cod-field select:focus { border-color: #2458d2; background: #fff; }
.cod-field--half { display: inline-block; width: calc(50% - 5px); }
.cod-field--half:first-of-type { margin-right: 8px; }
.cod-field.cod-invalid input,
.cod-field.cod-invalid select { border-color: #e02424; background: #fff5f5; }
.cod-error { color: #e02424; font-size: 11px; margin-top: 3px; display: none; }
.cod-field.cod-invalid .cod-error { display: block; }

/* ---------- Upsell (+1 Produto Premiado) ---------- */
.cod-upsell {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(217, 235, 246, 1);
  border: 2px solid rgba(0, 116, 191, 1);
  border-radius: 8px;
  padding: 11px 12px;
  margin: 6px 0 14px;
  cursor: pointer;
  user-select: none;
}
.cod-upsell input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: #0074bf;
  cursor: pointer;
  margin: 0;
}
.cod-upsell__text { font-size: 13px; font-weight: 600; color: #000; line-height: 1.25; }
.cod-upsell__price { margin-left: auto; font-size: 14px; font-weight: 700; color: #0074bf; white-space: nowrap; }

.cod-totals__row#cod-upsell-row { color: #0074bf; font-weight: 600; }

.cod-submit {
  margin-top: 4px;
  border-radius: 18px;
  font-size: 18px;
  min-height: 56px;
}
.cod-row { display: flex; gap: 8px; }
.cod-row .cod-field { flex: 1; margin-bottom: 10px; }

.cod-spinner {
  width: 18px; height: 18px;
  border: 3px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cod-spin .7s linear infinite;
}
@keyframes cod-spin { to { transform: rotate(360deg); } }

body.cod-modal-open { overflow: hidden; }

/* ---------- Upsell step 2 (Pro Max) ---------- */
.cod-upsell-img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 12px;
}
.cod-upsell-title {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7e0;
  border: 2px solid #f59e0b;
  border-radius: 10px;
  color: #92400e;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  padding: 10px 14px;
  margin: 0 0 8px;
  line-height: 1.3;
}
.cod-upsell-title::before {
  content: "⚠️";
  font-size: 18px;
  flex-shrink: 0;
}
.cod-upsell-price {
  font-size: 22px;
  font-weight: 800;
  color: #16a34a;
  text-align: center;
  margin-bottom: 8px;
}
.cod-countdown {
  font-size: 15px;
  font-weight: 700;
  color: #e02424;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.cod-upsell-skip {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  color: #888;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 8px;
  padding: 4px;
  font-family: inherit;
}
.cod-upsell-skip:hover { color: #444; }

/* ---------- Passo 3: loading ---------- */
.cod-pay-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 20px;
  color: #555;
  font-size: 14px;
}
.cod-spinner--dark {
  border-color: rgba(0,0,0,.15);
  border-top-color: #222;
  width: 32px;
  height: 32px;
  border-width: 4px;
}

/* ---------- Cartão MB Way ---------- */
.cod-mbway-card {
  background: linear-gradient(135deg, #d4002a 0%, #ff1744 100%);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgba(212,0,42,.3);
}
.cod-mbway-card__icon {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 10px;
}
.cod-mbway-card__title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}
.cod-mbway-card__phone {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 10px;
  opacity: .95;
}
.cod-mbway-card__amount {
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 10px;
}
.cod-mbway-card__hint {
  font-size: 13px;
  opacity: .85;
  line-height: 1.4;
}
.cod-mbway-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  color: #555;
  margin-bottom: 14px;
}

/* ---------- Passos de pagamento ---------- */
.cod-mb-steps {
  background: #f0f4ff;
  border: 1.5px solid #c7d7f9;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.cod-mb-steps__title {
  font-size: 12px;
  font-weight: 700;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 8px;
}
.cod-mb-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
  line-height: 1.4;
}
.cod-mb-step:last-child { margin-bottom: 0; }
.cod-mb-step__num {
  background: #2458d2;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.cod-mb-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ---------- Ecrã de sucesso ---------- */
.cod-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 8px 8px;
}
.cod-success__icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
}
.cod-success__title {
  font-size: 22px;
  font-weight: 800;
  color: #111;
  margin: 0 0 10px;
}
.cod-success__text {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin: 0 0 20px;
}

/* ---------- Erro de pagamento ---------- */
.cod-pay-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 30px 12px;
  color: #b91c1c;
}
.cod-pay-error span { font-size: 40px; line-height: 1; }
.cod-pay-error p { font-size: 14px; line-height: 1.6; margin: 0; color: #7f1d1d; }
