/* Карточка товара и её адаптивные состояния. */

.product-card {
    position: relative;
    height: 100%;
    padding-bottom: 63px;
    border: 1px solid #f3f3f3;
}

.product-card--filter .product-card__img {
    height: auto;
    max-height: 180px;
}

.product-card__img {
    font-size: 0;
    line-height: 0;
    display: block;
    width: 100%;
    height: 180px;
    margin: 0 0 20px 0;
    text-align: center;
}

.product-card__img:before {
    display: inline-block;
    height: 100%;
    content: '';
    vertical-align: middle;
}

.product-card__img img {
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
    vertical-align: middle;
}

.product-card__caption {
    padding: 0 15px;
}

.product-card__text a {
    text-decoration: underline;
    font-weight: bold;
}

.product-card__text a:hover {
    text-decoration: none;
}

.product-card__params {
    padding: 0 0 10px 0;
}

.product-card__params:after {
    display: block;
    clear: both;
    content: ' ';
}

.product-card__params-term {
    float: left;
    clear: both;
    width: 50%;
}

.product-card__params-descr {
    font-weight: 700;
    float: left;
    width: 50%;
}

.product-card__actions {
    position: absolute;
    right: 8px;
    bottom: 15px;
    left: 8px;
}

.product-card__actions:after {
    display: block;
    clear: both;
    content: ' ';
}

.product-card__actions-left {
    float: left;
    width: 56%;
    padding: 0 8px;
}

.product-card__actions-right {
    float: left;
    width: 44%;
    padding: 0 8px;
}

.product-card__inputs {
    position: relative;
    padding: 0 40px 0 0;
}

.product-card__inputs input[type='text'] {
    text-align: center;
}

.product-card__inputs-togglebox {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
}

.product-card__inputs-toggler {
    display: block;
    width: 100%;
    cursor: pointer;
}

.product-card__inputs-toggler input[type='radio'] {
    display: none;
}

.product-card__inputs-toggler input[type='radio']:checked + span {
    color: #fff;
    background: #599c28;
}

.product-card__inputs-toggler span {
    font-size: 16px;
    line-height: 16px;
    display: block;
    padding: 4px 1px;
    text-align: center;
    background: #f3f3f3;
}

.product-card__stock {
    font-size: 14px;
    line-height: 1;
    position: absolute;
    top: 7px;
    right: -9px;
    padding: 5px 13px 5px 8px;
    color: #fff;
    background-color: #e40606;
}

.product-card__stock::after {
    position: absolute;
    bottom: -9px;
    right: 0;
    transform: rotate(270deg);
    width: 0;
    height: 0;
    content: '';
    border-width: 0 9px 9px 0;
    border-style: solid;
    border-color: transparent #e40606 transparent transparent;
}

a.product-card__img {
    width: 100%;
    height: 286px;
    aspect-ratio: 1 / 1;
}

a.product-card__img img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

div.product-card a.product-card__img {
    max-height: 100%;
}

/**
 * Индикатор наличия выводится в partials/catalog/product-card.php.
 * Данные готовит Tools\Catalog::buildProductCard(); значок stock-dot выводит Tools\Icons.
 * Стили подключают потребители карточек: список и слайдер сопутствующих товаров.
 */

.in-stock {
    display: flex;
    align-items: center;
    gap: 5px;
    border-top: 1px solid #f3f3f3;
    border-bottom: 1px solid #f3f3f3;
    margin: 0 0 10px 0;
    padding: 5px 0;
}

.in-stock .lw-icon {
    width: 8px;
    height: 8px;
}

/* Цвет кружка; fill в CSS перекрывает fill="currentColor" из разметки иконки */
.in-stock .lw-icon.green-dot {
    color: #599c28;
}

.in-stock .lw-icon.grey-dot {
    color: #aaaaaa;
}

.in-stock .lw-icon.orange-dot {
    color: #eb8c18;
}

.in-stock span {
    font-weight: bold;
}

@media (max-width: 1255px) {
    .product-card--filter {
        padding-bottom: 119px;
    }

    .product-card--filter .product-card__img {
        margin-bottom: 10px;
    }

    .product-card--filter .product-card__actions-left {
        float: none;
        width: 100%;
        margin-bottom: 8px;
    }

    .product-card--filter .product-card__actions-right {
        float: none;
        width: 100%;
    }

    .product-card--filter .product-card__inputs {
        padding-right: 96px;
    }

    .product-card--filter .product-card__inputs-togglebox {
        width: 96px;
    }

    .product-card--filter .product-card__inputs-togglebox:after {
        display: block;
        clear: both;
        content: ' ';
    }

    .product-card--filter .product-card__inputs-toggler {
        float: left;
        width: 48px;
    }

    .product-card--filter .product-card__inputs-toggler span {
        line-height: 39px;
        height: 48px;
    }
}

@media (max-width: 767px) {
    .product-card--filter .product-card__inputs {
        padding-right: 120px;
    }

    .product-card--filter .product-card__inputs-togglebox {
        width: 120px;
    }

    .product-card--filter .product-card__inputs-toggler {
        width: 60px;
    }
}

@media (max-width: 400px) {
    .product-card__stock {
        right: -4px;
    }

    .product-card__stock::after {
        content: none;
    }
}

@media (max-width: 768px) {
    a.product-card__img {
        max-width: 100%;
    }
    div.product-card__actions {
        display: flex;
        flex-direction: column;
    }

    div.product-card a.product-card__img {
        height: fit-content;
    }

    dl.product-card__params {
        display: flex;
        flex-direction: column;
    }

    div.product-card__actions-left,
    div.product-card__actions-right,
    div.product-card__inputs,
    dd.product-card__params-descr,
    dt.product-card__params-term {
        width: 100%;
    }

    div.product-card__actions-right {
        margin-top: 16px;
        padding: 0;
    }

    div.product-card__actions {
        position: unset;
    }

    div.product-card {
        padding-bottom: 16px;
    }
}
