/* ── Evita estouro horizontal (ex.: margens negativas do .row do Bootstrap) ── */
html {
    overflow-x: hidden;
}

/* ── Espaço para as barras fixas ─────────────────── */
body {
    padding-top: 102px; /* 64px navbar + 38px cat-nav */
    overflow-x: hidden;
    max-width: 100%;
}

@media (max-width: 991px) {
    body {
        padding-top: 120px; /* navbar mobile (2 linhas) */
    }
}

/* ── Navbar ──────────────────────────────────────── */
#menu_top .navbar {
    background-color: var(--cor-barra_menu) !important;
    padding: 8px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    min-height: 64px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ── Logo ────────────────────────────────────────── */
.navbar-logo { flex-shrink: 0; }
.navbar-logo img {
    max-height: 55px;
    width: auto;
}

/* ── Nome da empresa ─────────────────────────────── */
#menu_top .nome_empresa,
#menu_top .navbar-brand {
    color: var(--cor-fonte) !important;
    font-family: 'Russo One', sans-serif !important;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 14px;
    margin-right: 0;
}

/* ── Barra de pesquisa (desktop) ─────────────────── */
.header-search {
    position: relative;
    flex: 1;
    max-width: none;
    margin: 0 12px;
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 30px;
    border: 1px solid #ccc;
    overflow: visible;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.header-search:focus-within {
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    border-color: #aaa;
}

.header-search-icon {
    color: #999;
    padding: 0 6px 0 14px;
    font-size: 14px;
    flex-shrink: 0;
}

.header-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 8px;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    color: #333;
    outline: none;
}

.header-search-input::placeholder {
    color: #999;
    opacity: 1;
}

.header-search-btn {
    background: var(--cor-secundaria, #333);
    color: #fff;
    border: none;
    border-radius: 0 30px 30px 0;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
    flex-shrink: 0;
    align-self: stretch;
}

.header-search-btn:hover { opacity: 0.85; }

/* ── Links de navegação ──────────────────────────── */
#menu_top .nav-link {
    color: var(--cor-fonte) !important;
    font-family: 'Roboto', sans-serif;
    font-weight: 500;
    font-size: 12px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4px 10px !important;
    line-height: 1.3;
    transition: opacity 0.2s;
}

#menu_top .nav-link:hover { opacity: 0.75; }

#menu_top .icones_header {
    display: block;
    margin-bottom: 3px;
}

#menu_top .icones_header img {
    width: 22px;
    height: 22px;
}

#menu_top .badge {
    font-size: 9px;
    position: relative;
    top: -2px;
}

/* ── Dropdown ────────────────────────────────────── */
#menu_top .dropdown-menu {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    background: var(--cor-barra_menu, #fff);
}
#menu_top .dropdown-menu .dropdown-item {
    color: var(--cor-fonte, #333);
}
#menu_top .dropdown-menu .dropdown-item:hover,
#menu_top .dropdown-menu .dropdown-item:focus {
    background: var(--cor-secundaria, #333);
    color: #fff;
}

/* ── Barra de pesquisa (mobile, dentro do collapse) ─ */
.header-search-mobile {
    padding: 8px 0;
    width: 100%;
}

