/* ============================================================
   iStore — categoryFilterPage.css  (каталог: фильтры + товары)
   Карточки — из product-card.css (глобально). Зависит от theme.css.
   ============================================================ */

.cf-crumb { width: 100%; max-width: 1280px; margin: 0 auto; padding: 18px 24px 0; font-size: 12px; color: var(--muted); }
.cf-crumb a { color: inherit; text-decoration: none; }
.cf-crumb a:hover { color: var(--text); }
.cf-crumb .sep { padding: 0 6px; }

.cf-layout {
    width: 100%; max-width: 1280px; margin: 0 auto; padding: 20px 24px 72px;
    display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start;
}

/* ---------- sidebar ---------- */
.cf-sidebar { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 112px; /* JS уточнит по высоте навигации */ }
.cf-filter { display: flex; flex-direction: column; gap: 12px; }
.cf-filter__title {
    display: flex; align-items: center; gap: 8px; width: 100%;
    font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 0 0 0 10px; border: 0; border-left: 3px solid var(--accent);
    background: none; color: var(--text); cursor: pointer; text-align: left;
}
.cf-filter__name { flex: 1; }
.cf-filter__count {
    font-size: 11px; font-weight: 700; letter-spacing: 0;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 980px;
    background: var(--accent); color: var(--accent-text);
    display: inline-flex; align-items: center; justify-content: center;
}
.cf-filter__count[hidden] { display: none; }
.cf-filter__caret { flex: none; color: var(--muted); transition: transform .2s; }
.cf-filter.is-collapsed .cf-filter__caret { transform: rotate(-90deg); }

.cf-filter__values {
    display: flex; flex-direction: column; gap: 10px;
    overflow: hidden; transition: max-height .25s ease, opacity .2s, margin .2s;
    max-height: 500px; opacity: 1;
}
.cf-filter.is-collapsed .cf-filter__values { max-height: 0; opacity: 0; margin-top: -12px; }
.cf-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.cf-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: none; }
.cf-check__label { color: var(--text); }
.cf-swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); flex: none; }

/* ---------- мобильный drawer фильтров (кнопка/заголовок скрыты на десктопе) ---------- */
.cf-filters-btn { display: none; }
.cf-sidebar__head { display: none; }
.cf-backdrop { display: none; }


/* ---------- content ---------- */
.cf-content { min-width: 0; }
.cf-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding-bottom: 20px; flex-wrap: wrap;
}
/* переключатель grid/list, сортировка, .cf-products(--grid/--list),
   .cf-cell, .cat-empty, прелоадер и responsive-колонки — в catalog-grid.css (глобально) */
.cf-controls { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.cf-available { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.cf-available input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* плавающая кнопка фильтров и apply — по умолчанию скрыты (десктоп), показываются в мобильном медиа ниже */
.cf-fab { display: none; }
.cf-sidebar__apply { display: none; }

@media (max-width: 860px) {
    .cf-layout { grid-template-columns: 1fr; }

    /* кнопку в топбаре прячем — используем плавающую */
    .cf-filters-btn { display: none; }

    /* плавающая кнопка "Фильтры" снизу по центру — всегда видна */
    .cf-fab {
        display: inline-flex; align-items: center; gap: 8px;
        position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
        z-index: 50;
        height: 44px; padding: 0 22px; border: 0; border-radius: 980px;
        background: var(--accent); color: var(--accent-text);
        font-size: 14px; font-weight: 600; cursor: pointer;
        box-shadow: 0 4px 16px rgba(0,0,0,.25);
    }
    .cf-fab__count {
        min-width: 20px; height: 20px; padding: 0 6px; border-radius: 980px;
        background: var(--accent-text); color: var(--accent);
        font-size: 11px; font-weight: 700;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .cf-fab__count[hidden] { display: none; }

    /* сайдбар → панель слева, ПОВЕРХ всего (включая меню) */
    .cf-sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 9999;
        width: 320px; max-width: 90vw;
        margin: 0; padding: 0 20px 24px;
        background: var(--surface);
        flex-direction: column; gap: 24px;
        overflow-y: auto;
        transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: 2px 0 24px rgba(0,0,0,.2);
    }
    .cf-sidebar.is-open { transform: translateX(0); }

    .cf-sidebar__head {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; background: var(--surface); z-index: 1;
        padding: 18px 0 14px; margin-bottom: 4px;
        font-size: 17px; font-weight: 600;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    }
    .cf-sidebar__close { border: 0; background: none; font-size: 30px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }

    /* низ панели — кнопка "Показать" (применить и закрыть) */
    .cf-sidebar__apply {
        position: sticky; bottom: 0; margin-top: auto;
        padding: 14px; border: 0; border-radius: 980px;
        background: var(--accent); color: var(--accent-text);
        font-size: 15px; font-weight: 600; cursor: pointer;
    }

    .cf-backdrop {
        display: block; position: fixed; inset: 0; z-index: 9998;
        background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    .cf-backdrop.is-open { opacity: 1; pointer-events: auto; }

    /* блокировка скролла фона при открытом drawer */
    body.cf-noscroll { overflow: hidden; }
}
@media (max-width: 560px) {
    .cf-layout { padding: 16px 16px 48px; }
}

/* заголовок категории (h1) */
.cf-title { width: 100%; max-width: 1280px; margin: 0 auto; padding: 10px 24px 6px; font-size: clamp(26px, 3.2vw, 38px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
@media (max-width: 560px) { .cf-title { padding: 8px 16px 0; } }
