/*
 * LayerBasket — items-tabel links, totals-aside rechts.
 * Mobile: aside stackt onder de tabel, tabel wordt card-vorm.
 */

@import url('variables/webshop.css');

.layer__basket {
    padding-block: var(--space-5);
}

.basket__head {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    margin-bottom: var(--space-4);
}

.basket__title {
    font-size: var(--fs-h1);
    line-height: var(--line-tight);
    margin: 0;
}

/* ── Empty ────────────────────────────────────────────────── */

.basket__empty {
    max-width: var(--content-max);
    margin-inline: auto;
    padding: var(--space-6) var(--gutter);
    text-align: center;
    color: color-mix(in srgb, currentColor 75%, transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

/* ── Body grid ────────────────────────────────────────────── */

.basket__body {
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: grid;
    grid-template-columns: 1fr 22rem;
    gap: var(--space-5);
    align-items: start;
}

@media (max-width: 64rem) {
    .basket__body {
        grid-template-columns: 1fr;
    }
}

/* ── Items table ──────────────────────────────────────────── */

.basket__items-wrap {
    overflow-x: auto;
}

.basket__items {
    width: 100%;
    border-collapse: collapse;
}

.basket__items th,
.basket__items td {
    padding: var(--space-3);
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
    vertical-align: middle;
    text-align: left;
}

.basket__items thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, currentColor 60%, transparent);
}

.basket__items .num {
    text-align: right;
    white-space: nowrap;
}

.basket__item-image-cell {
    width: 5rem;
}

.basket__item-image {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: var(--ws-input-radius);
    display: block;
}

.basket__item-title {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.basket__item-title:hover {
    text-decoration: underline;
}

.basket__item-variant,
.basket__item-unit {
    font-size: 0.85rem;
    color: color-mix(in srgb, currentColor 65%, transparent);
}

.basket__item-sku {
    font-size: 0.75rem;
    font-family: ui-monospace, monospace;
    color: color-mix(in srgb, currentColor 50%, transparent);
}

.basket__item-discount {
    font-size: 0.8rem;
    color: var(--ws-stock-in-color);
    font-style: italic;
}

/* ── Mobile card layout ───────────────────────────────────── */

@media (max-width: 48rem) {
    /* Stap 1: alle table-elementen expliciet block — anders doet de browser
       table-fixup en blijft de overflow bestaan */
    .basket__items,
    .basket__items thead,
    .basket__items tbody,
    .basket__row,
    .basket__items th,
    .basket__items td {
        display: block;
    }

    .basket__items thead { display: none; }
    .basket__items td    { padding: 0; border-bottom: none; }

    /* Stap 2: row als grid (overschrijft display:block hierboven) */
    .basket__row {
        display: grid;
        grid-template-columns: 1fr max-content;
        grid-template-areas:
            "title  remove"
            "qty    total";
        column-gap: var(--space-3);
        row-gap: var(--space-2);
        padding: var(--space-3) 0;
        border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
        align-items: start;
    }

    .basket__row:last-child { border-bottom: none; }

    .basket__item-image-cell { display: none; }
    .basket__item-title-cell { grid-area: title; }
    .basket__unit-price      { display: none; }
    .basket__qty-cell        { grid-area: qty; }
    .basket__line-total      { grid-area: total; text-align: right; align-self: end; }
    .basket__remove-cell     { grid-area: remove; width: auto; text-align: right; padding: 0; }
}

/* ── Qty stepper in row ───────────────────────────────────── */

.basket__qty {
    display: inline-grid;
    grid-template-columns: 2rem 3rem 2rem;
    border: var(--ws-input-border);
    border-radius: var(--ws-input-radius);
    overflow: hidden;
}

.basket__qty button {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.basket__qty button:hover {
    background: color-mix(in srgb, currentColor 6%, transparent);
}

.basket__qty-input {
    border: 0;
    border-inline: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    text-align: center;
    font: inherit;
    background: transparent;
    -moz-appearance: textfield;
}

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

.basket__line-total {
    font-weight: 600;
}

.basket__remove-cell {
    width: 2.5rem;
    text-align: center;
}

.basket__remove {
    background: transparent;
    border: 0;
    color: color-mix(in srgb, currentColor 50%, transparent);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    transition: color .2s, background .2s;
}

.basket__remove:hover {
    color: var(--ws-price-sale-color);
    background: color-mix(in srgb, var(--ws-price-sale-color) 12%, transparent);
}

/* ── Totals aside ─────────────────────────────────────────── */

.basket__totals {
    background: var(--color-bg-elev, #fff);
    border: var(--ws-card-border);
    border-radius: var(--ws-card-radius);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.basket__delivery h2,
.basket__voucher label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, currentColor 60%, transparent);
    margin: 0 0 var(--space-2);
    font-weight: 600;
    display: block;
}

.basket__delivery-country {
    width: 100%;
    min-width: 0;
    margin-bottom: var(--space-2);
    border: var(--ws-input-border);
    border-radius: var(--ws-input-radius);
    padding: var(--ws-input-padding);
    font: inherit;
    background: var(--ws-input-bg);
    color: var(--ws-input-color);
}

.basket__delivery-none {
    font-size: 0.875rem;
    color: color-mix(in srgb, currentColor 60%, transparent);
    margin: var(--space-1) 0 0;
}

.basket__delivery-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.basket__delivery-option {
    display: grid;
    grid-template-columns: 1.2rem 1fr auto;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--ws-input-radius);
    cursor: pointer;
}

.basket__delivery-option:hover {
    background: color-mix(in srgb, currentColor 5%, transparent);
}

.basket__delivery-cost {
    font-weight: 600;
    color: color-mix(in srgb, currentColor 75%, transparent);
}

/* ── Voucher form ─────────────────────────────────────────── */

.basket__voucher-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-2);
}

.basket__voucher input[type="text"] {
    border: var(--ws-input-border);
    border-radius: var(--ws-input-radius);
    padding: var(--ws-input-padding);
    font: inherit;
    background: var(--ws-input-bg);
    color: var(--ws-input-color);
    text-transform: uppercase;
    min-width: 0;
}

.basket__voucher-status {
    font-size: 0.85rem;
    margin-top: var(--space-1);
    color: var(--ws-stock-in-color);
}

.basket__voucher-status--error {
    color: var(--ws-price-sale-color);
}

/* ── Totals list ──────────────────────────────────────────── */

.basket__totals-list {
    margin: var(--space-3) 0 0;
    padding-top: var(--space-3);
    border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.basket__totals-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    margin: 0;
}

.basket__totals-row dt {
    margin: 0;
}

.basket__totals-row dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.basket__totals-row--discount {
    color: var(--ws-stock-in-color);
    font-weight: 600;
}

.basket__totals-row--vat {
    font-size: 0.85rem;
    color: color-mix(in srgb, currentColor 60%, transparent);
}

.basket__totals-row--grand {
    border-top: 2px solid currentColor;
    padding-top: var(--space-2);
    margin-top: var(--space-1);
    font-size: 1.15rem;
    font-weight: 700;
}

.basket__checkout {
    margin-top: var(--space-3);
    text-align: center;
}

.basket__continue {
    text-align: center;
    color: color-mix(in srgb, currentColor 65%, transparent);
    font-size: 0.9rem;
    text-decoration: none;
}

.basket__continue:hover {
    text-decoration: underline;
}
