.brand-item.collapsed {
    display: none;
}

.brand-item {
    display: flex;             /* включаем flex-контейнер */
    align-items: center;       /* выравниваем по вертикали */
    gap: 6px;                  /* расстояние между элементами */
    padding: 4px 6px;
}

.brand-item img {
    width: 27px;           /* фиксированный размер для компактного вида */
    height: 27px;
    object-fit: contain;   /* сохраняет пропорции, не обрезая изображение */
    display: inline-block;
    margin-left: 4px;
}
.colors-toggle-link,
.brand-toggle-link {
    display: inline-block;
    margin-top: 8px;
    color: #5159FE !important;
}

.colors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.colors-list.open {
    max-height: fit-content !important;
}

.color-chip {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.color-chip span {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: block;
}

.color-chip input {
    display: none;
}

.color-chip input:checked+span {
    outline: 3px solid #5159FE;
    outline-offset: 2px;
}

/* Значок «снять»: понятно, что выбранный цвет можно отжать повторным нажатием */
.color-chip:has(input:checked)::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(41, 35, 31, 0.1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath stroke='%235159FE' stroke-linecap='round' stroke-width='1.4' d='M3 3l6 6M9 3L3 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 9px 9px;
    pointer-events: none;
    z-index: 1;
}

.brand-list {
    max-height: 300px !important;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.catalog-sidebar {
    padding: 0;
    border-radius: 8px;
    background-color: white;
    display: flex;
    flex-direction: column;
    gap: 0px;
    width: 0px;
    min-width: 0px;
    /* opacity: 0; */
    user-select: none;
    pointer-events: none;
    position: relative;
    height: fit-content;

    transition: all 0.3s, opacity 0.1s;
}
.catalog-sidebar * {
    opacity: 0;
    transition: opacity 0.3s easE;
}

.catalog-sidebar.open {
    width: 325px;
    min-width: 325px;
    opacity: 1;
    user-select: auto;
    pointer-events: all;
}
.catalog-sidebar.open * {
    opacity: 1;
}

.catalog-sidebar-filter {
    padding: 14px;
    border-bottom: 1px solid #F2F2F2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 325px;
    scrollbar-width: thin;
}

.catalog-sidebar-filter.horizontal {
    flex-direction: row;
    justify-content: space-between;
}

.catalog-sidebar-filter-name {
    font-size: 14px;
    line-height: 126%;
    color: #29231F;
    font-weight: 500;
}

.sidebar-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-choices-inputs {
    display: flex;
    gap: 4px;
}

.sidebar-choices-inputs input {
    border-radius: 6px;
    border: 1px solid #F0F0F0;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 120%;
    width: calc((100% - 4px) / 2);
}

/* Тумблер */
.switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Ползунок */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #F6F6F6;
    border-radius: 34px;
    transition: 0.3s;
}

/* Круг внутри */
.slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #E8E8E8;
    border-radius: 50%;
    transition: 0.3s;
}

/* Активное состояние */
.switch input:checked+.slider {
    background-color: #E51F2C;
}

.switch input:checked+.slider::before {
    transform: translateX(14px);
}

.filter-block {
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}





.filter-block {
    border-bottom: 1px solid #F2F2F2;
    display: flex;
    flex-direction: column;
}

.filter-toggle {
    background: none;
    border: none;
    font-size: 14px;
    line-height: 126%;
    color: #29231F;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.filter-toggle::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    background-image: url(/static/images/dropdown-icon.svg);
    transform: translateY(-50%);
    transition: transform 0.2s ease;
    width: 12px;
    height: 12px;
    background-repeat: no-repeat;
}

.filter-toggle.active::after {
    transform: translateY(-50%) rotate(180deg);
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;

    scrollbar-width: thin;
    scrollbar-gutter: stable;
    scrollbar-color: #E4E4E4 #F6F6F6;
}

