/****************************************************************************
 * 1) RESET & BASE
 ****************************************************************************/

 html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

body {
    /* Se você tiver uma navbar fixa, este padding-top ajuda a não sobrepor conteúdo */
    padding-top: 60px;
}

/****************************************************************************
 * 2) LAYOUT PRINCIPAL
 ****************************************************************************/

.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Ajuste básico para a seção de catálogo */
.catalogo {
    padding-top: 20px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/****************************************************************************
 * 3) CARTÕES DE PRODUTO
 ****************************************************************************/

.produto {
    margin-bottom: 20px;
    padding: 10px;
}

.produto .card {
    border: none;
    transition: transform 0.2s;
    height: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.produto .card:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.produto .card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    font-size: 0.95em; /* Fonte geral menor */
}

/* Título do produto */
.produto .card-title {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 4px;
    color: #333;
    text-align: center; /* Centraliza o texto horizontalmente */
}

/* Imagem do produto */
.produto .card-img-top {
    height: 180px;
    object-fit: contain;
    padding: 5px;
}

/* Informações do produto */
.produto-info {
    margin-bottom: 6px !important;  /* Reduzido de 1rem/16px */
}
.produto-info p {
    margin-bottom: 1px;  /* Reduzido do padrão */
    line-height: 1.2;    /* Reduzido do padrão */
}

/* Destaque para "PDV MÍNIMO À VISTA:" em verde */
.produto-info p strong:contains("PDV MÍNIMO À VISTA:"),
p:contains("PDV MÍNIMO À VISTA:") {
    color: #078957;
}

/* Exemplo de destaque adicional */
.produto .pdv-minimo {
    font-size: 1.2em;
    color: #078957;
    font-weight: bold;
}

/* Preço */
.produto .preco {
    font-size: 1em;
    text-align: center;
    margin-bottom: 8px;
}

/* Botão principal */
.add-to-cart {
    font-size: 0.95em;
    padding: 6px 12px;
}

/* Texto de total */
.produto-total {
    font-size: 0.95em;
    margin-bottom: 5px;
}

/****************************************************************************
 * 4) FORMULÁRIOS & OPÇÕES DE TAMANHO
 ****************************************************************************/

/* Ajuste nos radio buttons e inputs */
.form-check {
    margin-bottom: 2px;  /* Reduzido do padrão */
    padding-top: 0;
    padding-bottom: 0;
}

.modo-adicao {
    margin: 5px 0;  /* Reduzido de 10px */
}

.quantidade-multipla label,
.tamanhos label {
    font-size: 0.9em;
}

.quantidade-multipla,
.tamanhos {
    margin-top: 5px;
}

/* Indicadores de quantidade */
.multiple-indicator {
    margin-top: 3px;
    font-size: 0.9em;
    text-align: center;
}

/* Exemplo de container para total de quantidades */
.quantidade-total-container {
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

/****************************************************************************
 * 5) BARRA DE PESQUISA (SEARCH-CONTAINER)
 ****************************************************************************/

/* Barra de pesquisa sticky no topo */
.search-container {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    gap: 10px;
    padding: 15px;
    margin-bottom: 20px;
    justify-content: center; /* nova propriedade para centralizar horizontalmente */
    align-items: center;     /* nova propriedade para centralizar verticalmente */
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Efeito de sombra extra quando a página rola */
.search-container.shadow-scroll {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Inputs dentro da barra de pesquisa */
.search-container .form-control {
    border-radius: 5px;
    border: 1px solid #ced4da;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    height: 42px; /* para manter altura consistente */
}

.search-container .form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
    border-color: #80bdff;
}

/* Campo de busca */
#search-input {
    flex: 3;
    max-width: 600px;
}

/* Dropdown de ordenação */
#sort-select {
    flex: 1;
    max-width: 250px;
}

/****************************************************************************
 * 6) CARRINHO (TOGGLE E SUMMARY)
 ****************************************************************************/

/* Botão flutuante para abrir/fechar o carrinho */
#toggle-cart {
    position: fixed;
    bottom: 80px; /* Alterado de 20px para 80px para evitar sobreposição */
    right: 20px;
    z-index: 1300;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.2s, transform 0.2s;
}
#toggle-cart:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

