/* ── Basket ─────────────────────────────────────────────────
   Figma: desktop 3144:31228, tablet 3144:31747, mobile
   3144:31392; empty 3144:31641, 3144:31968, 3144:31548. The
   grey basket beside the vehicle and Why Buy; stacked on
   tablet and mobile.
   ─────────────────────────────────────────────────────────── */

.basket {
    padding: 64px var(--pad-x) 0;
}

.basket--empty {
    padding-bottom: 64px;
}

.basket__inner {
    display: flex;
    align-items: flex-start;
    gap: 60px;
    max-width: var(--site-max-w);
    margin: 0 auto;
}

.basket--empty .basket__inner {
    gap: 40px;
}

.basket__card,
.basket__aside,
.basket__empty {
    flex: 1;
    min-width: 0;
}

.basket__card {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    border-radius: 12px;
    background: var(--color-grey-light);
}

.basket__aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.basket__head {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket__title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    line-height: 34px;
}

.basket__count,
.basket__label {
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 20px;
}

.basket__count {
    color: var(--color-text-muted);
}

.basket__errors,
.basket__item-error,
.basket__coupon-error {
    color: var(--color-error-dark);
    font-size: 14px;
    line-height: 20.8px;
}

.basket__errors a {
    color: inherit;
}

.basket__errors {
    padding: 10px 14px;
    border: 1px solid var(--color-error);
    border-radius: 6px;
    background: rgb(248 0 0 / 0.08);
}

/* The items: about two in view, the rest scroll, fading out at the bottom */
.basket__scroll {
    position: relative;
    max-height: 290px;
    margin-right: -12px;
    padding-right: 12px;
    overflow-y: auto;
    scrollbar-color: rgb(164 161 161 / 0.78) transparent;
    scrollbar-width: thin;
}

.basket__scroll.is-scrollable:not(.is-end) {
    mask-image: linear-gradient(to bottom, #000 calc(100% - 62px), transparent);
}

.basket__items {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
}

.basket__item {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.basket__image {
    flex: none;
    width: 127px;
    height: 127px;
    overflow: hidden;
    border-radius: 2px;
    background: var(--color-border);
    box-shadow: 0 0 12px rgb(0 0 0 / 0.12);
}

.basket__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.basket__details {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-self: center;
    gap: 20px;
    min-width: 0;
}

.basket__text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.basket__name {
    color: var(--color-text);
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
    text-decoration: none;
}

.basket__name:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.basket__format {
    color: var(--color-secondary);
    line-height: 20.8px;
}

.basket__controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.basket__stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: var(--color-white);
}

.basket__stepper button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--color-text);
    font: inherit;
    line-height: 20px;
    cursor: pointer;
}

.basket__stepper button:hover:not(:disabled) {
    background: var(--color-grey);
}

.basket__stepper button:disabled {
    opacity: 0.35;
    cursor: default;
}

.basket__qty {
    min-width: 12px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
    text-align: center;
}

.basket__remove {
    display: flex;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text);
    cursor: pointer;
}

.basket__remove:hover {
    color: var(--color-error-dark);
}

.basket__price {
    flex: none;
    margin-left: auto;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
}

/* Changing: the item waits for its new price */
.basket.is-updating .basket__card {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity var(--transition);
}

/* Delivery location: the buy box's location button, full width */
.basket__location {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket__place {
    flex: none;
    width: 100%;
    cursor: pointer;
}

/* Coupon */
.basket__coupon {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket__coupon-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.basket__coupon input {
    flex: 1;
    min-width: 0;
    height: 41px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: var(--color-white);
    color: var(--color-text);
    font: inherit;
    outline: none;
}

.basket__coupon input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.basket__coupon input:focus {
    border-color: var(--color-primary);
}

.basket__apply {
    flex: none;
    width: 144px;
}

/* Totals */
.basket__totals {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.basket__row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--color-secondary);
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    line-height: 25px;
}

.basket__row--subtotal {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-grey);
}

.basket__row--coupon {
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
}

.basket__coupon-remove {
    margin-left: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
}

.basket__total {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.basket__note {
    color: var(--color-text-muted);
    line-height: 20.8px;
}

/* Empty */
.basket__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 32px;
    border-radius: 12px;
    background: var(--color-grey-light);
    text-align: center;
}

.basket__empty-icon {
    flex: none;
}

.basket__empty-text {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.basket__empty-title {
    color: var(--color-secondary);
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    line-height: 34px;
}

.basket__empty-text p {
    color: var(--color-text-muted);
    font-size: 12px;
}

.basket__empty-button {
    width: min(438px, 100%);
}

/* ── Small desktop: the columns closer ──────────────────────── */
@media (max-width: 1366px) {
    .basket__inner {
        gap: 32px;
    }
}

/* ── Tablet: one column ─────────────────────────────────────── */
@media (max-width: 1024px) {
    .basket {
        padding-top: 48px;
    }

    .basket__inner,
    .basket--empty .basket__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .basket__card,
    .basket__aside,
    .basket__empty {
        flex: none;
    }
}

/* ── Mobile: every item in view, smaller ────────────────────── */
@media (max-width: 767px) {
    .basket {
        padding-top: 24px;
    }

    .basket__inner,
    .basket--empty .basket__inner {
        gap: 25px;
    }

    .basket__card {
        gap: 18px;
        padding: 20px;
    }

    .basket__head {
        gap: 4px;
    }

    .basket__title {
        font-size: 28px;
        line-height: 36px;
    }

    .basket__count {
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 400;
        line-height: 18px;
    }

    .basket__scroll {
        max-height: none;
        margin-right: 0;
        padding-right: 0;
        overflow: visible;
    }

    .basket__scroll.is-scrollable:not(.is-end) {
        mask-image: none;
    }

    .basket__items {
        gap: 14px;
    }

    /* Photo and words, then the amount and price under them */
    .basket__item {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        align-items: start;
        gap: 14px 12px;
    }

    .basket__image {
        width: 72px;
        height: 72px;
        border-radius: 4px;
        box-shadow: none;
    }

    .basket__details {
        display: contents;
    }

    .basket__text {
        gap: 3px;
    }

    .basket__name {
        font-size: 16px;
        line-height: 20px;
    }

    .basket__format {
        font-size: 13px;
        line-height: 17px;
    }

    .basket__controls {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 12px;
    }

    .basket__item-error {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .basket__stepper {
        gap: 12px;
        padding: 4px 8px;
        border: 1px solid var(--color-grey-light);
    }

    .basket__qty {
        font-size: 16px;
        line-height: 20px;
    }

    .basket__price {
        grid-column: 2;
        grid-row: 2;
        align-self: center;
        justify-self: end;
        font-size: 18px;
        line-height: 23px;
    }

    .basket__label {
        font-size: 14px;
        line-height: 18px;
    }

    .basket__coupon input {
        font-size: 13px;
    }

    .basket__apply {
        width: auto;
    }

    .basket__row,
    .basket__row--subtotal {
        padding: 0;
        border: 0;
        font-size: 16px;
        line-height: 20px;
    }

    .basket__total {
        gap: 4px;
    }

    .basket__note {
        font-size: 13px;
        line-height: 17px;
    }

    .basket__empty {
        gap: 24px;
        padding: 24px 16px;
    }

    .basket__empty-title {
        font-size: 28px;
        line-height: 32px;
    }

    .basket__empty-icon {
        width: 80px;
        height: 80px;
    }
}
