/* ================================================
   PRODUTOS.CSS — Tiju Brindes
   Inclui: Preloader, Dropdown Categorias, Busca,
           Grid, Modal, Paginação, Badges, Tags
   ================================================ */

/* ===== PRELOADER ===== */
#preloader-produtos {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#preloader-produtos.oculto {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: #2b3c6f;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.preloader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(43, 60, 111, 0.15);
    border-top-color: #2b3c6f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== LAYOUT GERAL ===== */
.portfolio-completo {
    padding: 140px 0 80px;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 15px;
    border-bottom: 2px solid #2b3c6f;
    gap: 1rem;
    flex-wrap: wrap;
}

.portfolio-header h2 {
    font-size: 2.2rem;
    color: #333;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ===== GRUPO DE FILTROS ===== */
.header-filtros {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== DROPDOWN CATEGORIAS ===== */
.dropdown-categorias {
    position: relative;
}

.btn-categorias {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    color: #2b3c6f;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid #2b3c6f;
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
    line-height: 1;
}

.btn-categorias:hover,
.dropdown-categorias.aberto .btn-categorias {
    background: #2b3c6f;
    color: white;
}

.btn-categorias:hover svg,
.dropdown-categorias.aberto .btn-categorias svg {
    stroke: white;
}

.seta-dropdown {
    transition: transform 0.25s;
    flex-shrink: 0;
}

.dropdown-categorias.aberto .seta-dropdown {
    transform: rotate(180deg);
}

.dropdown-lista {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 210px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 500;
    overflow: hidden;
    animation: fadeDown 0.2s ease;
}

.dropdown-categorias.aberto .dropdown-lista {
    display: block;
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: block;
    padding: 0.7rem 1.1rem;
    font-size: 0.9rem;
    color: #444;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:last-child { border-bottom: none; }

.dropdown-item:hover {
    background: #f0f3fa;
    color: #2b3c6f;
}

.dropdown-item.ativo {
    background: #2b3c6f;
    color: white;
    font-weight: 600;
}

.dropdown-vazio {
    display: block;
    padding: 0.7rem 1.1rem;
    font-size: 0.85rem;
    color: #aaa;
    font-style: italic;
}

/* ===== BARRA DE BUSCA ===== */
.barra-busca {
    flex: 1;
    max-width: 380px;
    min-width: 200px;
}

.busca-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.busca-icone {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    opacity: 0.45;
    pointer-events: none;
    flex-shrink: 0;
}

.busca-input {
    width: 100%;
    padding: 0.62rem 2.8rem 0.62rem 2.5rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333;
    background: white;
    transition: border-color 0.25s, box-shadow 0.25s;
    outline: none;
}

.busca-input:focus {
    border-color: #2b3c6f;
    box-shadow: 0 0 0 3px rgba(43, 60, 111, 0.1);
}

.busca-input::placeholder { color: #aaa; }

.busca-limpar {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: #e0e0e0;
    border-radius: 50%;
    color: #555;
    text-decoration: none;
    transition: background 0.2s;
}

.busca-limpar:hover { background: #bbb; }

/* ===== BOTÃO VOLTAR ===== */
.btn-ver-todos {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    color: #2b3c6f;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border: 2px solid #2b3c6f;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-ver-todos:hover { background: #2b3c6f; color: white; }

/* ===== TAGS DE FILTROS ATIVOS ===== */
.filtros-ativos {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag-filtro {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #e8ecf7;
    color: #2b3c6f;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tag-filtro a {
    display: flex;
    align-items: center;
    color: #2b3c6f;
    opacity: 0.6;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tag-filtro a:hover { opacity: 1; }

.total-resultados {
    font-size: 0.85rem;
    color: #888;
    margin-left: auto;
}

/* ===== GRID DE PRODUTOS ===== */
.portfolio-grid-completo {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 1.5rem 0 3rem;
}

/* ===== CARD ===== */
.portfolio-item-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
}

.portfolio-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.portfolio-item-imagem {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f9f9f9;
}

.portfolio-item-imagem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.portfolio-item-card:hover .portfolio-item-imagem img {
    transform: scale(1.08);
}

.portfolio-item-info {
    padding: 1.2rem;
    text-align: center;
}

.badge-categoria {
    display: inline-block;
    background: #e8ecf7;
    color: #2b3c6f;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.portfolio-item-info h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

/* ===== BOTÃO EU QUERO ===== */
.btn-quero-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #2b3c6f;
    color: white;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
    width: 100%;
    border: none;
    cursor: pointer;
}

.icone-whatsapp {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.btn-quero-modal:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}

/* ===== SEM RESULTADOS ===== */
.sem-resultados {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
    color: #aaa;
    font-size: 1rem;
    text-align: center;
}

.sem-resultados p { margin: 0; color: #999; font-size: 1.05rem; }

/* ===== PAGINAÇÃO ===== */
.paginacao {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.btn-pagina {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-pagina:hover:not(.disabled):not(.active) {
    background: #2b3c6f;
    color: white;
    border-color: #2b3c6f;
}

.btn-pagina.active {
    background: #2b3c6f;
    color: white;
    border-color: #2b3c6f;
}

.btn-pagina.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 2rem;
    width: 90%;
    max-width: 1000px;
    border-radius: 10px;
    position: relative;
    animation: modalFade 0.3s;
}

@keyframes modalFade {
    from { opacity: 0; transform: translateY(-40px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-fechar {
    position: absolute;
    right: 20px; top: 10px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    z-index: 10;
    line-height: 1;
}

.modal-fechar:hover { color: #2b3c6f; }

.modal-produto {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.modal-carrossel {
    position: relative;
    width: 100%;
    height: 300px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.modal-carrossel img { width: 100%; height: 100%; object-fit: cover; }

.carrossel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.85);
    border: none; border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem; color: #333;
    transition: all 0.3s;
    z-index: 5;
    display: flex; align-items: center; justify-content: center;
}

.carrossel-btn:hover { background: #2b3c6f; color: white; }
.carrossel-prev { left: 10px; }
.carrossel-next { right: 10px; }

.modal-miniaturas {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.miniatura {
    width: 100%; height: 70px;
    border-radius: 5px; overflow: hidden;
    cursor: pointer; opacity: 0.6;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.miniatura.ativa { opacity: 1; border-color: #2b3c6f; }
.miniatura:hover { opacity: 1; }
.miniatura img { width: 100%; height: 100%; object-fit: cover; }

.modal-produto-info h2 {
    font-size: 1.7rem;
    margin-bottom: 0.6rem;
    color: #1a1a1a;
    border-bottom: 2px solid #2b3c6f;
    padding-bottom: 0.5rem;
    line-height: 1.25;
    letter-spacing: -0.3px;
}

.modal-descricao {
    margin-bottom: 1.5rem;
    color: #555;
    line-height: 1.8;
    font-size: 0.95rem;

    /* Scroll na descrição */
    max-height: 180px;
    overflow-y: auto;
    padding-right: 8px;

    /* Scrollbar estilizada */
    scrollbar-width: thin;
    scrollbar-color: #2b3c6f #f0f0f0;
}

.modal-descricao::-webkit-scrollbar {
    width: 5px;
}

.modal-descricao::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.modal-descricao::-webkit-scrollbar-thumb {
    background: #2b3c6f;
    border-radius: 10px;
}

.modal-descricao::-webkit-scrollbar-thumb:hover {
    background: #1a2a50;
}

.btn-contato-whatsapp {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    background: #25D366;
    color: white;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 1.5rem;
    transition: all 0.25s;
    width: 100%;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    box-shadow: 0 3px 12px rgba(37,211,102,0.25);
}

.btn-contato-whatsapp:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37,211,102,0.3);
}

.modal-especificacoes {
    background: #f7f8fc;
    padding: 1.2rem 1.5rem;
    border-radius: 10px;
    border: 1px solid #e8ecf7;
    margin-bottom: 1.5rem;
}

.especificacao-item {
    display: flex; flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid #e8e8e8;
}

.especificacao-item:last-child { border-bottom: none; }
.espec-label { font-weight: 700; color: #2b3c6f; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.espec-opcoes { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.opcao-box { display: inline-flex; align-items: center; cursor: pointer; }
.opcao-box input[type="radio"] { display: none; }

.opcao-box span {
    padding: 0.5rem 1.2rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem; color: #444; font-weight: 500;
    transition: all 0.2s;
    min-width: 60px; text-align: center;
}

.opcao-box input[type="radio"]:checked + span {
    background: #2b3c6f; border-color: #2b3c6f; color: white;
    box-shadow: 0 2px 8px rgba(43,60,111,0.3);
}

.opcao-box:hover span { border-color: #2b3c6f; }

.input-quantidade {
    width: 100%; max-width: 200px;
    padding: 0.8rem 1rem;
    border: 2px solid #ddd; border-radius: 5px;
    font-size: 1rem; transition: all 0.3s; background: white;
}

.input-quantidade:focus {
    outline: none;
    border-color: #2b3c6f;
    box-shadow: 0 0 0 3px rgba(43,60,111,0.1);
}

/* ===== RESPONSIVO ===== */

/* Tablet (769–1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .portfolio-completo { padding: 120px 0 60px; }
    .portfolio-header { flex-wrap: wrap; justify-content: center; }
    .portfolio-header h2 { font-size: 1.9rem; }
    .header-filtros { width: 100%; justify-content: center; }
    .barra-busca { max-width: 300px; }
    .portfolio-grid-completo { grid-template-columns: repeat(3, 1fr); gap: 1rem; }
}

/* Mobile Grande (431–768px) */
@media (max-width: 768px) and (min-width: 431px) {
    .portfolio-completo { padding: 100px 0 40px; }
    .portfolio-header { flex-direction: column; align-items: stretch; text-align: center; gap: 0.8rem; }
    .portfolio-header h2 { font-size: 1.7rem; text-align: center; }
    .header-filtros { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .btn-categorias { width: 100%; justify-content: center; }
    .barra-busca { max-width: 100%; }
    .btn-ver-todos { align-self: center; }
    .portfolio-grid-completo { grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
    .portfolio-item-info { padding: 0.8rem; }
    .portfolio-item-info h3 { font-size: 0.85rem; }
    .btn-quero-modal { font-size: 0.75rem; padding: 0.4rem 0.6rem; }

    /* Modal fullscreen */
    .modal { padding: 0; overflow-y: auto; }
    .modal-content {
        width: 100%; max-width: 100%; margin: 0;
        padding: 1.4rem; border-radius: 0;
        min-height: 100dvh; box-sizing: border-box;
    }
    .modal-fechar {
        position: absolute; top: 12px; right: 12px;
        width: 36px; height: 36px; font-size: 1.4rem; line-height: 1;
        background: rgba(0,0,0,0.55); color: white;
        border-radius: 50%; display: flex; align-items: center; justify-content: center;
    }
    .modal-produto { display: flex !important; flex-direction: column !important; gap: 1.2rem; }
    .modal-produto-imagem, .modal-produto-info { width: 100%; }
    .modal-carrossel { height: 280px; border-radius: 10px; margin-bottom: 0.6rem; }
    .modal-miniaturas { grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
    .miniatura { height: 66px; }
    .modal-produto-info h2 { font-size: 1.5rem; }
    .modal-descricao { font-size: 0.93rem; max-height: 180px; }
    .modal-especificacoes { padding: 1rem 1.2rem; }
    .especificacao-item { padding: 0.8rem 0; }
    .opcao-box span { padding: 0.45rem 1rem; font-size: 0.85rem; }
    .btn-contato-whatsapp { padding: 0.9rem; font-size: 0.98rem; }
}

/* Mobile Pequeno (350–430px) */
@media (max-width: 430px) and (min-width: 350px) {
    .portfolio-completo { padding: 80px 0 30px; }
    .portfolio-header { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .portfolio-header h2 { font-size: 1.4rem; text-align: center; }
    .header-filtros { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .btn-categorias { width: 100%; justify-content: center; font-size: 0.85rem; }
    .barra-busca { max-width: 100%; min-width: unset; }
    .busca-input { font-size: 0.85rem; }
    .btn-ver-todos { align-self: center; font-size: 0.8rem; padding: 0.4rem 1rem; }
    .portfolio-grid-completo { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .portfolio-item-info { padding: 0.6rem; }
    .portfolio-item-info h3 { font-size: 0.75rem; }
    .badge-categoria { font-size: 0.6rem; }
    .btn-quero-modal { font-size: 0.65rem; padding: 0.35rem 0.4rem; }
    .icone-whatsapp { width: 13px; height: 13px; }

    /* Modal fullscreen */
    .modal { padding: 0; overflow-y: auto; }
    .modal-content {
        width: 100%; max-width: 100%; margin: 0;
        padding: 1rem; border-radius: 0;
        min-height: 100dvh; box-sizing: border-box;
    }
    .modal-fechar {
        position: absolute; top: 8px; right: 8px;
        width: 30px; height: 30px; font-size: 1.2rem; line-height: 1;
        background: rgba(0,0,0,0.55); color: white;
        border-radius: 50%; display: flex; align-items: center; justify-content: center;
    }
    .modal-produto { display: flex !important; flex-direction: column !important; gap: 1rem; }
    .modal-produto-imagem, .modal-produto-info { width: 100%; }
    .modal-carrossel { height: 230px; border-radius: 8px; margin-bottom: 0.5rem; }
    .modal-miniaturas { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }
    .miniatura { height: 54px; }
    .modal-produto-info h2 { font-size: 1.2rem; }
    .modal-descricao { font-size: 0.85rem; max-height: 130px; line-height: 1.6; }
    .modal-especificacoes { padding: 0.85rem 1rem; }
    .especificacao-item { padding: 0.65rem 0; gap: 0.4rem; }
    .espec-label { font-size: 0.78rem; }
    .opcao-box span { padding: 0.38rem 0.7rem; font-size: 0.78rem; min-width: 40px; }
    .btn-contato-whatsapp { padding: 0.82rem; font-size: 0.9rem; margin-bottom: 1rem; }
}

/* Mobile Extra Pequeno (≤349px) */
@media (max-width: 349px) {
    .portfolio-completo { padding: 70px 0 20px; }
    .portfolio-header h2 { font-size: 1.2rem; }
    .portfolio-grid-completo { grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
    .portfolio-item-info h3 { font-size: 0.65rem; }
    .btn-quero-modal { font-size: 0.58rem; }
    .btn-categorias { font-size: 0.8rem; padding: 0.45rem 0.8rem; }
    .busca-input { font-size: 0.8rem; }

    /* Modal fullscreen */
    .modal { padding: 0; overflow-y: auto; }
    .modal-content {
        width: 100%; max-width: 100%; margin: 0;
        padding: 0.85rem; border-radius: 0;
        min-height: 100dvh; box-sizing: border-box;
    }
    .modal-fechar {
        position: absolute; top: 6px; right: 6px;
        width: 28px; height: 28px; font-size: 1.1rem; line-height: 1;
        background: rgba(0,0,0,0.55); color: white;
        border-radius: 50%; display: flex; align-items: center; justify-content: center;
    }
    .modal-produto { display: flex !important; flex-direction: column !important; gap: 0.8rem; }
    .modal-produto-imagem, .modal-produto-info { width: 100%; }
    .modal-carrossel { height: 195px; border-radius: 7px; margin-bottom: 0.4rem; }
    .modal-miniaturas { grid-template-columns: repeat(4, 1fr); gap: 0.3rem; }
    .miniatura { height: 46px; }
    .modal-produto-info h2 { font-size: 1.05rem; }
    .modal-descricao { font-size: 0.8rem; max-height: 110px; line-height: 1.5; }
    .modal-especificacoes { padding: 0.75rem 0.85rem; }
    .especificacao-item { padding: 0.5rem 0; gap: 0.35rem; }
    .espec-label { font-size: 0.72rem; }
    .opcao-box span { padding: 0.32rem 0.6rem; font-size: 0.72rem; min-width: 34px; }
    .btn-contato-whatsapp { padding: 0.75rem; font-size: 0.82rem; margin-bottom: 0.8rem; }
}
/* ===== MODAL SEM IMAGEM ===== */
.modal-produto-sem-imagem {
    grid-template-columns: 1fr !important;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== QUANTIDADE MÍNIMA ===== */
.qtd-minima-info {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding: 0.35rem 0.75rem;
    background: #f0f3fa;
    color: #2b3c6f;
    border: 1px solid #d0d8ee;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
}