/*
 * yith-filters.css
 * Estilização do YITH WooCommerce Ajax Product Filter
 * integrada ao design system "O Jardim dos Pequenos".
 *
 * Carregado condicionalmente quando o plugin está ativo
 * (verificado em inc/enqueue.php via is_plugin_active ou class_exists).
 *
 * Layout: filtros em sidebar vertical à esquerda do grid de produtos.
 * O template archive-product.php controla a estrutura de duas colunas.
 */

/* ── Container principal dos filtros ────────────────────────────────────────── */
.referencia-shop-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    align-items: start;
}

.referencia-filters-sidebar {
    position: sticky;
    top: 90px; /* abaixo da navbar sticky */
}

/* ── Widget de filtro individual ─────────────────────────────────────────────── */
.yith-wcan-preset-container .yith-wcan-reset-navigation,
.widget_yith-woo-ajax-navigation,
.widget.yith-woo-ajax-navigation {
    background: white;
    border-radius: var(--r-card);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
}

/* Título do filtro */
.yith-wcan-preset-title,
.widget_yith-woo-ajax-navigation .widgettitle,
.yith-wcan-filter > .filter-title {
    font-family: 'Nunito', sans-serif !important;
    font-weight: 800 !important;
    font-size: .72rem !important;
    color: var(--blue) !important;
    text-transform: uppercase !important;
    letter-spacing: .08em !important;
    margin-bottom: .875rem !important;
    padding-bottom: .625rem;
    border-bottom: 1.5px solid var(--surface-low);
}

/* ── Checkboxes ───────────────────────────────────────────────────────────────── */
.yith-wcan-filter ul,
.yith-wcan-filter .filter-items {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.yith-wcan-filter ul li,
.yith-wcan-filter .filter-items li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Label do item */
.yith-wcan-filter ul li label,
.yith-wcan-filter .filter-items li label {
    display: flex !important;
    align-items: center !important;
    gap: .5rem !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: .875rem !important;
    font-weight: 500 !important;
    color: var(--ink-muted) !important;
    cursor: pointer !important;
    padding: .3rem .25rem !important;
    border-radius: .5rem !important;
    transition: color .15s, background .15s !important;
    line-height: 1.4 !important;
}

.yith-wcan-filter ul li label:hover,
.yith-wcan-filter .filter-items li label:hover {
    color: var(--ink) !important;
    background: var(--bg) !important;
}

/* Checkbox customizado */
.yith-wcan-filter ul li input[type="checkbox"],
.yith-wcan-filter .filter-items li input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    border: 2px solid var(--surface-low) !important;
    border-radius: 4px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background: white !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: border-color .15s, background .15s !important;
    position: relative !important;
}

.yith-wcan-filter ul li input[type="checkbox"]:checked,
.yith-wcan-filter .filter-items li input[type="checkbox"]:checked {
    background: var(--blue) !important;
    border-color: var(--blue) !important;
}

.yith-wcan-filter ul li input[type="checkbox"]:checked::after,
.yith-wcan-filter .filter-items li input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px; top: 1px;
    width: 5px; height: 9px;
    border: 2px solid white;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}

/* Item selecionado — label em azul */
.yith-wcan-filter ul li.chosen label,
.yith-wcan-filter ul li.active label {
    color: var(--blue) !important;
    font-weight: 600 !important;
}

/* ── Swatches de cor ──────────────────────────────────────────────────────────── */
.yith-wcan-filter .swatch {
    width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    border: 2px solid var(--surface-low) !important;
    cursor: pointer !important;
    transition: border-color .15s, transform .15s !important;
    flex-shrink: 0 !important;
}

.yith-wcan-filter .swatch:hover,
.yith-wcan-filter .swatch.selected {
    border-color: var(--blue) !important;
    transform: scale(1.15) !important;
}

/* ── Botão "Limpar filtros" ────────────────────────────────────────────────────── */
.yith-wcan-reset-navigation a,
.yith-wcan-preset-container .reset-filters {
    display: inline-flex !important;
    align-items: center !important;
    gap: .35rem !important;
    font-family: 'Nunito', sans-serif !important;
    font-weight: 800 !important;
    font-size: .8rem !important;
    color: var(--ink-muted) !important;
    text-decoration: none !important;
    padding: .4rem .875rem !important;
    border: 1.5px solid var(--surface-low) !important;
    border-radius: var(--r-pill) !important;
    transition: color .18s, border-color .18s !important;
    margin-top: .5rem !important;
}

.yith-wcan-reset-navigation a:hover,
.yith-wcan-preset-container .reset-filters:hover {
    color: var(--blue) !important;
    border-color: var(--blue) !important;
}

/* ── Loading state (AJAX) ─────────────────────────────────────────────────────── */
.yith-wcan-ajax-loading {
    opacity: .5 !important;
    pointer-events: none !important;
}

/* ── Contagem de resultados ao lado de cada filtro ───────────────────────────── */
.yith-wcan-filter .count {
    font-size: .75rem !important;
    color: var(--ink-muted) !important;
    margin-left: auto !important;
    background: var(--surface-low) !important;
    border-radius: var(--r-pill) !important;
    padding: 1px 7px !important;
}

/* ── Responsivo: filtros viram dropdown/offcanvas abaixo de 1024px ───────────── */
@media ( max-width: 1024px ) {
    .referencia-shop-layout {
        grid-template-columns: 1fr;
    }

    .referencia-filters-sidebar {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: .75rem;
        padding: 0 0 1rem;
    }

    /* Cada widget de filtro vira um bloco compacto */
    .yith-wcan-preset-container .yith-wcan-reset-navigation,
    .widget.yith-woo-ajax-navigation {
        flex: 1;
        min-width: 180px;
        padding: .875rem 1rem;
        margin-bottom: 0;
    }
}
