/* ============================================================
   CHECKOUT — FRETE, DATA DE ENTREGA E ENTREGA EXPRESSA
   O catalogo.js desenha dois blocos, no carrinho desktop e no
   modal "Seu pedido" do mobile:
     [data-frete-resumo]   linha "Entrega · qua, 04/11", antes do total
     [data-frete-checkout] barra do frete, datas e Expressa, depois do total
   Carregado depois do style.css (link no gerar.py).
   ============================================================ */

.frete-resumo {
    margin-top: 12px;
}

.frete-checkout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.frete-resumo[hidden],
.frete-checkout[hidden],
.pedido-mobile-frete[hidden],
.pedido-sucesso-entrega[hidden] {
    display: none;
}

.frete-checkout p {
    margin: 0;
}


/* ------------------------------------------------------------
   Barra de progresso até o frete grátis
   ------------------------------------------------------------ */

.frete-progresso {
    padding: 10px 14px 12px;
    background: #fff;
    border: 1px solid #ddd2b3;
    border-radius: 8px;
}

.frete-marcos {
    position: relative;
    height: 28px;
    margin: 0 11px 6px;
    font-size: 10px;
    line-height: 13px;
    color: #3f392f;
}

.frete-marco {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.frete-marco strong {
    font-weight: 800;
}

.frete-marco-inicio {
    left: 0;
    align-items: flex-start;
}

/* O "left" vem do JavaScript (posição do marco intermediário). */
.frete-marco-meio {
    align-items: center;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
}

.frete-marco-fim {
    right: -11px;
    align-items: flex-end;
}

.frete-barra {
    position: relative;
    height: 22px;
    margin: 0 11px;
}

.frete-barra::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 4px;
    background: #ece3c9;
}

/* A barra enche devagar até o valor novo (o catalogo.js parte do valor
   anterior); a cor muda para verde quando chega no frete grátis. */
.frete-barra-preenchida {
    position: absolute;
    top: 7px;
    left: 0;
    height: 8px;
    border-radius: 4px;
    background: var(--vermelho);
    transition:
        width 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.1s,
        background-color 0.3s ease 0.6s;
}

.frete-barra-gratis .frete-barra-preenchida {
    background: green;
}

.frete-ponto {
    position: absolute;
    top: 0;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    box-sizing: border-box;
    border: 2px solid #a89c7e;
    border-radius: 50%;
    background: #fff;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background-color 0.25s ease 0.45s,
        border-color 0.25s ease 0.45s,
        color 0.25s ease 0.45s;
}

/* Marco que acabou de ser alcançado dá um pulinho. */
.frete-ponto-novo {
    animation: frete-pulinho 0.45s ease 0.5s both;
}

@keyframes frete-pulinho {
    0%   { -webkit-transform: scale(1);    transform: scale(1); }
    45%  { -webkit-transform: scale(1.3);  transform: scale(1.3); }
    100% { -webkit-transform: scale(1);    transform: scale(1); }
}

.frete-ponto-fim {
    left: 100%;
}

.frete-ponto svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.frete-ponto.atingido {
    background: var(--vermelho);
    border-color: var(--vermelho);
    color: #fff;
}

.frete-barra-gratis .frete-ponto.atingido {
    background: green;
    border-color: green;
}

/* Texto acima da barra, numa linha só:
   "Adicione R$ 42,20 para frete de R$ 12,50" / "Adicione R$ 60,90 para FRETE GRÁTIS".
   Se não couber no box, o catalogo.js diminui a letra até caber. */
.frete-checkout .frete-mensagem {
    margin: 2px 0 10px;
    text-align: center;
    font-size: 13px;
    line-height: 1.45;
    white-space: nowrap;
}

.frete-texto-gratis {
    color: #126400;
}


/* ------------------------------------------------------------
   Quando você quer receber?
   ------------------------------------------------------------ */

.frete-checkout .frete-titulo {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
}

/* 2 datas: lado a lado. 1 ou 3 datas: uma embaixo da outra
   (três lado a lado não cabem no carrinho do desktop).
   minmax(0, 1fr): o cartão nunca passa da largura do carrinho,
   mesmo enquanto a Bebas Neue ainda não carregou. */
.frete-rotas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.frete-rotas-1,
.frete-rotas-3 {
    grid-template-columns: minmax(0, 1fr);
}

