/* Умный SEO-фильтр — витрина. Цвет — из темы сайта (--sfv2-accent задаёт сервер). Все классы с префиксом sfv2-. */

.sfv2 {
    --sfv2-line: #e3e7eb;
    --sfv2-line-strong: #cdd4da;
    --sfv2-text: #222;
    --sfv2-muted: #7a858d;
    --sfv2-bg: #fff;
    --sfv2-radius: 10px;
    position: relative;
    margin: 0 0 20px;
    color: var(--sfv2-text);
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}
.sfv2 *, .sfv2 *::before, .sfv2 *::after { box-sizing: border-box; }
.sfv2 [hidden] { display: none !important; }
.sfv2 button { font: inherit; color: inherit; }

.sfv2-form {
    margin: 0;
    padding: 18px 20px;
    border: 1px solid var(--sfv2-line);
    border-radius: var(--sfv2-radius);
    background: var(--sfv2-bg);
}
.sfv2-sheethead, .sfv2-mtoggle { display: none; }

/* колонкой слева от товаров */
.sfv2-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; margin: 0 0 20px; }
.sfv2-layout__aside {
    position: sticky;
    top: var(--sfv2-sticky-top, 16px);
    max-height: calc(100vh - var(--sfv2-sticky-top, 16px) - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
/* до замера шапки скриптом (filter.js задаёт --sfv2-sticky-top по месту) */
.admin-sett-1 .sfv2-layout__aside, .admin-sett-2 .sfv2-layout__aside, .admin-sett-3 .sfv2-layout__aside { --sfv2-sticky-top: 62px; }

/* полосы прокрутки — в цвет сайта; свои можно задать в seo-filter.css сайта: --sfv2-scroll-thumb, --sfv2-scroll-track */
.sfv2-layout__aside, .sfv2-opts, .sfv2-fields {
    scrollbar-width: thin;
    scrollbar-color: var(--sfv2-scroll-thumb, var(--sfv2-accent, #9aa7ae)) var(--sfv2-scroll-track, rgba(0, 0, 0, .06));
}
.sfv2-layout__aside::-webkit-scrollbar, .sfv2-opts::-webkit-scrollbar, .sfv2-fields::-webkit-scrollbar { width: 6px; height: 6px; }
.sfv2-layout__aside::-webkit-scrollbar-track, .sfv2-opts::-webkit-scrollbar-track, .sfv2-fields::-webkit-scrollbar-track { background: var(--sfv2-scroll-track, rgba(0, 0, 0, .06)); border-radius: 3px; }
.sfv2-layout__aside::-webkit-scrollbar-thumb, .sfv2-opts::-webkit-scrollbar-thumb, .sfv2-fields::-webkit-scrollbar-thumb { background: var(--sfv2-scroll-thumb, var(--sfv2-accent, #9aa7ae)); border-radius: 3px; }
.sfv2-layout__aside::-webkit-scrollbar-button, .sfv2-opts::-webkit-scrollbar-button, .sfv2-fields::-webkit-scrollbar-button { display: none; }
.sfv2-layout__aside .sfv2 { margin: 0; }
.sfv2-layout__aside .sfv2-form { padding: 16px 18px; }
.sfv2-layout__main { min-width: 0; }
.sfv2-layout__main > .zone-sort { margin-top: 0; }
@media (max-width: 1024px) {
    .sfv2-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 20px; }
}

/* поля */
.sfv2--top .sfv2-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px 28px;
    align-items: start;
}
.sfv2--side .sfv2-f + .sfv2-f { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--sfv2-line); }

.sfv2-f { min-width: 0; margin: 0; padding: 0; border: 0; }
.sfv2-f__head { display: block; width: 100%; padding: 0; margin: 0 0 8px; float: left; }
/* legend: стили сайта и админки платформы (fieldset legend { color … }) не должны перекрашивать заголовки */
.sfv2 .sfv2-f__head { color: inherit; font-size: inherit; line-height: inherit; border: 0; }
.sfv2-f__head + * { clear: both; }
.sfv2-f__head button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: none;
    font-weight: 700;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}
.sfv2-f__head button::after {
    content: '';
    flex: none;
    width: 7px;
    height: 7px;
    margin: 0 4px 0 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: .5;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s;
}
.sfv2-f.is-collapsed .sfv2-f__head button::after { transform: rotate(-45deg); }
.sfv2-f.is-collapsed .sfv2-f__body { display: none; }
.sfv2-f__head button:focus-visible { outline: 2px solid var(--sfv2-accent); outline-offset: 2px; border-radius: 4px; }
.sfv2-f__body { clear: both; }

/* значения */
.sfv2-opts { display: flex; flex-direction: column; gap: 2px; }
/* в списке с прокруткой строки не сжимаются (длинные значения иначе налезают друг на друга) */
.sfv2-opts > * { flex-shrink: 0; }
.sfv2-f.is-expanded .sfv2-opts { max-height: 300px; overflow-y: auto; padding-right: 4px; }
.sfv2-opt.is-more, .sfv2-sw.is-more { display: none; }
.sfv2-f.is-expanded .is-more, .sfv2-f.is-searching .is-more { display: flex; }
.sfv2-f.is-searching .is-hit-no { display: none !important; }

.sfv2-opt {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-height: 30px;
    padding: 5px 0;
    line-height: 18px; /* = высоте галочки: она стоит на уровне первой строки длинного значения */
    cursor: pointer;
    user-select: none;
}
.sfv2-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sfv2-opt__box {
    flex: none;
    position: relative;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--sfv2-line-strong);
    border-radius: 4px;
    background: #fff;
    transition: background .15s, border-color .15s;
}
.sfv2-opt:hover .sfv2-opt__box { border-color: var(--sfv2-accent); }
.sfv2-opt input:checked + .sfv2-opt__box { border-color: var(--sfv2-accent); background: var(--sfv2-accent); }
.sfv2-opt input:checked + .sfv2-opt__box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border-right: 2px solid var(--sfv2-accent-text);
    border-bottom: 2px solid var(--sfv2-accent-text);
    transform: rotate(45deg);
}
.sfv2-opt input:focus-visible + .sfv2-opt__box { box-shadow: 0 0 0 3px var(--sfv2-accent-soft); border-color: var(--sfv2-accent); }
.sfv2-opt__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* очень длинное значение (список артикулов) — до 4 строк, целиком во всплывающей подсказке */
.sfv2-opt__label.is-long { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
a.sfv2-opt__label { color: inherit !important; text-decoration: none !important; }
a.sfv2-opt__label:hover { color: var(--sfv2-accent) !important; text-decoration: underline !important; text-underline-offset: 3px; }
.sfv2-sw__a { display: block; border-radius: 50%; text-decoration: none !important; }
.sfv2-opt__n { flex: none; color: var(--sfv2-muted); font-size: 12px; }
.sfv2-opt.is-off { opacity: .42; cursor: default; }

.sfv2-more {
    margin-top: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sfv2-accent);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}
/* «Ещё характеристики»: поля сверх «сразу видно» в настройках категории */
.sfv2-extra-toggle {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px dashed var(--sfv2-line-strong);
    border-radius: var(--sfv2-radius);
    background: none;
    color: var(--sfv2-accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.sfv2-extra-toggle:hover { border-color: var(--sfv2-accent); background: var(--sfv2-accent-soft); }
.sfv2--side .sfv2-extra > .sfv2-f:first-child { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--sfv2-line); }
.sfv2-search, .sfv2-select, .sfv2-range input {
    width: 100%;
    height: 36px;
    margin: 0 0 8px;
    padding: 0 10px;
    border: 1px solid var(--sfv2-line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--sfv2-text);
    font: inherit;
    font-size: 14px;
}
.sfv2-search:focus, .sfv2-select:focus, .sfv2-range input:focus { outline: none; border-color: var(--sfv2-accent); box-shadow: 0 0 0 3px var(--sfv2-accent-soft); }

/* палитра */
.sfv2-opts--palette { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.sfv2-sw { position: relative; display: inline-flex; cursor: pointer; }
.sfv2-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sfv2-sw__dot {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--sw, #fff);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
    transition: box-shadow .15s;
}
.sfv2-sw.is-nocolor .sfv2-sw__dot { background: repeating-linear-gradient(45deg, #f1f3f5 0 4px, #dfe3e7 4px 8px); }
.sfv2-sw:hover .sfv2-sw__dot { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 2px #fff, 0 0 0 3px var(--sfv2-line-strong); }
.sfv2-sw input:checked + .sfv2-sw__dot { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 2px #fff, 0 0 0 4px var(--sfv2-accent); }
.sfv2-sw input:focus-visible + .sfv2-sw__dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sfv2-accent); }
.sfv2-sw.is-off { opacity: .35; cursor: default; }
.sfv2-sw__name {
    position: absolute;
    clip: rect(0 0 0 0);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
}

/* диапазон */
.sfv2-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sfv2-range label { position: relative; display: block; margin: 0; }
.sfv2-range label span { position: absolute; left: 10px; top: 9px; color: var(--sfv2-muted); font-size: 13px; pointer-events: none; }
.sfv2-range input { margin: 0; padding-left: 30px; -moz-appearance: textfield; }
.sfv2-range input::-webkit-outer-spin-button, .sfv2-range input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sfv2-slider { position: relative; height: 24px; margin: 8px 9px 0; }
.sfv2-slider__track { position: absolute; left: 0; right: 0; top: 10px; height: 4px; border-radius: 2px; background: var(--sfv2-line); }
.sfv2-slider__track i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: var(--sfv2-accent); }
.sfv2-slider input[type=range] {
    position: absolute;
    left: -9px;
    right: -9px;
    top: 3px;
    width: calc(100% + 18px);
    height: 18px;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}
.sfv2-slider input[type=range]::-webkit-slider-runnable-track { background: none; border: 0; }
.sfv2-slider input[type=range]::-moz-range-track { background: none; border: 0; }
.sfv2-slider input[type=range]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    border: 2px solid var(--sfv2-accent);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    pointer-events: auto;
    -webkit-appearance: none;
}
.sfv2-slider input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid var(--sfv2-accent);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    pointer-events: auto;
}

/* низ формы */
.sfv2-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; }
.sfv2--top .sfv2-foot { padding-top: 14px; border-top: 1px solid var(--sfv2-line); }
.sfv2-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 22px;
    border: 0;
    border-radius: 8px;
    background: var(--sfv2-accent);
    color: var(--sfv2-accent-text) !important;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s;
}
.sfv2-apply:hover { filter: brightness(1.07); }
.sfv2-apply:focus-visible { outline: 2px solid var(--sfv2-accent); outline-offset: 2px; }
.sfv2-apply[disabled] { opacity: .45; cursor: default; filter: none; }
.sfv2--side .sfv2-apply { width: 100%; }
.sfv2-reset { color: var(--sfv2-muted) !important; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.sfv2-reset:hover { color: var(--sfv2-text) !important; }
.sfv2-zero { flex-basis: 100%; padding: 8px 12px; border-radius: 8px; background: #fff5e6; color: #8a5a00; font-size: 13px; }
.sfv2[data-mode=ajax] .sfv2-foot .sfv2-apply { display: none; }
.sfv2[data-mode=ajax] .sfv2-foot:not(:has(.sfv2-reset)):not(:has(.sfv2-zero)) { display: none; }

/* выбранное */
.sfv2-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.sfv2-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    background: var(--sfv2-accent-soft);
    color: var(--sfv2-text) !important;
    font-size: 13px;
    text-decoration: none !important;
    transition: background .15s;
}
.sfv2-chip i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 15px; line-height: 1; opacity: .6; }
.sfv2-chip:hover i { opacity: 1; background: rgba(0, 0, 0, .08); }
.sfv2-chip--reset { padding-right: 12px; background: none; color: var(--sfv2-muted) !important; text-decoration: underline !important; text-underline-offset: 3px; }

