/*=========================================================
    BUSCA DA VITRINE
    Seletor de categorias + sugestões (autocomplete) da barra
    de busca do header, e a lista de categorias do aside da
    listagem de produtos.

    Carregado DEPOIS de style.css e mobile.css: as regras de
    celular dos componentes daqui moram neste arquivo mesmo,
    junto do resto do componente (como em conta.css).
===========================================================*/

/* O dropdown nasce dentro do #header, que não criava contexto de
   empilhamento — sem isto a faixa de chips (sticky, z-index 900) passa
   por cima das sugestões no celular. */
#header { position: relative; z-index: 1010; }

/*------------------------------------------------------
    Barra: categorias | campo | botão
------------------------------------------------------*/
@media only screen and (min-width: 768px) {
    .header-search form { display: flex; align-items: stretch; }
    .header-search form .hs-cat { flex: 0 0 190px; }
    .header-search form .input {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        margin: 0;
        border-left: none;
        border-right: none;
    }
    .header-search form .search-btn { flex: 0 0 110px; }
}

.header-search form .input:focus { outline: none; }

/*------------------------------------------------------
    Seletor de categorias
------------------------------------------------------*/
.hs-cat { position: relative; }

.hs-cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 40px 0 0 40px;
    color: #2b2d42;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
}
.hs-cat-btn:hover { color: var(--primary_color); }
.hs-cat-btn:focus { outline: none; }
.hs-cat-btn-label { overflow: hidden; text-overflow: ellipsis; }
.hs-cat-btn i { flex: 0 0 auto; transition: transform .2s; }
.hs-cat.open .hs-cat-btn { border-color: var(--primary_color); color: var(--primary_color); }
.hs-cat.open .hs-cat-btn i { transform: rotate(180deg); }

.hs-panel-in { animation: hsPanelIn .16s ease both; }
@keyframes hsPanelIn {
    from { opacity: 0; transform: translateY(-6px); }
}

.hs-cat-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    width: 290px;
    max-width: 88vw;
    padding: 6px;
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
    animation: hsPanelIn .16s ease both;
}
.hs-cat-panel[hidden] { display: none; }

.hs-cat-filter { position: relative; padding: 4px 4px 8px; }
.hs-cat-filter i { position: absolute; left: 14px; top: 14px; font-size: 12px; color: #94a3b8; }
.hs-cat-filter input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 32px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    font-size: 13px;
    color: #2b2d42;
}
.hs-cat-filter input:focus { outline: none; border-color: var(--primary_color); }

.hs-cat-list { max-height: 292px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }

