/* =============================================
   Smart WooCommerce Search v4.1
   Две темы: light (Вариант 2) и dark (Вариант 1)
   Все размеры управляются CSS-переменными
   ============================================= */

/* ── Дефолтные переменные (переопределяются из PHP) ── */
:root {
    --sws-accent:      #3a86ca;
    --sws-thumb-size:  80px;
    --sws-left-width:  220px;
    --sws-drop-width:  680px;
    --sws-grid-cols:   4;
    --sws-radius:      16px;
}

/* ════════════════════════════════
   ОБЩИЕ — поле ввода
════════════════════════════════ */

.sws-wrapper {
    position: relative;
    width: 100%;
    font-family: inherit;
}

.sws-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

/* Поле — светлая тема */
.sws-input {
    width: 100%;
    padding: 12px 56px 12px 20px;
    font-size: 15px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    border: none;
    border-radius: 50px;
    outline: none;
    box-shadow: 0 2px 20px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.05);
    transition: box-shadow 0.2s;
    box-sizing: border-box;
}
.sws-input::placeholder { color: #b0b8c8; }
.sws-input:focus {
    box-shadow: 0 4px 32px rgba(0,0,0,.12), 0 0 0 2px var(--sws-accent);
}

/* Поле — тёмная тема */
.sws-theme-dark .sws-input {
    background: rgba(255,255,255,.05);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08);
}
.sws-theme-dark .sws-input::placeholder { color: rgba(255,255,255,.25); }
.sws-theme-dark .sws-input:focus {
    background: rgba(255,255,255,.07);
    box-shadow: 0 0 0 2px var(--sws-accent), 0 0 0 4px rgba(167,139,250,.15);
}

/* Иконка поиска */
.sws-icon {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: #b0b8c8;
    pointer-events: none;
    display: flex; align-items: center;
}
.sws-icon svg { width: 18px; height: 18px; }

/* Кнопка очистки */
.sws-clear {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    cursor: pointer;
    color: #b0b8c8;
    font-size: 14px;
    display: none;
    align-items: center; justify-content: center;
    transition: color 0.15s;
    border-radius: 50%;
}
.sws-clear:hover { color: #555; background: rgba(0,0,0,.05); }
.sws-clear.visible { display: flex; }
.sws-theme-dark .sws-clear { color: rgba(255,255,255,.3); }
.sws-theme-dark .sws-clear:hover { color: rgba(255,255,255,.7); background: rgba(255,255,255,.08); }

/* Спиннер */
.sws-spinner {
    position: absolute;
    right: 44px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    border: 2px solid rgba(0,0,0,.1);
    border-top-color: var(--sws-accent);
    border-radius: 50%;
    animation: sws-spin 0.7s linear infinite;
    display: none;
}
.sws-spinner.active { display: block; }
.sws-theme-dark .sws-spinner { border-color: rgba(255,255,255,.1); border-top-color: var(--sws-accent); }
@keyframes sws-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ════════════════════════════════
   ДРОПДАУН
════════════════════════════════ */

.sws-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: var(--sws-drop-width);
    max-width: 96vw;
    z-index: 99999;
    display: none;
    overflow: hidden;
    border-radius: var(--sws-radius);

    /* Светлая тема */
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.13), 0 4px 16px rgba(0,0,0,.07);
}

.sws-dropdown.open {
    display: block;
    animation: sws-drop-in 0.18s ease;
}

/* sws-layout — горизонтальный контейнер левой и правой панелей */
.sws-layout {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    min-height: 100px;
    width: 100%;
}

@keyframes sws-drop-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Тёмная тема */
.sws-theme-dark .sws-dropdown {
    background: #16161f;
    box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}

.sws-theme-dark .sws-layout,
.sws-theme-light .sws-layout,
.sws-theme-classic .sws-layout {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
}

/* ════════════════════════════════
   ЛЕВАЯ ПАНЕЛЬ
════════════════════════════════ */

