/* ================================================================== */
/* Checkout — Juntos Saúde                                            */
/* Paleta azul royal alinhada à home / login. Layout stepper + aside. */
/* ================================================================== */

/* =============================== TOKENS =============================== */

:root {
  --bg: #0D1B2A;
  --bg-deep: #11253D;
  --blue: #2563EB;
  --blue-h: #1d4fc0;
  --sky: #6FB6F2;
  --ink: #0D1B2A;
  --ink-mid: #314256;
  --ink-soft: #56697e;
  --fog: #8fa3b8;
  --mist: #b6c5d6;
  --line: #dce4ee;
  --surface: #ffffff;
  --bg-light: #f5f8fc;
}

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

html { font-size: 62.5%; }

body {
  min-height: 100vh;
  font-family: "Montserrat", sans-serif;
  background-color: var(--bg-light);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }
button { border: none; cursor: pointer; background: transparent; }
a { text-decoration: none; color: inherit; }

/* =================== LAYOUT =================== */

.checkout-layout {
  width: 100%;
  max-width: 130rem;
  margin: 0 auto;
  padding: 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36rem;
  gap: 4rem;
  align-items: start;
}

.checkout-form-area {
  background: var(--surface);
  border-radius: 2rem;
  padding: 4rem;
  border: 1px solid var(--line);
  box-shadow: 0 3rem 6rem -3rem rgba(13, 27, 42, 0.18);
}

.checkout-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 3.6rem;
  padding: 0 1.4rem;
  border-radius: 999rem;
  border: 1px solid var(--line);
  background: var(--bg-light);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin-bottom: 2.4rem;
  transition: color 0.2s, border-color 0.2s, transform 0.18s;
}

.checkout-back-link:hover {
  color: var(--blue);
  border-color: rgba(37, 99, 235, 0.4);
  transform: translateY(-0.1rem);
}

.checkout-back-link svg { width: 1.5rem; height: 1.5rem; stroke-width: 2.2; }

.checkout-logo {
  width: 16rem;
  height: auto;
  margin-bottom: 3rem;
  display: block;
}

/* =================== STEPPER =================== */

.checkout-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4rem;
  position: relative;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
  z-index: 2;
}

.step-circle {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 50%;
  background: var(--bg-light);
  color: var(--fog);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 0.2rem solid var(--line);
  transition: all 0.3s;
}

.step.is-active .step-circle {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 0 0 0.5rem rgba(37, 99, 235, 0.16);
}

.step.is-done .step-circle {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.step.is-done .step-circle::before {
  content: "✓";
  font-size: 1.7rem;
  font-weight: 800;
}

.step.is-done .step-number { display: none; }

.step-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fog);
  text-transform: uppercase;
}

.step.is-active .step-label,
.step.is-done .step-label { color: var(--ink); }

.step-line {
  flex: 1;
  height: 0.2rem;
  background: var(--line);
  margin: 0 0.8rem;
  margin-bottom: 2.4rem;
  transition: background 0.3s;
}

.step-line.is-done { background: #16a34a; }

/* =================== STEP CONTENT =================== */

.step-content[hidden] { display: none; }

.step-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
  letter-spacing: -0.04rem;
}

.step-subtitle {
  font-size: 1.45rem;
  color: var(--ink-soft);
  margin-bottom: 1.6rem;
}

.step-hint {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin-bottom: 2rem;
}

.step-form {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* =================== INPUTS =================== */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
}

.form-row--3 {
  grid-template-columns: 2fr 1fr 1fr;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin-bottom: 0.7rem;
}

.form-field input,
.form-field select,
.form-select {
  height: 4.8rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  padding: 0 1.5rem;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field input::placeholder { color: #9aa8ba; }
.form-field input:focus,
.form-field select:focus,
.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 0.4rem rgba(37, 99, 235, 0.12);
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239aa8ba' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.5rem center;
  background-size: 1.5rem;
  padding-right: 4rem;
  cursor: pointer;
}

/* =================== PASSWORD =================== */

.password-wrap { position: relative; }

.password-wrap input { padding-right: 4.6rem; }

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 4.4rem;
  height: 4.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fog);
  transition: color 0.2s;
}

