/*
 * 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: 78rem) {
    .basket__body {
        grid-template-columns: 1fr;
    }
}

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

.basket__items-wrap {
    /* Geen horizontale scroll (testfeedback): de productkolom krimpt met
       ellipsis i.p.v. dat de tabel buiten z'n container groeit. */
    overflow-x: visible;
}

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

.basket__items,
.basket__items thead,
.basket__items tbody,
.basket__items thead tr,
.basket__row,
.basket__items th,
.basket__items td {
    display: block;
}

.basket__items thead tr,
.basket__row {
    display: grid;
    grid-template-columns: 5rem minmax(12rem, 1fr) minmax(7.5rem, max-content) minmax(7rem, max-content) minmax(7.5rem, max-content) 2rem;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.basket__items thead tr {
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.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 {
    position: relative;
    min-height: 1.2rem;
    font-weight: 600;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, currentColor 60%, transparent);
    border-bottom: 0;
}

/*.basket__th-label {*/
/*    position: absolute;*/
/*    inset-block-start: 50%;*/
/*    inset-inline-start: 0;*/
/*    transform: translateY(-50%);*/
/*    white-space: nowrap;*/
/*}*/

.basket__th-label--left {
    inset-inline-start: 0;
}

.basket__th-label--center {
    inset-inline-start: 50%;
    transform: translate(-50%, -50%);
}

.basket__th-label--right {
    inset-inline-end: 0;
}

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

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

.basket__item-image-cell > a {
    display: block;
    width: 4.5rem;
}

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

.basket__items thead th:nth-child(1) {
    grid-column: 1 / span 2;
}

.basket__items thead th:nth-child(2) {
    grid-column: 3;
    /*text-align: right;*/
}

.basket__items thead th:nth-child(3) {
    grid-column: 4;
    text-align: center;
}

.basket__items thead th:nth-child(4) {
    grid-column: 5;
    /*text-align: right;*/
}

.basket__items thead th:nth-child(5) {
    grid-column: 6;
}

.basket__row {
    padding: var(--space-3) 0;
    border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

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

.basket__item-image-cell {
    grid-column: 1;
    padding-left: 0;
}

.basket__item-title-cell {
    grid-column: 2;
    min-width: 0;
}

.basket__unit-price {
    grid-column: 3;
    text-align: right;
}

.basket__qty-cell {
    grid-column: 4;
    text-align: center;
}

.basket__line-total {
    grid-column: 5;
    text-align: right;
}

.basket__remove-cell {
    grid-column: 6;
    width: auto;
    text-align: right;
    padding-right: 0;
}

.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;
}

/* ── Tablet/mobile row layout ─────────────────────────────── */

@media (max-width: 78rem) {
    .basket__items td    { padding: 0; border-bottom: none; }

    .basket__items thead th {
        padding-inline: 0;
    }
}

@media (max-width: 900px) {
    .layer__basket {
        padding-block: var(--space-3);
    }

    .basket__head {
        margin-bottom: var(--space-2);
    }

    .basket__body {
        gap: var(--space-3);
    }

    .basket__items thead {
        display: none;
    }

    .basket__items tbody {
        display: block;
    }

    .basket__row {
        background: var(--color-bg-elev, #fff);
        border: var(--ws-card-border);
        border-radius: var(--ws-card-radius);
        box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, currentColor 8%, transparent);
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: var(--space-2);
        padding: var(--space-3);
        border-bottom: 0;
        margin-bottom: var(--space-3);
    }

    .basket__row:last-child { margin-bottom: 0; }

    .basket__item-image-cell {
        grid-column: span 3;
        width: 5rem;
        min-width: 5rem;
        max-width: 5rem;
    }

    .basket__item-image-cell > a,
    .basket__item-image {
        width: 5rem;
        min-width: 5rem;
        height: 5rem;
    }

    .basket__item-title-cell {
        grid-column: span 8;
        min-width: 0;
    }

    .basket__remove-cell {
        grid-column: span 1;
        align-self: flex-start;
        text-align: right;
    }

    .basket__remove {
        font-size: 1.25rem;
        padding: 0;
    }

    .basket__qty-cell,
    .basket__unit-price,
    .basket__line-total {
        border-top: 1px solid color-mix(in srgb, currentColor 8%, transparent);
        margin-top: var(--space-2);
        padding-top: var(--space-2) !important;
    }

    .basket__qty-cell {
        grid-column: span 4;
        margin-left: 0;
        text-align: left;
    }

    .basket__qty {
        grid-template-columns: 2rem 2.75rem 2rem;
    }

    .basket__unit-price {
        display: block;
        grid-column: span 4;
        min-width: 4.5rem;
        color: color-mix(in srgb, currentColor 65%, transparent);
        font-size: 0.8rem;
        text-align: right;
        margin-left: 0;
    }

    .basket__line-total {
        grid-column: span 4;
        min-width: max-content;
        text-align: right;
        font-size: 0.95rem;
    }
}

/* ── 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);
}

/* ── Gratis-verzending-nudge ──────────────────────────────── */

.basket__free-shipping {
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--ws-card-radius);
    background: color-mix(in srgb, var(--ws-stock-in-color) 10%, transparent);
    color: var(--ws-stock-in-color);
    font-size: 0.9rem;
    line-height: var(--line-tight, 1.2);
    text-align: center;
}

.basket__free-shipping[hidden] {
    display: none;
}

/* Drempel gehaald: iets nadrukkelijker, zelfde groen-token. */
.basket__free-shipping--reached {
    font-weight: 600;
    background: color-mix(in srgb, var(--ws-stock-in-color) 16%, transparent);
}

/* ── 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;
}

/* Te betalen (incl. btw): secundair onder het ex-totaal. */
.basket__totals-row--payable {
    font-size: 0.85rem;
    color: color-mix(in srgb, currentColor 60%, transparent);
}

.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;
}

/* Productkolom krijgt de flexibele ruimte. Titels mogen wrappen; afkappen maakt
   vooral varianten onleesbaar zodra prijs/aantal/totaal naast elkaar staan. */
.basket__item-title-cell {
    width: 100%;
    min-width: min(18rem, 45vw);
}
.basket__item-title,
.basket__item-variant,
.basket__item-unit,
.basket__item-sku {
    display: block;
    overflow-wrap: anywhere;
}