.filter-content.open {
    max-height: 124px;
    /* padding-bottom: 10px; */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.check-item {
    display: flex;
    align-items: center;
    width: max-content;
    gap: 10px;
    font-size: 16px;
    color: var(--color-gray-dark);
    cursor: pointer;
}
.check-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 4px; 
    border: 1px solid #E8E8E8;
    background: #F6F6F6;
    display: inline-block;
    position: relative;
    transition: all .15s ease;
}
.check-item input[type="checkbox"]:checked {
    background: var(--color-red); 
    border-color: var(--color-red);
    background-image: url("/static/images/white-mark.svg");
    background-position: center;
    background-repeat: no-repeat;
}

.filter-content label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    line-height: 120%;
    color: #29231F;
    cursor: pointer;
    padding: 2px 0;
}

.filter-content input[type="checkbox"],
.filter-content input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #E51F2C;
    cursor: pointer;
}

.open-sidebar-button {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: fit-content;
    cursor: pointer;

    position: absolute;
    z-index: 0;

    transition: all 0.2s ease;
}

.open-sidebar-button.invisible {
    /* opacity: 0; */
    user-select: none;
    pointer-events: none;
}

.open-sidebar-button .open-sidebar-button-red img {
    transition: all 0.3s ease;
}

.open-sidebar-button:hover .open-sidebar-button-red img {
    rotate: -90deg;
}

.open-sidebar-button-red {
    background-color: var(--color-red);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    width: 56px;
    height: 56px;
}

.open-sidebar-button p {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-red);
    text-align: center;
    text-transform: uppercase;
}

.close-sidebar-button {
    position: absolute;
    right: 10px;
    top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    cursor: pointer;

    transition: opacity 0.1s ease-out;
}

.catalog-sidebar .close-sidebar-button {
    opacity: 0;
    transition: all 0.3s ease;
}

.catalog-sidebar.open .close-sidebar-button {
    opacity: 1;
}
.catalog-sidebar .close-sidebar-button img {
    transition: scale 0.2s ease;
}

#filters-apply {
    padding: 12px 24px;
    border-radius: 6px;
    background-color: var(--color-red);
    color: white;
    font-weight: 500;
}

#filters-reset {
    padding: 12px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.category-link {
    display: block;
    padding: 4px 6px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
    border-radius: 4px;
}
.parent-category {
    background-image: url("/static/images/parent-category-icon.svg");
    background-repeat: no-repeat;
    padding-left: 16px;
    background-position: left center;
}
.usual-category {
    padding-left: 17px;
}

.category-link:hover {
    /* border-bottom-color: var(--text-color); */
    background-color: #F6F6F6;
}

.category-link.active {
    color: #9569F0;
    font-weight: 500;
}
.category-link.parent-category.current {
    color: #9569F0;
    font-weight: 500;
}


.category-link.collapsed {
    display: none;
}

.categories-toggle-link {
    display: inline-block;
    margin-top: 8px;
    color: #5159FE !important;
}

.cart-panel-delete-button {
    display: flex;
}
.cart-panel-delete-button img {
    min-width: 12px
}
#search-category,
#search-brand {
    padding: 6px 6px 6px 26px;
    background-color: #F6F6F6;
    font-size: 12px;
    color: var(--color-gray-dark);
    background-image: url('/static/images/search-product.svg');
    background-position: left 6px center;
    background-repeat: no-repeat;
    border-radius: 8px;
    background-size: 16px;
}

@media (max-width: 990px) {
    /* Скрываем десктопный сайдбар и кнопку */
    .sidebar-and-cards > .catalog-sidebar:not(.mobile-filters-content .catalog-sidebar) {
        display: none;
    }
    .open-sidebar-button {
        display: none;
    }
    .catalog-section {
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 20px;
    }
    
    /* Убираем margin-left на мобильных */
    .cards-container.margin-left {
        margin-left: 0;
    }

    .check-item input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
}