.password-toggle:hover { color: var(--blue); }

.password-toggle svg { width: 1.8rem; height: 1.8rem; stroke-width: 2; }

/* =================== CHECKBOX =================== */

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-light);
  font-size: 1.3rem;
  color: var(--ink-mid);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.8rem;
  height: 1.8rem;
  accent-color: var(--blue);
  cursor: pointer;
  margin-top: 0.1rem;
}

.checkbox-row span { line-height: 1.5; }

.checkbox-row a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
}

/* =================== METHOD INFO =================== */

.method-info {
  padding: 1.4rem 1.6rem;
  background: #eef4ff;
  border-left: 0.3rem solid var(--blue);
  border-radius: 0.8rem;
  font-size: 1.3rem;
  color: var(--ink-mid);
  line-height: 1.5;
}

.method-info:empty { display: none; }

/* =================== BOTÕES =================== */

.btn-next, .btn-submit {
  width: 100%;
  height: 5.2rem;
  border-radius: 999rem;
  background: var(--blue);
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.6rem;
  box-shadow: 0 1.2rem 2.4rem -0.8rem rgba(37, 99, 235, 0.6);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-next:hover, .btn-submit:hover {
  background: var(--blue-h);
  transform: translateY(-0.2rem);
  box-shadow: 0 1.6rem 2.8rem -0.8rem rgba(37, 99, 235, 0.7);
}

.btn-submit:disabled, .btn-next:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-spinner svg {
  width: 1.8rem;
  height: 1.8rem;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.btn-back-edit {
  display: inline-block;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--blue);
  margin-top: 1rem;
}

.btn-back-edit:hover { color: var(--blue-h); text-decoration: underline; }

/* =================== MENSAGEM =================== */

.form-message {
  min-height: 1.6rem;
  font-size: 1.3rem;
  font-weight: 600;
}

.form-message--error   { color: #dc2626; }
.form-message--success { color: #16a34a; }
.form-message--loading { color: var(--blue); }

/* =================== CONTA JÁ EXISTENTE =================== */

.checkout-conta-existente {
  display: flex;
  gap: 1.4rem;
  padding: 1.8rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 1.2rem;
}

.checkout-conta-existente[hidden] { display: none; }

.checkout-conta-existente__icon {
  flex-shrink: 0;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #ffedd5;
  color: #c2410c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-conta-existente__icon svg {
  width: 2rem;
  height: 2rem;
  stroke-width: 2;
}

.checkout-conta-existente__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.checkout-conta-existente__body strong {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
}

.checkout-conta-existente__body p {
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--ink-mid);
}

.checkout-conta-existente__btn {
  align-self: flex-start;
  margin-top: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 4rem;
  padding: 0 1.8rem;
  border-radius: 999rem;
  background: var(--blue);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.18s;
}

.checkout-conta-existente__btn:hover {
  background: var(--blue-h);
  transform: translateY(-0.1rem);
}

.checkout-conta-existente__btn svg {
  width: 1.6rem;
  height: 1.6rem;
  stroke-width: 2.2;
}

/* =================== ASIDE — RESUMO =================== */

.checkout-summary {
  position: sticky;
  top: 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.summary-highlight {
  background: linear-gradient(140deg, #2563EB 0%, #1d4fc0 100%);
  border-radius: 1.6rem;
  padding: 2.2rem 2.4rem;
  color: #ffffff;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.4rem;
  box-shadow: 0 1.8rem 3.6rem -1.6rem rgba(37, 99, 235, 0.6);
}

.summary-highlight-label {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.summary-highlight-value {
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: flex-start;
}

.summary-highlight-value > span {
  font-size: 4.4rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0.2rem;
}

.summary-highlight-value sup {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

.summary-total {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1.6rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-total-label {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink-mid);
}

.summary-total-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--blue);
}

.summary-plan-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #16a34a;
  padding: 0 0.4rem;
}

.summary-plan-name svg {
  width: 1.6rem;
  height: 1.6rem;
  stroke-width: 2.2;
}

.summary-info {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink-soft);
  padding: 0 0.4rem;
}

.summary-info p { margin-bottom: 0.6rem; }
.summary-info strong { color: var(--ink); font-weight: 700; }

/* =================== RESULTADO (PIX / BOLETO / CARTÃO) =================== */

.step-result {
  text-align: center;
}

.result-icon {
  width: 7.2rem;
  height: 7.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
}

.result-icon svg {
  width: 3.6rem;
  height: 3.6rem;
  stroke-width: 2;
}

.result-icon--pending {
  background: #fef3c7;
  color: #b45309;
}

.result-icon--success {
  background: #dcfce7;
  color: #15803d;
}

.result-icon--failed {
  background: #fee2e2;
  color: #b91c1c;
}

.step-result .step-title,
.step-result .step-subtitle { text-align: center; }

.pix-qrcode-wrap {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.pix-qrcode-wrap img {
  width: 24rem;
  height: 24rem;
  border: 0.4rem solid #ffffff;
  border-radius: 1.2rem;
  box-shadow: 0 0.2rem 1.2rem rgba(13, 27, 42, 0.12);
  background: #ffffff;
}

.pix-copy-wrap, .boleto-line-wrap {
  margin: 2rem auto;
  max-width: 50rem;
  text-align: left;
}

.pix-copy-wrap label, .boleto-line-wrap label {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin-bottom: 0.8rem;
}

.pix-copy-input {
  display: flex;
  gap: 0.6rem;
}

.pix-copy-input input {
  flex: 1;
  height: 4.6rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--bg-light);
  padding: 0 1.4rem;
  font-size: 1.25rem;
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.btn-copy {
  height: 4.6rem;
  padding: 0 1.5rem;
  background: var(--bg);
  color: #ffffff;
  border-radius: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.2s;
}

.btn-copy:hover { background: var(--blue); }

.btn-copy svg { width: 1.4rem; height: 1.4rem; stroke-width: 2.2; }

.btn-copy.is-copied { background: #16a34a; }

.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.1rem 1.8rem;
  border: 1px solid var(--line);
  border-radius: 999rem;
  background: var(--bg-light);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink-mid);
  margin: 1rem auto;
  transition: color 0.2s, border-color 0.2s, transform 0.18s;
}

.btn-pdf:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: var(--blue);
  transform: translateY(-0.1rem);
}

.btn-pdf svg { width: 1.5rem; height: 1.5rem; stroke-width: 2.2; }

.result-info {
  font-size: 1.35rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 1.6rem auto;
  max-width: 48rem;
}

/* =================== RESPONSIVO TABLET =================== */

@media (max-width: 980px) {
  .checkout-layout {
    grid-template-columns: 1fr;
    gap: 2.4rem;
    padding: 2.4rem;
  }
  .checkout-summary {
    position: static;
    order: -1;
  }
  .checkout-form-area { padding: 3rem 2.4rem; }
}

/* =================== RESPONSIVO MOBILE =================== */

@media (max-width: 640px) {
  html { font-size: 58%; }

  .checkout-layout { padding: 1.6rem; }

  .form-row, .form-row--3 {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .form-row > .form-field, .form-row--3 > .form-field {
    margin-bottom: 1.6rem;
  }

  .step-label { font-size: 1rem; }
  .checkout-logo { width: 13rem; }
  .checkout-form-area {
    padding: 2.4rem 1.8rem;
    border-radius: 1.4rem;
  }

  .pix-qrcode-wrap img { width: 20rem; height: 20rem; }
}


/* =============================== MODAL: TERMOS E CONDIÇÕES =============================== */

.termos-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
}
.termos-modal[aria-hidden="false"] { display: flex; }

.termos-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.termos-modal__dialog {
  position: relative;
  width: min(72rem, 100%);
  max-height: calc(100vh - 3.2rem);
  background: #fff;
  border-radius: 1.4rem;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.termos-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1.8rem 2.2rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.termos-modal__title {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.termos-modal__title svg {
  width: 2rem; height: 2rem; stroke-width: 1.9;
  color: #3366d9;
}

.termos-modal__close {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: background 180ms ease;
}
.termos-modal__close:hover { background: #e2e8f0; color: #0f172a; }
.termos-modal__close svg { width: 2rem; height: 2rem; stroke-width: 2; }

.termos-modal__body {
  padding: 1.8rem 2.2rem;
  overflow-y: auto;
  font-size: 1.4rem;
  line-height: 1.65;
  color: #334155;
}
.termos-modal__intro {
  background: #f1f5f9;
  border-left: 3px solid #3366d9;
  padding: 1.2rem 1.4rem;
  border-radius: 0.6rem;
  margin: 0 0 1.6rem;
  font-size: 1.35rem;
}
.termos-modal__body p { margin: 0 0 1rem; }
.termos-modal__h {
  font-size: 1.45rem;
  font-weight: 700;
  color: #0f172a;
  margin: 1.6rem 0 0.6rem;
}
.termos-modal__footer-note {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e5e7eb;
  font-size: 1.15rem;
  color: #64748b;
  text-align: center;
}

.termos-modal__foot {
  padding: 1.4rem 2.2rem;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}
.termos-modal__btn {
  padding: 0 2rem;
  height: 4.2rem;
  background: #3366d9;
  color: #fff;
  border: none;
  border-radius: 0.8rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms ease;
}
.termos-modal__btn:hover { background: #2854b8; }

@media (max-width: 640px) {
  .termos-modal { padding: 0.8rem; }
  .termos-modal__dialog { max-height: calc(100vh - 1.6rem); border-radius: 1rem; }
  .termos-modal__head, .termos-modal__foot { padding: 1.2rem 1.4rem; }
  .termos-modal__body { padding: 1.4rem 1.4rem; font-size: 1.3rem; }
}

/* Botão "Desistir da compra" na tela do PIX/boleto — ação secundária discreta */
.btn-desistir {
  display: inline-block;
  margin-top: 1.6rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  transition: color 160ms ease;
}
.btn-desistir:hover { color: #dc2626; }
.btn-desistir:disabled { opacity: 0.5; cursor: default; }

/* Modal de confirmação ("Desistir da compra?") — substitui o window.confirm */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
}
.confirm-modal[aria-hidden="false"] { display: flex; }
.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.confirm-modal__dialog {
  position: relative;
  width: min(40rem, 100%);
  background: #fff;
  border-radius: 1.4rem;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.28);
  padding: 2.6rem 2.2rem 2.2rem;
  text-align: center;
  animation: confirm-pop 160ms ease-out;
}
@keyframes confirm-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.confirm-modal__icon {
  width: 5.6rem;
  height: 5.6rem;
  margin: 0 auto 1.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  color: #d97706;
}
.confirm-modal__icon svg { width: 2.8rem; height: 2.8rem; stroke-width: 2; }
.confirm-modal__title {
  font-size: 1.9rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.8rem;
}
.confirm-modal__text {
  font-size: 1.4rem;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 2rem;
}
.confirm-modal__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}
.confirm-modal__btn {
  flex: 1;
  max-width: 18rem;
  padding: 1.2rem 1.6rem;
  border-radius: 0.9rem;
  font-size: 1.4rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 160ms ease;
}
.confirm-modal__btn--ghost  { background: #f1f5f9; color: #334155; }
.confirm-modal__btn--ghost:hover  { background: #e2e8f0; }
.confirm-modal__btn--danger { background: #dc2626; color: #fff; }
.confirm-modal__btn--danger:hover { background: #b91c1c; }
@media (max-width: 480px) {
  .confirm-modal__actions { flex-direction: column-reverse; }
  .confirm-modal__btn { max-width: none; }
}
