/* catalog.css — страница категории: хлебные крошки, раскладка «фильтры + сетка»,
   фильтры (noUiSlider/чекбоксы/цвета/счётчики/disabled), чипсы активных фильтров,
   тулбар, пагинация и «показать ещё». Подключается только на категории. */

/* ── Хлебные крошки ── */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 16px 0;
    font-size: 13px;
    color: var(--muted);
}
.breadcrumbs__item { color: var(--muted); transition: color 0.15s ease; }
.breadcrumbs__item:hover { color: var(--primary); }
.breadcrumbs__item.is-current { color: var(--ink); font-weight: 600; }
.breadcrumbs__sep { font-size: 10px; color: var(--muted); opacity: 0.6; }

/* ── Шапка категории ── */
.cat-head { display: flex; align-items: baseline; gap: 14px; margin: 6px 0 4px; }
.cat-head__title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.cat-head__count { font-size: 14px; color: var(--muted); }
.cat-head__desc { margin: 8px 0 4px; color: var(--ink-2, #333); line-height: 1.6; max-width: 900px; }

/* ── Раскладка ── */
.catalog {
    display: grid;
    grid-template-columns: 272px 1fr;
    gap: 28px;
    align-items: start;
    margin: 22px 0 40px;
}
.catalog__main { min-width: 0; }
.catalog__main.is-loading { opacity: 0.55; pointer-events: none; transition: opacity 0.15s ease; }

/* ── Сайдбар фильтров ── */
.catalog__side {
    position: sticky;
    top: 16px;
    align-self: start;
}
.filters {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 6px 18px 18px;
}
.filters__head { display: none; align-items: center; justify-content: space-between; padding: 12px 0; }
.filters__title { font-size: 17px; font-weight: 700; }
.filters__close { border: none; background: none; font-size: 20px; color: var(--ink); cursor: pointer; }

.filter-group { padding: 16px 0; border-bottom: 1px solid var(--line); }
.filter-group:last-of-type { border-bottom: none; }
.filter-group__title { font-size: 14px; font-weight: 700; margin-bottom: 12px; }

/* Цена + noUiSlider */
.filter-price__slider { margin: 6px 6px 18px; }
.filter-price__inputs { display: flex; align-items: center; gap: 8px; }
.filter-price__input {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
}
.filter-price__input:focus { outline: none; border-color: var(--primary); }
.filter-price__dash { color: var(--muted); }

/* Тема noUiSlider */
.filter-price__slider.noUi-target { height: 5px; border: none; background: var(--surface-2); box-shadow: none; }
.filter-price__slider .noUi-connect { background: var(--primary); }
.filter-price__slider .noUi-handle {
    width: 16px;
    height: 16px;
    right: -8px;
    top: -6px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: grab;
}
.filter-price__slider .noUi-handle::before,
.filter-price__slider .noUi-handle::after { display: none; }
.filter-price__slider .noUi-handle:active { cursor: grabbing; }

/* Чекбоксы */
.filter-values { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
.filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 2px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ink);
}
.filter-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-check__box {
    flex: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--line);
    border-radius: 5px;
    position: relative;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.filter-check input:checked + .filter-check__box {
    background: var(--primary);
    border-color: var(--primary);
}
.filter-check input:checked + .filter-check__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.filter-check input:focus-visible + .filter-check__box { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25); }

/* Радио (склады — одиночный выбор) */
.filter-check__box--radio { border-radius: 50%; }
.filter-check input:checked + .filter-check__box--radio { background: #fff; border-color: var(--primary); }
.filter-check input:checked + .filter-check__box--radio::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    transform: translate(-50%, -50%) rotate(0);
}
.filter-check__label { flex: 1; }
.filter-check__cnt { font-size: 12px; color: var(--muted); }
.filter-check:hover .filter-check__label { color: var(--primary); }

/* Деактивированное значение */
.filter-check.is-disabled { opacity: 0.4; cursor: not-allowed; }
.filter-check.is-disabled:hover .filter-check__label { color: var(--ink); }

