/* ===== GRID (основной фильтр) ===== */
.ff-grid{display:grid!important;gap:16px}
.ff-grid[data-ff-cols="1"]{grid-template-columns:1fr!important}
.ff-grid[data-ff-cols="2"]{grid-template-columns:repeat(2,1fr)!important}
.ff-grid[data-ff-cols="3"]{grid-template-columns:repeat(3,1fr)!important}
.ff-grid[data-ff-cols="4"]{grid-template-columns:repeat(4,1fr)!important}
.ff-grid[data-ff-cols="5"]{grid-template-columns:repeat(5,1fr)!important}
.ff-grid[data-ff-cols="6"]{grid-template-columns:repeat(6,1fr)!important}
.ff-grid-item{width:100%;min-width:0}
@media(max-width:1024px){
    .ff-grid[data-ff-cols-t="1"]{grid-template-columns:1fr!important}
    .ff-grid[data-ff-cols-t="2"]{grid-template-columns:repeat(2,1fr)!important}
    .ff-grid[data-ff-cols-t="3"]{grid-template-columns:repeat(3,1fr)!important}
    .ff-grid[data-ff-cols-t="4"]{grid-template-columns:repeat(4,1fr)!important}
}
@media(max-width:767px){
    .ff-grid[data-ff-cols-m="1"]{grid-template-columns:1fr!important}
    .ff-grid[data-ff-cols-m="2"]{grid-template-columns:repeat(2,1fr)!important}
    .ff-grid[data-ff-cols-m="3"]{grid-template-columns:repeat(3,1fr)!important}
}

/* ===== BASE ===== */
.ff-widget{font-size:14px;line-height:1}
.ff-widget *,.ff-widget *::before,.ff-widget *::after{box-sizing:border-box}

