/* ========================================
   FILTERS SIDEBAR — MODERN 2025
   ======================================== */

/* -------- Обёртка сайдбара -------- */
.filters-sidebar {
    width: 280px;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* -------- Кнопка показа фильтров (моб.) -------- */
.filters-toggle {
    display: none;
    width: 100%;
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover, #e67a2e) 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.92rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(255, 140, 66, 0.25);
}

.filters-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 140, 66, 0.35);
}

.filters-toggle:active {
    transform: translateY(0);
}

/* -------- Блок фильтра -------- */
.filter-block {
    background: var(--white, #fff);
    border-radius: 14px;
    border: 1px solid var(--gray-200, #e5e7eb);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    animation: filterFadeIn 0.3s ease;
}

.filter-block:hover {
    border-color: var(--gray-300, #d1d5db);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

/* -------- Заголовок блока -------- */
.filter-header {
    padding: 14px 16px;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--primary, #1f2937);
    transition: background 0.2s ease, color 0.2s ease;
    user-select: none;
    border-left: 3px solid transparent;
}

.filter-header:hover {
    background: var(--gray-100, #f3f4f6);
}

.filter-header i {
    transition: transform 0.3s ease;
    color: var(--accent, #ff8c42);
    font-size: 0.78rem;
}

.filter-header.collapsed i {
    transform: rotate(-90deg);
}

.filter-header.has-active {
    color: var(--accent, #ff8c42);
    border-left-color: var(--accent, #ff8c42);
    background: rgba(255, 140, 66, 0.04);
}

/* -------- Тело блока -------- */
.filter-body {
    padding: 4px 16px 16px;
    background: transparent;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.filter-body.collapsed {
    display: none;
}

/* -------- Категории -------- */
.filter-categories {
    list-style: none;
    margin: 0;
    padding: 0;
}

.filter-categories li + li {
    margin-top: 4px;
}

.filter-categories a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    color: var(--text-dark, #374151);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease, padding 0.2s ease;
}

.filter-categories a:hover {
    color: var(--accent, #ff8c42);
    background: rgba(255, 140, 66, 0.06);
    padding-left: 14px;
}

.filter-categories a.active {
    color: var(--accent, #ff8c42);
    font-weight: 600;
    background: rgba(255, 140, 66, 0.1);
    padding-left: 14px;
}

.filter-categories .count {
    color: var(--text-light, #9ca3af);
    font-size: 0.72rem;
    background: var(--gray-100, #f3f4f6);
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.filter-categories a:hover .count,
.filter-categories a.active .count {
    background: rgba(255, 140, 66, 0.15);
    color: var(--accent, #ff8c42);
}

/* -------- Диапазон цен -------- */
.price-range {
    width: 100%;
}

.price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.price-input label {
    font-size: 0.7rem;
    color: var(--text-light, #9ca3af);
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.price-input input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--white, #fff);
    box-sizing: border-box;
}

.price-input input:hover {
    border-color: var(--gray-400, #9ca3af);
}

.price-input input:focus {
    outline: none;
    border-color: var(--accent, #ff8c42);
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.12);
}

/* -------- Переключатель «В наличии» -------- */
.filter-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 0;
    font-size: 0.85rem;
    user-select: none;
}

.filter-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-switch-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--gray-300, #d1d5db);
    border-radius: 22px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.filter-switch-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.filter-switch input:checked + .filter-switch-slider {
    background: var(--accent, #ff8c42);
}

.filter-switch input:checked + .filter-switch-slider::before {
    transform: translateX(18px);
}

.filter-switch input:focus-visible + .filter-switch-slider {
    box-shadow: 0 0 0 3px rgba(255, 140, 66, 0.25);
}

.filter-switch-label {
    color: var(--text-dark, #374151);
    transition: color 0.2s ease;
    line-height: 1.3;
}

.filter-switch:hover .filter-switch-label {
    color: var(--accent, #ff8c42);
}

/* -------- Кнопки действий -------- */
.filter-actions {
    padding: 14px 16px;
    border-top: 1px solid var(--gray-200, #e5e7eb);
    display: flex;
    gap: 10px;
    background: var(--white, #fff);
    border-radius: 14px;
    border: 1px solid var(--gray-200, #e5e7eb);
}

.btn-filter,
.btn-reset {
    flex: 1;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
    text-align: center;
    border: 1px solid transparent;
}

.btn-filter {
    background: var(--accent, #ff8c42);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 140, 66, 0.25);
}

.btn-filter:hover {
    background: var(--accent-hover, #e67a2e);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 140, 66, 0.35);
}

.btn-filter:active {
    transform: translateY(0);
}

.btn-reset {
    background: var(--white, #fff);
    color: var(--text-dark, #374151);
    border-color: var(--gray-300, #d1d5db);
}

.btn-reset:hover {
    background: var(--gray-100, #f3f4f6);
    border-color: var(--gray-400, #9ca3af);
}

/* -------- Счётчик активных фильтров -------- */
.active-filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 7px;
    margin-left: 4px;
}

/* -------- Контейнер каталога с фильтрами -------- */
.catalog-with-filters {
    display: flex;
    gap: 28px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    align-items: flex-start;
}

.catalog-content {
    flex: 1;
    min-width: 0;
}

/* ========================================
   ДЕСКТОП (>= 993px)
   ======================================== */
@media (min-width: 993px) {
    .filters-sidebar {
        position: sticky;
        top: 130px;
        align-self: flex-start;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        width: 280px;
        padding-right: 4px;
    }

    .filters-sidebar::-webkit-scrollbar {
        width: 4px;
    }

    .filters-sidebar::-webkit-scrollbar-track {
        background: transparent;
    }

    .filters-sidebar::-webkit-scrollbar-thumb {
        background: var(--gray-300, #d1d5db);
        border-radius: 4px;
    }

    .filters-sidebar::-webkit-scrollbar-thumb:hover {
        background: var(--accent, #ff8c42);
    }

    /* Sticky-кнопки внизу панели */
    .filter-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
    }
}

/* ========================================
   ПЛАНШЕТЫ / МОБИЛЬНЫЕ (<= 992px)
   ======================================== */
@media (max-width: 992px) {
    .catalog-with-filters {
        flex-direction: column;
        gap: 20px;
    }

    .filters-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        width: 100%;
    }

    .filters-toggle {
        display: flex;
    }

    .filters-sidebar.collapsed .filters-form {
        display: none;
    }
}

/* ========================================
   МОБИЛЬНЫЕ (<= 576px)
   ======================================== */
@media (max-width: 576px) {
    .filter-header {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .filter-body {
        padding: 4px 14px 14px;
    }

    .filter-actions {
        padding: 12px 14px;
    }

    .btn-filter,
    .btn-reset {
        font-size: 0.82rem;
        padding: 10px 12px;
    }
}

/* ========================================
   АНИМАЦИЯ
   ======================================== */
@keyframes filterFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}