.frete-opcao {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #cbbf9f;
    border-radius: 6px;
    background: #fbf7ea;
    color: #191919;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.frete-opcao:hover {
    border-color: #8a7f66;
}

/* Borda de 2px: o padding diminui 1px para o cartão não mudar de tamanho. */
.frete-opcao.selecionada {
    padding: 9px;
    border: 2px solid var(--vermelho);
    background: #fff;
}

.frete-opcao:focus-visible {
    outline: 2px solid #191919;
    outline-offset: 2px;
}

.frete-opcao-topo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

/* Com a Bebas Neue cabe numa linha. Se outra fonte entrar no lugar
   (carregando ou bloqueada), quebra em "QUA" / "04/11" em vez de cortar. */
.frete-opcao-dia {
    min-width: 0;
    padding-top: 2px;
    font-family: "Bebas Neue", "Arial Narrow", sans-serif;
    font-size: 22px;
    line-height: 1;
    letter-spacing: 0.5px;
    word-break: keep-all;
}

.frete-opcao-prazo {
    display: block;
    margin-top: 4px;
    font-size: 10.5px;
    line-height: 1.35;
    color: #5b5346;
}

/* "TER 03/11 17h" não se divide: se faltar espaço, quebra depois de "Peça até". */
.frete-sem-quebra {
    white-space: nowrap;
}

.frete-radio {
    position: relative;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    box-sizing: border-box;
    border: 2px solid #8a7f66;
    border-radius: 50%;
    background: #fff;
}

.frete-opcao.selecionada .frete-radio {
    border-color: var(--vermelho);
}

.frete-opcao.selecionada .frete-radio::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vermelho);
}


/* Data com o prazo encerrado: continua na tela para o cliente ver
   a opção (e pedir antes na próxima vez), mas não dá para escolher.
   Fundo listrado, data riscada e "Encerrado em ..." no lugar do prazo. */
.frete-opcao-encerrada,
.frete-opcao-encerrada:hover {
    padding: 10px;
    border: 1px solid #ddd2b3;
    background-color: #f4eedd;
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.55) 0,
        rgba(255, 255, 255, 0.55) 6px,
        transparent 6px,
        transparent 12px
    );
    color: #8a7f66;
    cursor: not-allowed;
}

.frete-opcao-encerrada .frete-opcao-dia s {
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: #a89c7e;
}

.frete-opcao-encerrada .frete-opcao-prazo {
    color: #6f6757;
}

.frete-encerrada-icone {
    flex: 0 0 auto;
    display: flex;
    color: #a89c7e;
}

.frete-encerrada-icone svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ------------------------------------------------------------
   Entrega Expressa
   ------------------------------------------------------------ */

.frete-expressa {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    border: 1px dashed #8a7f66;
    background: transparent;
}

.frete-expressa.selecionada {
    padding: 11px;
}

.frete-expressa-icone {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #191919;
    color: #f7f0dd;
}

.frete-expressa-icone svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.frete-expressa-texto {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    line-height: 1.4;
    color: #5b5346;
}

.frete-expressa-texto strong {
    font-size: 12.5px;
    line-height: 1.35;
    color: #191919;
}

.frete-expressa .frete-radio {
    margin-top: 2px;
}

.frete-checkout .frete-aviso {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.45;
    color: #5b5346;
}


/* ------------------------------------------------------------
   Linha "Entrega · qua, 04/11 ... R$ 12,50" (antes do total)
   ------------------------------------------------------------ */

.frete-linha-entrega {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
}

.frete-linha-entrega strong {
    white-space: nowrap;
}


/* ------------------------------------------------------------
   Mobile — modal "Seu pedido" e barra fixa
   ------------------------------------------------------------ */

/* Mais espaço para o modal, que agora tem o bloco de entrega. */
.pedido-mobile-modal {
    max-height: 88vh;
}

.pedido-mobile-modal .frete-checkout {
    margin-top: 16px;
}

.pedido-mobile-modal .frete-opcao-rota {
    min-height: 60px;
}

.pedido-mobile-frete {
    margin-top: 2px;
    font-size: 10px;
    line-height: 13px;
    color: #191919;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pedido-mobile-frete strong {
    color: var(--vermelho-escuro);
}


/* ------------------------------------------------------------
   Menos movimento (configuração de acessibilidade do aparelho)
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {

    .frete-barra-preenchida,
    .frete-ponto {
        transition: none;
    }

    .frete-ponto-novo {
        animation: none;
    }

}