/* Painel do carrinho */
#cart-summary {
    position: fixed;
    top: 70px; /* se tiver navbar fixa, ajuste conforme necessário */
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    transition: transform 0.3s ease;
    z-index: 1300;
}

/* Classe para esconder o carrinho (fica fora da tela à direita) */
#cart-summary.cart-collapsed {
    transform: translateY(100vh); /* Move totalmente para fora da tela, na vertical */
    bottom: 0;
    right: 0;
    left: 0;
    position: fixed;
    pointer-events: none;
}

/* Badge do carrinho (contador) */
#cart-count {
    position: absolute;
    top: -8px !important;
    right: -8px !important;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 0.25em 0.6em;
    font-size: 0.75rem;
    min-width: 18px;
    text-align: center;
}

/* Itens dentro do carrinho */
.cart-item {
    position: relative;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.item-controls {
    position: absolute;
    top: 5px;
    right: 0;
    display: flex;
    gap: 5px;
}

.item-controls button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #007bff;
    padding: 2px 5px;
}
.item-controls button:hover {
    color: #0056b3;
}

/* Remover item */
.remove-item {
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9em;
    text-decoration: underline;
}
.remove-item:hover {
    color: #c82333;
}

/****************************************************************************
 * 7) MODAL DE DETALHES DO PRODUTO
 ****************************************************************************/

/* Conteúdo do modal */
.product-modal-content {
    position: relative;
}

/* Container da imagem principal */
.modal-image-container {
    position: relative;
    overflow: hidden;
    max-height: 60vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    margin: -1rem -1rem 1rem -1rem; /* remove padding do modal-body */
    padding: 1rem;
}

/* Imagem dentro do modal */
.modal-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    pointer-events: none; /* Evita interferir nos cliques para swipe */
}

/* Áreas clicáveis (navegação esquerda/direita) */
.modal-nav-area {
    position: absolute;
    top: 0;
    height: 100%;
    width: 40%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: background 0.3s ease;
}
.modal-nav-area:hover {
    background: rgba(0, 0, 0, 0.1);
}
.modal-nav-area.prev {
    left: 0;
}
.modal-nav-area.next {
    right: 0;
}

/* Botões de navegação (setas) */
.modal-nav-button {
    opacity: 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 1rem;
    cursor: pointer;
    transition: opacity 0.3s ease;
    z-index: 1000;
}
.modal-nav-area:hover .modal-nav-button {
    opacity: 1;
}

/* Botão rápido de adicionar no modal */
.modal-quick-add-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1060;
}
.modal-quick-add-btn {
    background-color: #0d6efd;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 1.2em;
}
.modal-quick-add-btn:hover {
    background-color: #0b5ed7;
    transform: scale(1.1);
}

/* Dimensões do modal */
.modal-dialog {
    max-width: 800px; /* Largura máxima */
    margin: 1.75rem auto;
}
.modal-content {
    background-color: #fff;
    border-radius: 12px;
}

/****************************************************************************
 * 8) RESPONSIVIDADE GERAL
 ****************************************************************************/

@media (max-width: 768px) {
    /* Barra de pesquisa empilhada no mobile */
    .search-container {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        padding: 10px;
    }
    #search-input,
    #sort-select {
        max-width: 100%;
    }

    /* Ajuste no container do carrinho (desliza a partir de baixo) */
    #cart-summary {
        width: 90%;
        right: 5%;
        left: 5%;
        bottom: 80px;
        top: auto;
        transform: translateY(0); /* quando aberto */
    }
    #cart-summary.cart-collapsed {
        transform: translateY(100vh); /* Oculta completamente na vertical */
    }

    #toggle-cart {
        bottom: 75px !important; /* Força o posicionamento no mobile */
        right: 15px !important;
        z-index: 1050 !important; /* Garante que o botão fique acima de outros elementos */
    }

    .produto {
        padding: 5px;
    }

    /* Modal de produto menor em altura */
    .modal-image-container {
        min-height: 300px;
        max-height: 60vh;
    }
    .modal-image-container img {
        max-height: 55vh;
    }
}

