/* ===== RESET / GLOBAL ===== */
body {
    background-image: url('../imagens/background/background_produtos.jpg');
    background-size: 100% auto;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-color: #f5f5f5;
    font-family: "Inter", sans-serif;
    margin: 0;
    padding-top: 120px;
}

/* ===== TOP BAR (pesquisa) ===== */
.div_menu_search {
    width: 100%;
    padding: 1rem 2rem;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    margin-bottom: 2rem;
}

/* Título à esquerda */
.products-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

/* Botão hambúrguer (mobile) */
.div_btn_categoria_mobile {
    display: none;
    background-color: white;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 2px solid #f08080;
    cursor: pointer;
    margin-right: 1rem;
    transition: 0.2s;
}
.div_btn_categoria_mobile i {
    font-size: 1.5rem;
    color: #f08080;
}
.div_btn_categoria_mobile:hover {
    background-color: #ffe0e0;
}

/* Container da barra de pesquisa (direita) */
.div_search_bar {
    flex: 0 1 40rem;
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search_bar {
    width: 100%;
    padding: 0.9rem 1rem;
    background-color: #f0f0f0;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: "Inter", sans-serif;
    transition: all 0.2s;
    box-sizing: border-box;
}
.search_bar:focus {
    background-color: #e4e4e4;
    outline: none;
}
.search_button {
    position: absolute;
    right: 0.8rem;
    background: transparent;
    border: none;
    cursor: pointer;
}
.search_button i {
    font-size: 1.3rem;
    color: #888;
}

/* ===== LAYOUT PRINCIPAL (grid) ===== */
.main-layout {
    max-width: 1600px;
    margin: 0 auto 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Sidebar de categorias (DESKTOP) */
.categories-desktop {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    align-self: start;
}

.categories-desktop .gray_sub_title {
    font-size: 1.4rem;
    font-weight: 500;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #eee;
}

/* Árvore de categorias */
.category-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.cat-parent {
    margin-top: 0.8rem;
    list-style: none;
}
.cat-parent-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e1e1e;
    display: block;
    padding: 0.3rem 0;
    letter-spacing: -0.2px;
}
.cat-parent .category-tree {
    padding-left: 1.2rem;
    margin-top: 0.2rem;
}

/* Categorias sem subcategorias (primeiro nível) */
.category-tree > .cat-child {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0.3rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e1e1e;
    cursor: pointer;
    transition: color 0.2s;
}
.category-tree > .cat-child:hover {
    color: #666;
}

/* Subcategorias */
.category-tree .category-tree .cat-child {
    font-size: 0.9rem;
    font-weight: normal;
    padding: 0.3rem 0.5rem;
    margin: 0.2rem 0;
    border-radius: 0.5rem;
    background: transparent;
}
.category-tree .category-tree .cat-child:hover {
    color: #666;
    background: #f9f9f9;
}

/* Área dos produtos */
.products-area {
    min-width: 0;
}
.section_list_produtos {
    background-color: #fafafa;
    border-radius: 1rem;
    padding: 1rem;
}
.div_list_produtos {
    display: flex;
    flex-flow: row wrap;
    gap: 1.5rem;
    justify-content: flex-start;
    padding: 1rem;
    background: #fafafa;
}

/* Cards de produto - 5 por linha */
.container_item_produto {
    width: calc(20% - 1.2rem);
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid #eaeaea;
    position: relative;
    display: flex;
    flex-direction: column;
    padding-bottom: 0.3rem;
}
.container_item_produto:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.img_item_produto {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    background-color: #fff;
    flex-shrink: 0;
}
.p_item_produto {
    flex-grow: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    text-align: center;
    padding: 0.8rem 0.8rem 0 0.8rem;
    color: #111;
    font-weight: 500;
    overflow: hidden;
    word-break: break-word;
    max-height: none;
    line-height: 1.4;
}
.container_item_produto i {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    color: #f08080;
    opacity: 0;
    transition: opacity 0.2s;
}
.container_item_produto:hover i {
    opacity: 1;
}

/* Paginação */
.pagination_container {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}
.pagination {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.pagination a,
.pagination_current,
.pagination_arrow {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.2rem;
    border-radius: 50%;
    font-size: 1rem;
    text-decoration: none;
    background: #eee;
    color: #333;
}
.pagination_current {
    background: #aaa;
    color: white;
}
.pagination a:hover {
    background: #ddd;
}
.pagination_arrow.disabled {
    opacity: 0.4;
    pointer-events: none;
}
.pagination span:not(.pagination_current):not(.disabled) {
    margin: 0 0.2rem;
    color: #888;
}

.section_title {
    text-align: center;
    font-weight: 400;
    margin: 2rem 0 1rem;
    font-size: 1.2rem;
}

/* ===== SIDE-NAV (MOBILE ONLY) ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: 0.2s;
    z-index: 1000;
}
.overlay.active {
    opacity: 1;
    visibility: visible;
}
.side-nav {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1001;
    padding: 1.5rem;
    overflow-y: auto;
    transition: left 0.25s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}
.side-nav.active {
    left: 0;
}
.side-nav img {
    width: 80%;
    margin-bottom: 1rem;
}
.close-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
}
.side-nav .gray_sub_title {
    margin-top: 2rem;
    font-size: 1.3rem;
    font-weight: 500;
}
.side-nav .category-tree {
    margin-top: 1rem;
}
.side-nav .cat-parent-name {
    font-size: 1rem;
}
.side-nav .cat-child {
    font-size: 0.85rem;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 1200px) {
    .container_item_produto {
        width: calc(25% - 1.2rem);
    }
}
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 240px 1fr;
        gap: 1.2rem;
        padding: 0 1rem;
    }
    .container_item_produto {
        width: calc(33.33% - 1rem);
    }
}
@media (max-width: 768px) {
    body {
        padding-top: 100px;
    }
    .div_menu_search {
        justify-content: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    .products-title {
        display: none;
    }
    .div_btn_categoria_mobile {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .categories-desktop {
        display: none;
    }
    .main-layout {
        display: block;
        margin: 0 1rem 2rem 1rem;
        padding: 0;
    }
    .div_search_bar {
        flex: 1;
        margin-left: 0;
    }
    .div_list_produtos {
        justify-content: center;
    }
    .container_item_produto {
        width: calc(50% - 1rem);
    }
    .pagination a,
    .pagination_current,
    .pagination_arrow {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
    }
    .search_bar {
        font-size: 0.9rem;
    }
}

/* ===== RESET DE CATEGORIA ===== */
.categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
}
.categories-header .gray_sub_title {
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: none;
}
.reset-category-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #888;
    padding: 0.2rem;
    transition: color 0.2s, transform 0.1s;
}
.reset-category-btn:hover {
    color: #f08080;
    transform: rotate(15deg);
}

.div_list_produtos p {
    text-align: center;
    font-size: 1.5rem;
    width: 100%;
    padding: 2rem;
    color: #666;
    font-weight: 500;
}