body {
    &:has(.catalog .filters-panel[open]) {
        overflow: hidden;
    }
}
main {
    .catalog {
        padding: 12px 0 100px;
        h1 {
            font-size: 32px;
            line-height: 35px;
            color: var(--text-7);
            margin-bottom: 24px;
        }
        .body {
            display: grid;
            grid-template-columns: 348px minmax(0, 1fr);
            gap: 12px;
            align-items: start;
        }
        .filters {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 20px;
            padding: 20px;
            border: 1px solid var(--bg-12);
            border-radius: 20px;
            background: var(--bg-4);
            .heading {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                min-height: 28px;
                h2 {
                    font-size: 16px;
                    font-weight: 700;
                    line-height: 20px;
                    color: var(--text-7);
                }
                .close {
                    display: none;
                }
            }
            .group {
                display: flex;
                flex-direction: column;
                gap: 12px;
                padding-top: 20px;
                border-top: var(--border-9);
                &.open {
                    h3 button::after {
                        content: '\f021';
                        background: var(--bg-14);
                    }
                    .options {
                        display: flex;
                    }
                }
                h3 {
                    font-size: 14px;
                    font-weight: 700;
                    line-height: 17px;
                    color: var(--text-7);
                    button {
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                        gap: 12px;
                        width: 100%;
                        background: none;
                        font: inherit;
                        color: inherit;
                        text-align: left;
                        &::after {
                            content: '\f011';
                            display: grid;
                            place-items: center;
                            flex: none;
                            width: 20px;
                            height: 20px;
                            border-radius: 6px;
                            background: var(--text-3);
                            font-family: icon;
                            font-size: 12px;
                            font-weight: 400;
                            line-height: 20px;
                            color: var(--text-6);
                        }
                    }
                }
                .options {
                    display: none;
                    flex-direction: column;
                    gap: 10px;
                    &:not(.expanded) {
                        .option.extra {
                            display: none;
                        }
                    }
                    &.expanded {
                        .more {
                            .expand {
                                display: none;
                            }
                            .collapse {
                                display: inline;
                            }
                            &::after {
                                transform: rotate(180deg);
                            }
                        }
                    }
                    .more {
                        display: flex;
                        align-items: center;
                        align-self: center;
                        gap: 4px;
                        padding: 0;
                        background: none;
                        font-size: 12px;
                        line-height: 14px;
                        color: var(--text-1);
                        &.unavailable {
                            display: none;
                        }
                        &::after {
                            content: '\f00f';
                            font-family: icon;
                            font-size: 12px;
                            font-weight: 400;
                            line-height: 12px;
                            color: inherit;
                        }
                        span {
                            font: inherit;
                            color: inherit;
                        }
                        .collapse {
                            display: none;
                        }
                    }
                    .option {
                        display: grid;
                        grid-template-columns: 20px minmax(0, 1fr) auto;
                        align-items: center;
                        gap: 10px;
                        cursor: pointer;
                        &.unavailable {
                            display: none;
                        }
                        input {
                            appearance: none;
                            display: grid;
                            place-items: center;
                            width: 20px;
                            height: 20px;
                            border: 0;
                            border-radius: 6px;
                            background: var(--bg-3);
                            cursor: inherit;
                            &::before {
                                content: '\f023';
                                font-family: icon;
                                font-size: 10px;
                                color: var(--text-6);
                                opacity: 0;
                            }
                            &:checked {
                                background: var(--bg-14);
                                &::before {
                                    opacity: 1;
                                }
                            }
                        }
                        .value {
                            min-width: 0;
                            overflow-wrap: anywhere;
                            font-size: 14px;
                            line-height: 20px;
                            color: var(--text-7);
                        }
                        .count {
                            font-size: 12px;
                            line-height: 14px;
                            color: var(--text-3);
                        }
                    }
                }
            }
            .actions {
                display: flex;
                gap: 4px;
                padding-top: 20px;
                border-top: var(--border-9);
                button {
                    flex: 1;
                    min-width: 0;
                    min-height: 44px;
                    padding: 10px 8px;
                    font-size: 14px;
                    line-height: 20px;
                }
                .btn {
                    background: var(--bg-14);
                    &:hover {
                        background: var(--bg-9);
                    }
                }
                .btn-2 {
                    border: 1px solid var(--bg-12);
                    font-weight: 600;
                    color: var(--text-1);
                }
            }
        }
        .listing {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 12px;
            .toolbar {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 16px;
                flex-wrap: wrap;
                min-height: 68px;
                padding: 14px 14px 14px 20px;
                border: 1px solid var(--bg-12);
                border-radius: 20px;
                background: var(--bg-4);
                .results {
                    display: flex;
                    align-items: center;
                    flex-wrap: wrap;
                    gap: 8px;
                    strong {
                        font-size: 15px;
                        font-weight: 700;
                        color: var(--text-7);
                    }
                    span {
                        font-size: 13px;
                        color: var(--text-3);
                    }
                }
                .controls {
                    display: flex;
                    align-items: center;
                    flex-wrap: wrap;
                    gap: 16px;
                    .filters-toggle {
                        display: none;
                    }
                    .sort {
                        display: flex;
                        align-items: center;
                        gap: 8px;
                        &> span {
                            font-size: 13px;
                            color: var(--text-3);
                        }
                        .dropdown {
                            position: relative;
                            min-width: 222px;
                            .value, .sub button {
                                display: flex;
                                align-items: center;
                                gap: 6px;
                                width: 100%;
                                min-height: 40px;
                                padding: 8px 10px;
                                border-radius: 8px;
                                background: var(--bg-4);
                                font-size: 13px;
                                font-weight: 600;
                                line-height: 18px;
                                color: var(--text-7);
                                text-align: left;
                                white-space: nowrap;
                            }
                            .mark {
                                display: flex;
                                align-items: center;
                                justify-content: center;
                                flex: none;
                                min-width: 24px;
                                height: 24px;
                                padding: 0 4px;
                                border-radius: 8px;
                                background: var(--bg-3);
                                font-size: 10px;
                                font-weight: 500;
                                line-height: 14px;
                                color: var(--text-1);
                                &::before {
                                    font-family: icon;
                                    font-size: 12px;
                                    font-weight: 400;
                                    color: inherit;
                                }
                            }
                            .price-asc, .price-desc {
                                .mark::before {
                                    content: '\f009';
                                    transform: rotate(-90deg);
                                }
                            }
                            .price-desc .mark::before {
                                transform: rotate(90deg);
                            }
                            .popular .mark::before {
                                content: '\f00c';
                                font-size: 16px;
                            }
                            .title-asc, .title-desc {
                                .mark {
                                    min-width: 34px;
                                }
                            }
                            .value {
                                border-radius: 12px;
                                background: var(--bg-3);
                                .mark {
                                    background: var(--bg-4);
                                    color: var(--text-10);
                                }
                                &::after {
                                    content: '\f00f';
                                    flex: none;
                                    width: 16px;
                                    margin-left: auto;
                                    font-family: icon;
                                    font-size: 16px;
                                    font-weight: 400;
                                    line-height: 16px;
                                    color: var(--text-1);
                                }
                            }
                            .sub {
                                display: none;
                                position: absolute;
                                top: calc(100% + 3px);
                                left: 0;
                                z-index: 30;
                                width: 100%;
                                min-width: 226px;
                                padding: 4px;
                                border-radius: 12px;
                                background: var(--bg-4);
                                box-shadow: var(--shadow-1);
                                button {
                                    &+ button {
                                        margin-top: 4px;
                                    }
                                    &:hover, &:focus-visible {
                                        background: var(--bg-3);
                                        .mark {
                                            background: var(--bg-4);
                                            color: var(--text-10);
                                        }
                                    }
                                    &.current {
                                        background: var(--bg-8);
                                        .mark {
                                            background: var(--bg-4);
                                            color: var(--text-10);
                                        }
                                    }
                                }
                            }
                            &.open {
                                .value {
                                    background: var(--bg-8);
                                    &::after {
                                        transform: rotate(180deg);
                                    }
                                }
                                .sub {
                                    display: block;
                                }
                            }
                        }
                    }
                    .views {
                        display: flex;
                        gap: 4px;
                        padding: 4px;
                        border-radius: 12px;
                        background: var(--bg-3);
                        button {
                            flex: none;
                            width: 32px;
                            height: 32px;
                            border-radius: 8px;
                            background: transparent;
                            &::before {
                                font-family: icon;
                                font-size: 20px;
                                color: var(--text-1);
                            }
                            &.active {
                                background: var(--bg-4);
                                &::before {
                                    color: var(--text-10);
                                }
                            }
                            &.grid::before {
                                content: '\f01e';
                            }
                            &.horizontal::before {
                                content: '\f029';
                            }
                            &.table::before {
                                content: '\f02a';
                            }
                        }
                    }
                }
            }
            .cards {
                display: grid;
                grid-template-columns: repeat(3, minmax(0, 1fr));
                gap: 12px;
                &.horizontal, &.table {
                    grid-template-columns: minmax(0, 1fr);
                }
                &.table {
                    gap: 0;
                    &> .table-head {
                        display: grid;
                        grid-template-columns: var(--product-table-columns);
                        align-items: center;
                        gap: 12px;
                        padding: 12px 12px 11px;
                        border-bottom: var(--border-9);
                        background: var(--bg-4);
                        &.guest {
                            grid-template-columns: var(--product-table-columns-unavailable);
                        }
                        span {
                            font-size: 12px;
                            font-weight: 700;
                            line-height: 15px;
                            color: var(--text-3);
                        }
                        .quantity {
                            text-align: center;
                        }
                        .actions {
                            text-align: right;
                        }
                    }
                }
                &> .table-head {
                    display: none;
                }
            }
        }
        .filters-panel {
            display: none;
            position: fixed;
            inset: 0 0 0 auto;
            width: 380px;
            max-width: calc(100% - 32px);
            height: 100dvh;
            max-height: 100dvh;
            margin: 0;
            padding: 0;
            border: 0;
            border-radius: 16px 0 0 0;
            background: var(--bg-4);
            box-shadow: var(--shadow-2);
            overflow-y: auto;
            overscroll-behavior: contain;
            animation-duration: 0.25s;
            animation-timing-function: ease-out;
            &[open] {
                display: block;
                animation-name: catalog-filters-in;
            }
            &.closing {
                animation-name: catalog-filters-out;
                animation-timing-function: ease-in;
                animation-fill-mode: forwards;
            }
            &::backdrop {
                background: var(--bg-21);
                backdrop-filter: blur(5px);
            }
            .filters {
                min-height: 100%;
                padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
                border: 0;
                border-radius: 0;
                .heading {
                    .close {
                        display: grid;
                        place-items: center;
                        flex: none;
                        width: 36px;
                        height: 36px;
                        padding: 0;
                        border-radius: 10px;
                        background: var(--bg-3);
                        &::before {
                            content: '\f021';
                            font-family: icon;
                            font-size: 20px;
                            font-weight: 400;
                            color: var(--text-7);
                        }
                    }
                }
            }
        }
    }
}
@media screen and (max-width: 1279px) {
    main {
        .catalog {
            width: calc(100% - 48px);
            padding-bottom: 80px;
            h1 {
                font-size: 28px;
                line-height: 1.1;
            }
            .body {
                grid-template-columns: minmax(0, 1fr);
                .listing {
                    .toolbar {
                        .controls {
                            .filters-toggle {
                                display: flex;
                                padding: 10px 16px;
                                font-size: 14px;
                                line-height: 18px;
                            }
                        }
                    }
                    .cards {
                        &:not(.horizontal, .table) {
                            grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
                        }
                        &.table {
                            overflow-x: auto;
                            overscroll-behavior-x: contain;
                            > .table-head, > .product-card {
                                min-width: 1080px;
                            }
                        }
                    }
                }
            }
        }
    }
}
@media screen and (max-width: 767px) {
    main {
        .catalog {
            width: calc(100% - 32px);
            h1 {
                font-size: 26px;
                margin-bottom: 20px;
            }
            .body {
                .listing {
                    .toolbar {
                        align-items: stretch;
                        gap: 12px;
                        padding: 12px;
                        border-radius: 16px;
                        .results {
                            gap: 4px;
                        }
                        .controls {
                            display: grid;
                            grid-template-columns: minmax(0, 1fr) auto;
                            gap: 8px;
                            .filters-toggle {
                                grid-area: 1 / 1;
                            }
                            .sort {
                                grid-area: 2 / 1 / 3 / 3;
                                flex-direction: column;
                                align-items: stretch;
                                gap: 4px;
                                .dropdown {
                                    min-width: 0;
                                    .value, .sub button {
                                        white-space: normal;
                                    }
                                    .sub {
                                        min-width: 0;
                                    }
                                }
                            }
                            .views {
                                grid-area: 1 / 2;
                            }
                        }
                    }
                    .cards {
                        &:not(.horizontal, .table) {
                            grid-template-columns: repeat(2, minmax(0, 1fr));
                            gap: 8px;
                        }
                    }
                }
            }
        }
    }
}
@keyframes catalog-filters-in {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}
@keyframes catalog-filters-out {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}