/*
 * Лаборатория Кошмарского — cart.css
 * Корзина: кнопка в шапке, выезжающая панель справа, всплывающее уведомление.
 * Работает в паре с js/cart.js.
 */

/* ===== КНОПКА В ШАПКЕ ===== */
.header__cart {
    position: relative;
    margin-right: 18px;
    color: #161918;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.header__cart:hover {
    color: #6B1A1E;
    text-decoration: none;
}

.header__cart i {
    font-size: 17px;
}

.header__cart-badge {
    position: absolute;
    top: -9px;
    left: 11px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #6B1A1E;
    border: 2px solid #ffffff;
    border-radius: 9px;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.header__cart-badge.is-bump {
    animation: cart-bump .35s;
}

@keyframes cart-bump {
    50% { transform: scale(1.4); }
}

/* ===== ПАНЕЛЬ ===== */
.cart-open,
.cart-open body {
    overflow: hidden;
}

.cart {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9500;
    visibility: hidden;
}

.cart.is-open {
    visibility: visible;
}

.cart__shade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 8, .6);
    opacity: 0;
    transition: opacity .25s;
}

.cart.is-open .cart__shade {
    opacity: 1;
}

/* Панель выезжает справа: в закрытом виде сдвинута за край экрана на всю свою ширину */
.cart__panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background: #E4E7E3;
    box-shadow: -6px 0 24px rgba(0, 0, 0, .45);
    transform: translateX(100%);
    transition: transform .25s ease-out;
}

.cart.is-open .cart__panel {
    transform: none;
}

.cart__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(#3B4241, #1B1F1F);
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
}

.cart__close {
    padding: 0 4px;
    background: none;
    border: 0;
    color: #AEB2AD;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.cart__close:hover {
    color: #ffffff;
}

/* Список прокручивается сам, а итог с кнопками всегда прижат к низу */
.cart__list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 18px;
}

.cart__empty {
    flex: 1;
    padding: 30px 18px;
    color: #4F5654;
    text-align: center;
}

.cart__item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #BCC0BB;
}

.cart__info {
    flex: 1;
    min-width: 0;
    padding-right: 10px;
}

.cart__name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.cart__unit {
    color: #4F5654;
    font-size: 12px;
}

.cart__qty {
    display: flex;
    flex-shrink: 0;
}

.cart__qty-btn {
    width: 24px;
    height: 26px;
    padding: 0;
    background: linear-gradient(#FFFFFF, #CDD1CC);
    border: 1px solid #9EA39E;
    color: #161918;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.cart__qty-input {
    width: 54px;
    height: 26px;
    border: 1px solid #9EA39E;
    border-left: 0;
    border-right: 0;
    font-family: inherit;
    font-size: 13px;
    text-align: center;
    /* Убираем стрелки у поля-числа: у нас свои кнопки − и + */
    -moz-appearance: textfield;
}

.cart__qty-input::-webkit-outer-spin-button,
.cart__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart__line {
    flex-shrink: 0;
    width: 82px;
    padding-left: 8px;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.cart__remove {
    flex-shrink: 0;
    margin-left: 6px;
    padding: 0 2px;
    background: none;
    border: 0;
    color: #7B817E;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cart__remove:hover {
    color: #6B1A1E;
}

.cart__foot {
    padding: 14px 18px 16px;
    background: #D5D8D4;
    border-top: 1px solid #9EA39E;
}

.cart__total {
    margin-bottom: 12px;
    font-size: 16px;
}

.cart__total b {
    color: #6B1A1E;
}

.cart__clear {
    display: block;
    margin: 10px auto 0;
    padding: 0;
    background: none;
    border: 0;
    color: #4F5654;
    font: inherit;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

.cart__small {
    margin: 10px 0 0;
    color: #7B817E;
    font-size: 9px;
    line-height: 1.35;
}

/* ===== УВЕДОМЛЕНИЕ «ДОБАВЛЕНО В КОРЗИНУ» ===== */
.cart-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9600;
    max-width: 320px;
    padding: 12px 16px;
    background: #101313;
    border-left: 4px solid #6B1A1E;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
    color: #ffffff;
    font-size: 13px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}

.cart-toast.is-shown {
    opacity: 1;
    transform: none;
}

/* ===== ТЕМА 2010 ===== */
.theme-2010 .cart__panel {
    background: linear-gradient(#F2F3F1, #DADDD9);
}

.theme-2010 .cart__head {
    background: linear-gradient(#8E2A31, #5A1519);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, .4);
}

.theme-2010 .cart__qty-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.theme-2010 .cart__qty-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.theme-2010 .header__cart {
    text-decoration: none;
}

@media (max-width: 600px) {
    .header__cart {
        margin-right: 12px;
        font-size: 0;   /* на телефоне только значок, без слова «Корзина» */
    }

    .header__cart i {
        font-size: 19px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart__panel,
    .cart__shade,
    .cart-toast {
        transition: none;
    }
}
