body{
    font-family:Arial,sans-serif;
    margin:0;
    background:#f5f5f5;
}
header{
    background:#1602ce;
    color:#fff;
    padding:15px;
    text-align:center;
    font-size:20px;
}

#loading{
    text-align:center;
    padding:40px;
    font-size:18px;
    color:#555;
}

.top-bar{
    display:flex;
    justify-content:center;
    padding:10px 15px;
    background:#fff;
    box-shadow:0 2px 4px rgba(0,0,0,0.08);
}
.top-bar input{
    width:100%;
    max-width:400px;
    padding:10px 14px;
    border-radius:10px;
    border:1px solid #ccc;
    font-size:16px;
}

.container{
    padding:15px;
}

.filtros{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:8px;
    overflow-x:visible;
    padding-bottom:5px;
}
.filtros button{
    padding:8px 16px;
    border-radius:20px;
    border:none;
    cursor:pointer;
    background:#e5e7eb;
    font-size:14px;
    white-space:nowrap;
}
.filtros button.ativo{
    background:#2563eb;
    color:#fff;
}

.produtos{
    display:none;
    grid-template-columns:repeat(auto-fill, minmax(160px, 1fr));
    gap:18px;
    padding:10px 0;
}
.produto{
    background:#fff;
    padding:12px;
    border-radius:12px;
    box-shadow:0 2px 6px rgba(0,0,0,0.12);
    text-align:center;
    display:flex;
    flex-direction:column;
    gap:8px;
}
.produto img{
    width:100%;
    aspect-ratio:1/1;
    object-fit:cover;
    border-radius:10px;
    background:#eee;
}
.produto h3{
    margin:0;
    font-size:16px;
    min-height:40px;
    line-height:20px;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.produto small{
    color:#6b7280;
    font-size:13px;
}
.produto button{
    margin-top:5px;
    padding:10px;
    width:100%;
    background:#007bff;
    color:#fff;
    border:none;
    border-radius:8px;
    cursor:pointer;
    font-size:15px;
}
.btn-adicionado{
    background:#28a745!important;
}

.modal-fundo{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    backdrop-filter:blur(6px);
    background:rgba(0,0,0,0.45);
    display:none;
    justify-content:center;
    align-items:center;
    padding:10px;
    box-sizing:border-box;
    z-index:2000;
}
.modal-carrinho{
    background:rgba(255,255,255,0.97);
    width:100%;
    max-width:420px;
    max-height:90vh;
    border-radius:18px;
    box-shadow:0 10px 35px rgba(0,0,0,0.25);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    padding:15px;
    box-sizing:border-box;
    gap:12px;
}
.modal-topo{
    flex-shrink:0;
    background:#fff;
    padding:10px 0 15px 0;
    border-bottom:1px solid #ddd;
    display:flex;
    justify-content:space-between;
    align-items:center;
}
.modal-topo h2{
    margin:0;
    font-size:20px;
}
.modal-topo button{
    background:#ff4d4d;
    color:#fff;
    border:none;
    padding:6px 12px;
    border-radius:8px;
    cursor:pointer;
}

#lista-carrinho{
    flex:1;
    overflow-y:auto;
    padding-right:5px;
}
.item-carrinho{
    border-bottom:1px solid #ddd;
    padding:12px 0;
}
.linha-produto{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}
.produto-nome{
    font-weight:bold;
    font-size:16px;
    flex:1;
    min-width:140px;
}
.produto-qtd{
    font-weight:bold;
    color:#2563eb;
    font-size:16px;
}
.linha-botoes{
    display:flex;
    gap:10px;
    margin-top:10px;
    flex-wrap:wrap;
}
.qtd-btn{
    width:38px;
    height:38px;
    border-radius:50%;
    border:none;
    background:linear-gradient(135deg,#3b82f6,#1d4ed8);
    color:#fff;
    font-size:20px;
    cursor:pointer;
}
.excluir-btn{
    background:#ef4444;
    color:#fff;
    border:none;
    padding:6px 14px;
    border-radius:8px;
    font-size:15px;
}

.btn-whatsapp{
    flex-shrink:0;
    width:100%;
    padding:14px;
    background:#25d366;
    color:#fff;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-size:18px;
    position:sticky;
    bottom:0;
    margin-top:10px;
}

.btn-carrinho{
    position:fixed;
    right:15px;
    bottom:15px;
    width:58px;
    height:58px;
    background:#0416b9;
    border-radius:50%;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:26px;
    color:#fff;
    cursor:pointer;
    z-index:1500;
}
.contador{
    position:absolute;
    top:-5px;
    right:-5px;
    background:red;
    color:#fff;
    width:22px;
    height:22px;
    border-radius:50%;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:18px;
}

.fly-img{
    position:fixed;
    width:80px;
    height:80px;
    object-fit:cover;
    border-radius:10px;
    z-index:3000;
    transition:0.8s ease-in-out;
}

.qtd-btn.pulse{
    animation:pulseScale 0.25s ease-out;
}
@keyframes pulseScale{
    0%{transform:scale(1);}
    40%{transform:scale(1.18);}
    100%{transform:scale(1);}
}

.input-qtd{
    width:60px;
    padding:6px;
    text-align:center;
    font-size:16px;
    border:1px solid #ccc;
    border-radius:6px;
}

.limpar-btn{
    background:#f59e0b;
    color:#fff;
    border:none;
    padding:6px 12px;
    border-radius:8px;
    cursor:pointer;
    font-size:15px;
}
.limpar-btn:hover{
    background:#d97706;
}

/* POPUP DE TERMOS */
.popup-termos{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.55);
    display:flex;
    justify-content:center;
    align-items:center;
    z-index:3000;
}

