/* Cart per Figma "М. Корзина" / "Корзина". Loaded after cart.css and cart-card.css. */

.cart {
    gap: 15px;
}

.cart__empty {
    background: var(--belyy);
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.07);
}

/* ---- select all (phones) ---- */
.cart__all {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding: 0 0 2px;
}

.cart__all-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.cart__all-delete {
    padding: 0;
    border: 0;
    background: none;
    font: 500 15px/140% var(--font-family);
    color: var(--firmennyy);
    cursor: pointer;
}

.cart__all-delete[hidden] {
    display: none;
}

.cart-card__radio {
    position: relative;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--chernyy);
    border-radius: 50%;
    background: var(--belyy);
    box-sizing: border-box;
}

input:checked + .cart-card__radio {
    background: var(--chernyy);
    box-shadow: inset 0 0 0 3px var(--belyy);
}

.cart-card__checker {
    display: flex;
    cursor: pointer;
}

/* ---- card ---- */
.cart__cards-wrapper {
    gap: 5px;
}

.cart-card {
    grid-template-columns: 90px minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 6px 15px;
    padding: 12px;
}

.cart-card__media {
    grid-area: 1 / 1 / 4 / 2;
    width: 90px;
    height: 90px;
    aspect-ratio: 1;
    align-self: start;
    padding: 8px;
}

.cart-card__media img {
    object-fit: contain;
}

.cart-card__info-price {
    grid-area: 1 / 2 / 2 / 3;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    padding-right: 34px;
}

.cart-card__current-price {
    font-size: 16px;
    line-height: 140%;
    font-weight: 700;
}

.cart-card__old-price {
    font-size: 11px;
    font-weight: 400;
}

.cart-card__text {
    grid-area: 2 / 2 / 3 / 3;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.cart-card__title {
    max-height: none;
    font-weight: 500;
    font-size: 15px;
    line-height: 140%;
}

.cart-card__text dl.variation {
    margin: 0;
    font: 400 12px/130% var(--font-family);
    color: var(--seryy);
}

.cart-card__text dl.variation dt,
.cart-card__text dl.variation dd {
    display: inline;
    margin: 0;
}

.cart-card__text dl.variation dd p {
    display: inline;
    margin: 0;
}

/* "Цвет: Оранжевый · Память: 256 ГБ · Тип SIM: Nano-SIM" — the pairs ran together without a separator */
.cart-card__text dl.variation dd:not(:last-child)::after {
    content: " · ";
    white-space: pre;
}

.cart-card__rating-menu {
    display: none;
    align-items: center;
    gap: 5px;
    font: 500 15px/140% var(--font-family);
}

.cart-card__rating-icon {
    width: 16px;
}

.cart-card__reviews-count {
    display: flex;
    gap: 4px;
    color: var(--seryy);
}

.cart-card__counter {
    grid-area: 3 / 2 / 4 / 3;
    align-self: end;
    height: 37px;
}

.cart-card__checker {
    position: absolute;
    top: 12px;
    right: 12px;
}

.cart-card__actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
}

.cart-card__actions--menu {
    display: flex;
}

.cart-card__actions-fav,
.cart-card__actions-remove {
    display: none;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.cart-card__actions-fav img,
.cart-card__actions-remove img {
    display: block;
    width: 100%;
    height: auto;
}

.cart-card__actions-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 32px;
    height: 24px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.cart-card__actions-more span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--chernyy);
}

/* ---- totals ---- */
.details__summary-dropdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 6px 0 0 12px;
}

.details__summary-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font: italic 500 12px/140% var(--font-family);
    color: var(--seryy);
}

.details__summary-line span:first-child::after {
    content: "";
}

.details__summary-line span:last-child {
    margin-left: auto;
}

.details__points {
    margin: -4px 0 0;
    text-align: right;
    font: 500 15px/140% var(--font-family);
    color: var(--chernyy);
}

.details .details__final-value {
    color: var(--firmennyy);
}

