/* Arquivo: assets/css/loja.css */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; -webkit-tap-highlight-color: transparent; }
body { background-color: #f4f4f9; color: #333; }

/* =========================================
   CABEÇALHO E MENU FIXOS JUNTOS
========================================= */
.top-fixo { position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.08); background: #fff; }

.header-loja { background: var(--cor-primaria); color: #fff; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.header-loja-info { display: flex; align-items: center; gap: 10px; overflow: hidden; flex-grow: 1; }
.logo-loja { height: 40px; width: 40px; border-radius: 50%; object-fit: cover; background: #fff; padding: 2px; }
.header-titulo { font-size: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0;}

.btn-cart-top { background: #fff; color: var(--cor-primaria); border: none; padding: 8px 15px; border-radius: 20px; font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-shrink: 0;}

/* =========================================
   WRAPPER DO MENU DE CATEGORIAS (DESKTOP UX)
========================================= */
.menu-categorias-wrapper {
    position: relative;
    background: #fff;
    display: flex;
    align-items: center;
}

/* Menu Horizontal de Categorias */
.menu-categorias {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 12px 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    flex-grow: 1; /* Preenche o espaço entre as setas */

    /* A MÁGICA PARA O FIREFOX E EDGE ANTIGO */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE e Edge */
}
.menu-categorias::-webkit-scrollbar { display: none; } /* Chrome, Safari e Opera */

.btn-cat { background: #f0f0f0; border: none; padding: 8px 18px; border-radius: 20px; font-weight: 600; color: #555; cursor: pointer; white-space: nowrap; transition: all 0.2s ease; }
.btn-cat.active { background: var(--cor-primaria); color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

/* Estilo das Setas de Rolagem (Escondidas no Mobile) */
.btn-scroll-cat {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    color: var(--cor-primaria);
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 15px; /* AJUSTE: Tiramos o padding vertical (10px) para não empurrar o ícone */
    position: absolute;
    z-index: 10;
    height: 100%;
    transition: 0.2s;

    /* A MÁGICA DA CENTRALIZAÇÃO (Flexbox) */
    align-items: center;
    justify-content: center;
}
.btn-scroll-cat:hover { color: #333; background: #f4f4f4; }

#btn-scroll-left { left: 0; box-shadow: 5px 0 10px -5px rgba(0,0,0,0.15); }
#btn-scroll-right { right: 0; box-shadow: -5px 0 10px -5px rgba(0,0,0,0.15); }

/* Responsividade: Mostra as setas só em telas grandes (PCs) */
@media (min-width: 768px) {
    .menu-categorias {
        padding-left: 45px; /* Abre espaço para a seta não cobrir o primeiro botão */
        padding-right: 45px;
    }
}

.container { max-width: 1200px; margin: 20px auto; padding: 0 15px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; padding-bottom: 20px;}

/* Cartão Padrão: Agora com uma borda cinza fina para delimitar espaço no mobile */
.card-produto {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb; /* <- Nova borda divisória */
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

/* Efeito Premium: Quando passa o mouse (PC) ou segura o toque (Mobile) */
.card-produto:hover,
.card-produto:active {
    border-color: var(--cor-primaria); /* Pinta a borda com a cor da loja */
    box-shadow: 0 8px 16px rgba(0,0,0,0.12); /* Aumenta a sombra */
    transform: translateY(-3px); /* Faz o cartão dar um "pulinho" para cima */
}

.card-produto img { width: 100%; height: 160px; object-fit: cover; background-color: #f9f9f9; border-bottom: 1px solid #eee; }
.sem-foto-loja {
    width: 100%;
    height: 160px;
    background-color: #f9fafb;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    font-size: 3em;
}
.badge-promo { position: absolute; top: 10px; left: 10px; background: #e11d48; color: white; padding: 4px 8px; font-size: 0.75em; font-weight: bold; border-radius: 6px; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }

.card-info { padding: 12px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-info h3 { font-size: 1em; margin-bottom: 5px; }
.card-info p { font-size: 0.8em; color: #777; margin-bottom: 10px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { display: flex; flex-direction: column; gap: 8px; }
.preco-container { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.preco-antigo { text-decoration: line-through; color: #999; font-size: 0.85em; }
.preco { font-weight: 900; color: var(--cor-primaria); font-size: 1.1em; }
.btn-add { background: var(--cor-primaria); color: white; border: none; padding: 8px; border-radius: 6px; cursor: pointer; font-weight: bold; }

/* Sidebar (Carrinho Lateral) */
#cart-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; }

#cart-sidebar {
    position: fixed; top: 0; right: -400px; width: 400px; max-width: 90%;
    height: 100vh; /* Fallback */
    height: 100dvh; /* SOLUÇÃO DO CORTE NO MOBILE: Altura dinâmica da tela */
    background: #fff; z-index: 1000; transition: right 0.3s ease-in-out; display: flex; flex-direction: column; box-shadow: -5px 0 15px rgba(0,0,0,0.1);
}
#cart-sidebar.open { right: 0; }
#cart-overlay.open { display: block; }

.cart-header { padding: 15px; background: var(--cor-primaria); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.btn-close { background: rgba(255, 255, 255, 0.2); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; }
.btn-close i { font-size: 1.2em; }
.btn-close:hover { background: rgba(255, 255, 255, 0.4); transform: scale(1.1); }
.btn-trash { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; margin-left: 5px; }

.cart-body { padding: 15px; overflow-y: auto; flex-grow: 1; background: #f9f9f9; }
.cart-section { background: #fff; padding: 15px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #eee; }
.cart-section h3 { font-size: 0.9em; border-bottom: 1px dashed #ccc; padding-bottom: 5px; margin-bottom: 10px; }

input, select, textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.9em; box-sizing: border-box; margin-bottom: 5px; transition: all 0.3s;}
.toggle-box { display: flex; gap: 5px; margin-bottom: 10px;}
.toggle-box button { flex: 1; padding: 12px 5px; border: 1px solid #ccc; background: #fff; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 0.85em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s;}
.toggle-box button.active { background: var(--cor-primaria); color: #fff; border-color: var(--cor-primaria); }

@keyframes piscarDestaque {
    0% { border-color: #ccc; box-shadow: none; }
    25% { border-color: var(--cor-primaria); box-shadow: 0 0 8px var(--cor-primaria); }
    50% { border-color: #ccc; box-shadow: none; }
    75% { border-color: var(--cor-primaria); box-shadow: 0 0 8px var(--cor-primaria); }
    100% { border-color: var(--cor-primaria); box-shadow: 0 0 4px var(--cor-primaria); }
}
.highlight-input { animation: piscarDestaque 1s ease-in-out forwards; border-color: var(--cor-primaria) !important; outline: none; }

.cart-resumo { background: #f8f9fa; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; margin-top: 15px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);}
.cart-resumo p { display: flex; justify-content: space-between; font-size: 0.95em; color: #555; margin-bottom: 8px; }
.cart-resumo h3 { display: flex; justify-content: space-between; align-items: center; font-size: 1.3em; color: var(--cor-primaria); margin-top: 12px; padding-top: 12px; border-top: 2px dashed #ccc; }

.cart-footer {
    padding: 15px;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 10px; background: #fff; border-top: 1px solid #eee;
}
.btn-fechar { background: #25D366; color: #fff; border: none; padding: 15px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1.1em; }

#custom-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 2000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; }
#custom-modal-overlay.show { display: flex; opacity: 1; }
.custom-modal-box { background: #fff; padding: 25px 20px; border-radius: 12px; max-width: 90%; width: 320px; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,0.2); transform: translateY(-20px) scale(0.95); transition: all 0.3s ease; }
#custom-modal-overlay.show .custom-modal-box { transform: translateY(0) scale(1); }
.custom-modal-box p { margin-bottom: 20px; font-size: 1em; color: #444; line-height: 1.4; }
.custom-modal-buttons { display: flex; justify-content: center; gap: 10px; }
.btn-modal { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 0.9em; transition: 0.2s; }
.btn-modal-cancel { background: #e0e0e0; color: #555; }
.btn-modal-confirm { background: var(--cor-primaria); color: #fff; }

.search-container { position: relative; display: flex; align-items: center; width: 100%; }
.search-container input { width: 100%; padding: 12px 40px 12px 42px; border: 1px solid #ddd; border-radius: 25px; font-size: 1em; background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23999" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 15px center; transition: all 0.3s; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.search-container input:focus { outline: none; border-color: var(--cor-primaria); box-shadow: 0 0 8px rgba(0,0,0,0.1); }
.btn-clear-search { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); margin-top: -2px; background: none; border: none; color: #999; font-size: 1.2em; cursor: pointer; display: none; align-items: center; justify-content: center; padding: 5px; transition: 0.2s; }
.btn-carregar-mais { display: none; margin: 20px auto 40px; padding: 12px 30px; background: transparent; color: var(--cor-primaria); border: 2px solid var(--cor-primaria); border-radius: 25px; font-weight: bold; cursor: pointer; transition: 0.3s; text-align: center; }
#msg-sem-produtos { display: none; grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: #777; font-size: 1.1em; }

.btn-cat.btn-cat-promo {
    background-color: #e11d48 !important;
    color: #ffffff !important;
    font-weight: bold;
}
.btn-cat.btn-cat-promo.active {
    box-shadow: 0 4px 8px rgba(225, 29, 72, 0.4);
    transform: scale(1.05);
}

/* =========================================
   MODAL DE INFORMAÇÕES DA LOJA (LEI E-COMMERCE)
========================================= */
.btn-info-loja { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 0.8em; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 5px; margin-top: 2px; padding: 0; font-weight: normal; }
.btn-info-loja:hover { color: #fff; }
.btn-info-loja:hover span { text-decoration: underline; }

.modal-info-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; padding: 15px; }
.modal-info-overlay.show { display: flex; opacity: 1; }

.modal-info-box { background: #fff; border-radius: 12px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.2); transform: translateY(-20px); transition: all 0.3s ease; display: flex; flex-direction: column; }
.modal-info-overlay.show .modal-info-box { transform: translateY(0); }

.modal-info-header { padding: 15px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 10; border-radius: 12px 12px 0 0; }
.modal-info-header h2 { font-size: 1.1em; color: #333; margin: 0; }
.btn-close-info { background: #f0f0f0; border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: #555; display: flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 1.1em; }
.btn-close-info:hover { background: #e0e0e0; color: #000; }

.modal-info-body { padding: 20px; color: #555; font-size: 0.9em; line-height: 1.5; }
.modal-info-body hr { border: none; border-top: 1px dashed #ddd; margin: 15px 0; }
.info-text { color: #777; margin-top: 2px; }

.info-list { list-style: none; padding: 0; margin-top: 5px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-list li { display: flex; align-items: center; gap: 6px; font-size: 0.9em; color: #444; }

.pix-box { display: flex; align-items: center; justify-content: space-between; background: #f8f9fa; border: 1px solid #ddd; padding: 12px; border-radius: 8px; margin-top: 5px; gap: 10px; }
.pix-box span { font-family: monospace; font-size: 1em; color: #333; word-break: break-all; flex-grow: 1; }
.btn-copiar-pix {
    background: #32bcad;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    transition: 0.2s;
    white-space: nowrap;
    min-width: 115px; /* Impede o botão de encolher ou esticar */
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-copiar-pix:hover { background: #2ba496; }

.btn-zap-loja { display: flex; align-items: center; justify-content: center; gap: 8px; background: #25D366; color: #fff; text-decoration: none; padding: 14px; border-radius: 8px; font-weight: bold; font-size: 1em; text-align: center; transition: 0.2s; margin-top: 5px;}
.btn-zap-loja:hover { background: #20bd5a; }

/* =========================================
   Botões das Opções do Produto (Modal Variações)
========================================= */
.btn-opcao-item {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: bold;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;

    /* Flexbox Blindado: Força o lado esquerdo e direito a ficarem na mesma linha */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* Opção Nuclear: Força QUALQUER texto ou ícone a alinhar pelo meio geométrico */
.btn-opcao-item > span,
.btn-opcao-item > div,
.btn-opcao-item > div > span,
.btn-opcao-item > div > i {
    display: flex;
    align-items: center;
    line-height: 1; /* <- Remove o espaço invisível acima e abaixo das letras */
    margin: 0;
}

/* Dá o espacinho apenas entre o Preço e o Sinal de + */
.btn-opcao-item > div {
    gap: 8px;
}

/* Efeito Premium ao passar o mouse */
.btn-opcao-item:hover {
    background: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Deixa tudo branco por dentro ao passar o mouse */
.btn-opcao-item:hover * {
    color: white !important;
}

.btn-opcao-item:hover {
    background: var(--cor-primaria);
    color: white;
    border-color: var(--cor-primaria);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* Força a cor dos elementos internos (como o span do preço) a ficar branco no hover */
.btn-opcao-item:hover * {
    color: white !important;
}
/* =========================================
   Botão de WhatsApp ao lado da Referência
========================================= */
.ref-container {
    font-size: 0.75em;
    color: #999;
    margin-top: -3px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-zap-ref {
    color: #25D366;
    text-decoration: none;
    font-size: 1.3em;
    padding: 2px;
    margin-top: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.btn-zap-ref:hover {
    transform: scale(1.2);
    color: #20bd5a; /* Fica um verde ligeiramente mais escuro ao passar o rato */
}

/* =========================================
   LIGHTBOX DA IMAGEM DO PRODUTO
========================================= */
#lightbox-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 3000;
    display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
#lightbox-overlay.show {
    display: flex; opacity: 1;
}
#lightbox-img {
    max-width: 90%; max-height: 90vh;
    object-fit: contain; border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(0.95); transition: transform 0.3s ease;
}
#lightbox-overlay.show #lightbox-img {
    transform: scale(1);
}
.btn-fechar-lightbox {
    position: absolute; top: 20px; right: 20px;
    background: rgba(255,255,255,0.2); border: none; color: white;
    width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.5em; cursor: pointer; display: flex;
    align-items: center; justify-content: center; transition: 0.2s;
    z-index: 3001;
}
.btn-fechar-lightbox:hover {
    background: rgba(255,255,255,0.5); transform: scale(1.1);
}

/* =========================================
   ESTILO DA UNIDADE DE MEDIDA (EX: UN, KG)
========================================= */
.unidade-medida {
    font-size: 0.75em; /* Deixa o texto bem menor que o preço */
    color: #9ca3af; /* Um tom de cinza mais suave e discreto */
    font-weight: 400; /* Tira o negrito, caso o preço principal tenha */
    margin-left: 2px; /* Dá um espacinho milimétrico do preço */
    text-transform: lowercase; /* Dica de design: transforma 'UN' em 'un', fica bem mais elegante */
}

/* =========================================
   BARRA FLUTUANTE (STICKY CART)
========================================= */
.sticky-cart {
    position: fixed;
    bottom: -100px; /* Escondida por padrão (fora da tela) */
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 500px;
    background: var(--cor-primaria);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 990; /* Fica abaixo dos modais, mas acima da loja */
    transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Efeito "mola" ao subir */
}
.sticky-cart.show {
    bottom: 20px; /* Sobe e fica flutuando */
}

/* Botão de Fechar/Esvaziar [X] */
.btn-fechar-sticky {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: 0.2s;
    flex-shrink: 0;
}
.btn-fechar-sticky:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }

/* Resumo (Ícone + Texto) */
.sticky-resumo {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 0 15px;
}
.sticky-textos { display: flex; flex-direction: column; text-align: left; }
.sticky-count { font-size: 0.85em; opacity: 0.9; font-weight: 500; }
.sticky-total { font-size: 1.1em; font-weight: 900; display: inline-block; transition: transform 0.2s; }

/* Botão Ver Sacola */
.btn-ver-sacola-sticky {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}
.btn-ver-sacola-sticky:hover { background: #fff; color: var(--cor-primaria); }