/* ==============================================
   Фильтр каталога
   ============================================= */

.catalog-filter {
    margin: 28px 0 12px;
}

.catalog-filter__btn {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    color: var(--black, #202124);
}

.button.button-primary.catalog-filter__btn {
    color: var(--black, #202124);
    height: 50px;
}

.catalog-filter__body {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    overflow-y: auto;
    padding: 24px 15px;
    justify-content: space-between;
}

.catalog-filter__body .f-button.is-close-btn {
    display: none;
}

.catalog-filter__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.catalog-filter__name {
    color: var(--black, #202124);
    font-feature-settings: 'liga' off, 'clig' off;
    font-family: AdihausDIN;
    font-size: 20px;
    font-style: normal;
    font-weight: 700;
    line-height: 100%;
}

.catalog-filter__btn-clear {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    outline: 0;
    border: none;
    margin: 0;
    padding: 0;
    color: var(--black, #202124);
    text-align: center;
    font-feature-settings: 'liga' off, 'clig' off;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 100%;
}

.catalog-filter__title {
    margin: 54px 0 28px;
    color: var(--black, #202124);
    font-feature-settings: 'liga' off, 'clig' off;
    font-size: 20px;
    font-style: normal;
    font-weight: 700;
    line-height: 100%;
}

.catalog-filter__wrap .custom-select {
    width: 100%;
    margin: 0 0 20px;
}

.catalog-filter__wrap .custom-select__header {
    height: 42px;
}

.catalog-filter__result {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.catalog-filter__result:has(li) {
    margin: 0 0 16px;
}

.catalog-filter__result-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 9px 6px 16px;
    border: 1px solid var(--grey, #EBECED);
    background: var(--bg, #F8F9FA);
    margin: 0;
    list-style-type: none;
    cursor: pointer;
}

.catalog-filter__result-item:hover{
    background-color: var(--grey, #EBECED);
}

.catalog-filter__result-item::after {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: url("/assets/images/clear.svg") center no-repeat;
}

.catalog-filter__show_result.button.button-primary {
    color: var(--black);
    height: 50px;
    width: 100%;
}

.catalog-filter__footer {
    margin: 0 0 0;
}

.catalog-filter__footer:has(.catalog-filter__result-item) {
    margin: 16px 0 0;
}

.filter-wrapper {
    padding: 0;
}

@media (min-width: 64rem) {
    .catalog-filter__head {
        display: none;
    }

    .catalog-filter__body {
        display: block;
        padding: 0;
        min-height: auto;
        overflow: unset;
    }

    .catalog-filter__row,
    .catalog-filter__title,
    .catalog-filter__show_result {
        display: none;
    }

    .catalog-filter__wrap {
        display: flex;
        gap: 15px;
        overflow: unset;
        position: relative;
        z-index: 11;
    }

    .catalog-filter__wrap .custom-select {
        margin-bottom: 0;
    }
}

/* ==============================================
   Таблица товаров — вид по умолчанию (список)
   ============================================= */

.catalog-product {
    margin: 0 0 50px;
}

.catalog-product .product__head {
    display: none;
}

.catalog-product .product__row {
    display: block;
    width: 100%;
    border: 1px solid var(--grey-1, #D7D8DA);
    padding: 15px 20px;
}

.product__table {
    width: 100%;
}

.product__cell {
    display: block;
    column-count: 2;
    gap: 8px;
    margin: 0 0 8px;
}

/*.product__cell-price{*/
/*    min-width: 110px;*/
/*}*/

.product__cell:has(.product__buttons) {
    column-count: 1;
}

.product__cell-image {
    display: none;
}

.catalog-product .product__cell.product__cell-name {
    display: none;
}

.catalog-product__item-title,
.catalog-product__item-text {
    display: block;
    color: var(--black, #202124);
    font-family: AdihausDIN;
    font-size: 14px;
    font-style: normal;
    font-weight: 400;
    line-height: 150%;
    text-decoration: none;
}

.catalog-product__item-title {
    color: var(--grey-4, #4D4D50);
}

.catalog-product .product__cell.product__cell-price {
    grid-column: 1;
    grid-row: 1 / span 100;
    padding: 0;
}

.product__count {
    display: none;
}

.product__size {
    display: none;
}

.product__size.custom-select:has(.active):not(.show) {
    box-shadow: none;
    border-color: var(--grey-1);
}

.product__buttons {
    column-count: 1;
    margin: 16px 0 0;
    width: 100%;
}

.product__cart-btn {
    width: 100%;
    height: 42px;
    padding: 0;
    font-size: 14px;
}

.product__body .product__row {
    margin: 0 0 16px;
}

.product__tfoot {
    display: flex;
    justify-content: center;
}

.product__tfoot button {
    margin-top: 30px;
}

.product__table.product__table--grid-small .product__tfoot,
.product__table.product__table--grid-small .product__tfoot td,
.product__table.product__table--grid-small .product__tfoot tr,
.product__table.product__table--grid .product__tfoot,
.product__table.product__table--grid .product__tfoot td,
.product__table.product__table--grid .product__tfoot tr
{
    width: 100%;
    display: block;
}

@media (min-width: 64rem) {

    .product:has(.product__table){
        /*overflow-x: auto;*/
    }

    .product__table {
        display: table;
        border: none;
        border-collapse: collapse;
    }

    .product__table .product__head,
    .product__table .product__tfoot {
        display: table-header-group;
    }

    .product__table .product__tfoot {
        text-align: center;
        border: none;
        border-collapse: collapse;
    }

    .catalog-product .product {
        width: 100%;
    }

    .catalog-product .product__row {
        display: table-row;
        position: relative;
        padding: 0;
        border: none;
    }

    .catalog-product .product__row::after {
        content: '';
        display: block;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        border-bottom: 1px solid #D7D8DA;
        background-color: transparent;
    }

    .catalog-product .product__head .product__row {
        border: none;
    }

    .catalog-product .product__cell {
        display: table-cell;
        column-count: 1;
        align-items: center;
    }

    .catalog-product .product__cell-buttons {
        text-align: start;
        width: 330px;
    }

    .catalog-product__item-title {
        display: none;
    }

    .product__cell {
        padding: 8px;
        margin: 0;
    }

    .product__cell.product__cell--th {
        height: 63px;
        background: var(--grey, #F8F9FA);
        align-items: center;
        color: var(--grey-4, #4D4D50);
        font-feature-settings: 'liga' off, 'clig' off;
        font-family: AdihausDIN;
        font-size: 14px;
        font-style: normal;
        font-weight: 400;
        line-height: 160%;
        /*white-space: nowrap;*/
    }

    .product__cell--th[data-sort-order] {
        cursor: pointer;
    }

    .product__cell--th-sort {
        display: flex;
        align-items: center;
    }

    .product__cell--th-sort::after {
        content: '';
        display: block;
        width: 16px;
        height: 16px;
        min-width: 16px;
        background-position: center;
        background-repeat: no-repeat;
        transition: transform .3s;
    }

    [data-sort-order="desc"] .product__cell--th-sort::after {
        background-image: url(/assets/images/sort.svg);
    }

    [data-sort-order="asc"] .product__cell--th-sort::after {
        background-image: url(/assets/images/sort.svg);
        transform: rotateX(180deg);
    }

    .product__cell.product__cell--th[data-sort-order="asc"],
    .product__cell.product__cell--th[data-sort-order="desc"]{
        color: var(--primary);
        font-weight: 500;
    }

    .product__cell-sort {
        cursor: pointer;
    }

    .product__cell-sort::after {
        content: '';
        background: url("/assets/images/sort.svg") center / contain no-repeat;
        width: 16px;
        height: 16px;
        min-width: 16px;
        margin-left: -8px;
    }

    .product__count {
        display: flex;
    }

    .product__size {
        display: block;
        width: 90px;
        height: 42px;
    }

    .product__size .custom-select__header {
        height: 42px;
    }

    .product__buttons {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        column-count: unset;
        justify-content: flex-end;
        margin: 0;
    }

    .product__cart-btn {
        width: 128px;
    }

    .product__body .product__row {
        margin: 0;
    }

    .product__body .product__row:hover {
        background: #F6F6F7;
    }
}

/* ==============================================
   Тулбар переключения вида
   ============================================= */

.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0 16px;
}

/* ==============================================
   Сортировка
   ============================================= */

.catalog-sort {
    position: relative;
    min-width: 180px;
}

.catalog-sort__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 40px;
    padding: 0;
    border: none;
    margin-left: 0;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    background: #fff;
    transition: border-color .2s;
    outline: none;
}

.catalog-sort__header:hover {
    border-color: var(--black, #202124);
}

.catalog-sort.show .catalog-sort__header {
    border-color: var(--black, #202124);
}

.catalog-sort.show .custom-select__arrow {
    transform: rotate(180deg);
}

.custom-select__arrow {
    flex-shrink: 0;
    transition: transform .2s;
}

.catalog-sort__label {
    color: var(--black, #202124);
    font-family: AdihausDIN;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

@media (min-width: 48rem) {
    .catalog-sort__label{
        font-size: 16px;
    }
}

.catalog-sort__list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #fff;
    border: 1px solid var(--grey, #F8F9FA);
    border-radius: 4px;
    padding: 0;
    margin: 0;
    list-style: none;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.catalog-sort.show .catalog-sort__list {
    display: block;
}

.catalog-sort__item {
    padding: 9px 14px;
    font-family: AdihausDIN;
    font-size: 14px;
    color: var(--black, #202124);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}

.catalog-sort__item:hover {
    background: var(--grey, #F8F9FA);
}

.catalog-sort__item.is-active {
    font-weight: 700;
    background: var(--grey, #F8F9FA);
}

.catalog-sort__arrow {
    margin-left: 4px;
    font-style: normal;
}

.catalog-toolbar__views {
    display: flex;
    align-items: center;
    gap: 4px;
}

.catalog-toolbar__view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--grey-4, #4D4D50);
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
}

.catalog-toolbar__view-btn[data-view="grid"]{
    display: none;
}

@media (min-width: 768px) {
    .catalog-toolbar__view-btn[data-view="grid"]{
        display: flex;
    }
}

.catalog-toolbar__view-btn:hover svg rect{
    fill: var(--black, #202124);
}

.catalog-toolbar__view-btn.is-active svg rect{
    fill: var(--black, #202124);
}

.catalog-toolbar__view-btn svg * {
    fill: var(--grey-1);
}

/* ==============================================
   Вид: grid / grid-small — общие правила
   ============================================= */

.product__table--grid,
.product__table--grid-small {
    display: block;
    border: none;
}

.product__table--grid thead.product__head,
.product__table--grid-small thead.product__head {
    display: none;
}

.product__table--grid tfoot,
.product__table--grid-small tfoot {
    display: flex;
}

.product__table--grid tfoot .product__row,
.product__table--grid-small tfoot .product__row {
    display: none;
}

.product__table--grid .product__row::after,
.product__table--grid-small .product__row::after {
    display: none;
}

/* Перебиваем ховер десктопного списка */
.product__table--grid .product__row:hover,
.product__table--grid-small .product__row:hover {
    background: var(--white, #fff);
}

/* Имя товара — скрыто в списке, видно в карточках */
.product__table--grid .product__cell.product__cell-name,
.product__table--grid-small .product__cell.product__cell-name {
    display: block;
    padding: 4px 12px;
    font-weight: 500;
    font-size: 14px;
    line-height: 150%;
    color: var(--black);
}

.product__table--grid .product__cell.product__cell-name a{
    text-decoration: none;
    color: var(--black);
}

@media (min-width: 48rem) {
    .product__table--grid .product__cell.product__cell-name,
    .product__table--grid-small .product__cell.product__cell-name {
        font-size: 16px;
    }
}

/* Блок цены + изображения */
.product__table--grid .product__cell-price,
.product__table--grid-small .product__cell-price {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
    width: auto;
    z-index: 1;
}

.product__table--grid .product__cell-price .catalog-product__item-title,
.product__table--grid-small .product__cell-price .catalog-product__item-title {
    display: none;
}

.product__table--grid .product__cell-price .catalog-product__item-link,
.product__table--grid-small .product__cell-price .catalog-product__item-link {
    display: block;
    position: absolute;
    left: 12px;
    bottom: 0;
    padding: 6px 8px;
    background-color: var(--white);
    font-size: 12px;
    font-weight: 400;
    line-height: 160%;
    color: var(--black, #202124);
}

@media (min-width: 48rem) {
    .product__table--grid .product__cell-price .catalog-product__item-link,
    .product__table--grid-small .product__cell-price .catalog-product__item-link {
        font-size: 14px;
    }
}

/* ==============================================
   Вид: grid — горизонтальная карточка
   [изображение 180px] | заголовок
                        | атрибут  | атрибут
                        | кнопки
   ============================================= */

.product__table--grid tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 64rem) {
    gap: 16px;
}

.product__table--grid .product__row {
    display: grid;
    grid-template-columns: 150px 1fr;
    position: relative;
    min-height: 180px;
    background: var(--white, #fff);
    box-shadow: 0 5px 50px 0 rgba(18, 17, 39, 0.02);
    border: none;
    padding: 0;
    margin: 0;
}

@media (min-width: 48rem) {
    .product__table--grid .product__row {
        grid-template-columns: 180px 1fr 1fr;
    }
}

@media (min-width: 64rem) {
    .product__table--grid .product__row {
        grid-template-columns: 180px 1fr 1fr 1fr;
    }
}

.product__table--grid .product__cell {
    display: flex;
    flex-direction: column;
    gap:0;
    justify-content: flex-start;
    align-items: flex-start;
    column-count: unset;
    padding: 4px 12px;
    margin: 0;
    border: none;
    width: auto;
}

@media (min-width: 420px) {
    .product__table--grid .product__cell {
        flex-direction: row;
        gap:8px;
    }
}

.product__table--grid .product__cell-price {
    grid-column: 1;
    grid-row: 1 / span 100; /* 1/-1 не работает с implicit rows */
}

.product__table--grid .product__cell-price .product__cell-image {
    display: block;
    width: 100%;
    flex: 1;
    object-fit: cover;
    object-position: center;
    background: #F6F6F7;
    height: 100%;
}

.product__table--grid .catalog-product__item-title {
    display: block;
    font-size: 14px;
    color: var(--black);
    width: auto;
}

.product__table--grid .catalog-product__item-text {
    color: var(--grey-5);
}

/* Первая ячейка — заголовок, на всю правую ширину */
.product__table--grid .product__cell:first-of-type {
    grid-column: 2 / span 1;
    grid-row: 1;
    padding: 4px 12px 8px;
    align-self: end;
}

@media (min-width: 48rem) {
    .product__table--grid .product__cell:first-of-type {
        grid-column: 2 / span 2;
    }
}



@media (min-width: 64rem) {
    .product__table--grid .product__cell:first-of-type {
        grid-column: 2 / span 3;
    }
}

.product__table--grid .product__cell:first-of-type .catalog-product__item-title {
    display: none;
}

.product__table--grid .product__cell:first-of-type .catalog-product__item-link {
    font-size: 15px;
    font-weight: 700;
    color: var(--black, #202124);
}

/* Кнопки — на всю правую ширину */
.product__table--grid .product__cell:has(.product__buttons) {
    grid-column: 2 / span 1;
    align-items: flex-start;
}

@media (min-width: 48rem) {
    .product__table--grid .product__cell:has(.product__buttons) {
        grid-column: 2 / span 2;
    }
}

@media (min-width: 64rem) {
    .product__table--grid .product__cell:has(.product__buttons) {
        grid-column: 2 / span 3;
    }
}

.product__table--grid .product__buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 0;
    justify-content: flex-start;
}

@media (min-width: 64rem) {
    .product__table--grid .product__buttons {
        display: flex;
        flex-direction: column;
        max-width: 160px;
    }

    .product__table--grid .product__cell:has(.product__buttons){
        align-items: end;
        justify-content: end;
        grid-column: 4;
        grid-row: 1 / span 100;
    }
}

.product__table--grid .product__count {
    display: flex;
    width: 100%;
}

.product__table--grid .product__cart-btn {
    width: 100%;
    min-width: 160px;
}

.product__table--grid .count__input{
    width: inherit;
}

/* ==============================================
   Вид: grid-small — вертикальные карточки
   ============================================= */

.product__table--grid-small tbody {
    display: grid;
    grid-template-columns: 100%;
    gap: 12px;
    row-gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 48rem) {
    .product__table--grid-small tbody {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 64rem) {
    .product__table--grid-small tbody {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 80rem) {
    .product__table--grid-small tbody {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product__table--grid-small .product__row {
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: var(--white, #fff);
    box-shadow: 0 5px 50px 0 rgba(18, 17, 39, 0.02);
    border: none;
    padding: 0;
    margin: 0;
}

.product__table--grid-small .product__cell {
    display: grid;
    grid-template-columns: repeat(2, calc(50% - 4px));
    column-gap: 8px;
    align-items: baseline;
    padding: 0px 12px 8px;
    margin: 0 0 2px;
    border: none;
    width: auto;
}

.product__table--grid-small .product__cell.product__cell-price{
    grid-template-columns: 100%;
}

.product__table--grid-small .catalog-product__item-title {
    display: block;
    font-size: 12px;
    color: var(--black);
}

.product__table--grid-small .catalog-product__item-text {
    color: var(--grey-5);
}

.product__table--grid-small .catalog-product__item-link {
    font-size: 10px;
    overflow: hidden;
}

@media (min-width: 48rem) {
    .product__table--grid-small .catalog-product__item-title,
    .product__table--grid-small .catalog-product__item-link {
        font-size: 14px;
    }
}

.product__table--grid-small .product__cell:first-of-type {
    padding: 6px 12px 8px;
    order: 1;
}

.product__table--grid-small .product__cell:first-of-type .catalog-product__item-title {
    display: none;
}

.product__table--grid-small .product__cell:first-of-type .catalog-product__item-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--black, #202124);
}

.product__table--grid-small .product__cell:not(:first-of-type):not(.product__cell-price):not(:has(.product__buttons)) {
    order: 2;
}

.product__table--grid-small .product__cell-price {
    order: 0;
    flex-shrink: 0;
}

.product__table--grid-small .product__cell-price .product__cell-image {
    display: block;
    width: 100%;
    height: 158px;
    flex-shrink: 0;
    object-fit: cover;
    object-position: center;
    background: #F6F6F7;
}

@media (min-width: 48rem) {
    .product__table--grid-small .product__cell-price .product__cell-image {
        height: 231px;
    }
}


.product__cell-price{
    white-space: nowrap;
}

.product__cell-price .product__cell-image img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.product__table--grid-small .product__cell:has(.product__buttons) {
    order: 4;
    margin-top: auto;
    padding: 0px 0 0;
    width: auto;
    grid-template-columns: 100%;
    flex: 1 1;
}

.product__table--grid-small .product__count{
    display: flex;
    padding: 0;
    width: 100%;
}

.product__table--grid-small .product__buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 8px 0 0;
    width: 100%;
}

.product__table--grid-small .product__count .count__input {
    width: inherit;
}

.product__table--grid-small .product__cart-btn {
    width: 100%;
    height: 50px;
    font-size: 14px;
}

@media (min-height: 48rem) {
    .product__table--grid-small .product__cart-btn{
        font-size: 16px;
    }
}