/* ===== TITLE ===== */
.ff-title{font-size:15px;font-weight:600;margin:0;color:#1f2937;display:flex;align-items:center;justify-content:space-between}
.ff-toggle{cursor:pointer;user-select:none}
.ff-toggle:hover{color:#2563eb}
.ff-arr{font-size:10px;transition:transform .2s;color:#9ca3af}
.ff-arr-up{transform:rotate(180deg)}

/* ===== BODY VISIBILITY ===== */
.ff-visible{display:block}
.ff-hidden{display:none}
.ff-hover-body{display:none}

/* ===== HOVER MODE ===== */
.ff-hover-mode{position:relative}
.ff-hover-mode .ff-hover-body{
    position:absolute;top:100%;left:0;z-index:1000;
    background:#fff;border:1px solid #e5e7eb;border-radius:8px;
    box-shadow:0 8px 24px rgba(0,0,0,.12);
    padding:16px;min-width:280px;max-width:400px;width:max-content;
}
.ff-hover-mode:hover .ff-hover-body{display:block}
.ff-hover-mode .ff-title{padding-bottom:6px}

/* ===== SEARCH ===== */
.ff-search-box{position:relative;display:flex}
.ff-search-inp{width:100%;padding:8px 36px 8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;outline:none;transition:border-color .2s}
.ff-search-inp:focus{border-color:#2563eb}
.ff-search-icon{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-size:14px;pointer-events:none;opacity:.5}

/* ===== SELECT ===== */
.ff-sort-sel{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;outline:none;cursor:pointer}
.ff-sort-sel:focus{border-color:#2563eb}

/* ===== CHECKBOX ===== */
.ff-list{display:flex;flex-direction:column;gap:4px;overflow-y:auto;scrollbar-width:thin;padding-right:4px}
.ff-list::-webkit-scrollbar{width:4px}
.ff-list::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:4px}
.ff-lbl{display:flex;align-items:center;gap:8px;cursor:pointer;padding:3px 0}
.ff-lbl:hover{color:#2563eb}
.ff-child{padding-left:22px}
.ff-cb{width:16px;height:16px;accent-color:#2563eb;cursor:pointer;flex-shrink:0;margin:0}
.ff-num{font-size:12px;color:#9ca3af;margin-left:auto;flex-shrink:0}

/* ===== BUTTONS ===== */
.ff-btns{display:flex;flex-wrap:wrap;gap:6px}
.ff-btn{padding:5px 14px;border:1px solid #d1d5db;border-radius:20px;background:#fff;font-size:13px;cursor:pointer;transition:all .15s;white-space:nowrap}
.ff-btn:hover{border-color:#2563eb;color:#2563eb}
.ff-btn-on{background:#2563eb!important;border-color:#2563eb!important;color:#fff!important}
.ff-btn-on:hover{background:#1d4ed8!important}

/* ===== PRICE ===== */
.ff-price-fields{display:flex;align-items:flex-end;gap:8px}
.ff-pf{flex:1;min-width:0}
.ff-pf label{display:block;font-size:12px;color:#6b7280;margin-bottom:4px;white-space:nowrap}
.ff-inp{width:100%;padding:8px 8px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;outline:none;min-width:0}
.ff-inp:focus{border-color:#2563eb}
.ff-dash{color:#9ca3af;padding-bottom:8px;flex-shrink:0}
.ff-inp[type="number"]::-webkit-inner-spin-button,.ff-inp[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.ff-inp[type="number"]{-moz-appearance:textfield}

/* ===== RANGE ===== */
.ff-range-wrap{padding:0 2px}
.ff-range-under{margin-top:12px}
.ff-range-labels{display:flex;justify-content:space-between;font-size:14px;font-weight:500;margin-bottom:12px;color:#374151}
.ff-range-box{position:relative;height:24px}
.ff-range-track{position:absolute;top:50%;left:0;right:0;height:4px;background:#e5e7eb;border-radius:2px;transform:translateY(-50%)}
.ff-range-fill{position:absolute;top:50%;height:4px;background:#2563eb;border-radius:2px;transform:translateY(-50%);left:0;width:100%;pointer-events:none}
.ff-range{position:absolute;top:0;left:0;width:100%;height:100%;-webkit-appearance:none;appearance:none;background:transparent;pointer-events:none;outline:none;margin:0;padding:0}
.ff-range::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;border-radius:50%;background:#2563eb;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.2);cursor:pointer;pointer-events:auto;position:relative;z-index:2}
.ff-range::-moz-range-thumb{width:20px;height:20px;border-radius:50%;background:#2563eb;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.2);cursor:pointer;pointer-events:auto}

/* ===== TAGS ===== */
.ff-tags-box{margin-bottom:12px}
.ff-tags{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.ff-tag{display:inline-flex;align-items:center;gap:4px;padding:3px 10px;background:#eff6ff;border:1px solid #bfdbfe;border-radius:14px;font-size:12px;color:#1e40af}
.ff-tag-x{cursor:pointer;font-size:15px;line-height:1;opacity:.6}
.ff-tag-x:hover{opacity:1}
.ff-reset-all{background:none;border:none;color:#ef4444;font-size:13px;cursor:pointer;padding:0;text-decoration:underline}
.ff-reset-all:hover{color:#dc2626}
/* Режим «только кнопка сброса»: кнопка видна всегда, но неактивна,
   пока не применён ни один фильтр. */
.ff-reset-all:disabled{color:#9ca3af;cursor:default;text-decoration:none}
.ff-reset-w .ff-reset-title{margin-bottom:8px}

/* ===== LOADING ===== */
body.ff-loading::after{content:'';position:fixed;inset:0;z-index:99999;background:rgba(255,255,255,.4);pointer-events:none}
body.ff-loading::before{content:'';position:fixed;top:50%;left:50%;z-index:100000;width:36px;height:36px;margin:-18px 0 0 -18px;border:3px solid #e5e7eb;border-top-color:#2563eb;border-radius:50%;animation:ffspin .6s linear infinite;pointer-events:none}
@keyframes ffspin{to{transform:rotate(360deg)}}

/* ===== MISC ===== */
.ff-notice{padding:12px;background:#fef3cd;border:1px solid #ffc107;border-radius:6px;font-size:13px;color:#856404;margin-bottom:12px}
.ff-empty{padding:40px 20px;text-align:center;color:#6b7280;font-size:16px;grid-column:1/-1}
.ff-card a{text-decoration:none;color:inherit;display:block}
.ff-card img{width:100%;height:auto;border-radius:6px}
.ff-card h3{font-size:14px;margin:8px 0 4px}
.ff-card-price{font-weight:600;color:#1f2937}

@media(max-width:767px){
    .ff-price-fields{flex-direction:row}
    .ff-dash{display:none}
    .ff-hover-mode .ff-hover-body{min-width:200px;left:0;right:0;width:auto}
}

/* ===== УМНЫЙ ПОИСК (Smart Search) ===== */
.ff-smart-search-widget {
    position: relative;
    z-index: 99990;
    width: 100%;
    font-family: inherit;
}

/* Поле ввода */
.ff-search-input-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
}
/* Обёртка собственно строки ввода (поле + иконки/очистка): кнопка закрытия
   «справа от строки» лежит рядом, вне поля, в одной flex-строке. */
.ff-search-field {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
/* Кнопка закрытия вне поля: на той же строке, справа. */
.ff-search-input-wrapper > .ff-search-close {
    flex-shrink: 0;
    margin-left: 12px;
}

.ff-search-inp {
    width: 100%;
    /* Правый резерв под кнопки: JS-замер (--ff-inp-pr), без него — расчёт
       из размеров иконок (лупа + крестик + паддинги/gap/разделитель/воздух).
       Дефолт 98px. Фикс наезжания длинного запроса на крестик/лупу. */
    padding: 12px var(--ff-inp-pr, calc(var(--ff-loupe-size, 18px) + var(--ff-clear-size, 14px) + 66px)) 12px 15px !important;
    border: 1px solid #cccccc;
    border-radius: 8px;
    font-size: 16px;
    color: #333333;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box !important;
    margin: 0 !important;
    height: auto !important;
    line-height: normal !important;
}

.ff-smart-search-widget .ff-search-inp:focus {
    outline: none;
    border-color: #cccccc;
    box-shadow: none !important;
}

.ff-search-inp::placeholder {
    color: #999999;
    opacity: 1;
}

/* Иконки */
.ff-search-actions {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding-right: 28px !important;
    pointer-events: auto;
    z-index: 20 !important;
}

.ff-search-icon {
    color: #888888;
    font-size: 18px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto;
    cursor: pointer;
    width: auto;
    height: auto;
    /* Перебиваем legacy opacity:.5 выше по файлу — иначе лупа полупрозрачная. */
    opacity: 1;
}

/* Отдельный разделитель перед лупой (вместо border у кнопки —
   тот съезжал и наезжал на контент). Всегда слева от лупы. */
.ff-search-actions .ff-search-divider {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    flex-shrink: 0;
    align-self: center;
    /* Слева gap(5px) + padding крестика(5px) = 10px до глифа,
       справа только gap(5px) — добираем margin, чтобы встать ровно по центру. */
    margin-right: 5px;
}

.ff-search-icon svg {
    width: 18px;
    height: 18px;
}

.ff-search-clear {
    background: none !important;
    border: none !important;
    color: #888888;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer;
    padding: 0 5px !important;
    margin: 0 !important;
    /* Видимостью управляет класс ff-show (jQuery show/hide проигрывали
       этому !important и кнопка либо вечно висела, либо не показывалась). */
    display: none;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.2s;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
}
.ff-search-clear.ff-show {
    display: flex !important;
}

button.ff-search-clear:hover,
button.ff-search-clear:focus {
    color: #f37b2d;
}
button.ff-search-clear:hover svg,
button.ff-search-clear:focus svg {
    fill: #f37b2d;
}

.ff-search-clear i {
    font-size: var(--ff-clear-size, 16px);
}
.ff-search-clear svg {
    width: var(--ff-clear-size, 14px);
    height: var(--ff-clear-size, 14px);
}

/* Выпадающее окно */
.ff-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    padding: 20px;
    z-index: 99999;
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    box-sizing: border-box;
}

.ff-smart-search-widget.ff-open .ff-search-dropdown {
    display: none;
}

/* Сброс списков */
.ff-search-dropdown .ff-search-dynamic-suggestions ul,
.ff-search-dropdown .ff-search-categories-results ul,
.ff-search-dropdown ul.ff-history-list,
.ff-search-dropdown ul.ff-popular-list {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
    cursor: pointer;
}

.ff-search-dropdown .ff-search-dynamic-suggestions ul li,
.ff-search-dropdown .ff-search-categories-results ul li,
.ff-search-dropdown ul.ff-history-list li,
.ff-search-dropdown ul.ff-popular-list li {
    list-style: none !important;
    list-style-type: none !important;
    /* Без !important: отступы/зазоры отдаём одноимённым контролам
       Elementor (у них !important — они старше при любом раскладе). */
    padding: 0;
    margin: 0 0 10px 0;
    background: none;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px;
}

.ff-search-dropdown .ff-search-dynamic-suggestions ul li::before,
.ff-search-dropdown .ff-search-categories-results ul li::before,
.ff-search-dropdown .ff-search-dynamic-suggestions ul li::after,
.ff-search-dropdown .ff-search-categories-results ul li::after,
.ff-search-dropdown ul.ff-history-list li::before,
.ff-search-dropdown ul.ff-popular-list li::before,
.ff-search-dropdown ul.ff-history-list li::after,
.ff-search-dropdown ul.ff-popular-list li::after,
.ff-search-dropdown li::marker {
    display: none !important;
    content: none !important;
    font-size: 0 !important;
}

.ff-search-dropdown ul.ff-cat-list li a {
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: none !important;
}

.ff-search-dropdown .ff-search-section ul {
    padding-inline-start: 0px !important;
}

.ff-search-dropdown ul,
.ff-search-dropdown .ff-search-section ul {
    padding: 0 0 0 0 !important;
    padding-left: 0 !important;
    padding-inline-start: 0 !important;
    margin: 0 0 20px 0 !important;
    margin-left: 0 !important;
    margin-inline-start: 0 !important;
    list-style: none !important;
    display: block !important;
}

.ff-search-dropdown li {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    /* Без !important: см. комментарий выше — рулят контролы Elementor. */
    gap: 8px;
    list-style: none !important;
    margin-bottom: 10px;
    padding-left: 0;
    margin-left: 0;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ff-search-dropdown li i,
.ff-search-dropdown li svg {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ff-search-dropdown ul.ff-cat-list li a {
    flex-grow: 1 !important;
    display: block !important;
}

.ff-search-dropdown li:hover strong {
    color: inherit !important;
}

/* Подсветка введённого текста в подсказках — явная жирность,
   чтобы не зависеть от браузерного дефолта strong и сброса темы. */
.ff-search-dropdown .ff-sug-text strong,
.ff-search-dropdown .ff-sug-text b {
    font-weight: 700;
}

.ff-search-dropdown li * {
    cursor: pointer !important;
}

.ff-search-title {
    display: block;
    margin: 0 0 15px 0;
    font-weight: 600;
}

/* Сетка товаров в умном поиске (динамические колонки).
   data-cols-d/t/m ставятся прямо на .elementor-loop-container.elementor-grid
   и PHP (результаты поиска + «популярные товары»), и JS — поэтому правила
   работают и внутри .ff-products-grid, и вне его. Атрибуты выставляются только
   нашими контейнерами — чужие сетки Elementor на странице не задеваются. */
.ff-products-grid { display: block; }
.ff-products-grid .elementor-loop-container.elementor-grid,
.elementor-loop-container.elementor-grid { display: grid; }
.ff-products-grid[data-cols-d="1"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="1"],
.elementor-loop-container.elementor-grid[data-cols-d="1"] { grid-template-columns: repeat(1, 1fr) !important; }
.ff-products-grid[data-cols-d="2"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="2"],
.elementor-loop-container.elementor-grid[data-cols-d="2"] { grid-template-columns: repeat(2, 1fr) !important; }
.ff-products-grid[data-cols-d="3"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="3"],
.elementor-loop-container.elementor-grid[data-cols-d="3"] { grid-template-columns: repeat(3, 1fr) !important; }
.ff-products-grid[data-cols-d="4"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="4"],
.elementor-loop-container.elementor-grid[data-cols-d="4"] { grid-template-columns: repeat(4, 1fr) !important; }
.ff-products-grid[data-cols-d="5"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="5"],
.elementor-loop-container.elementor-grid[data-cols-d="5"] { grid-template-columns: repeat(5, 1fr) !important; }
.ff-products-grid[data-cols-d="6"],
.ff-products-grid .elementor-loop-container.elementor-grid[data-cols-d="6"],
.elementor-loop-container.elementor-grid[data-cols-d="6"] { grid-template-columns: repeat(6, 1fr) !important; }

/* Сетка результатов — собственный stacking-контекст НИЖЕ кнопки.
   Карточки Loop-шаблона на hover поднимают свои контексты (фон, z-index,
   transform) и без этой ловушки вылезают поверх «Всех результатов» —
   любой z-index внутри сетки теперь упирается в её z-index: 1. */
.ff-search-products-results .ff-products-grid,
.ff-search-products-results .elementor-loop-container.elementor-grid {
    position: relative;
    z-index: 1;
}

/* Кнопка «Все результаты» */
.ff-see-all-btn {
    display: inline-block;
    margin-top: 20px;
    /* Всегда поверх товаров (у карточек свои stacking-контексты:
       hover, бейджи, transform пина). Без смещения в потоке. */
    position: relative;
    z-index: 50;
}

@media (max-width: 1024px) {
    .ff-products-grid[data-cols-t="1"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="1"],
    .elementor-loop-container.elementor-grid[data-cols-t="1"] { grid-template-columns: repeat(1, 1fr) !important; }
    .ff-products-grid[data-cols-t="2"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="2"],
    .elementor-loop-container.elementor-grid[data-cols-t="2"] { grid-template-columns: repeat(2, 1fr) !important; }
    .ff-products-grid[data-cols-t="3"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="3"],
    .elementor-loop-container.elementor-grid[data-cols-t="3"] { grid-template-columns: repeat(3, 1fr) !important; }
    .ff-products-grid[data-cols-t="4"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="4"],
    .elementor-loop-container.elementor-grid[data-cols-t="4"] { grid-template-columns: repeat(4, 1fr) !important; }
    .ff-products-grid[data-cols-t="5"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="5"],
    .elementor-loop-container.elementor-grid[data-cols-t="5"] { grid-template-columns: repeat(5, 1fr) !important; }
    .ff-products-grid[data-cols-t="6"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-t="6"],
    .elementor-loop-container.elementor-grid[data-cols-t="6"] { grid-template-columns: repeat(6, 1fr) !important; }
}
@media (max-width: 767px) {
    .ff-products-grid[data-cols-m="1"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="1"],
    .elementor-loop-container.elementor-grid[data-cols-m="1"] { grid-template-columns: repeat(1, 1fr) !important; }
    .ff-products-grid[data-cols-m="2"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="2"],
    .elementor-loop-container.elementor-grid[data-cols-m="2"] { grid-template-columns: repeat(2, 1fr) !important; }
    .ff-products-grid[data-cols-m="3"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="3"],
    .elementor-loop-container.elementor-grid[data-cols-m="3"] { grid-template-columns: repeat(3, 1fr) !important; }
    .ff-products-grid[data-cols-m="4"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="4"],
    .elementor-loop-container.elementor-grid[data-cols-m="4"] { grid-template-columns: repeat(4, 1fr) !important; }
    .ff-products-grid[data-cols-m="5"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="5"],
    .elementor-loop-container.elementor-grid[data-cols-m="5"] { grid-template-columns: repeat(5, 1fr) !important; }
    .ff-products-grid[data-cols-m="6"],
    .ff-products-grid .elementor-loop-container.elementor-grid[data-cols-m="6"],
    .elementor-loop-container.elementor-grid[data-cols-m="6"] { grid-template-columns: repeat(6, 1fr) !important; }
}

/* Overlay затемнения */
.ff-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    transition: opacity 0.3s ease;
    pointer-events: none;
    opacity: 0;
}
.ff-search-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ===== TOGGLE MODE ===== */
.ff-smart-search-widget[data-toggle-mode="1"] {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
    max-width: 100%;
}
.ff-search-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    padding: 0;
    font-size: 16px;
    transition: all 0.2s;
    line-height: 1;
    user-select: none;
}
button.ff-search-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #2563eb;
    color: #2563eb;
}
.ff-search-toggle-btn i,
.ff-search-toggle-btn svg {
    display: block;
    vertical-align: middle;
    pointer-events: none;
}

/* Wrapper в toggle-режиме: всплывает под кнопкой, не сдвигая вёрстку.
   Непрозрачный фон, чтобы затемнение (overlay) не просвечивало сквозь панель. */
.ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 280px;
    box-sizing: border-box;
    background: #ffffff;
    z-index: 99999;
}
/* Открытие по классу .ff-open (перебивает inline display:none) */
.ff-smart-search-widget[data-toggle-mode="1"].ff-open .ff-search-wrapper:not(.ff-search-fullscreen) {
    display: block !important;
}
/* Выравнивание «По центру страницы»: фиксированное окно по центру вьюпорта.
   Ширина: режим «Во всю ширину» = вьюпорт минус отступы; «Ограниченная» =
   ширина контейнера брейкпоинта (--ff-popup-width) с ограничением по экрану */
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-align="page_center"] .ff-search-wrapper:not(.ff-search-fullscreen) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(var(--ff-popup-width, 600px), calc(100vw - 40px));
    max-width: none;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    z-index: 99999;
}
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-align="page_center"][data-popup-width="full"] .ff-search-wrapper:not(.ff-search-fullscreen) {
    width: calc(100vw - 40px);
}
/* Режим «Своя (слайдер)»: ширина как раньше — окно на всю ширину,
   ограничение сверху задаёт инлайн max-width (popup_width). */
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-align="page_center"][data-popup-width="custom"] .ff-search-wrapper:not(.ff-search-fullscreen) {
    width: 100%;
}
/* В режиме «по центру страницы» результаты — в потоке (скроллится само окно) */
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-align="page_center"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-dropdown {
    position: static;
    border-radius: 0 0 12px 12px;
}
.ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
}
/* Режимы ширины всплывающего окна:
   full — во всю ширину (по умолчанию дает width:100%), limited — шириной
   контейнера брейкпоинта, custom — инлайн-значение слайдера popup_width. */
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-width="limited"] .ff-search-wrapper:not(.ff-search-fullscreen) {
    width: min(var(--ff-popup-width, 1140px), calc(100vw - 24px));
}
/* «Во всю ширину» (кроме «по центру страницы») — фиксированная панель на всю
   ширину вьюпорта, появляется под кнопкой; top задаёт JS при открытии */
.ff-smart-search-widget[data-toggle-mode="1"][data-popup-width="full"]:not([data-popup-align="page_center"]) .ff-search-wrapper:not(.ff-search-fullscreen) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    transform: none;
    height: auto;
}
/* Режим содержимого окна: строка поиска и окно результатов.
   limited — по ширине контейнера брейкпоинта, центрируются в окне. */
.ff-smart-search-widget[data-toggle-mode="1"][data-content-width="limited"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-input-wrapper,
.ff-smart-search-widget[data-toggle-mode="1"][data-content-width="limited"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-dropdown {
    width: min(var(--ff-content-width, 1140px), 100%);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.ff-smart-search-widget[data-toggle-mode="1"][data-content-width="limited"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-dropdown {
    right: 0;
}
/* Страховка для закешированной разметки: 0-ширина = на всю ширину окна */
.ff-smart-search-widget[data-toggle-mode="1"] .ff-search-input-wrapper[style*="width:0px"],
.ff-smart-search-widget[data-toggle-mode="1"] .ff-search-dropdown[style*="width:0px"] {
    width: 100% !important;
}

/* Адаптив: на мобильных всплывающее окно вписывается в экран,
   даже если кнопка размещена у края шапки */
@media (max-width: 767px) {
    /* Sticky (data-mobile-sticky=1/отсутствует): окно «прилипает» у верха
       экрана на offset из mobile_popup_top (--ff-mobile-top). Выключено —
       окно открывается под кнопкой, как на десктопе. */
    .ff-smart-search-widget[data-toggle-mode="1"][data-mobile-sticky!="0"] .ff-search-wrapper:not(.ff-search-fullscreen) {
        position: fixed !important;
        top: var(--ff-mobile-top, 10px) !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
    }
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    .ff-smart-search-widget[data-toggle-mode="1"].ff-open .ff-search-wrapper:not(.ff-search-fullscreen) {
        display: flex !important;
    }
    /* «По центру страницы» на мобильных — тоже по центру экрана */
    .ff-smart-search-widget[data-toggle-mode="1"][data-popup-align="page_center"] .ff-search-wrapper:not(.ff-search-fullscreen) {
        position: fixed !important;
        top: 50%;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        scrollbar-width: thin;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
        width: auto !important;
        max-width: none !important;
    }
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-dropdown {
        flex-basis: 100%;
        width: 100% !important;
        max-width: min(var(--ff-content-width, 100%), 100%) !important;
        margin-left: auto;
        margin-right: auto;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-close.ff-close-dev-desktop {
        display: none !important;
    }
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-close.ff-close-dev-mobile {
        display: inline-flex !important;
    }
    /* «Внутри строки (справа)» на мобильных — в .ff-search-actions перед иконкой */
    .ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-actions .ff-close-text_inside {
        margin-left: 6px;
        margin-right: 4px;
    }
}

/* Полноэкранный режим: панель занимает весь экран */
.ff-search-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    background: #fff;
    padding: 70px 20px 40px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.ff-search-fullscreen .ff-search-input-wrapper {
    max-width: 700px;
    margin: 0 auto;
}
.ff-search-fullscreen .ff-search-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0 0 12px 12px;
    max-width: 700px;
    margin: 0 auto;
    max-height: none;
}
body.ff-search-locked {
    overflow: hidden;
}
/* Пока открыт поиск (поле ввода + кнопка закрытия), глобальная загрузочная
   вуаль сетки (body.ff-loading) НЕ должна перекрывать панель поиска. */
body.ff-loading.ff-search-open::before,
body.ff-loading.ff-search-open::after {
    display: none !important;
}

/* Close button for fullscreen.
   Перебиваем глобальные стили кнопок Elementor ([type=button], button),
   которые добавляют рамку/фон/отступы/размер — селектор с тегом равен по
   специфичности, а !important исключает зависимость от порядка загрузки. */
button.ff-search-close-btn,
button.ff-search-close {
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    line-height: 1 !important;
    cursor: pointer;
    transition: color 0.3s;
}
button.ff-search-close-btn {
    position: absolute;
    top: 14px;
    right: 20px;
    font-size: 28px !important;
    color: #6b7280 !important;
    z-index: 30;
}
button.ff-search-close-btn:hover {
    color: #f37b2d !important;
}
button.ff-search-close {
    color: #6b7280 !important;
}
button.ff-search-close:hover {
    color: #f37b2d !important;
}
.ff-search-close.ff-close-dev-mobile {
    display: none !important;
}

/* «Внутри строки (справа)» — в .ff-search-actions, перед иконкой поиска. */
.ff-smart-search-widget[data-toggle-mode="1"] .ff-search-wrapper:not(.ff-search-fullscreen) .ff-search-actions .ff-close-text_inside {
    margin-left: 6px;
    margin-right: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    z-index: 21;
}

/* === FF: В наличии — переключатель ===
   Размеры задаются CSS-переменными --ff-stock-w / --ff-stock-h (их публикуют
   настройки виджета), поэтому кружок и его сдвиг пересчитываются автоматически
   и переключатель остаётся пропорциональным при любых значениях. */
.ff-stock-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}
.ff-stock-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: var(--ff-stock-w, 40px);
    height: var(--ff-stock-h, 22px);
}
.ff-stock-inp {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.ff-stock-slider {
    position: absolute;
    inset: 0;
    background-color: #d1d5db;
    border-radius: 999px;
    transition: background-color 0.2s ease;
    pointer-events: none;
}
.ff-stock-slider:before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    height: calc(var(--ff-stock-h, 22px) - 6px);
    width: calc(var(--ff-stock-h, 22px) - 6px);
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
}
.ff-stock-inp:checked + .ff-stock-slider {
    background-color: #2563eb;
}
.ff-stock-inp:checked + .ff-stock-slider:before {
    transform: translateX(calc(var(--ff-stock-w, 40px) - var(--ff-stock-h, 22px)));
}
.ff-stock-inp:focus-visible + .ff-stock-slider {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.ff-stock-text {
    user-select: none;
    line-height: 1.2;
}

/* ========== Модуль: чипы-области ========== */
.ff-search-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
/* Текст перед чипами (опция виджета): в той же строке, не кликабелен. */
.ff-search-chips .ff-chips-label {
    align-self: center;
    font-size: 13px;
    line-height: 1.4;
    color: #6b7280;
}
/* Мобайл: чипы — горизонтальная прокручивающаяся строка вместо переносов. */
@media(max-width:767px){
    .ff-search-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .ff-search-chips::-webkit-scrollbar { display: none; }
    .ff-search-chips > * { flex-shrink: 0; }
}
button.ff-chip,
a.ff-chip {
    border: 0;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.4;
    background-color: #f3f4f6;
    color: #111827;
    text-decoration: none;
    display: inline-block;
}
button.ff-chip:hover,
button.ff-chip:focus,
a.ff-chip:hover,
a.ff-chip:focus { background-color: #111827; color: #ffffff; text-decoration: none; }
button.ff-chip.ff-chip-on,
a.ff-chip.ff-chip-on {
    background-color: #111827;
    color: #ffffff;
}

/* ========== Модуль: история (кнопка Очистить) ========== */
.ff-search-title button.ff-history-clear {
    border: 0;
    background: none !important;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
    padding: 0;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.ff-search-title button.ff-history-clear:hover { color: #f37b2d; }

/* ========== Категории: родитель второй строкой + ellipsis ========== */
.ff-cat-list li a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}
.ff-cat-parent {
    display: block;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== Чипы-подсказки (продолжение запроса) ========== */
.ff-sug-chips,
.ff-search-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 15px 0;
}
button.ff-sug-chip {
    /* Прозрачная граница вместо border:0 — контрол «Цвет границы при
       наведении» работает из коробки, дефолтный вид не меняется. */
    border: 1px solid transparent;
    cursor: pointer;
    border-radius: 16px;
    padding: 5px 12px;
    background: #f3f4f6;
    color: #111827;
    font-size: 13px;
    line-height: 1.3;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
button.ff-sug-chip:hover,
button.ff-sug-chip:focus { background: #111827; color: #ffffff; }

/* ========== Лёгкие строки товаров ========== */
.ff-rows-list { display: flex; flex-direction: column; gap: 10px; }
.ff-row-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}
.ff-row-item:hover { text-decoration: none; }
.ff-row-thumb { width: 56px; height: 56px; flex-shrink: 0; overflow: hidden; border-radius: 6px; }
.ff-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ff-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.ff-row-name {
    font-size: 14px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
}
.ff-row-price { font-size: 14px; }