@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =====================================================================
   checkout2 - folha única do checkout.
   Sem framework: os layouts de referência (layoutexemplo/) são CSS puro,
   então aqui não entra Bootstrap nem Flowbite. Tudo em tokens, para as
   quatro telas (assinar / pix / processando / confirmação) ficarem iguais.

   TIPOGRAFIA - a mesma do checkoutps:
     html  = 15px  (layout.css)
     fonte = Inter (ui-flowbite.css, que é o que vale nas telas de checkout)
     tamanhos em rem, na mesma escala de lá:
       .78 .8 .85 .875 .9 .95 = apoio | 1 = corpo | 1.05 1.2 1.4 1.55 = destaque

   Marca: os tokens de cor trocam por [data-marca] no <body>.
   ===================================================================== */

/* ---------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------- */
:root {
    --ink: #0f1b2d;
    --ink-soft: #5a6a7e;
    --line: #e3e8ef;
    --line-strong: #cbd4e0;
    --bg: #f5f7fa;
    --card: #ffffff;

    --brand: #1a73e8;          /* SpotWay */
    --brand-ink: #0b57d0;
    --brand-wash: #f0f6ff;

    --ok: #1a8a5a;
    --ok-bg: #e7f5ee;
    --pix: #00a884;
    --pix-bg: #e6f7f2;
    --warn: #b26a00;
    --warn-bg: #fdf3e3;
    --erro: #c0392b;
    --erro-bg: #fdecea;

    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 8px 24px rgba(15, 27, 45, .06);
}

/* Guia Taubaté usa o azul da marca (#009BEA), o resto da paleta é igual */
body[data-marca="guia"] {
    --brand: #009BEA;
    --brand-ink: #007cbb;
    --brand-wash: #eef8fe;
}

/* ---------------------------------------------------------------
   2. BASE
   --------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

/*
 * O atributo hidden do HTML só funciona porque o navegador aplica
 * [hidden]{display:none} - regra fraquíssima, que QUALQUER display nosso
 * derruba. Foi o que aconteceu com o aviso de Pix expirado: .timer tem
 * display:flex e o elemento aparecia mesmo marcado como hidden.
 */
[hidden] { display: none !important; }

html {
    font-size: 15px;   /* raiz do rem - igual ao checkoutps */
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    padding: 24px 16px 64px;
}

/* form controls não herdam fonte sozinhos */
input, select, button, textarea { font-family: inherit; font-size: 1rem; }

.wrap { max-width: 480px; margin: 0 auto; }

/* ---------------------------------------------------------------
   3. TOPO (logo + selo de segurança)
   --------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px;
}
.topbar__logo img { height: 34px; width: auto; display: block; }
/* a logo do Guia é 157x28: esticar para 34px de altura deforma */
body[data-marca="guia"] .topbar__logo img { height: 26px; }

.secure {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .8rem; color: var(--ok); font-weight: 600;
    background: var(--ok-bg); padding: 5px 10px; border-radius: 999px;
    white-space: nowrap;
}
.secure svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ---------------------------------------------------------------
   4. RESUMO DO PLANO
   --------------------------------------------------------------- */