/* Ajuste para telas muito baixas */
@media (max-height: 700px) {
    .modal-image-container {
        min-height: 250px;
        max-height: 50vh;
    }
    .modal-image-container img {
        max-height: 45vh;
    }
}

/****************************************************************************
 * 9) TOAST NOTIFICATIONS (SE FOR USAR)
 ****************************************************************************/

#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 900;
}

.toast {
    min-width: 200px;
}

/****************************************************************************
 * 10) AJUSTES DE ESPAÇAMENTO GERAL
 ****************************************************************************/

.mt-3 {
    margin-top: 6px !important;
}

/****************************************************************************
 * 11) ESTILOS DA VITRINE DE CHECKOUT (ADICIONAIS)
 ****************************************************************************/

/**
 * ESTILOS APRIMORADOS PARA A VITRINE DE CHECKOUT
 *
 * Este CSS implementa layouts responsivos e opções de visualização flexíveis
 * para permitir uma experiência de usuário otimizada para representantes comerciais.
 */

/* Contenedor principal da vitrine */
#vitrine-container {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

/* Painel de controles da vitrine */
#view-controls {
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 15px;
}

#view-controls label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

#view-controls select,
#view-controls input[type="checkbox"] {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#view-controls select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* Contenedor dos produtos */
.produtos-vitrine {
    padding: 15px;
}

/* Grid responsivo com diferentes configurações */
.sortable-container {
    display: grid;
    gap: 15px;
    width: 100%;
    position: relative;
    min-height: 50px;
    transition: all 0.3s ease;
}

/* Layouts de Grid com diferentes números de colunas */
.layout-grid-6 {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
}

.layout-grid-5 {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
}

.layout-grid-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
}

.layout-grid-3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
}

.layout-grid-2 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
}

/* Layout de Lista */
.layout-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    grid-template-columns: unset !important; /* Desabilita grid columns explicitamente */
}

/* Cartão de produto na vitrine */
.produto-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 10px;
    transition: all 0.2s ease;
}

.produto-card:hover {
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    cursor: grab;
}

/* Alça para arrastar */
.drag-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    cursor: grab;
    color: #aaa;
    z-index: 10;
    padding: 5px;
    font-size: 16px;
    opacity: 0.5;
}

.drag-handle:hover {
    opacity: 1;
    color: #666;
}

/* Botão de remover */
.remove-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.7);
    border: none;
    cursor: pointer;
    color: #dc3545;
    font-size: 14px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
    transition: all 0.2s ease;
}

.remove-button:hover {
    background: #dc3545;
    color: white;
}

/* Container da Imagem do Produto */
.produto-imagem-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.produto-imagem {
    display: block;
    max-width: 100%;
    object-fit: contain;
    transition: height 0.3s ease;
}

/* Tamanhos de Imagem */
.img-size-small .produto-imagem {
    height: 80px;
}

.img-size-medium .produto-imagem {
    height: 140px;
}

.img-size-large .produto-imagem {
    height: 200px;
}

