.catalog--filter-layout,
.catalog--filter-layout .catalog__main,
.catalog--filter-layout .catalog__aside {
    min-width: 0;
}
.catalog--filter-layout [data-facet-limit][hidden] {
    display: none !important;
}
.catalog-facets-shell,
.catalog-facets-shell *,
.catalog-facets-shell *::before,
.catalog-facets-shell *::after { box-sizing: border-box; }
/* Reference: lanmaster.com copper cable filters. Keep the dynamic data separate. */
.catalog-facets-shell {
    position: relative;
    min-width: 0;
    margin-block-end: 20px;
}
.catalog-facets {
    min-width: 0;
    scroll-margin-block-start: 90px;
}
.catalog-facets summary {
    display: flex;
    align-items: center;
    cursor: pointer;
    list-style: none;
}
.catalog-facets summary::-webkit-details-marker {
    display: none;
}
.catalog-facets > summary {
    width: max-content;
    min-height: 40px;
    gap: 8px;
}
.catalog-facets__name {
    color: #55483b;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.catalog-facets__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    color: var(--ui-orange-1);
    background: #fff;
    border-radius: 50%;
}
.catalog-facets__icon svg { width: 15px; height: 15px; }
.catalog-facets__chevron { flex: 0 0 auto; color: var(--ui-orange-1); }
.catalog-facets[open] > summary .catalog-facets__chevron { transform: rotate(180deg); }
.catalog-facets[open] > summary .catalog-facets__name { color: var(--ui-orange-1); }
.catalog-facets[open] > summary .catalog-facets__icon { background: var(--ui-orange-1); color: #fff; }
.catalog-facets__content { margin-block-start: 16px; }
.catalog-facets__group {
    background: #fff;
    border-block-start: 1px solid #d9d9d9;
}
.catalog-facets__group:first-of-type { border-block-start: 0; }
.catalog-facets__group > summary {
    gap: 10px;
    min-height: 40px;
    padding: 8px 8px 8px 10px;
    color: #464646;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}
.catalog-facets__group > summary::before {
    content: '';
    width: 6px;
    height: 3px;
    flex: 0 0 6px;
    background: var(--ui-orange-1);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform: rotate(-90deg);
}
.catalog-facets__group[open] > summary { color: var(--ui-orange-2); }
.catalog-facets__group[open] > summary::before { transform: none; }
.catalog-facets__options {
    display: flex;
    flex-direction: column;
    gap: 11px;
    max-height: 180px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 5px 25px 16px;
}
.catalog-facets__option {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    flex: 0 0 auto;
    min-height: 25px;
    margin: 0;
    color: #464646;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.catalog-facets__option input {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid var(--ui-orange-1);
    border-radius: 0;
    background: #fff;
    padding: 0;
    margin: 2px 0 0;
    cursor: inherit;
}
.catalog-facets__option input:checked {
    background: var(--ui-orange-1) url('../img/check.svg') center / contain no-repeat;
}
.catalog-facets__option:has(:disabled) { color: #a4a4a4; cursor: default; }
.catalog-facets__option input:disabled { border-color: #a4a4a4; }
.catalog-facets__count {
    position: relative;
    display: inline-block;
    margin: 3px 0 0 6px;
    padding: 1px 2px;
    border: 1px solid var(--ui-orange-1);
    border-inline-start-color: transparent;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.catalog-facets__count::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    width: 12px;
    height: 12px;
    border: 1px solid var(--ui-orange-1);
    border-top-color: transparent;
    border-right-color: transparent;
    transform: translateY(-50%) rotate(45deg);
}
.catalog-facets__remove {
    position: relative;
    display: block;
    width: 16px;
    height: 16px;
    margin: 2px 0 0 6px;
    justify-self: end;
    color: #e85b5b;
}
.catalog-facets__reset {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: #f00;
    font-size: 14px;
    text-decoration: none !important;
    border: 0 !important;
    box-shadow: none !important;
    transition: color .15s ease-in-out;
}
.catalog-facets__reset:hover { color: #c00; }
.catalog-facets__reset-icon { position: relative; display: block; width: 16px; height: 16px; }
.catalog-facets__remove::before,
.catalog-facets__remove::after,
.catalog-facets__reset-icon::before,
.catalog-facets__reset-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}
.catalog-facets__remove::after,
.catalog-facets__reset-icon::after { transform: translate(-50%, -50%) rotate(-45deg); }
.catalog-facets__remove::before,
.catalog-facets__remove::after { width: 14px; }
.catalog-facets summary:focus-visible,
.catalog-facets a:focus-visible,
.catalog-facets input:focus-visible { outline: 2px solid var(--ui-orange-2); outline-offset: 3px; }
.catalog-facets__tools { display: none; }
@media (min-width: 1200px) {
    .catalog-facets__icon { width: 40px; height: 40px; }
    .catalog-facets__icon svg { width: 22px; height: 22px; }
    .catalog-facets__name { font-size: 14px; }
}
@media (min-width: 1400px) {
    .catalog-facets__group > summary { font-size: 18px; }
}
@media (max-width: 991.98px) {
    .catalog--filter-layout .catalog__aside { margin-block-end: 0; }
    .catalog-facets-shell { margin-block: 20px 0; }
    .catalog-facets__tools {
        display: flex;
        position: absolute;
        top: 0;
        right: 0;
        min-height: 40px;
        align-items: center;
    }
    .catalog-facets__reset { right: auto; left: 142px; }
    .catalog--filter-layout.catalog--controls .catalog__menu .catalog-menu__toolbar {
        display: flex;
        margin: 0;
    }
    html[lang] .catalog--filter-layout .catalog-menu__toolbar .catalog-mobile-limit-control { margin-left: auto; }
    .catalog-facets__tools .catalog-menu__view { display: flex !important; gap: 18px; margin: 0; }
}
@media (max-width: 359.98px) {
    /* A separate reset row keeps the localized label clear of the view controls. */
    .catalog-facets[open] .catalog-facets__content { margin-block-start: 48px; }
    .catalog-facets__reset { top: 40px; right: auto; left: 0; min-height: 32px; }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
    body:has(.catalog--filter-layout) .header {
        gap: 10px;
    }
    body:has(.catalog--filter-layout) .header .top-logo {
        max-width: 168px;
    }
    body:has(.catalog--filter-layout) .header .menu-list {
        font-size: 15px;
    }
    body:has(.catalog--filter-layout) .header .menu-list > .menu-list__item > div {
        padding-inline: 6px;
    }
    body:has(.catalog--filter-layout) .header-actions > ul {
        gap: 8px !important;
    }
}

@media (max-width: 575.98px) {
    .catalog--filter-layout .catalog__pagination { grid-template-columns: minmax(0, 1fr); }
    .catalog--filter-layout .catalog__more { min-width: 0; max-width: 100%; }
    .catalog--filter-layout .pagenav { min-width: 0; }
    .catalog--filter-layout .pagenav__list { min-width: 0; gap: 6px; flex-wrap: wrap; }
}

/* A hidden page-size control must not cancel the view switcher's auto margin. */
html[lang] .catalog--filter-layout.catalog--controls .catalog-mobile-limit-control[hidden] + .catalog-menu__view {
    margin-inline-start: auto;
}

/* MegaFilter keeps its query engine, but shares the category filter shell. */
.catalog-facets--legacy .category-filter {
    display: block;
    position: static;
    width: 100%;
}
.catalog-facets--legacy .mfilter-box,
.catalog-facets--legacy .mfilter-content { position: static; margin: 0; padding: 0; }
.catalog-facets--legacy .category-filter .mfilter-button-reset.catalog-facets__reset {
    display: inline-flex !important;
    margin: 0;
    gap: 10px;
    width: auto;
    height: auto;
    min-height: 40px;
    color: #e85b5b;
    background: transparent;
    text-decoration: none !important;
}
.catalog-facets--legacy .category-filter .mfilter-button-reset.catalog-facets__reset > span {
    position: relative;
    display: block;
    width: 16px;
    height: 16px;
}
.catalog-facets--legacy .category-filter .mfilter-button-reset.catalog-facets__reset > span::before,
.catalog-facets--legacy .category-filter .mfilter-button-reset.catalog-facets__reset > span::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}
.catalog-facets--legacy .category-filter .mfilter-button-reset.catalog-facets__reset > span::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.catalog-facets--legacy .mfilter-heading-text { flex: 1; min-width: 0; }
.catalog-facets--legacy .mfilter-heading.mfilter-collapsed .mfilter-heading-text > span { color: #464646; }
.catalog-facets--legacy .mfilter-heading .mfilter-head-icon { transform: none; flex: 0 0 6px; }
.catalog-facets--legacy .mfilter-heading.mfilter-collapsed .mfilter-head-icon { transform: rotate(-90deg); }
.catalog-facets--legacy .mfilter-option { flex: 0 0 auto; min-height: 25px; color: #464646; font-size: 14px; line-height: 1.4; }
.catalog-facets--legacy .mfilter-option > label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.catalog-facets--legacy .mfilter-col-input { flex: 0 0 16px; }
.catalog-facets--legacy .mfilter-col-count { flex: 0 0 auto; padding-left: 6px; }
.catalog-facets--legacy .mfilter-heading { cursor: pointer; }

.catalog-facets--legacy .catalog-facets__reset-wrap { display: contents; }

.catalog--filter-layout .catalog-mobile-limit-control[hidden] { display: none !important; }

/* List mode must stay a list when the sidebar narrows the results column. */
html[lang] #view-list:checked ~ .catalog.catalog--controls .catalog-products {
    grid-template-columns: minmax(0, 1fr);
}
html[lang] #view-list:checked ~ .catalog.catalog--controls .card-product {
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
}
html[lang] #view-list:checked ~ .catalog.catalog--controls .card-product__title,
html[lang] #view-list:checked ~ .catalog.catalog--controls .card-product__text {
    min-width: 0;
    overflow-wrap: anywhere;
}
@media (max-width: 575.98px) {
    html[lang] #view-list:checked ~ .catalog.catalog--controls .card-product {
        padding: 10px;
        column-gap: 12px;
    }
    html[lang] #view-list:checked ~ .catalog.catalog--controls .card-product__img-wrap {
        width: 80px;
    }
}
body:has(.catalog--filter-layout) .catalog-title {
    overflow-wrap: anywhere;
    hyphens: auto;
}