.product {
    display: flex; gap: 14px; align-items: center;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
    margin-bottom: 14px;
}
.product-icon {
    width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-ink));
    display: grid; place-items: center; color: #fff; font-weight: 700;
    overflow: hidden;
}
.product-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-info h1 { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.product-info .plan-tag { font-size: .8rem; color: var(--ink-soft); margin-top: 1px; }
.product-price { margin-left: auto; text-align: right; }
.product-price .big { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.product-price .big small { font-size: .85rem; font-weight: 600; }
.product-price .sub { font-size: .78rem; color: var(--ink-soft); white-space: nowrap; }
.product-price .risco { font-size: .78rem; color: var(--ink-soft); text-decoration: line-through; display: block; }

/* Faixa do cupom aplicado */
.cupom-tag {
    display: flex; align-items: center; gap: 6px; justify-content: center;
    background: var(--ok-bg); color: var(--ok); font-size: .85rem; font-weight: 700;
    padding: 9px 12px; border-radius: 9px; margin-bottom: 14px;
}
.cupom-tag svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------------------------------------------------------------
   5. CARTÕES / SEÇÕES
   --------------------------------------------------------------- */
.card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
    margin-bottom: 14px;
}
.card--center { text-align: center; }

.card-title {
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.card-title .step {
    width: 21px; height: 21px; border-radius: 999px;
    background: var(--ink); color: #fff; font-size: .75rem; font-weight: 700;
    display: grid; place-items: center; letter-spacing: 0; flex-shrink: 0;
}

/* ---------------------------------------------------------------
   6. CAMPOS
   --------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.hint { font-size: .8rem; color: var(--ink-soft); font-weight: 400; }

input, select {
    width: 100%; color: var(--ink);
    background: #fff; border: 1.5px solid var(--line-strong);
    border-radius: 9px; padding: 12px 13px;
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #9aa7b8; }
input:focus, select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .14);
}
body[data-marca="guia"] input:focus,
body[data-marca="guia"] select:focus { box-shadow: 0 0 0 3px rgba(0, 155, 234, .16); }

/* estado de erro + mensagem por campo */
input.is-invalid, select.is-invalid { border-color: var(--erro); }
input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.field-erro { display: none; font-size: .8rem; color: var(--erro); margin-top: 5px; }
.field.tem-erro .field-erro { display: block; }

/* linha de ajuda abaixo do campo ("Porque pedimos CPF? Saiba mais") */
.ajuda { display: block; font-size: .8rem; color: var(--ink-soft); margin-top: 6px; }
.ajuda a { color: var(--brand); font-weight: 600; text-decoration: none; cursor: pointer; }
.ajuda a:hover { text-decoration: underline; }

/* .row = lado a lado sempre (ex.: Validade + CVV, que cabem em qualquer tela) */
.row { display: flex; gap: 10px; }
.row .field { flex: 1; }

/* .row--desk = lado a lado só no desktop; empilha no celular, onde dois
   campos longos (telefone e CPF/CNPJ) ficariam apertados demais */
.row--desk { display: block; }
@media (min-width: 480px) {
    .row--desk { display: flex; gap: 10px; }
}

/* ---------------------------------------------------------------
   7. FORMAS DE PAGAMENTO
   --------------------------------------------------------------- */
.pay-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.pay-tab {
    flex: 1; cursor: pointer; text-align: center;
    border: 1.5px solid var(--line-strong); border-radius: 9px;
    padding: 11px 6px; font-size: .9rem; font-weight: 600; color: var(--ink-soft);
    background: #fff; transition: all .15s; user-select: none;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.pay-tab svg { width: 20px; height: 20px; }
.pay-tab.active {
    border-color: var(--brand); color: var(--brand-ink);
    background: var(--brand-wash); box-shadow: 0 0 0 1px var(--brand);
}
.pay-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.pay-panel { display: none; }
.pay-panel.active { display: block; }

.pay-aviso { text-align: center; padding: 8px 4px; font-size: .95rem; color: var(--ink-soft); }
.pay-aviso strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 1rem; }

/* ---------------------------------------------------------------
   8. TOTAL + CTA
   --------------------------------------------------------------- */
.total-line {
    display: flex; justify-content: space-between; align-items: baseline;
    padding-top: 14px; margin-top: 4px; border-top: 1px dashed var(--line-strong);
}
.total-line .lbl { font-size: .95rem; color: var(--ink-soft); }
.total-line .val { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; text-align: right; }
.total-line .val small { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }

.cta {
    width: 100%; border: none; cursor: pointer;
    background: var(--ok); color: #fff;
    font-size: 1.05rem; font-weight: 700; letter-spacing: .01em;
    padding: 16px; border-radius: 11px; margin-top: 4px;
    transition: background .15s, transform .05s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cta:hover { background: #14724a; }
.cta:active { transform: translateY(1px); }
.cta:disabled { background: #93a5b5; cursor: default; transform: none; }
.cta svg { width: 18px; height: 18px; }

.btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; border: none; cursor: pointer; text-decoration: none;
    background: var(--brand); color: #fff;
    font-size: 1rem; font-weight: 700; padding: 15px; border-radius: 11px;
    transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--brand-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary svg { width: 16px; height: 16px; }

/* spinner dentro do botão */
.btn-spinner {
    width: 16px; height: 16px; border: 2.5px solid rgba(255, 255, 255, .45);
    border-top-color: #fff; border-radius: 999px;
    animation: girar .7s linear infinite; display: inline-block;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* alerta de erro do formulário */
.alerta {
    display: none; align-items: flex-start; gap: 8px;
    background: var(--erro-bg); color: var(--erro);
    border: 1px solid #f5c6c0; border-radius: 9px;
    padding: 12px 14px; font-size: .9rem; font-weight: 600; margin-bottom: 14px;
}
.alerta.visivel { display: flex; }
/* referência técnica do gateway, discreta mas legível num print */
.alerta__ref {
    display: block; margin-top: 4px;
    font-size: .78rem; font-weight: 400; opacity: .75;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.alerta svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* ---------------------------------------------------------------
   9. SELOS E RODAPÉ
   --------------------------------------------------------------- */
.assurances {
    display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 16px;
}
.assurance {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .8rem; color: var(--ink-soft);
}
.assurance svg { width: 15px; height: 15px; color: var(--ok); flex-shrink: 0; }

.access-note { font-size: .8rem; color: var(--ink-soft); text-align: center; margin-top: 14px; line-height: 1.5; }

.terms { font-size: .78rem; color: #9aa7b8; text-align: center; margin-top: 18px; line-height: 1.5; }
.terms a { color: var(--ink-soft); }

.footer-legal { font-size: .78rem; color: #9aa7b8; text-align: center; margin-top: 24px; line-height: 1.6; }

/* ---------------------------------------------------------------
   10. TELA DO PIX
   --------------------------------------------------------------- */
.pix-head { text-align: center; margin-bottom: 20px; }
.pix-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--pix-bg); color: var(--pix); font-size: .85rem; font-weight: 700;
    padding: 6px 14px; border-radius: 999px; margin-bottom: 14px;
}
.pix-badge svg { width: 16px; height: 16px; }
.pix-head h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.pix-head .amount { font-size: 1rem; color: var(--ink-soft); }
.pix-head .amount strong { color: var(--ink); font-weight: 700; }

.qr-frame {
    width: 220px; height: 220px; margin: 0 auto 8px; padding: 12px;
    background: #fff; border: 1.5px solid var(--line); border-radius: 16px;
    display: grid; place-items: center;
}
.qr-frame img, .qr-frame svg { width: 100%; height: 100%; display: block; }
.qr-hint { text-align: center; font-size: .875rem; color: var(--ink-soft); margin-bottom: 20px; }

.timer {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--warn-bg); color: var(--warn); font-size: .875rem; font-weight: 600;
    padding: 10px; border-radius: 9px; margin-bottom: 20px;
}
.timer svg { width: 16px; height: 16px; }
.timer .clock { font-variant-numeric: tabular-nums; font-weight: 700; }

.copy-label {
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 8px;
}
.copy-box {
    display: flex; gap: 8px; align-items: stretch;
    border: 1.5px solid var(--line-strong); border-radius: 10px;
    padding: 4px 4px 4px 12px; background: #fbfcfe;
}
.copy-box code {
    flex: 1; font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .8rem; color: var(--ink-soft); align-self: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
    flex-shrink: 0; border: none; cursor: pointer;
    background: var(--brand); color: #fff; font-size: .875rem; font-weight: 700;
    padding: 10px 16px; border-radius: 8px; transition: background .15s;
    display: inline-flex; align-items: center; gap: 6px;
}
.copy-btn:hover { background: var(--brand-ink); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.copied { background: var(--ok); }

.status {
    display: flex; align-items: center; gap: 10px; justify-content: center;
    margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line-strong);
    font-size: .95rem; color: var(--ink-soft);
}
.spinner {
    width: 16px; height: 16px; border: 2.5px solid var(--line-strong);
    border-top-color: var(--pix); border-radius: 999px;
    animation: girar .8s linear infinite; flex-shrink: 0;
}

.howto-title {
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 12px;
}
.howto ol { list-style: none; counter-reset: h; }
.howto li {
    counter-increment: h; position: relative; padding-left: 34px;
    font-size: .95rem; color: var(--ink); margin-bottom: 11px; line-height: 1.45;
}
.howto li:last-child { margin-bottom: 0; }
.howto li::before {
    content: counter(h); position: absolute; left: 0; top: 0;
    width: 23px; height: 23px; border-radius: 999px;
    background: var(--pix-bg); color: var(--pix); font-size: .8rem; font-weight: 700;
    display: grid; place-items: center;
}

/* ---------------------------------------------------------------
   11. TELA DE PROCESSANDO
   --------------------------------------------------------------- */
.pulse { width: 96px; height: 96px; margin: 0 auto 26px; position: relative; display: grid; place-items: center; }
.pulse .ring {
    position: absolute; inset: 0; border-radius: 999px;
    border: 2px solid var(--brand); opacity: 0;
    animation: pulsar 2s ease-out infinite;
}
.pulse .ring:nth-child(2) { animation-delay: .6s; }
.pulse .ring:nth-child(3) { animation-delay: 1.2s; }
@keyframes pulsar {
    0%   { transform: scale(.55); opacity: .6; }
    100% { transform: scale(1.05); opacity: 0; }
}
.pulse .core {
    width: 60px; height: 60px; border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), var(--brand-ink));
    display: grid; place-items: center; position: relative; z-index: 1;
}
.pulse .core svg { width: 28px; height: 28px; color: #fff; animation: girar 1.4s linear infinite; }

.card h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.card .lead { font-size: 1rem; color: var(--ink-soft); margin-bottom: 24px; }

.prog { list-style: none; max-width: 265px; margin: 0 auto; text-align: left; }
.prog li {
    display: flex; align-items: center; gap: 12px;
    font-size: .95rem; color: var(--ink-soft); padding: 8px 0; transition: color .3s;
}
.prog li .dot {
    width: 21px; height: 21px; flex-shrink: 0; border-radius: 999px;
    border: 2px solid var(--line-strong); display: grid; place-items: center; transition: all .3s;
}
.prog li .dot svg { width: 11px; height: 11px; color: #fff; opacity: 0; transition: opacity .3s; }
.prog li.done { color: var(--ink); font-weight: 600; }
.prog li.done .dot { background: var(--ok); border-color: var(--ok); }
.prog li.done .dot svg { opacity: 1; }
.prog li.active { color: var(--ink); font-weight: 600; }
.prog li.active .dot { border-color: var(--brand); }
.prog li.active .dot::after {
    content: ''; width: 8px; height: 8px; border-radius: 999px;
    background: var(--brand); animation: piscar 1s ease-in-out infinite;
}
@keyframes piscar { 50% { opacity: .3; } }

.warn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: .875rem; color: var(--ink-soft); margin-top: 26px;
    padding-top: 20px; border-top: 1px dashed var(--line-strong);
}
.warn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------------------------------------------------------------
   12. TELA DE CONFIRMAÇÃO
   --------------------------------------------------------------- */
.check-ring {
    width: 84px; height: 84px; margin: 0 auto 20px;
    border-radius: 999px; background: var(--ok-bg);
    display: grid; place-items: center;
    animation: surgir .5s cubic-bezier(.2, .8, .3, 1.2) both;
}
@keyframes surgir { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.check-ring svg { width: 42px; height: 42px; }
.check-ring svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: riscar .5s .25s ease forwards; }
@keyframes riscar { to { stroke-dashoffset: 0; } }

.receipt {
    display: flex; justify-content: space-between; align-items: center;
    background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px;
    padding: 14px 16px; margin: 22px 0 4px; text-align: left; gap: 12px;
}
.receipt .r-plan { font-size: .95rem; font-weight: 700; }
.receipt .r-plan span { display: block; font-size: .8rem; font-weight: 400; color: var(--ink-soft); margin-top: 1px; }
.receipt .r-val { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }

.access {
    border: 1.5px solid var(--brand); background: var(--brand-wash);
    border-radius: 12px; padding: 20px; margin-bottom: 14px; text-align: left;
}
.access-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.access-head .ic {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
    background: var(--brand); display: grid; place-items: center;
}
.access-head .ic svg { width: 18px; height: 18px; color: #fff; }
.access-head h2 { font-size: 1rem; font-weight: 700; }
.access p { font-size: .95rem; color: var(--ink-soft); margin-bottom: 16px; }
.access p strong { color: var(--ink); }

.resend { font-size: .875rem; color: var(--ink-soft); text-align: center; margin-top: 14px; }
.resend a { color: var(--brand); font-weight: 600; text-decoration: none; }

.whatsapp-note {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--ok-bg); border-radius: 10px; padding: 14px 16px;
    font-size: .875rem; color: #15613f; text-align: left; margin-bottom: 14px;
}
.whatsapp-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ---------------------------------------------------------------
   13. PÁGINAS LEGAIS (privacidade / contrato)
   --------------------------------------------------------------- */
.legal { line-height: 1.65; }
.legal__titulo { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 16px; }
.legal p { margin-bottom: 12px; color: var(--ink-soft); font-size: .95rem; }
.legal h2,
.legal .modal-subtitle {
    font-size: 1rem; font-weight: 700; color: var(--ink);
    margin: 22px 0 8px;
}
.legal ul, .legal ol { margin: 0 0 12px 20px; color: var(--ink-soft); font-size: .95rem; }
.legal li { margin-bottom: 6px; }
.legal i, .legal em { font-size: .85rem; }

/* ---------------------------------------------------------------
   14. MODAL DE AVISO
   --------------------------------------------------------------- */
.modal {
    position: fixed; inset: 0; z-index: 999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal__fundo { position: absolute; inset: 0; background: rgba(15, 27, 45, .55); }
.modal__caixa {
    position: relative; background: var(--card);
    border-radius: var(--radius); padding: 26px 24px 22px;
    max-width: 380px; width: 100%; text-align: center;
    box-shadow: 0 12px 40px rgba(15, 27, 45, .25);
    animation: surgir .22s cubic-bezier(.2, .8, .3, 1.1) both;
}
.modal__titulo { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.modal__texto { font-size: .95rem; color: var(--ink-soft); margin-bottom: 20px; line-height: 1.55; }

/* ---------------------------------------------------------------
   14. RESPONSIVO
   --------------------------------------------------------------- */
@media (max-width: 400px) {
    .product-price .big { font-size: 1.05rem; }
    .topbar__logo img { height: 28px; }
    .assurances { gap: 12px; }
}