/* загрузка */
.sfv2.is-loading .sfv2-form { opacity: .65; transition: opacity .2s; }
.sfv2.is-loading::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--sfv2-accent), transparent);
    background-size: 200% 100%;
    animation: sfv2-load 1s linear infinite;
}
@keyframes sfv2-load { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* телефон: кнопка «Фильтры» и шторка */
@media (max-width: 780px) {
    .sfv2-layout { display: block; }
    .sfv2-layout__aside { position: static; max-height: none; overflow: visible; }
    .sfv2-layout__aside .sfv2 { margin: 0 0 16px; }
    .sfv2-mtoggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 42px;
        padding: 0 16px;
        border: 1px solid var(--sfv2-line-strong);
        border-radius: 21px;
        background: #fff;
        font-weight: 600;
        cursor: pointer;
    }
    .sfv2-mtoggle b {
        display: grid;
        place-items: center;
        min-width: 20px;
        height: 20px;
        padding: 0 5px;
        border-radius: 10px;
        background: var(--sfv2-accent);
        color: var(--sfv2-accent-text);
        font-size: 12px;
    }
    .sfv2-chips { margin-top: 10px; }
    .sfv2-form {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2147482000;
        display: flex;
        flex-direction: column;
        max-height: 88vh;
        max-height: 88dvh;
        padding: 0;
        border: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .25s ease, visibility 0s .25s;
    }
    .sfv2.is-open .sfv2-form { transform: none; visibility: visible; transition: transform .25s ease; }
    .sfv2-sheethead {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 12px 10px 20px;
        border-bottom: 1px solid var(--sfv2-line);
        font-size: 17px;
        font-weight: 700;
    }
    .sfv2-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f2f4f6; cursor: pointer; }
    .sfv2--top .sfv2-fields, .sfv2--side .sfv2-fields { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px; overscroll-behavior: contain; }
    .sfv2-f + .sfv2-f { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--sfv2-line); }
    .sfv2-foot, .sfv2--top .sfv2-foot, .sfv2[data-mode=ajax] .sfv2-foot {
        flex: none;
        display: flex !important;
        margin: 0;
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--sfv2-line);
        background: #fff;
    }
    .sfv2-foot .sfv2-apply, .sfv2[data-mode=ajax] .sfv2-foot .sfv2-apply { display: inline-flex; flex: 1; }
    .sfv2-backdrop { position: fixed; inset: 0; z-index: 2147481999; background: rgba(0, 0, 0, .4); }
    html.sfv2-locked, html.sfv2-locked body { overflow: hidden !important; }
}
@media (min-width: 781px) {
    .sfv2-backdrop { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sfv2-form, .sfv2-f__head button::after { transition: none !important; }
}