/* Цветовые свотчи */
.filter-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-color { position: relative; cursor: pointer; line-height: 0; }
.filter-color input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-color__dot {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.filter-color:hover .filter-color__dot { transform: scale(1.08); }
.filter-color.is-active .filter-color__dot { box-shadow: 0 0 0 2px var(--primary); }
.filter-color.is-disabled { opacity: 0.35; cursor: not-allowed; }

.filters__actions { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.filters__apply {
    padding: 11px;
    border: none;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}
.filters__apply:hover { background: var(--primary-600); }
.filters__reset { font-size: 13px; color: var(--muted); text-align: center; transition: color 0.15s ease; }
.filters__reset:hover { color: var(--danger); }

/* ── Активные фильтры (чипсы) ── */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.chip:hover { background: var(--danger); color: #fff; }
.chip i { font-size: 11px; opacity: 0.7; }
.active-filters__clear { font-size: 13px; color: var(--primary); font-weight: 600; margin-left: 4px; }

/* ── Тулбар ── */
.cat-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.cat-toolbar__total { font-size: 14px; color: var(--muted); }
.cat-toolbar__total b { color: var(--ink); }
.cat-toolbar__filters-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.cat-sort { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cat-sort__label { font-size: 13px; color: var(--muted); }
.cat-sort__select {
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%239ca3af' d='M6 8L2 4h8z'/></svg>") no-repeat right 12px center;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    cursor: pointer;
    appearance: none;
}
.cat-sort__select:focus { outline: none; border-color: var(--primary); }

/* ── Пустой результат ── */
.catalog-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.catalog-empty i { font-size: 48px; opacity: 0.5; }
.catalog-empty p { margin: 16px 0; font-size: 16px; }
.btn-reset {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

/* ── Пагинация ── */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.page {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.page:hover { border-color: var(--primary); color: var(--primary); }
.page.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page--gap { border: none; background: none; color: var(--muted); }

/* ── «Показать ещё» ── */
.catalog-more { text-align: center; margin-top: 30px; }
.btn-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 30px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-more:hover { border-color: var(--primary); color: var(--primary); }
.btn-more__spin { display: none; }
.btn-more.is-loading .btn-more__spin { display: inline-block; animation: cx-spin 0.7s linear infinite; }
.btn-more.is-loading .btn-more__label { opacity: 0.6; }
.catalog-more__hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* ── Мобильный сайдбар фильтров ── */
@media (max-width: 900px) {
    .catalog { grid-template-columns: 1fr; }
    .cat-toolbar__filters-btn { display: inline-flex; }
    .filters__head { display: flex; }

    .catalog__side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 1000;
        width: min(360px, 88vw);
        overflow: auto;
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
    }
    .is-filters-open .catalog__side { transform: translateX(0); }
    .filters { border: none; border-radius: 0; }
    .is-filters-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(15, 23, 42, 0.4);
    }
}

/* ── SEO-фильтр: ссылки фасетов на подборки + блок «похожие» ── */
.filter-link {
    margin-left: auto;
    color: var(--muted, #94a3b8);
    opacity: 0;
    transition: opacity .15s, color .15s;
    padding: 0 2px;
    font-size: 0.72rem;
}
.filter-check:hover .filter-link { opacity: 1; }
.filter-link:hover { color: var(--primary, #4f46e5); }
.cat-related { margin-top: 2rem; }
.cat-related__title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.75rem; }
.cat-related__list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-related__link {
    display: inline-block; padding: 0.35rem 0.8rem; border-radius: 999px;
    background: var(--panel-inset, #f1f5f9); color: var(--text, #1f2937);
    font-size: 0.85rem; text-decoration: none; transition: background .15s;
}
.cat-related__link:hover { background: var(--primary, #4f46e5); color: #fff; }
.cat-seo-text { margin-top: 2rem; color: var(--muted, #64748b); font-size: 0.9rem; line-height: 1.6; }
