/* ======================================
 * SIMULADOR DE FINANCIAMENTO — POP-UP
 * Markup: inc/simulador/simulador.php
 * ====================================== */

.pbsim {
    position: fixed;
    inset: 0;
    z-index: 10000; /* acima do botão flutuante do WhatsApp (9990) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pbsim[hidden] { display: none; }

html.pbsim-aberto, html.pbsim-aberto body { overflow: hidden; }

.pbsim__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 4, 27, .72);
}

.pbsim__dialog {
    position: relative;
    width: min(100%, 520px);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    background: var(--branco, #fff);
    color: var(--preto-8, #1c1b1c);
    border-radius: 1rem;
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    outline: none;
}

.pbsim__fechar {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    background: none;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--roxo-8, #2b0e41);
    cursor: pointer;
}

.pbsim__fechar:hover, .pbsim__fechar:focus-visible { background: var(--roxo-1, #f9f5ff); }

.pbsim__form[hidden], .pbsim__cabecalho[hidden], .pbsim__resultado[hidden], .pbsim__etapa[hidden] { display: none; }

.pbsim__titulo {
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 600;
    color: var(--roxo-8, #2b0e41);
    margin: 0 2rem .75rem 0;
}

.pbsim__etapa_texto {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--roxo-6, #4f3066);
    margin: 0 0 .375rem;
}

.pbsim__progresso {
    height: 6px;
    border-radius: 3px;
    background: var(--roxo-2, #ede4f7);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.pbsim__progresso span {
    display: block;
    height: 100%;
    width: 50%;
    border-radius: 3px;
    background: var(--gradiente-roxo, var(--roxo-6, #4f3066));
    transition: width .3s ease;
}

.pbsim__etapa {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.pbsim__legenda {
    font-size: 1rem;
    font-weight: 500;
    color: var(--preto-7, #333132);
    margin-bottom: 1rem;
    padding: 0;
}

.pbsim__campo { margin-bottom: 1rem; }

.pbsim__campo label {
    display: block;
    font-weight: 500;
    font-size: .9375rem;
    margin-bottom: .375rem;
    color: var(--preto-8, #1c1b1c);
}

.pbsim__campo input[type=text],
.pbsim__campo input[type=tel],
.pbsim__campo input[type=email] {
    width: 100%;
    min-height: 48px;
    padding: .625rem .875rem;
    font-size: 1rem; /* evita zoom no iOS */
    color: var(--preto-8, #1c1b1c);
    background: var(--branco, #fff) !important;
    border: 1.5px solid var(--roxo-4, #a695b4) !important;
    border-radius: .375rem;
    box-sizing: border-box;
}

.pbsim__campo input:focus-visible {
    outline: 2px solid var(--roxo-6, #4f3066);
    outline-offset: 1px;
    border-color: var(--roxo-6, #4f3066) !important;
}

.pbsim__campo input[aria-invalid=true] { border-color: #c62828 !important; }

.pbsim__ajuda {
    display: block;
    font-size: .8125rem;
    color: var(--preto-5, #7d7b7c);
    margin-top: .375rem;
}

.pbsim__erro {
    display: block;
    font-size: .8125rem;
    color: #c62828;
    margin-top: .25rem;
}

.pbsim__erro:empty { display: none; }

.pbsim__campo_check {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: .625rem;
    align-items: start;
}

.pbsim__campo_check input {
    width: 20px;
    height: 20px;
    margin: .125rem 0 0;
    accent-color: var(--roxo-6, #4f3066);
}

.pbsim__campo_check label {
    font-weight: 400;
    font-size: .8125rem;
    line-height: 1.45;
    margin: 0;
    color: var(--preto-6, #595758);
}

.pbsim__campo_check label a { text-decoration: underline; color: inherit; }
.pbsim__campo_check .pbsim__erro { grid-column: 2; }

.pbsim__recaptcha { margin: .25rem 0 .5rem; min-height: 78px; }

.pbsim__mensagem {
    background: #fdecea;
    color: #8e1c1c;
    border-radius: .375rem;
    padding: .75rem 1rem;
    font-size: .875rem;
    margin: .5rem 0 0;
}

.pbsim__mensagem[hidden] { display: none; }
.pbsim__mensagem a { color: inherit; font-weight: 600; text-decoration: underline; }

.pbsim__botao { width: 100%; min-height: 48px; margin-top: .5rem; cursor: pointer; }
.pbsim__botao[disabled] { opacity: .7; cursor: wait; }

.pbsim__acoes {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .75rem;
    align-items: end;
    margin-top: .5rem;
}

.pbsim__voltar { min-height: 48px; cursor: pointer; }

.pbsim__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* ---------- resultado ---------- */

.pbsim__resultado .pbsim__titulo:focus { outline: none; }

.pbsim__destaque {
    background: var(--roxo-1, #f9f5ff);
    border: 1px solid var(--roxo-3, #d8c6e8);
    border-radius: .75rem;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.pbsim__rotulo {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--roxo-6, #4f3066);
    margin-bottom: .25rem;
}

.pbsim__valor_principal {
    display: block;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--roxo-8, #2b0e41);
}

.pbsim__valor_principal span {
    display: block;
    font-size: 2.25rem;
    line-height: 1.15;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pbsim__lista { margin: 0 0 1.5rem; }
.pbsim__lista > div { padding: .75rem 0; border-bottom: 1px solid var(--preto-1, #efefef); }
.pbsim__lista > div:last-child { border-bottom: 0; }
.pbsim__lista dt { font-weight: 600; font-size: .9375rem; color: var(--preto-8, #1c1b1c); margin-bottom: .125rem; }
.pbsim__lista dd { margin: 0; font-size: .9375rem; line-height: 1.5; color: var(--preto-6, #595758); }
.pbsim__lista strong { color: var(--roxo-8, #2b0e41); font-variant-numeric: tabular-nums; }

.pbsim__whatsapp {
    width: 100%;
    min-height: 48px;
    gap: .5rem;
    background: var(--verde-whatsapp, #25d366);
    color: #0b3d1e;
    font-weight: 600;
    border-radius: var(--border-radius-025, .25rem);
    text-decoration: none;
}

.pbsim__whatsapp img { filter: brightness(0) saturate(100%) invert(15%) sepia(30%) saturate(1500%) hue-rotate(100deg); }
.pbsim__whatsapp:hover, .pbsim__whatsapp:focus-visible { filter: brightness(.95); }

.pbsim__refazer {
    display: block;
    margin: .75rem auto 0;
    background: none;
    border: 0;
    padding: .5rem;
    font-size: .875rem;
    text-decoration: underline;
    color: var(--roxo-6, #4f3066);
    cursor: pointer;
}

.pbsim__aviso {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--preto-5, #7d7b7c);
    margin: 1.25rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid var(--preto-1, #efefef);
}

@media (max-width: 600px) {
    .pbsim { padding: 0; align-items: flex-end; }
    .pbsim__dialog {
        width: 100%;
        max-height: 92dvh;
        border-radius: 1rem 1rem 0 0;
        padding: 1.75rem 1rem 1.25rem;
    }
    .pbsim__titulo { font-size: 1.25rem; }
    .pbsim__valor_principal span { font-size: 1.875rem; }
}

@media (prefers-reduced-motion: reduce) {
    .pbsim__progresso span { transition: none; }
}