/* ---- phones: sticky bar above the tab bar ---- */
@media (max-width: 767px) {
    .cart {
        padding-bottom: 170px;
    }

    .cart__bottom-menu {
        bottom: calc(74px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 20px 0 rgba(0, 0, 0, 0.08);
    }

    .cart__bottom-summary {
        padding: 12px 15px;
        gap: 15px;
    }

    .cart__bottom-info {
        flex: 0 0 auto;
    }

    .cart__bottom-confirm {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 48px;
        text-decoration: none;
    }

    .cart__recommend .scrolling-cards {
        gap: 5px;
    }
}

/* ---- tablet and desktop ---- */
@media (min-width: 768px) {
    .cart__all {
        display: none;
    }

    .cart-card {
        grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto;
        grid-template-rows: auto 1fr auto;
        gap: 10px 20px;
        padding: 20px;
        max-width: none;
    }

    .cart-card__media {
        grid-area: 1 / 1 / 4 / 2;
        width: 100%;
        height: auto;
        padding: 20px;
    }

    .cart-card__text {
        grid-area: 1 / 2 / 3 / 3;
        gap: 8px;
        padding-right: 90px;
    }

    .cart-card__title {
        font-size: clamp(16px, 1.3vw, 20px);
        font-weight: 500;
    }

    .cart-card__rating-menu {
        display: flex;
    }

    .cart-card__counter {
        grid-area: 3 / 2 / 4 / 3;
        height: 51px;
    }

    .cart-card__info-price {
        grid-area: 3 / 3 / 4 / 4;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
        padding: 0;
        align-self: end;
    }

    .cart-card__current-price {
        font-size: clamp(20px, 1.8vw, 30px);
        font-weight: 500;
        line-height: 117%;
    }

    .cart-card__old-price {
        font-size: clamp(14px, 1.2vw, 20px);
        font-weight: 400;
    }

    .cart-card__checker {
        display: none;
    }

    .cart-card__actions {
        top: 20px;
        right: 20px;
        bottom: auto;
        gap: 18px;
    }

    .cart-card__actions-more {
        display: none;
    }

    .cart-card__actions-fav,
    .cart-card__actions-remove {
        display: flex;
    }

    .cart__bottom-menu {
        display: none;
    }

    .cart {
        gap: 30px;
    }
}

@media (min-width: 1200px) {
    .cart {
        grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
        grid-template-rows: auto auto;
        row-gap: 60px;
        column-gap: 30px;
    }

    .cart__compound {
        grid-area: 1 / 1 / 2 / 2;
    }

    .cart__details {
        grid-area: 1 / 2 / 2 / 3;
        margin-top: 68px;
        position: sticky;
        top: 20px;
    }

    .cart__recommend {
        grid-area: 2 / 1 / 3 / 3;
        min-width: 0;
    }
}

@media (min-width: 1900px) {
    .cart {
        grid-template-columns: minmax(0, 1fr) 595px;
    }

    .cart__recommend {
        grid-area: 2 / 1 / 3 / 2;
    }
}

/* ---- modals (delete confirmation, item actions) ---- */
.cart__recommend {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.cart-modal[hidden] {
    display: none;
}

.cart-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.cart-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 27, 27, 0.5);
}

.cart-modal__dialog {
    position: relative;
    width: min(100%, 360px);
    padding: 20px 15px;
    background: var(--belyy);
    box-shadow: 0 0 30px 0 rgba(0, 0, 0, 0.2);
    font-family: var(--font-family);
}

.cart-modal__text {
    margin: 0 0 20px;
    font: 500 16px/150% var(--font-family);
    color: var(--chernyy);
}

.cart-modal__buttons {
    display: flex;
    gap: 5px;
}

.cart-modal__btn {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 51px;
    border: 0;
    background: var(--svetlo-seryy);
    font: 500 15px/140% var(--font-family);
    color: var(--chernyy);
    text-decoration: none;
    cursor: pointer;
}

.cart-modal__btn--yes {
    background: var(--firmennyy);
    color: var(--belyy);
}

.cart-modal--sheet {
    align-items: flex-end;
    padding: 0;
}

.cart-modal--sheet .cart-modal__dialog {
    width: 100%;
    padding: 20px 15px calc(20px + env(safe-area-inset-bottom, 0px));
}

.cart-modal__title {
    margin: 0 0 15px;
    font: 600 20px/120% var(--font-family);
    color: var(--chernyy);
}

.cart-modal__action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0;
    border: 0;
    background: none;
    font: 500 16px/150% var(--font-family);
    color: var(--chernyy);
    text-align: left;
    cursor: pointer;
}

.cart-modal__action img {
    width: 22px;
    height: auto;
}

body.cart-modal-open {
    overflow: hidden;
}

@media (min-width: 768px) {
    .cart-modal--sheet {
        display: none !important;
    }
}

.cart__recommend .scrolling-cards {
    align-items: stretch;
}

.cart--empty {
    display: block;
    padding-bottom: 40px;
}

.cart--empty .cart__empty {
    align-items: stretch;
    max-width: 420px;
}

.cart--empty .cart__empty-btn {
    text-decoration: none;
}
