/* Products */

a {
    text-decoration: none;
}

.products {
    padding-bottom: 100px;
}

.products.padding-y {
    padding: 100px 0;
}

.products__list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 20px 5px;
}

.products__card {
    display: flex;
    flex-direction: column;
    width: 280px;
    border: 1px solid #FF7A00;
    position: relative;
    overflow: hidden;
    height: 450px;
    box-sizing: border-box; /* Защита от вылезания рамок */
}

.products__imgWrapper {
    width: 100%; /* Вместо фиксированных 278px, чтобы подстраивалось под рамку */
    height: 260px;
    margin-bottom: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.products__imgWrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.products__description {
    font-size: 14px;
    line-height: 17px;
    text-align: center;
    color: #000000;
    margin-bottom: 12px;
    padding: 0 15px; /* Немного уменьшили, чтобы длинные названия помещались */
    height: 51px; /* Высота ровно под 3 строчки текста */
    overflow: hidden;
    text-overflow: ellipsis; /* Если текст не поместится, аккуратно поставит три точки */
}

.products__priceWrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.products__priceWrapper .products__price {
    text-align: initial;
    margin-bottom: 0;
}

.products__lineThrough {
    color: red;
    text-decoration: line-through;
}

.products__oldPrice {
    font-weight: bold;
    font-size: 16px;
    line-height: 19px;
    color: #000000;
    margin-right: 10px;
}

.products__price {
    font-weight: bold;
    font-size: 16px;
    line-height: 19px;
    text-align: center;
    color: #000000;
    margin-bottom: 10px;
}

/* Обертка кнопки */
.justify-center {
    display: flex;
    justify-content: center;
    margin-top: auto; /* МАГИЯ: толкает кнопку в самый низ карточки, выравнивая все кнопки в ряд */
    margin-bottom: 15px;
}

.products__btn {
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    width: 200px;
    height: 40px;
    background: #FF7A00;
    border-radius: 5px;
    font-weight: 900;
    font-size: 14px;
    line-height: 17px;
    color: #FFFFFF;
    text-transform: uppercase;
    transition: background 0.3s;
}

.products__btn:hover {
    background: #e06c00; /* Эффект при наведении на кнопку */
}

.products__new {
    width: 50px;
    height: 35px;
    background: #008DDC;
    font-weight: bold;
    font-size: 16px;
    line-height: 19px;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

.products__discount {
    width: 100px;
    height: 35px;
    background: #FF0000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    line-height: 19px;
    color: #FFFFFF;
    text-transform: uppercase;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}

/* Media Query */

@media (max-width: 1300px) {
    .products__list {
        justify-content: center;
        align-items: center;
        justify-items: center;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .products__card{
        width: 230px;
        height: 450px;
    }
}

@media (max-width: 1000px) {
    .products__list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .products {
        padding-bottom: 50px;
    }
}

@media (max-width: 450px) {
    .products__list {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 10px 5px;
    }
    .products__card {
        width: 100%; /* Чтобы карточки красиво занимали половину экрана мобильного */
        max-width: 170px;
        height: 320px;
    }
    .products__imgWrapper {
        width: 100%;
        height: 140px;
    }
    .products__description {
        font-size: 12px;
        line-height: 14px;
        padding: 0 5px;
        margin-bottom: 5px;
        height: 42px;
    }
    .products__price {
        font-size: 14px;
        line-height: 17px;
    }
    .justify-center {
        margin-bottom: 10px;
    }
    .products__btn {
        width: 120px;
        height: 28px;
        font-size: 11px;
    }
    .products__new {
        width: 35px;
        height: 22px;
        font-size: 10px;
    }
    .products__discount {
        width: 50px;
        height: 22px;
        font-size: 10px;
    }
    .products__priceWrapper {
        flex-direction: column;
    }
    .products__oldPrice {
        margin-right: 0;
        font-size: 12px;
        line-height: 14px;
    }
}