/* One toolbar moves between the desktop heading and the mobile catalog/filter. */
.catalog-heading-row { min-width: 0; }
.catalog-heading-tools { display: none; }
.catalog-limit-caption { display: none; }
@media (min-width: 992px) {
    .catalog-heading-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }
    .catalog-heading-row .catalog-title { min-width: 0; }
    .catalog-heading-tools { display: flex; flex: 0 0 auto; }
    .catalog-heading-tools .catalog-menu__toolbar {
        display: flex;
        align-items: center;
        gap: 18px;
        width: auto;
        margin: 0;
    }
    .catalog-heading-tools .catalog-toggler { display: none !important; }
    .catalog-heading-tools .catalog-mobile-limit-control {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin: 0;
    }
    .catalog-heading-tools .catalog-mobile-limit-control[hidden] { display: none !important; }
    .catalog-heading-tools .catalog-limit-caption {
        display: inline;
        color: #6c757d;
        font-size: 14px;
        white-space: nowrap;
    }
    .catalog-heading-tools .catalog-menu__view {
        display: inline-flex !important;
        gap: 18px;
        margin: 0;
    }
    .catalog--filter-layout {
        --catalog-search-height: 51px;
        --catalog-results-gap: 8px;
    }
    .catalog--filter-layout .catalog__search .catalog-search,
    .catalog--filter-layout .catalog__search .catalog-search__input,
    .catalog--filter-layout .catalog__search .catalog-search__btn {
        height: var(--catalog-search-height);
    }
    .catalog--filter-layout .catalog-facets > summary,
    .catalog--filter-layout .catalog-facets__reset {
        min-height: var(--catalog-search-height);
    }
    .catalog--filter-layout .catalog-facets__content {
        margin-block-start: var(--catalog-results-gap);
    }
    /* Closed filters: the catalog divider starts level with the result cards. */
    .catalog--filter-layout .catalog-facets-shell:has(> .catalog-facets:not([open])) {
        margin-block-end: var(--catalog-results-gap);
    }
    .catalog--filter-layout .catalog-facets-shell + .catalog__menu > .catalog-menu > li:first-child {
        border-top-color: var(--ui-orange-1);
    }
    .catalog.catalog--filter-layout:not(.catalog--detail) .catalog__products { margin-top: var(--catalog-results-gap); }
}

/* Search renders the shared shell directly in the sidebar. Its own margins
   provide spacing; the old flex gap must not lower the catalog divider. */
.catalog--filter-layout .catalog__aside:has(> .catalog-facets-shell) { gap: 0; }
