/* ==================== БЛОК СО СКИДКАМИ /css/sale.css ==================== */
.sale-container {
    display: block;
    justify-content: center;
    padding: 5px;
    margin-top: 12vh;
    width: 70%;
    margin-left: 15%;
}

.saletitle {
    margin: 0;
    padding: 0;
    margin-left: 5px;
    font-size: clamp(22px, 2.7vw, 32px);
}

.saledesc {
    font-size: clamp(14px, 1.4vw, 18px);
    margin-left: 5px;
    margin-block-start: 10px;
    margin-block-end: 10px;
}

.sale-block {
    width: 100%;
    background: white;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: white;
}

.sale-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

/* Карточка товара */
.sale-item {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    border: 1px solid black;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    background-color: white;
    height: 200px;
    width: calc(50% - 10px);
    flex: 1 1 calc(50% - 10px);
    min-width: clamp(280px, 45vw, 400px);
    cursor: pointer;
    position: relative;
}

.sale-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Кнопка "Добавить в корзину" */
.sale-item .add-to-cart {
    margin-top: auto !important;
    width: 100%;
    padding: 13px 10px;
    background: black;
    color: white;
    border: 1px solid black;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    font-size: clamp(16px, 1vw, 32px);
}

.sale-item .add-to-cart:hover {
    color: black;
    background-color: white;
}

.sale-item img {
    width: 180px;
    height: 100%;
    object-fit: contain;
    flex-shrink: 0;
    border-right: 1px solid black;
}

.sale-item-info {
    padding: 5px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sale-item-info > *:not(.add-to-cart) {
    flex-shrink: 0;
}

.sale-item-name {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.sale-item-size, .sale-item-price, .sale-item-details {
    font-size: 1em;
    color: #555;
}

.sale-item-details {
    position: relative;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin: 5px 0;
}

.sale-item-details::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 1) 100%
    );
}

/* === СОСТОЯНИЕ "В КОРЗИНЕ" (ПО УМОЛЧАНИЮ) === */
.add-to-cart.in-cart {
    background: white !important;
    background-image: linear-gradient(135deg, #ff00ff, #00ffff) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    transform: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

/* === СОСТОЯНИЕ "В КОРЗИНЕ" ПРИ НАВЕДЕНИИ === */
.add-to-cart.in-cart:hover {
    background: white !important;
    background-image: none !important; /* Убираем градиент фона, чтобы текст был просто красным */
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: #ff0000 !important; /* Красный цвет текста */
    color: #ff0000 !important;
    transform: translateY(-2px) !important; /* Сдвиг как при обычном наведении */
    box-shadow: 0 6px 20px rgba(255, 0, 0, 0.4) !important; /* Красная тень */
}

/* === НАЖАТИЕ НА КНОПКУ "В КОРЗИНЕ" === */
.add-to-cart.in-cart:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.2) !important;
}

/* ==================== АДАПТИВ ДЛЯ МОБИЛОК ==================== */
@media (max-aspect-ratio: 1/1) {
    .saledesc {
        margin-block-start: 5px;
        margin-block-end: 5px;
    }
    .sale-container {
        display: block;
        margin-top: 8vh;
        padding: 5px;
        width: 100%;
        margin-left: 0;
        box-sizing: border-box; /* Важно! */
        overflow-x: hidden; /* Защита от вылезания */
    }

    .sale-block {
        background: white;
        border-radius: 10px;
        padding: 10px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
        width: 100%;
    }

    .sale-items {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .sale-item {
        display: flex;
        flex-wrap: nowrap;
        align-items: stretch;
        border: 1px solid black;
        border-radius: 10px;
        overflow: hidden;
        transition: transform 0.3s, box-shadow 0.3s;
        background-color: white;
        min-height: 170px;
        height: 22vh;
        cursor: pointer;
        width: 100%;
        box-sizing: border-box; /* Чтобы border не добавлял ширину */
        
        /* Перебиваем базовый min-width */
        min-width: 0 !important;
        max-width: 100%;
    }

    /* Перебиваем базовый width: 180px */
    .sale-item img {
        width: 130px !important; /* Фиксированная ширина для мобилок */
        min-height: 100%;
        object-fit: contain;
        border-right: 1px solid black;
        flex: 0 0 130px;
        box-sizing: border-box;
    }

    .sale-item-info {
        padding: 5px;
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        overflow: hidden; /* Чтобы длинный текст не выталкивал */
    }

    .sale-item-name {
        font-size: 1.1em;
        font-weight: bold;
        margin-bottom: 5px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .sale-item-size, .sale-item-price, .sale-item-details {
        font-size: 0.95em;
        color: #555;
    }

    .sale-item-details {
        position: relative;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
        max-width: 100%;
        white-space: nowrap;
        text-overflow: ellipsis;
        margin: 0 0 3px 0;
        min-height: 1em;
    }

    .sale-item-details::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 40px;
        background: linear-gradient(
            to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 1) 100%
        );
        pointer-events: none;
    }

    .sale-item .add-to-cart {
        margin-top: auto !important;
        width: 100%;
        padding: 10px 5px;
        background: black;
        color: white;
        border: 1px solid black;
        border-radius: 14px;
        cursor: pointer;
        white-space: nowrap;
        font-size: 14px;
        box-sizing: border-box;
    }
}