.header-search-mobile .input-group {
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.header-search-mobile .form-control {
    border: none;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    padding: 10px 16px;
    background: #f5f5f5;
}

.header-search-mobile .btn-search-mobile {
    background: var(--cor-secundaria, #333);
    color: #fff;
    border: none;
    padding: 0 18px;
    cursor: pointer;
}

/* ── Autocomplete dropdown ───────────────────────── */
.header-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 99999;
    max-height: 420px;
    overflow-y: auto;
}

.header-search-result {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    text-decoration: none !important;
    color: #333 !important;
    border-bottom: 1px solid #f2f2f2;
    transition: background 0.15s;
    cursor: pointer;
}

.header-search-result:last-child { border-bottom: none; }

.header-search-result:hover { background: #f8f8f8; }

.header-search-result img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    margin-right: 12px;
    border-radius: 6px;
    border: 1px solid #eee;
    flex-shrink: 0;
    background: #fafafa;
}

.result-nome {
    display: block;
    font-size: 13px;
    font-family: 'Roboto', sans-serif;
    color: #333;
    line-height: 1.4;
}

.result-nome mark {
    background: transparent;
    color: var(--cor-secundaria, #e25c00);
    font-weight: 700;
    padding: 0;
}

.result-sku {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-top: 2px;
    font-family: 'Roboto', sans-serif;
}

/* ── Mobile: ícones rápidos (carrinho + conta) ──────*/
.mobile-header-icons { gap: 16px; }

.mobile-icon-link,
.mobile-icon-link:visited,
.mobile-icon-link:hover,
.mobile-icon-link:focus,
.mobile-icon-link i {
    color: var(--cor-fonte, #fff) !important;
    text-decoration: none !important;
    font-size: 20px;
    position: relative;
    display: inline-block;
}

.mobile-cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #e53935;
    color: #fff !important;
    border-radius: 50%;
    font-size: 9px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-style: normal;
}

/* ── Mobile: barra de pesquisa (segunda linha) ───── */
.mobile-search-bar {
    display: none;
    align-items: center;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    border: none;
    padding: 0 0 0 14px;
    position: relative;
    overflow: visible;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    margin: 0;
}

.mobile-search-icon {
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 6px;
}

.mobile-search-btn {
    background: var(--cor-secundaria, #333);
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 11px 16px;
    cursor: pointer;
    flex-shrink: 0;
    align-self: stretch;
    font-size: 14px;
}

.mobile-search-btn:hover { opacity: 0.85; }

/* ── Layout mobile via grid ──────────────────────── */
@media (max-width: 991px) {
    #menu_top .navbar {
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto;
        padding: 8px 12px;
        align-items: center;
        row-gap: 8px;
        column-gap: 8px;
    }

    /* Col 1: logo à esquerda */
    #menu_top .navbar-logo {
        grid-column: 1;
        grid-row: 1;
        position: static !important;
        transform: none !important;
    }
    #menu_top .navbar-logo img { max-height: 44px; }

    /* Col 2: nome da loja no centro */
    #menu_top .mobile-nome {
        display: block !important;
        grid-column: 2;
        grid-row: 1;
        text-align: center;
        font-size: 13px;
        margin: 0;
        white-space: normal;
        line-height: 1.2;
    }

    /* Col 3: ícones + hambúrguer à direita */
    #menu_top .mobile-header-icons {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        margin-left: 0 !important;
        gap: 10px;
    }

    /* Esconde o search e brand do desktop */
    #menu_top .header-search { display: none !important; }
    #menu_top .d-xl-block:not(.mobile-nome) { display: none !important; }

    /* Linha 2: barra de pesquisa full width */
    #menu_top .mobile-search-bar {
        display: flex !important;
        grid-column: 1 / -1;
        grid-row: 2;
    }

    /* Linha 3: collapse (links do menu) */
    #menu_top #navbarSupportedContent-4 {
        grid-column: 1 / -1;
        grid-row: 3;
        max-height: calc(100vh - 130px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Links no mobile: linha horizontal (ícone + texto) */
    #navbarSupportedContent-4 .nav-link {
        flex-direction: row !important;
        justify-content: flex-start;
        gap: 10px;
        padding: 12px 8px !important;
        border-bottom: 1px solid rgba(0,0,0,0.07);
    }

    #navbarSupportedContent-4 .icones_header {
        display: inline-flex;
        margin-bottom: 0;
    }

    #navbarSupportedContent-4 .navbar-nav { padding-top: 4px; }
}

/* ── Botão de menu mobile (☰) ────────────────────── */
.mobile-menu-btn {
    background: transparent;
    border: none;
    color: var(--cor-fonte, #fff) !important;
    font-size: 20px;
    padding: 4px;
    cursor: pointer;
    line-height: 1;
}
.mobile-menu-btn:focus { outline: none; box-shadow: none; }

.mobile-search-btn:hover { opacity: 0.85; }

/* ── Collapse: no desktop não cresce (o search que ocupa o espaço) ─ */
@media (min-width: 992px) {
    #menu_top .navbar-collapse {
        flex-grow: 0 !important;
        flex-basis: auto !important;
    }
}

/* ── Toggler ─────────────────────────────────────── */
#menu_top .navbar-toggler {
    border-color: rgba(255,255,255,0.5);
}