.popup-box{
    background:#fff;
    width:90%;
    max-width:380px;
    padding:20px;
    border-radius:14px;
    box-shadow:0 6px 20px rgba(0,0,0,0.25);
    text-align:left;
}

.popup-box h3{
    margin-top:0;
    font-size:20px;
}

.popup-check{
    display:flex;
    align-items:center;
    gap:8px;
    margin:15px 0;
    font-size:15px;
}

.popup-btn{
    width:100%;
    padding:12px;
    background:#2563eb;
    color:#fff;
    border:none;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
}

/* Margem lateral do popup em telas pequenas */
@media (max-width: 480px) {
    .popup-box{
        margin-left: 15px;
        margin-right: 15px;
    }
}
.popup-label{
    font-size:15px;
    margin-top:10px;
    display:block;
}

.popup-input{
    width:100%;
    padding:10px;
    margin-top:5px;
    margin-bottom:10px;
    border:1px solid #ccc;
    border-radius:8px;
    font-size:15px;
}

.popup-btn-cancelar{
    width:100%;
    padding:12px;
    background:#ef4444;
    color:#fff;
    border:none;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
}
.popup-btn-cancelar:hover{
    background:#dc2626;
}

.popup-box{
    background:#fff;
    width:90%;
    max-width:380px;
    padding:20px;
    border-radius:14px;
    box-shadow:0 6px 20px rgba(0,0,0,0.25);
    text-align:left;
    box-sizing:border-box; /* garante alinhamento perfeito */
}

.popup-input{
    width:100%;               /* ocupa toda a largura interna */
    padding:12px;             /* padding confortável */
    margin-top:5px;
    margin-bottom:12px;
    border:1px solid #ccc;
    border-radius:8px;
    font-size:16px;
    box-sizing:border-box;    /* evita ultrapassar o popup */
}

@media (max-width: 480px) {
    .popup-box{
        margin-left: 15px;
        margin-right: 15px;
        width: calc(100% - 30px); /* garante que o popup não encoste nas bordas */
    }
}

.popup-close-btn{
    position:absolute;
    top:10px;
    right:10px; /* AGORA NO LADO DIREITO */
    background:#ef4444;
    color:#fff;
    border:none;
    width:32px;
    height:32px;
    border-radius:50%;
    font-size:18px;
    cursor:pointer;
    display:flex;
    justify-content:center;
    align-items:center;
}

.popup-close-btn:hover{
    background:#dc2626;
}

.popup-box{
    position:relative; /* necessário para o botão X ficar dentro da caixa */
}