.hs-cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #2b2d42;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.hs-cat-item:hover,
.hs-cat-item:focus { background: #f4f6f9; color: var(--primary_color); outline: none; }
.hs-cat-item.active { background: var(--primary_color); color: #fff; font-weight: 700; }
.hs-cat-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-cat-item-name i { margin-right: 6px; }
.hs-cat-item-qty {
    flex: 0 0 auto;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #8d99ae;
}
.hs-cat-item.active .hs-cat-item-qty { background: rgba(255, 255, 255, .24); color: #fff; }
.hs-cat-empty { margin: 0; padding: 14px 10px; color: #8d99ae; font-size: 12px; text-align: center; }

/*------------------------------------------------------
    Sugestões (autocomplete)
------------------------------------------------------*/
.hs-suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 72vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e4e7ed;
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .16);
    text-align: left;
}
.hs-suggest[hidden] { display: none; }

.hs-group-title {
    margin: 0;
    padding: 11px 14px 7px;
    color: #8d99ae;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.hs-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.hs-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f7f8fa;
    border: 1px solid #e4e7ed;
    border-radius: 20px;
    color: #4a5568;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.hs-chip:hover,
.hs-chip:focus,
.hs-chip.hs-active {
    background: var(--primary_color);
    border-color: var(--primary_color);
    color: #fff;
    text-decoration: none;
}

.hs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-top: 1px solid #f1f5f9;
    color: #2b2d42;
    text-decoration: none;
}
.hs-item:hover,
.hs-item:focus,
.hs-item.hs-active { background: #f4f6f9; color: #2b2d42; text-decoration: none; }

.hs-item-thumb {
    display: flex;
    flex: 0 0 46px;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eef1f5;
    border-radius: 8px;
}
.hs-item-thumb img { width: 100%; height: 100%; object-fit: contain; }
.hs-item-thumb i { color: #cbd5e1; font-size: 16px; }

.hs-item-info { flex: 1 1 auto; min-width: 0; }
.hs-item-name {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* o <mark> só marca o trecho digitado; o amarelo padrão do navegador não serve */
.hs-suggest mark { padding: 0; background: none; color: var(--primary_color); font-weight: 700; }
.hs-chip mark,
.hs-chip:hover mark,
.hs-chip.hs-active mark { color: inherit; text-decoration: underline; }
.hs-item-cat {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: #8d99ae;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hs-item-price { flex: 0 0 auto; color: var(--primary_color); font-size: 13px; font-weight: 700; }
.hs-item-tag {
    flex: 0 0 auto;
    padding: 2px 7px;
    background: #ef4444;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.hs-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: #f8fafc;
    border-top: 1px solid #e4e7ed;
    color: var(--primary_color);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.hs-all:hover,
.hs-all:focus,
.hs-all.hs-active { background: var(--primary_color); color: #fff; text-decoration: none; }

.hs-empty { padding: 24px 16px; color: #8d99ae; font-size: 13px; text-align: center; }
.hs-empty i { display: block; margin-bottom: 8px; color: #cbd5e1; font-size: 24px; }
.hs-empty strong { color: #2b2d42; }

/* Buscas recentes */
.hs-recent-head { display: flex; align-items: center; justify-content: space-between; padding-right: 10px; }
.hs-recent-head .hs-group-title { padding-bottom: 7px; }
.hs-recent-clear {
    background: none;
    border: none;
    color: #8d99ae;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
}
.hs-recent-clear:hover { color: var(--primary_color); }
.hs-recent-item .hs-item-thumb { flex-basis: 30px; width: 30px; height: 30px; border: none; background: #f4f6f9; }

/* Esqueleto enquanto a consulta não volta */
.hs-sk-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid #f1f5f9; }
.hs-sk-row:first-child { border-top: none; }
.hs-sk {
    background: linear-gradient(90deg, #e9edf2 25%, #f5f7fa 50%, #e9edf2 75%);
    background-size: 600px 100%;
    border-radius: 6px;
    animation: hsShimmer 1.3s infinite linear;
}
@keyframes hsShimmer {
    0%   { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}

@media only screen and (max-width: 767px) {
    .hs-suggest {
        top: calc(100% + 6px);
        max-height: calc(100vh - 170px);
        border-radius: 12px;
    }
    .hs-item { padding: 10px 12px; }
    .hs-item-thumb { flex-basis: 42px; width: 42px; height: 42px; }
    .hs-group-title { padding: 10px 12px 6px; }
    .hs-chips { padding: 0 12px 10px; }
}

/*------------------------------------------------------
    Lista de categorias do aside (listagem de produtos)
------------------------------------------------------*/
.cat-aside .aside-title { margin-bottom: 14px; }

.cat-filter { position: relative; margin-bottom: 10px; }
.cat-filter i { position: absolute; left: 11px; top: 11px; font-size: 12px; color: #94a3b8; }
.cat-filter input {
    width: 100%;
    height: 34px;
    padding: 0 10px 0 30px;
    border: 1px solid #e4e7ed;
    border-radius: 8px;
    font-size: 13px;
    color: #2b2d42;
}
.cat-filter input:focus { outline: none; border-color: var(--primary_color); }

.cat-list { max-height: 330px; margin: 0; padding: 2px; overflow-y: auto; list-style: none; }

.cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #4a5568;
    font-size: 13px;
    text-decoration: none;
}
.cat-row + .cat-row { margin-top: 2px; }
.cat-row:hover,
.cat-row:focus { background: #f4f6f9; color: var(--primary_color); text-decoration: none; }
.cat-row.active {
    background: var(--primary_color);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
}
.cat-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row-name i { margin-right: 7px; opacity: .7; }
.cat-row-qty {
    flex: 0 0 auto;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #8d99ae;
}
.cat-row.active .cat-row-qty { background: rgba(255, 255, 255, .24); color: #fff; }
.cat-empty { margin: 0; padding: 12px 4px; color: #8d99ae; font-size: 12px; text-align: center; }

@media only screen and (max-width: 767px) {
    .cat-list { max-height: 252px; }
    .cat-row { padding: 9px 10px; font-size: 14px; }
}