#menu_top .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ── Barra de categorias (desktop, abaixo do navbar) ─ */
.cat-nav {
    position: fixed;
    top: 0; /* ajustado via JS */
    left: 0;
    right: 0;
    z-index: 1028;
    background: var(--cor-barra_menu, #333);
    border-top: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.cat-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0 16px;
    overflow: visible;
    flex-wrap: nowrap;
    align-items: stretch;
}

.cat-nav-item {
    flex-shrink: 0;
    position: relative;
}

.cat-nav-link {
    display: block;
    padding: 10px 16px;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.6px;
    color: var(--cor-fonte, #333);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    opacity: 0.85;
}

.cat-nav-link:hover,
.cat-nav-item:hover > .cat-nav-link {
    opacity: 1;
    border-bottom-color: var(--cor-secundaria, #e25c00);
    background: rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--cor-fonte, #333);
}

.cat-nav-chevron {
    font-size: 9px;
    margin-left: 5px;
    transition: transform 0.2s;
    vertical-align: middle;
}

.cat-nav-item:hover > .cat-nav-link .cat-nav-chevron {
    transform: rotate(180deg);
}

/* ── Dropdown nível 1 ──────────────────────────────── */
.cat-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 2px solid var(--cor-secundaria, #e25c00);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.13);
    list-style: none;
    padding: 4px 0;
    margin: 0;
    z-index: 9999;
}

/* Dropdown com muitos itens: colunas automáticas conforme o conteúdo */
.cat-dropdown.cat-dropdown--colunas {
    column-width: 190px;
    column-gap: 0;
    min-width: 190px;
    max-width: 80vw;
}

.cat-dropdown.cat-dropdown--colunas > .cat-dropdown-item {
    break-inside: avoid;
}

/* Último nível (marcas por tipo): scroll fino sem afetar nested */
.cat-dropdown.cat-dropdown--marcas {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: visible;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.cat-dropdown.cat-dropdown--marcas::-webkit-scrollbar { width: 4px; }
.cat-dropdown.cat-dropdown--marcas::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.cat-nav-item:hover > .cat-dropdown {
    display: block;
}

/* ── Itens do dropdown ─────────────────────────────── */
.cat-dropdown-item {
    position: relative;
}

.cat-dropdown-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.cat-dropdown-item > a i {
    font-size: 9px;
    margin-left: 8px;
    color: #aaa;
}

.cat-dropdown-item > a:hover {
    background: #f5f5f5;
    color: var(--cor-secundaria, #e25c00);
}

/* ── Dropdown nível 2 (nested → direita) ──────────── */
.cat-dropdown--nested {
    top: -5px;
    left: 100%;
    border-top: 2px solid var(--cor-secundaria, #e25c00);
    display: none;
}

.cat-dropdown-item.has-children:hover > .cat-dropdown--nested {
    display: block;
}

/* ── Mobile: accordion de categorias ─────────────── */
.mobile-cat-tree {
    border-top: 1px solid rgba(255,255,255,0.12);
    padding: 4px 0 8px;
}

.mobile-cat-section-title {
    padding: 10px 12px 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--cor-fonte, #fff);
    opacity: 0.55;
}

.mobile-cat-entry { list-style: none; }

.mobile-cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.mobile-cat-row--indent  { padding-left: 24px; background: rgba(0,0,0,0.08); }
.mobile-cat-row--indent2 { padding-left: 36px; background: rgba(0,0,0,0.13); }
.mobile-cat-row--indent3 { display: flex; padding-left: 48px; background: rgba(0,0,0,0.17); border-bottom: 1px solid rgba(255,255,255,0.06); }

.mobile-cat-link {
    flex: 1;
    padding: 11px 0;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--cor-fonte, #fff) !important;
    text-decoration: none !important;
}

.mobile-cat-toggle {
    background: none;
    border: none;
    color: var(--cor-fonte, #fff);
    opacity: 0.5;
    padding: 8px 4px 8px 8px;
    cursor: pointer;
    font-size: 10px;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.mobile-cat-toggle.open {
    transform: rotate(180deg);
    opacity: 1;
}

.mobile-cat-sub {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-cat-sub.open { display: block; }

/* ── Carrinho lateral (drawer) ── */
.carrinho-lateral-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.carrinho-lateral-overlay.show {
    opacity: 1;
    visibility: visible;
}
.carrinho-lateral {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 92vw;
    background: #fff;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(0, 0, 0, .18);
    transform: translateX(100%);
    transition: transform .3s ease;
}
.carrinho-lateral.show {
    transform: translateX(0);
}
.carrinho-lateral-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.carrinho-lateral-header h5 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #222;
}
.carrinho-lateral-fechar {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #555;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.carrinho-lateral-fechar:hover { color: #000; }
.carrinho-lateral-corpo {
    flex: 1;
    overflow-y: auto;
    padding: 8px 20px;
}
.carrinho-lateral-vazio {
    padding: 40px 0;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}
.carrinho-lateral-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}
.carrinho-lateral-item:last-child { border-bottom: none; }
.carrinho-lateral-item-remover {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    align-self: flex-start;
    margin-top: 2px;
    flex-shrink: 0;
}
.carrinho-lateral-item-remover:hover { color: #c62828; }
.carrinho-lateral-item-info {
    flex: 1;
    min-width: 0;
}
.carrinho-lateral-item-nome {
    display: block;
    font-size: 0.85rem;
    color: #333;
    text-decoration: none;
    margin-bottom: 6px;
    line-height: 1.35;
}
.carrinho-lateral-item-nome:hover { color: #000; text-decoration: none; }
.carrinho-lateral-item-preco {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #222;
    margin-bottom: 8px;
}
.carrinho-lateral-item-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}
.carrinho-lateral-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.carrinho-lateral-qty-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.85rem;
    color: #444;
}
.carrinho-lateral-qty-btn:hover { background: #e6e6e6; }
.carrinho-lateral-qty-valor {
    width: 28px;
    text-align: center;
    font-size: 0.85rem;
    color: #333;
}
.carrinho-lateral-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
.carrinho-lateral-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 14px;
}
.carrinho-lateral-subtotal strong {
    font-size: 1.1rem;
    color: #111;
}
.carrinho-lateral-btn-ver {
    display: block;
    text-align: center;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: background .15s ease;
}
.carrinho-lateral-btn-ver:hover { background: #f5f5f5; color: #333; text-decoration: none; }
.carrinho-lateral-btn-finalizar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: 8px;
    background: #1a5c3f;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.92rem;
    transition: filter .15s ease;
}
.carrinho-lateral-btn-finalizar:hover { filter: brightness(1.08); color: #fff; text-decoration: none; }
@media (max-width: 480px) {
    .carrinho-lateral { width: 100%; max-width: 100%; }
}
