section:has(.catalog-filter-sidebar) {
    display: grid;
    grid-template-columns: 280px 1fr;
    column-gap: 40px;
}

section:has(.catalog-filter-sidebar) .hero-section {
    grid-column: 1 / -1;
}

section:has(.catalog-filter-sidebar) .catalog-filter-sidebar {
    grid-column: 1;
}

section:has(.catalog-filter-sidebar) .entries {
    grid-column: 2;
    height: max-content;
}

section:has(.catalog-filter-sidebar) .ct-pagination {
    grid-column: 2;
}

@media (max-width: 1024px) {

    section:has(.catalog-filter-sidebar) {
        display: block;
    }

}

.catalog-layout {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.catalog-filter-sidebar {
    width: 280px;
    flex: 0 0 280px;
}

.catalog-layout .entries {
    flex: 1;
}

@media (max-width: 1024px) {

    .catalog-layout {
        display: block;
    }

    .catalog-filter-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        transform: translateX(-100%);
        transition: .3s ease;
        background: #fff;
        z-index: 9999;
        overflow-y: auto;
    }

    .catalog-filter-sidebar.active {
        transform: translateX(0);
    }
}


.filter-section {
    border-bottom:1px solid #eee;
    padding:12px 0;
}

.filter-section-h {
    cursor:pointer;
    font-weight:600;
}

.filter-list {
    display:none;
    margin-top:10px;
}

.filter-section.is-open .filter-list {
    display:block;
}

.filter-lv1 {
    list-style:none;
    margin:0;
    padding:0;
}

.filter-lv1-i {
    margin-bottom:6px;
}

.filter-lv1:not(.is-expanded) .filter-lv1-i:nth-child(n+6) {
    display: none;
}
.filter-lv1-i.is-disabled {
    opacity: .4;
    pointer-events: none;
}

.filter-lv1-i.is-active .filter-title {
    font-weight:600;
}

.filter-count {
    opacity:.6;
    margin-left:6px;
}

.filter-panel {
  background:#fff;
  position: sticky;
  top: calc(var(--admin-bar) + 20px);
  align-self: start;
}

.filter-toggle {
    background: none;
    border: 0;
    padding: 0;
    margin-top: 6px;
    font-size: 14px;
    color: #0d3b66;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
}

.filter-toggle:hover {
    text-decoration: none;
}

.filter-toggle:focus {
    outline: none;
}

@media (max-width:1024px){
  .catalog-filter-sidebar{
    position:fixed;
    left:0;
    top:0;
    bottom:0;
    width:320px;
    transform:translateX(-100%);
    transition:.3s;
    z-index:1000;
  }
  .catalog-filter-sidebar .filter-panel.active{
    transform:translateX(0);
  }
}

@media (min-width: 1025px){
    .filter-open-mobile,
    .filter-close,
    .filter-apply,
    .filter-panel-header {
        display:none;
    }
}
/* === Active Filters Block === */

.filter-current-wrapper {
    margin-bottom: 24px;
    padding: 16px 18px;
    border-radius: 10px;
    border: none;
    background: var(--theme-palette-color-7);
}

.filter-current {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: flex-start;
}

.filter-current-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-current-heading {
    font-weight: 600;
    font-size: 14px;
    margin-right: 4px;
}

.filter-current-i {
    text-decoration: none;
}

.filter-current-i__content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    font-size: 13px;
    border-radius: 5px;
    background: var(--theme-palette-color-8);
    border: 1px solid var(--theme-palette-color-4);
    transition: all 0.2s ease;
}

.filter-current-i__content:hover {
    background: var(--theme-palette-color-4);
    border-color: var(--theme-palette-color-2);
    color: var(--theme-palette-color-8);
}

.filter-current-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 14px;
    line-height: 1;
    border-radius: 50%;
    background: var(--theme-palette-color-4);
    color: var(--theme-palette-color-8);
    transition: all 0.2s ease;
}

.filter-current-i__content:hover .filter-current-remove {
    background: var(--theme-palette-color-8);
    color: var(--theme-palette-color-4);
}

.filter-clear {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--theme-palette-color-1);
    transition: opacity 0.2s ease;
}

.filter-clear:hover {
    opacity: 0.7;
}

.catalog-filter-overlay{
    display: none;
}
@media (max-width: 1024px) {

    .filter-current-wrapper {
        padding: 14px;
    }

    .filter-current {
        gap: 10px 12px;
    }

    .filter-clear {
        margin-top: 8px;
    }
}
/* =========================
   MOBILE CONTROLS PANEL
========================= */

.catalog-mobile-controls {
    display: none;
}

@media (max-width:1024px){

    .catalog-mobile-controls{
        display:block;
        position: sticky;
        top: calc(var(--admin-bar, 0px) + 0px);
        z-index: 60;
        background: var(--theme-palette-color-8);
    }

    .catalog-mobile-controls__inner{
        padding:12px 15px;
        display:flex;
        align-items:center;
        justify-content:space-between;
    }

    .catalog-mobile-filter-btn{
        display:flex;
        align-items:center;
        gap:8px;
        background:none;
        border:0;
        font-weight:600;
        font-size:15px;
        padding:0;
    }
    .catalog-mobile-filter-btn svg{
        display: block;
    }
    .catalog-mobile-filter-badge{
        background: var(--theme-palette-color-1);
        color: var(--theme-palette-color-8);
        border-radius:20px;
        font-size:12px;
        padding:2px 8px;
        line-height:1.4;
        display:none;
    }

    .catalog-mobile-filter-badge.is-active{
        display:inline-block;
    }
}
/* =========================
   MOBILE FILTER LAYOUT
========================= */

@media (max-width: 1024px) {
    .hero-section[data-type="type-1"]{
        margin-bottom: 10px;
    }
    
    [data-prefix="catalog_archive"] .entries{
        margin-top: 18px;
    }

    .filter-panel-header{
    padding: 10px 20px;
    font-size: 20px;
    background-color: var(--theme-palette-color-4);
    color: var(--theme-palette-color-8);
    }

    /* Sidebar */
    .catalog-filter-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 320px;
        max-width: 85%;
        background:  var(--theme-palette-color-8);
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform .3s ease;
        display: flex;
        flex-direction: column;
    }

    .catalog-filter-sidebar.active {
        transform: translateX(0);
    }

    /* Затемнение */
    .catalog-filter-overlay {
        position: fixed;
        display: block;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: .3s;
    }

    .catalog-filter-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Панель */
    .filter-panel {
        position: relative;
        top: 0;
        height: 100%;   
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .filter-groups {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
    }

    .filter-panel-footer {
        padding: 15px 20px;
        border-top: 1px solid var(--theme-palette-color-4);
        background:  var(--theme-palette-color-8);
    }

    .filter-apply {
        width: 100%;
        padding: 12px;
        background:  var(--theme-palette-color-1);
        color:  var(--theme-palette-color-8);
        border: 0;
        border-radius: 8px;
        font-weight: 600;
    }

    .filter-panel .filter-current-wrapper{
        border-radius: 0px;
    }

    .filter-close {
        position: absolute;
        top: 8px;
        right: 10px;
        font-size: 24px;
        border: 0;
        background: none;
        color: var(--theme-palette-color-8);
    }
}