/*
 * Estilo do pop-up.
 *
 * Tudo com prefixo fpop- e sem depender de nada do tema, porque o mesmo arquivo
 * roda em cinco instalacoes com temas diferentes. As medidas sao relativas para
 * o card caber em tela de celular pequena sem cortar o botao, que e o erro mais
 * comum desse tipo de componente.
 */

.fpop-fundo {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 17, 17, .55);
    opacity: 0;
    transition: opacity .2s ease;
}

.fpop-fundo.fpop-visivel {
    opacity: 1;
}

body.fpop-travado {
    overflow: hidden;
}

.fpop-caixa {
    --fpop-cor: #111111;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    transform: translateY(12px);
    transition: transform .2s ease;
    font-family: inherit;
    color: #1f1f1f;
}

.fpop-visivel .fpop-caixa {
    transform: translateY(0);
}

.fpop-fechar {
    position: absolute;
    top: 6px;
    right: 8px;
    z-index: 2;
    width: 34px;
    height: 34px;
    padding: 0;
    line-height: 1;
    font-size: 26px;
    color: #444;
    background: rgba(255, 255, 255, .85);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.fpop-fechar:hover {
    color: #000;
}

/*
 * A imagem nao pode empurrar o botao para fora da tela. Com a foto em altura
 * natural (retrato 4:5 da loja), o card de 420px passava de 900px de altura e o
 * CTA so aparecia depois de rolar dentro do proprio pop-up, que e a forma mais
 * cara possivel de perder a captura.
 */
.fpop-figura img {
    display: block;
    width: 100%;
    max-height: 24vh;
    object-fit: cover;
    object-position: center 20%;
    border-radius: 10px 10px 0 0;
}

.fpop-conteudo {
    padding: 16px 20px 18px;
}

.fpop-titulo {
    margin: 0 0 6px;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 700;
}

.fpop-oferta {
    display: inline-block;
    margin: 0 0 8px;
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--fpop-cor);
    border-radius: 4px;
}

.fpop-texto {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
}

.fpop-contador {
    margin: 0 0 14px;
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
    color: var(--fpop-cor);
}

/* Vitrine: tira horizontal com encaixe, sem biblioteca de carrossel. */
.fpop-vitrine {
    display: flex;
    gap: 10px;
    margin: 0 0 16px;
    padding-bottom: 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.fpop-produto {
    flex: 0 0 108px;
    scroll-snap-align: start;
    text-decoration: none;
    color: inherit;
}

.fpop-produto img {
    display: block;
    width: 108px;
    height: 135px;
    object-fit: cover;
    border-radius: 6px;
    background: #f2f2f2;
}

.fpop-produto-nome {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.3;
}

.fpop-produto-preco {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.fpop-produto-preco del {
    font-weight: 400;
    opacity: .6;
}

.fpop-campo {
    display: block;
    margin: 0 0 10px;
}

/* O nome do campo e o proprio placeholder, entao ele precisa de contraste
   suficiente para ser lido como rotulo. O opacity existe porque o Firefox
   aplica transparencia propria no placeholder e deixaria o texto fraco. */
.fpop-campo input::placeholder {
    color: #767676;
    opacity: 1;
}

.fpop-campo input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    /* 16px evita o zoom automatico do iPhone ao focar o campo. */
    font-size: 16px;
    color: #1f1f1f;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.fpop-campo input:focus {
    outline: 2px solid var(--fpop-cor);
    outline-offset: 1px;
    border-color: var(--fpop-cor);
}

.fpop-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.fpop-consent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 2px 0 10px;
    font-size: 12px;
    line-height: 1.4;
    color: #555;
}

.fpop-consent input {
    margin-top: 2px;
    flex: 0 0 auto;
}

.fpop-botao {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background: var(--fpop-cor);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

.fpop-botao:hover {
    opacity: .9;
    color: #fff;
}

.fpop-botao[disabled] {
    opacity: .6;
    cursor: default;
}

.fpop-erro:empty {
    display: none;
}

.fpop-erro {
    margin: 10px 0 0;
    font-size: 13px;
    color: #b32d2e;
}

.fpop-regra {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #777;
}

.fpop-codigo {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 14px;
}

.fpop-codigo-valor {
    flex: 1;
    padding: 12px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .08em;
    text-align: center;
    background: #f4f4f4;
    border: 1px dashed #bbb;
    border-radius: 6px;
}

.fpop-copiar {
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--fpop-cor);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

/*
 * Quiz. A alternativa e um alvo de toque grande, e nao um radio: no celular, a lista de
 * radios pede pontaria e um erro de meio centimetro custa a resposta inteira.
 */
.fpop-quiz {
    display: block;
}

.fpop-progresso {
    height: 4px;
    margin: 0 0 8px;
    background: #ececec;
    border-radius: 2px;
    overflow: hidden;
}

.fpop-progresso-barra {
    height: 100%;
    background: var(--fpop-cor);
    border-radius: 2px;
    transition: width .25s ease;
}

.fpop-passo {
    margin: 0 0 10px;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #888;
}

.fpop-pergunta {
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #111;
}

.fpop-opcoes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fpop-opcao {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    color: #1f1f1f;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.fpop-opcao:hover,
.fpop-opcao:focus-visible {
    border-color: var(--fpop-cor);
    background: #fafafa;
}

.fpop-opcao-ativa {
    border-color: var(--fpop-cor);
    box-shadow: inset 0 0 0 1px var(--fpop-cor);
}

.fpop-voltar {
    margin: 12px 0 0;
    padding: 0;
    font-size: 13px;
    font-family: inherit;
    color: #777;
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

.fpop-voltar:hover {
    color: #111;
}

.fpop-quiz .fpop-form {
    margin-top: 14px;
}

@media (min-width: 760px) and (min-height: 560px) {
    .fpop-caixa {
        flex-direction: row;
        max-width: 680px;
    }

    .fpop-figura {
        flex: 0 0 46%;
    }

    .fpop-figura img {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 10px 0 0 10px;
    }

    .fpop-conteudo {
        flex: 1;
        align-self: center;
        padding: 22px 24px;
    }
}

@media (max-width: 480px) {
    .fpop-fundo {
        align-items: flex-end;
        padding: 0;
    }

    .fpop-figura img {
        max-height: 22vh;
    }

    .fpop-caixa {
        max-width: none;
        max-height: 92vh;
        border-radius: 14px 14px 0 0;
    }

    .fpop-figura img {
        border-radius: 14px 14px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fpop-fundo,
    .fpop-caixa {
        transition: none;
    }
}