.sws-panel-left {
    width: var(--sws-left-width);
    min-width: var(--sws-left-width);
    max-width: var(--sws-left-width);
    flex-shrink: 0;
    flex-grow: 0;
    padding: 16px 0;
    border-right: 1px solid #f0f2f5;
    overflow: hidden;
    box-sizing: border-box;
}
.sws-theme-dark .sws-panel-left { border-right-color: rgba(255,255,255,.05); }

.sws-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0 16px 8px;
    color: #b0b8c8;
}
.sws-theme-dark .sws-section-title { color: rgba(255,255,255,.22); }

/* Подсказки */
.sws-suggestion {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px 9px 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.sws-suggestion:hover { background: #f6f8ff; }
.sws-theme-dark .sws-suggestion:hover { background: rgba(139,92,246,.08); }

.sws-suggestion__icon {
    width: 13px; height: 13px;
    flex-shrink: 0;
    fill: none; stroke-width: 2;
    color: #c8d0dc;
}
.sws-theme-dark .sws-suggestion__icon { color: rgba(255,255,255,.2); }

.sws-suggestion__text {
    flex: 1;
    font-size: 13px;
    color: #4a5568;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sws-suggestion__text strong { color: #1a1a2e; font-weight: 600; }
.sws-theme-dark .sws-suggestion__text { color: rgba(255,255,255,.6); }
.sws-theme-dark .sws-suggestion__text strong { color: var(--sws-accent); }

.sws-suggestion__count {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    flex-shrink: 0;
    min-width: 20px;
    text-align: right;
}
.sws-theme-dark .sws-suggestion__count { color: rgba(255,255,255,.35); }

/* История поиска */
.sws-section-title--flex {
    display: flex; align-items: center; justify-content: space-between;
    padding-right: 14px;
}

.sws-history-clear {
    background: none; border: none; padding: 0;
    font-size: 11px; color: #c8d0dc; cursor: pointer;
    font-family: inherit; transition: color 0.12s;
}
.sws-history-clear:hover { color: #555; }
.sws-theme-dark .sws-history-clear { color: rgba(255,255,255,.2); }
.sws-theme-dark .sws-history-clear:hover { color: rgba(255,255,255,.5); }

.sws-history-item { position: relative; padding-right: 28px; }

.sws-icon-history { color: #d0d8e4; }
.sws-theme-dark .sws-icon-history { color: rgba(255,255,255,.15); }

.sws-history-remove {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; padding: 2px 4px;
    font-size: 12px; color: #ccc; cursor: pointer;
    border-radius: 3px; opacity: 0;
    transition: opacity 0.12s, color 0.12s;
    font-family: inherit;
}
.sws-history-item:hover .sws-history-remove { opacity: 1; }
.sws-history-remove:hover { color: #888; background: #f0f0f0; }

/* Разделитель */
.sws-divider { height: 1px; background: #f0f2f5; margin: 6px 0; }
.sws-theme-dark .sws-divider { background: rgba(255,255,255,.05); }

/* Категории */
.sws-category {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 14px 8px 16px; cursor: pointer;
    text-decoration: none; color: inherit;
    transition: background 0.1s;
}
.sws-category:hover { background: #f6f8ff; }
.sws-theme-dark .sws-category:hover { background: rgba(139,92,246,.08); }

.sws-category__icon {
    width: 13px; height: 13px; flex-shrink: 0;
    fill: none; stroke-width: 2; color: #c8d0dc;
}
.sws-theme-dark .sws-category__icon { color: rgba(255,255,255,.2); }

.sws-category span {
    font-size: 12px; color: #4a5568; flex: 1;
    white-space: normal;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sws-theme-dark .sws-category span { color: rgba(255,255,255,.55); }

.sws-category__count {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    flex-shrink: 0;
    min-width: 24px;
    text-align: right;
    align-self: flex-start;
    padding-top: 1px;
}
.sws-theme-dark .sws-category__count { color: rgba(255,255,255,.35); }

/* Популярные теги */
.sws-popular-wrap {
    padding: 8px 14px;
    display: flex; flex-wrap: wrap; gap: 6px;
}

.sws-popular-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 12px; color: #555;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.sws-popular-tag:hover { background: #e0e8ff; color: var(--sws-accent); }
.sws-theme-dark .sws-popular-tag { background: rgba(255,255,255,.07); color: rgba(255,255,255,.5); }
.sws-theme-dark .sws-popular-tag:hover { background: rgba(139,92,246,.15); color: var(--sws-accent); }

/* ════════════════════════════════
   ПРАВАЯ ПАНЕЛЬ — товары
════════════════════════════════ */

.sws-panel-right {
    flex: 1 1 0%;
    padding: 16px;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.sws-products-title {
    font-size: 11px; font-weight: 700; color: #b0b8c8;
    text-transform: uppercase; letter-spacing: 0.12em;
    margin-bottom: 10px;
}
.sws-theme-dark .sws-products-title { color: rgba(255,255,255,.22); }

/* Сетка товаров */
.sws-grid {
    display: grid;
    grid-template-columns: repeat(var(--sws-grid-cols), 1fr);
    gap: 8px;
}

/* Карточка товара */
.sws-card {
    display: flex; flex-direction: column;
    text-decoration: none; color: inherit;
    border-radius: calc(var(--sws-radius) * 0.7);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    border: 1.5px solid #eef0f4;
    background: #f8f9fb;
}
.sws-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    border-color: var(--sws-accent);
}

.sws-theme-dark .sws-card {
    background: rgba(255,255,255,.03);
    border-color: rgba(255,255,255,.06);
}
.sws-theme-dark .sws-card:hover {
    border-color: var(--sws-accent);
    background: rgba(139,92,246,.06);
    box-shadow: none;
}

.sws-card__img-wrap {
    width: 100%;
    height: var(--sws-thumb-size);
    background: #eef0f3;
    overflow: hidden;
    flex-shrink: 0;
}
.sws-theme-dark .sws-card__img-wrap { background: rgba(255,255,255,.05); }

.sws-card__img {
    width: 100%; height: 100%;
    object-fit: contain; display: block;
}
.sws-card--outofstock .sws-card__img { opacity: 0.45; filter: grayscale(40%); }

.sws-card__body {
    padding: 6px 8px 8px;
    flex: 1; display: flex; flex-direction: column; gap: 2px;
}

.sws-card__title {
    font-size: 11px; line-height: 1.35; color: #2d3748;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.sws-card:hover .sws-card__title { color: var(--sws-accent); }
.sws-theme-dark .sws-card__title { color: rgba(255,255,255,.75); }

.sws-card__sku {
    font-size: 10px; line-height: 1.3; color: #94a3b8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sws-theme-dark .sws-card__sku { color: rgba(255,255,255,.35); }
.sws-theme-classic .sws-card__sku { color: #888; font-size: 10px; }

.sws-card__price {
    font-size: 12px; font-weight: 700; color: #1a1a2e;
    margin-top: auto; padding-top: 4px;
}
.sws-card__price del { font-weight: 400; color: #a0aec0; font-size: 12px; margin-right: 2px; }
.sws-card__price ins { text-decoration: none; }
.sws-theme-dark .sws-card__price { color: var(--sws-accent); }

.sws-card__out-of-stock {
    font-size: 11px; font-weight: 600; color: #e53e3e;
    margin-top: auto; padding-top: 4px;
}

/* Нет результатов */
.sws-no-results {
    padding: 30px 16px; text-align: center;
    color: #a0aec0; font-size: 13px;
    flex: 1; display: flex; align-items: center; justify-content: center;
}
.sws-theme-dark .sws-no-results { color: rgba(255,255,255,.25); }

/* Пустой хинт */
.sws-empty-hint {
    display: flex; align-items: center; justify-content: center;
    flex: 1; min-height: 80px;
    color: #c8d0dc; font-size: 13px;
}
.sws-theme-dark .sws-empty-hint { color: rgba(255,255,255,.18); }

/* Футер */
.sws-footer {
    display: block;
    padding: 10px 14px; margin-top: 10px;
    text-align: center; font-size: 12px; font-weight: 600;
    color: var(--sws-accent);
    background: rgba(0,0,0,.02);
    text-decoration: none;
    border-top: 1px solid #f0f2f5;
    border-radius: 0 0 calc(var(--sws-radius) * 0.7) calc(var(--sws-radius) * 0.7);
    transition: background 0.12s;
}
.sws-footer:hover { background: rgba(0,0,0,.04); }
.sws-theme-dark .sws-footer { background: rgba(255,255,255,.02); border-top-color: rgba(255,255,255,.05); }
.sws-theme-dark .sws-footer:hover { background: rgba(255,255,255,.04); }

/* Подсветка совпадений */
.sws-highlight { font-weight: 700; background: none; color: inherit; }

/* Адаптив */
@media (max-width: 600px) {
    .sws-dropdown { flex-direction: column; }
    .sws-panel-left { width: 100% !important; border-right: none; border-bottom: 1px solid #f0f2f5; }
    .sws-theme-dark .sws-panel-left { border-bottom-color: rgba(255,255,255,.05); }
    .sws-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ════════════════════════════════
   КЛАССИЧЕСКАЯ ТЕМА (sws-theme-classic)
   Стиль Advanced Woo Search — горизонтальный layout
════════════════════════════════ */

/* Поле ввода */
.sws-theme-classic .sws-input {
    border-radius: 3px;
    border: 1px solid #ddd;
    box-shadow: none;
    padding: 10px 80px 10px 16px;
    font-size: 14px;
    color: #333;
}
.sws-theme-classic .sws-input:focus {
    border-color: #999;
    box-shadow: none;
}

/* Дропдаун — прижат к левому краю поля */
.sws-theme-classic .sws-dropdown {
    border-radius: 0 0 4px 4px;
    border: 1px solid #ddd;
    border-top: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.10);
    top: calc(100% + 2px);
    left: 0;
    transform: none;
    width: var(--sws-drop-width);
    display: none;
}
.sws-theme-classic .sws-dropdown.open {
    display: block;
    animation: none;
}

/* Левая панель */
.sws-theme-classic .sws-panel-left {
    background: #fff;
    border-right: 1px solid #f0f0f0;
    padding: 14px 0;
    flex-shrink: 0;
    width: var(--sws-left-width);
    min-width: 160px;
}

.sws-theme-classic .sws-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #aaa;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 14px 6px;
}

.sws-theme-classic .sws-suggestion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    transition: background 0.1s;
}
.sws-theme-classic .sws-suggestion:hover { background: #f7f7f7; }
.sws-theme-classic .sws-suggestion__icon { color: #ccc; width: 13px; height: 13px; }
.sws-theme-classic .sws-suggestion__text { font-size: 13px; color: #444; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sws-theme-classic .sws-suggestion__text strong { color: #3a86ca; font-weight: 700; }
.sws-theme-classic .sws-suggestion__count { font-size: 11px; color: #bbb; font-weight: 600; flex-shrink: 0; }

.sws-theme-classic .sws-divider { background: #f0f0f0; margin: 6px 0; }

.sws-theme-classic .sws-category {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; transition: background 0.1s;
    text-decoration: none; color: inherit;
}
.sws-theme-classic .sws-category:hover { background: #f7f7f7; }
.sws-theme-classic .sws-category__icon { color: #bbb; width: 13px; height: 13px; }
.sws-theme-classic .sws-category span { color: #444; font-size: 13px; flex: 1; }
.sws-theme-classic .sws-category__count { font-size: 11px; color: #bbb; font-weight: 600; }

/* Правая панель */
.sws-theme-classic .sws-panel-right {
    flex: 1;
    padding: 14px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sws-theme-classic .sws-products-title {
    font-size: 11px; font-weight: 700; color: #aaa;
    text-transform: uppercase; letter-spacing: 0.08em;
    margin-bottom: 10px;
}

/* Сетка */
.sws-theme-classic .sws-grid {
    display: grid;
    grid-template-columns: repeat(var(--sws-grid-cols), 1fr);
    gap: 8px;
}

/* Карточки */
.sws-theme-classic .sws-card {
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.12s, border-color 0.12s;
}
.sws-theme-classic .sws-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    border-color: #ddd;
    transform: none;
}
.sws-theme-classic .sws-card__img-wrap { background: #f9f9f9; }
.sws-theme-classic .sws-card__title { color: #333; font-size: 11px; }
.sws-theme-classic .sws-card:hover .sws-card__title { color: #3a86ca; }
.sws-theme-classic .sws-card__price { color: #333; font-size: 12px; }

/* Футер */
.sws-theme-classic .sws-footer {
    background: #fafafa;
    border-top: 1px solid #eee;
    color: #3a86ca;
    font-size: 12px;
    border-radius: 0;
    margin-top: 8px;
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    text-decoration: none;
    display: block;
    transition: background 0.1s;
}
.sws-theme-classic .sws-footer:hover { background: #f0f0f0; }

/* Популярные теги */
.sws-theme-classic .sws-popular-tag { background: #f5f5f5; color: #666; }
.sws-theme-classic .sws-popular-tag:hover { background: #e8edf8; color: #3a86ca; }

/* Нет результатов */
.sws-theme-classic .sws-no-results { color: #aaa; font-size: 13px; }

/* Пустой хинт */
.sws-theme-classic .sws-empty-hint { color: #ccc; font-size: 13px; }


/* ════════════════════════════════
   МОБИЛЬНЫЙ FULLSCREEN ПОИСК v4.3.5
   Overlay на весь экран.
   Верхний header сдвинут вправо на --sws-burger-w,
   чтобы не перекрывать бургер темы.
════════════════════════════════ */

/* ── Overlay ── */
.sws-mobile-overlay {
    display: none;
    /* Используем width/height вместо right/bottom — обходим баг с overflow:hidden на html/body */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* dvh учитывает мобильный браузер с адресной строкой */
    z-index: 2147483647;
    flex-direction: column;
    background: transparent;
    pointer-events: none;
    /* НЕ overflow:hidden — это сломает дочерний скролл */
}
.sws-mobile-overlay.active {
    display: flex;
}
@keyframes sws-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Шапка поиска (поле + кнопка назад) ──
   Располагается ниже хедера сайта, правее бургера.
   Высота хедера = --sws-header-h (JS)
   Ширина бургера = --sws-burger-w (JS, обычно 56-64px) */
.sws-mobile-header {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: var(--sws-header-h, 0px);
    padding: 8px 12px 8px var(--sws-burger-w, 56px);
    /* Цвет подхватывается из JS через CSS-переменную --sws-header-bg */
    background: var(--sws-header-bg, #fff);
    border-bottom: 1px solid var(--sws-header-border, rgba(0,0,0,.08));
    flex-shrink: 0;
    animation: sws-slide-up 0.2s ease;
}
/* .sws-theme-dark переопределяет если тема задана вручную в настройках плагина */
.sws-theme-dark .sws-mobile-header {
    background: var(--sws-header-bg, #16161f);
    border-bottom-color: var(--sws-header-border, rgba(255,255,255,.07));
}

/* Кнопка «назад» */
.sws-mobile-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--sws-header-text, #555);
    border-radius: 50%;
    transition: background 0.12s;
    padding: 0;
}
.sws-mobile-back:active { background: rgba(128,128,128,.15); }
.sws-mobile-back svg { width: 20px; height: 20px; display: block; }

/* Обёртка поля */
.sws-mobile-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

/* Поле ввода */
.sws-mobile-input {
    width: 100%;
    padding: 10px 38px 10px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--sws-header-text, #1a1a2e);
    background: var(--sws-header-input-bg, rgba(0,0,0,0.07));
    border: none;
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
    transition: background 0.15s;
}
.sws-mobile-input::placeholder { color: var(--sws-header-icon-color, rgba(0,0,0,0.35)); }
.sws-mobile-input:focus { background: var(--sws-header-input-focus-bg, rgba(0,0,0,0.10)); }

/* Иконка лупы в поле */
.sws-mobile-icon {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--sws-header-icon-color, rgba(0,0,0,0.35));
    pointer-events: none;
    display: flex; align-items: center;
}
.sws-mobile-icon svg { width: 17px; height: 17px; }

/* Кнопка очистки */
.sws-mobile-clear {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 24px; height: 24px;
    cursor: pointer;
    color: var(--sws-header-icon-color, rgba(0,0,0,0.35));
    font-size: 13px;
    display: none;
    align-items: center; justify-content: center;
    border-radius: 50%;
    background: none;
    border: none;
}
.sws-mobile-clear:active { background: rgba(128,128,128,.15); }
.sws-mobile-clear.visible { display: flex; }

/* Спиннер */
.sws-mobile-spinner {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    border: 2px solid rgba(0,0,0,.1);
    border-top-color: var(--sws-accent);
    border-radius: 50%;
    animation: sws-spin 0.7s linear infinite;
    display: none;
}
.sws-mobile-spinner.active { display: block; }
.sws-theme-dark .sws-mobile-spinner { border-color: rgba(255,255,255,.1); border-top-color: var(--sws-accent); }

/* ── Зона результатов ──
   pointer-events:auto — скролл работает.
   Фон белый, высота = всё оставшееся место. */
.sws-mobile-results {
    pointer-events: auto;
    flex: 1 1 auto;
    min-height: 0;
    /* Высоту даёт flex:1 в колонке высотой 100dvh: results занимает всё
       место, оставшееся под .sws-mobile-header. Прежний жёсткий
       max-height: calc(100dvh - header-h - 57px) недотягивал панель до
       низа, потому что header-h, измеренный JS, включал высоту WP
       admin bar (на мобильном position:absolute, top:0) — лишние 46px.
       Полагаемся на flex, без ручного calc. */
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y pinch-zoom;
    background: #fff;
    /* Важно: position не static чтобы создать новый stacking context */
    position: relative;
    z-index: 0;
}
.sws-theme-dark .sws-mobile-results { background: #16161f; }

/* Блокируем скролл страницы под overlay.
   НЕ используем position:fixed на body — это вызывает обрезку overlay на Android/iOS
   когда на html или body стоит overflow:hidden/clip */
body.sws-overlay-open {
    overflow: hidden !important;
    /* touch-action:none блокирует скролл страницы без position:fixed */
    touch-action: none;
}
html.sws-overlay-open {
    overflow: hidden !important;
    touch-action: none;
}

/* На десктопе отключаем всю мобильную механику */
@media (min-width: 768px) {
    .sws-mobile-overlay { display: none !important; pointer-events: none !important; }
    body.sws-overlay-open,
    html.sws-overlay-open { overflow: auto !important; touch-action: auto; }
}

/* ════════════════════════════════
   МОБИЛЬНЫЙ OVERLAY — контент результатов
   Вертикально: запросы → категории → товары
════════════════════════════════ */

.sws-mobile-full { padding-bottom: 20px; }

/* Секция */
.sws-m-section { padding: 4px 0; }
.sws-m-section--sep {
    border-top: 1px solid #eef0f4;
    padding-top: 4px;
}
.sws-theme-dark .sws-m-section--sep { border-top-color: rgba(255,255,255,.07); }

/* Строка (запрос / категория) */
.sws-m-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,.06);
}
.sws-m-row:active { background: rgba(0,0,0,.04); }
.sws-theme-dark .sws-m-row:active { background: rgba(255,255,255,.05); }

.sws-m-row .sws-suggestion__icon,
.sws-m-row .sws-category__icon { width: 16px; height: 16px; flex-shrink: 0; }

.sws-m-row__text {
    flex: 1;
    font-size: 15px;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sws-m-row__text strong { font-weight: 700; color: #1a1a2e; }
.sws-theme-dark .sws-m-row__text { color: rgba(255,255,255,.75); }
.sws-theme-dark .sws-m-row__text strong { color: var(--sws-accent); }

.sws-m-row__count { font-size: 12px; font-weight: 600; color: #94a3b8; flex-shrink: 0; }
.sws-theme-dark .sws-m-row__count { color: rgba(255,255,255,.3); }

.sws-m-row__arrow { width: 16px; height: 16px; flex-shrink: 0; color: #c8d0dc; }
.sws-theme-dark .sws-m-row__arrow { color: rgba(255,255,255,.2); }

/* Заголовок секции товаров */
.sws-m-products-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #b0b8c8;
    padding: 10px 16px 6px;
}
.sws-theme-dark .sws-m-products-title { color: rgba(255,255,255,.25); }

/* Сетка товаров — 2 квадратные колонки */
.sws-m-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px;
}

/* Карточка */
.sws-m-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #eef0f4;
    background: #f8f9fb;
    -webkit-tap-highlight-color: transparent;
}
.sws-m-card:active { border-color: var(--sws-accent); }
.sws-theme-dark .sws-m-card { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.07); }
.sws-m-card--out .sws-m-card__img img { opacity: 0.45; filter: grayscale(40%); }

/* Квадратное фото */
.sws-m-card__img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #eef0f3;
    overflow: hidden;
    flex-shrink: 0;
}
.sws-m-card__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sws-theme-dark .sws-m-card__img { background: rgba(255,255,255,.05); }

/* Инфо */
.sws-m-card__info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }

.sws-m-card__title {
    font-size: 12px;
    line-height: 1.35;
    color: #2d3748;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sws-m-card__title strong { font-weight: 700; }
.sws-theme-dark .sws-m-card__title { color: rgba(255,255,255,.8); }

.sws-m-card__sku { font-size: 12px; color: #94a3b8; }
.sws-theme-dark .sws-m-card__sku { color: rgba(255,255,255,.3); }

.sws-m-card__price { font-size: 14px; font-weight: 700; color: #1a1a2e; margin-top: 2px; }
.sws-m-card__price del { font-weight: 400; color: #a0aec0; font-size: 11px; }
.sws-m-card__price ins { text-decoration: none; }
.sws-theme-dark .sws-m-card__price { color: var(--sws-accent); }

.sws-m-card__out { font-size: 11px; font-weight: 600; color: #e53e3e; margin-top: 2px; }

/* Кнопка «все результаты» */
.sws-m-footer {
    display: block;
    margin: 14px 12px 0;
    padding: 13px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--sws-accent);
    background: rgba(0,0,0,.02);
    border: 1.5px solid #eef0f4;
    border-radius: 12px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.sws-m-footer:active { background: rgba(58,134,202,.08); }
.sws-theme-dark .sws-m-footer { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.08); }

/* Пустые состояния */
.sws-mobile-results .sws-no-results,
.sws-mobile-results .sws-empty-hint {
    padding: 40px 16px;
    text-align: center;
    color: #a0aec0;
    font-size: 14px;
}

/* История в мобильном overlay */
.sws-mobile-results .sws-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 12px 16px 6px;
    color: #b0b8c8;
}
.sws-theme-dark .sws-mobile-results .sws-section-title { color: rgba(255,255,255,.22); }

.sws-mobile-results .sws-suggestion,
.sws-mobile-results .sws-category {
    padding: 12px 16px;
}

/* ═══════════════════════════════════════════════════════════════
   ПУСТАЯ ВЫДАЧА — ПОДСКАЗКИ (исправление, категории, WhatsApp)
   ═══════════════════════════════════════════════════════════════ */

.sws-no-results-block {
    padding: 24px 20px;
    text-align: center;
}

.sws-no-results-head {
    margin-bottom: 16px;
}

.sws-no-results-icon {
    color: #cbd5e1;
    margin-bottom: 8px;
}

.sws-no-results-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.sws-no-results-sub {
    font-size: 13px;
    color: #64748b;
}

.sws-no-results-correction {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 18px;
    flex-wrap: wrap;
    justify-content: center;
}

.sws-correction-link {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
    transition: opacity .12s ease;
}
.sws-correction-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}
.sws-correction-count {
    color: #64748b;
    font-weight: 400;
    font-size: 12px;
}

.sws-no-results-cats-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
    text-align: left;
    padding: 0 4px;
}

.sws-no-results-cats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.sws-no-results-cat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #1e293b;
    text-decoration: none;
    font-size: 13px;
    text-align: left;
    transition: all .15s ease;
}
.sws-no-results-cat:hover {
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(59,130,246,.1);
    transform: translateY(-1px);
}

.sws-no-results-cat .sws-category__icon {
    color: #64748b;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.sws-no-results-cat-name {
    flex: 1;
    font-weight: 500;
}

.sws-no-results-cat-count {
    background: #e2e8f0;
    color: #64748b;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.sws-no-results-msgrs-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin: 4px 0 8px;
    text-align: center;
}

.sws-no-results-msgrs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.sws-msgr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
    line-height: 1;
}

.sws-msgr-btn:hover {
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
    opacity: .92;
}

/* Цвета фирменного бренда у каждого мессенджера */
.sws-msgr-whatsapp { background: #25D366; box-shadow: 0 1px 4px rgba(37,211,102,.25); }
.sws-msgr-whatsapp:hover { box-shadow: 0 3px 10px rgba(37,211,102,.32); }

.sws-msgr-telegram { background: #229ED9; box-shadow: 0 1px 4px rgba(34,158,217,.25); }
.sws-msgr-telegram:hover { box-shadow: 0 3px 10px rgba(34,158,217,.32); }

/* MAX — фиолетовый фон с белой иконкой, в одном стиле с WhatsApp/Telegram */
.sws-msgr-max {
    background: #7c3aed; /* фирменный фиолетовый MAX */
    color: #fff;
    box-shadow: 0 1px 4px rgba(124,58,237,.25);
}
.sws-msgr-max:hover {
    color: #fff;
    box-shadow: 0 3px 10px rgba(124,58,237,.32);
}

/* Мобильная версия */
.sws-mobile-results .sws-no-results-block {
    padding: 28px 16px 24px;
    /* Отступ сверху: на мобильном блок «Не нашли? Спросите у нас» с
       кнопками мессенджеров шёл вплотную к кнопке «Посмотреть все
       результаты» (.sws-footer) — визуально слипались. Отделяем. */
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,.06);
}

.sws-mobile-results .sws-no-results-cats {
    grid-template-columns: 1fr;
    gap: 6px;
}

/* Тёмная тема */
.sws-theme-dark .sws-no-results-title { color: rgba(255,255,255,.9); }
.sws-theme-dark .sws-no-results-sub { color: rgba(255,255,255,.6); }
.sws-theme-dark .sws-no-results-correction {
    background: rgba(59,130,246,.1);
    border-color: rgba(59,130,246,.3);
    color: rgba(255,255,255,.9);
}
.sws-theme-dark .sws-correction-link { color: #60a5fa; }
.sws-theme-dark .sws-no-results-cat {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.1);
    color: rgba(255,255,255,.85);
}
.sws-theme-dark .sws-no-results-cat:hover {
    background: rgba(255,255,255,.08);
    border-color: rgba(96,165,250,.5);
}
.sws-theme-dark .sws-no-results-cat-count {
    background: rgba(255,255,255,.1);
    color: rgba(255,255,255,.6);
}

/* ═══════════════════════════════════════════════════════════════
   КНОПКИ МЕССЕНДЖЕРОВ ПОД ТОВАРАМИ (inline)
   ═══════════════════════════════════════════════════════════════ */
.sws-inline-msgrs-wrap {
    margin-top: 12px;
    padding: 12px 14px 14px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
    border-radius: 0 0 10px 10px;
}
.sws-inline-msgrs-wrap .sws-no-results-msgrs-title {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 8px;
    text-align: center;
}
.sws-theme-dark .sws-inline-msgrs-wrap {
    background: rgba(255,255,255,.04);
    border-top-color: rgba(255,255,255,.08);
}
.sws-mobile-results .sws-inline-msgrs-wrap {
    border-radius: 0;
    /* margin-top сохраняем (отрыв от кнопки «Посмотреть все результаты»),
       по бокам растягиваем на всю ширину панели (-16px компенсирует
       padding контейнера результатов). Раньше тут было margin:0 -16px 0 —
       обнулял верхний отступ и блок слипался с кнопкой. */
    margin: 16px -16px 0;
}

/* ═══════════════════════════════════════════════════════════════
   НЕДАВНО ПРОСМОТРЕННЫЕ ТОВАРЫ
   ═══════════════════════════════════════════════════════════════ */
/* Карточки recently viewed выглядят как обычные товарные, но с очень
   легким акцентом — лёгкий бордер чтобы юзер визуально понимал
   что это «другой» список (не текущая выдача поиска). */
.sws-card--recent {
    position: relative;
}
.sws-card--recent::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}
