/* cart.css — страница корзины (checkout/cart.html).
   Язык оформления «Маркетплейс»: серый фон страницы, белые карточки с radius 12,
   круглые иконки на --primary-soft, primary-кнопки высотой 44.
   Степпер количества и удаление обслуживает theme.js по data-атрибутам —
   здесь только оформление. */

.section--cart { padding: 24px 0 56px; }

.cart-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 20px;
}
.cart-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink, #2d2d32);
}
.cart-head__count { font-size: 14px; color: var(--muted, #8d8d8d); }

/* ── Раскладка: список + липкая сводка ─────────────────────────────────── */
.cart {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

/* ── Список позиций ────────────────────────────────────────────────────── */
.cart-list {
    background: var(--card, #fff);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(16, 24, 40, .04));
    padding: 6px 18px;
}

.cart-row {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) auto 124px 110px 40px;
    gap: 18px;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--line, #e8e8e8);
}
.cart-row:last-child { border-bottom: 0; }

.cart-row__media {
    width: 80px; height: 80px;
    display: grid; place-items: center;
    border-radius: var(--radius-sm, 8px);
    background: var(--surface, #f6f5f3);
    overflow: hidden;
}
.cart-row__media img { width: 100%; height: 100%; object-fit: contain; }
.cart-row__noimg { color: var(--muted, #8d8d8d); font-size: 24px; }

.cart-row__info { min-width: 0; }
.cart-row__name {
    display: block;
    font-size: 14px; font-weight: 500; line-height: 1.4;
    color: var(--ink, #2d2d32);
    transition: color .15s ease;
}
.cart-row__name:hover { color: var(--primary, #4652ff); }
.cart-row__sku {
    display: inline-block; margin-top: 6px;
    padding: 2px 8px; border-radius: var(--radius-pill, 999px);
    background: var(--surface, #f6f5f3);
    font-size: 12px; color: var(--muted, #8d8d8d);
}
.cart-row__services {
    margin: 8px 0 0; padding: 0; list-style: none;
    display: flex; flex-direction: column; gap: 3px;
    font-size: 12px; color: var(--muted, #8d8d8d);
}
.cart-row__services li { display: flex; gap: 6px; }
.cart-row__services li::before { content: "+"; color: var(--primary, #4652ff); font-weight: 700; }

/* Цена за единицу: старая цена сверху, действующая — крупнее */
.cart-row__price { font-size: 14px; color: var(--ink-2, #3a3a44); white-space: nowrap; }
.cart-row__old { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted, #8d8d8d); text-decoration: line-through; }
.cart-row__now { font-weight: 500; }
.cart-row__now.is-sale { color: var(--badge, #ff0638); font-weight: 700; }
.cart-row__unit { color: var(--muted, #8d8d8d); font-size: 12px; }
.cart-row__reasons { margin: 6px 0 0; padding: 0; list-style: none; white-space: normal; }
.cart-row__reasons li { font-size: 12px; line-height: 1.35; color: var(--success, #058427); }

.cart-row__total {
    font-size: 18px; font-weight: 700;
    color: var(--ink, #2d2d32);
    white-space: nowrap; text-align: right;
}

/* Удаление — всегда корзина, не крестик */
.cart-row__remove {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: var(--surface, #f6f5f3);
    color: var(--muted, #8d8d8d);
    font-size: 15px; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.cart-row__remove:hover { background: #fdecee; color: var(--badge, #ff0638); }

/* ── Счётчик количества (дробный шаг приходит в data-step/data-min) ─────── */
.cart-qty {
    display: inline-flex; align-items: center;
    border: 1px solid var(--line, #e8e8e8);
    border-radius: var(--radius-pill, 999px);
    background: var(--card, #fff);
    overflow: hidden;
}
.cart-qty__btn {
    width: 38px; height: 40px;
    border: 0; background: none; cursor: pointer;
    font-size: 18px; line-height: 1; color: var(--ink-2, #3a3a44);
    transition: background .15s ease, color .15s ease;
}
.cart-qty__btn:hover { background: var(--primary-soft, #eeefff); color: var(--primary, #4652ff); }
.cart-qty__input {
    width: 54px; height: 40px;
    border: 0; background: none;
    text-align: center; font: inherit; font-size: 14px; font-weight: 600;
    color: var(--ink, #2d2d32);
}
.cart-qty__input:focus { outline: none; }

/* ── Низ списка: продолжить покупки ────────────────────────────────────── */
.cart-foot { grid-column: 1; margin-top: 16px; }
.cart-foot__back {
    display: inline-flex; align-items: center; gap: 10px;
    height: 44px; padding: 0 20px;
    border-radius: var(--radius, 12px);
    background: var(--card, #fff);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(16, 24, 40, .04));
    font-size: 14px; font-weight: 500; color: var(--ink-2, #3a3a44);
    transition: color .15s ease, box-shadow .15s ease;
}
.cart-foot__back i { color: var(--primary, #4652ff); }
.cart-foot__back:hover { color: var(--primary, #4652ff); box-shadow: var(--shadow-hover, 0 12px 28px rgba(16, 24, 40, .10)); }

/* ── Сводка ────────────────────────────────────────────────────────────── */
.cart-summary {
    position: sticky; top: 16px;
    display: flex; flex-direction: column; gap: 12px;
    padding: 22px;
    background: var(--card, #fff);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(16, 24, 40, .04));
}
.cart-summary__title { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--ink, #2d2d32); }
.cart-summary__row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    font-size: 14px; color: var(--muted, #8d8d8d);
}
.cart-summary__row > span:last-child { color: var(--ink, #2d2d32); font-weight: 500; }
.cart-summary__row--discount > span:last-child { color: var(--success, #058427); font-weight: 600; }
.cart-summary__row--total {
    padding-top: 14px; margin-top: 2px;
    border-top: 1px solid var(--line, #e8e8e8);
    font-size: 15px; color: var(--ink, #2d2d32); font-weight: 600;
}
.cart-summary__row--total > span:last-child { font-size: 22px; font-weight: 700; }

/* За что дана скидка: пояснение к строке выше — мельче и со сдвигом */
.cart-summary__rules { list-style: none; margin: 0; padding: 0 0 0 10px; display: flex; flex-direction: column; gap: 4px; }
.cart-summary__rules li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted, #8d8d8d); }

.cart-summary__checkout {
    display: flex; align-items: center; justify-content: center;
    height: 48px; margin-top: 4px;
    border-radius: var(--radius, 12px);
    background: var(--primary, #4652ff); color: #fff;
    font-size: 15px; font-weight: 600;
    transition: background .15s ease;
}
.cart-summary__checkout:hover { background: var(--primary-600, #3742e0); }
.cart-summary__checkout.is-disabled { background: var(--muted, #8d8d8d); pointer-events: none; }

.cart-summary__continue {
    display: block; text-align: center; padding: 4px;
    font-size: 14px; color: var(--muted, #8d8d8d);
}
.cart-summary__continue:hover { color: var(--primary, #4652ff); }

/* Сколько осталось до бесплатной доставки */
.cart-summary__free {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border-radius: var(--radius-sm, 8px);
    background: rgba(5, 132, 39, .08); color: var(--success, #058427);
    font-size: 13px; line-height: 1.4;
}
/* Заказ меньше минимальной суммы — оформление недоступно */
.cart-summary__warn {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 14px; border-radius: var(--radius-sm, 8px);
    background: rgba(255, 6, 56, .07); color: var(--badge, #ff0638);
    font-size: 13px; line-height: 1.4;
}
.cart-summary__warn i { margin-top: 2px; }

/* ── Пустая корзина ────────────────────────────────────────────────────── */
.cart-empty {
    text-align: center; padding: 56px 24px;
    background: var(--card, #fff);
    border-radius: var(--radius, 12px);
    box-shadow: var(--shadow-card, 0 1px 2px rgba(16, 24, 40, .04));
}
.cart-empty__ico {
    width: 88px; height: 88px; margin: 0 auto 20px;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--primary-soft, #eeefff); color: var(--primary, #4652ff);
    font-size: 34px;
}
.cart-empty__title { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--ink, #2d2d32); }
.cart-empty__hint { margin: 0 0 22px; font-size: 14px; color: var(--muted, #8d8d8d); }
.cart-empty__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 44px; padding: 0 26px;
    border-radius: var(--radius, 12px);
    background: var(--primary, #4652ff); color: #fff;
    font-size: 15px; font-weight: 600;
    transition: background .15s ease;
}
.cart-empty__btn:hover { background: var(--primary-600, #3742e0); }

/* Кнопка «в корзину» — подтверждение при добавлении */
.pcard__buy.is-added, .product-buy.is-added { background: var(--success, #058427) !important; }

/* ── Адаптив ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .cart { grid-template-columns: minmax(0, 1fr) 300px; }
    .cart-row { grid-template-columns: 72px minmax(0, 1fr) auto 104px 96px 40px; gap: 14px; }
}
@media (max-width: 992px) {
    .cart { grid-template-columns: 1fr; }
    .cart-summary { position: static; order: 2; }
    .cart-list { order: 1; }
    .cart-foot { order: 3; }
}
@media (max-width: 768px) {
    .cart-list { padding: 4px 14px; }
    .cart-row {
        grid-template-columns: 72px minmax(0, 1fr) 40px;
        grid-template-areas:
            "media info remove"
            "media price price"
            "qty   total total";
        gap: 10px 14px;
        padding: 16px 0;
    }
    .cart-row__media { grid-area: media; width: 72px; height: 72px; align-self: start; }
    .cart-row__info { grid-area: info; }
    .cart-row__price { grid-area: price; white-space: normal; }
    .cart-row__remove { grid-area: remove; align-self: start; }
    .cart-qty { grid-area: qty; justify-self: start; }
    .cart-row__total { grid-area: total; align-self: center; }
}
@media (max-width: 480px) {
    .cart-title { font-size: 22px; }
    .cart-row { grid-template-columns: 64px minmax(0, 1fr) 40px; }
    .cart-row__media { width: 64px; height: 64px; }
    .cart-empty { padding: 40px 18px; }
}