/* Informações do Produto */
.produto-info {
    padding: 5px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.produto-titulo {
    font-size: 0.85rem;
    font-weight: bold;
    color: #002244;
    margin: 0 0 4px 0;
    line-height: 1.2;
    height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.produto-artigo {
    font-size: 0.7rem;
    color: #666;
    margin: 2px 0;
}

.quantidade {
    font-size: 0.8rem;
    font-weight: bold;
    color: #333;
    margin: 4px 0;
    padding: 2px 4px;
    background-color: #f8f9fa;
    border-radius: 3px;
    display: inline-block;
}

.produto-preco {
    font-size: 0.85rem;
    font-weight: bold;
    color: #0056b3;
    margin: 4px 0;
}

.pdv-minimo {
    font-size: 0.75rem;
    font-weight: bold;
    color: #078957;
    margin: 4px 0;
}

/* Controle de visibilidade das informações */
.hide-price .produto-preco {
    display: none;
}

.hide-pdv .pdv-minimo {
    display: none;
}

.hide-quantity .quantidade {
    display: none;
}

.hide-article .produto-artigo {
    display: none;
}

/* Ajustes para o layout de lista */
.layout-list .produto-card {
    flex-direction: row;
    align-items: center;
    min-height: unset;
    height: auto;
    padding: 8px 30px 8px 30px;
}

.layout-list .produto-imagem-container {
    width: auto;
    margin-right: 15px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.layout-list.img-size-small .produto-imagem-container {
    width: 60px;
    height: 60px;
}

.layout-list.img-size-medium .produto-imagem-container {
    width: 80px;
    height: 80px;
}

.layout-list.img-size-large .produto-imagem-container {
    width: 100px;
    height: 100px;
}

.layout-list .produto-imagem {
    height: 100%;
    width: 100%;
}

.layout-list .produto-info {
    text-align: left;
    padding-left: 15px;
}

.layout-list .produto-titulo,
.layout-list .produto-artigo,
.layout-list .pdv-minimo,
.layout-list .quantidade,
.layout-list .produto-preco {
    text-align: left;
    margin: 2px 0;
}

.layout-list .drag-handle {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.layout-list .remove-button {
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

/* Estilos para o SortableJS */
.sortable-ghost {
    opacity: 0.4;
    background-color: #e6f7ff;
    border: 1px dashed #91d5ff;
}

.sortable-chosen {
    box-shadow: 0 5px 10px rgba(0,0,0,0.15);
    transform: scale(1.02);
    z-index: 10;
    border-color: #aaa;
}

.sortable-drag {
    opacity: 0.9;
    cursor: grabbing;
}

/* Responsividade */
@media (max-width: 1200px) {
    .layout-grid-6 {
        grid-template-columns: repeat(4, 1fr);
    }

    .layout-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .layout-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .layout-grid-6, .layout-grid-5, .layout-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .layout-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .layout-grid-6, .layout-grid-5, .layout-grid-4, .layout-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout-grid-2 {
        grid-template-columns: 1fr;
    }

    .img-size-large .produto-imagem {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .layout-grid-6, .layout-grid-5, .layout-grid-4, .layout-grid-3, .layout-grid-2 {
        grid-template-columns: 1fr;
    }

    .produto-card {
        padding: 8px;
    }

    .layout-list .produto-imagem-container {
        width: 60px;
        margin-right: 10px;
    }
}

/* Estilos para o botão de screenshot/cópia */
#screenshot-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#screenshot-button:hover {
    background-color: #5a6268;
}

#screenshot-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#clipboard-feedback {
    color: #28a745;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#clipboard-feedback.show {
    opacity: 1;
}

/* Indicador de carregamento */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-indicator::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal para opções de imagem */
.vitrine-options-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.vitrine-options-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 90%;
    width: 600px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.vitrine-options-content h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.vitrine-preview {
    margin: 15px 0;
    text-align: center;
    border: 1px solid #eee;
    padding: 10px;
    background: #f9f9f9;
    max-height: 300px;
    overflow: auto;
}

.vitrine-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Estilo para o feedback do botão de cópia */
#modal-feedback {
    text-align: center;
    margin-top: 10px;
    font-weight: 500;
    min-height: 20px;
    transition: all 0.3s ease;
}

/* Estilos para melhorar a captura de screenshot */
.screenshot-preparing .produto-card {
    margin: 6px !important;
    transition: none !important;
}

.screenshot-mode {
    background-color: white !important;
    box-shadow: none !important;
    border: none !important;
    gap: 12px !important;
}

.screenshot-mode .produto-card {
    transform: none !important;
    transition: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    border: 1px solid #e0e0e0 !important;
    margin: 6px !important;
}

/* Classes para corrigir o arrastar travando */
.being-dragged {
    z-index: 9999 !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
}

/* Melhora a aparência quando o item está sendo arrastado */
.sortable-ghost {
    opacity: 0.4 !important;
    background-color: #f0f8ff !important;
    border: 1px dashed #4b9cdb !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Suaviza a animação do arrasto para melhor desempenho */
.sortable-drag {
    opacity: 0.9 !important;
    transform: scale(1.03) !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15) !important;
    z-index: 10000 !important;
    pointer-events: none !important;
}

/* Corrige btn-secondary invisível causado pelo conflito Tailwind + Bootstrap */
.btn-secondary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}
.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
    color: #fff !important;
}
