/* Cart table & rows */

.cart-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.cart-table__head th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 0 0 0.75rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
}

.cart-table__th--price,
.cart-table__th--subtotal {
    text-align: right;
}

.cart-table__th--qty {
    text-align: center;
}

.cart-table__th--actions {
    width: 40px;
}

/* ── Row ── */
.cart-row {
    border-bottom: 1px solid var(--color-border);
    transition: opacity 250ms ease;
}

.cart-row:last-child {
    border-bottom: none;
}

.cart-row__cell {
    padding: 1.25rem 0;
    vertical-align: middle;
}

/* Image */
.cart-row__cell--img {
    width: 72px;
    padding-right: var(--space-sm);
}

.cart-row__img-link {
    display: block;
}

.cart-row__img {
    width: 60px;
    height: 76px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
    background: #f7f7f7;
}

/* Name */
.cart-row__cell--name {
    padding-right: var(--space-md);
}

.cart-row__name {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.35;
    transition: color var(--transition-fast);
}

a.cart-row__name:hover {
    color: var(--color-text-muted);
}

.cart-row__price-mobile {
    display: none;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 3px;
}

/* Price */
.cart-row__cell--price {
    text-align: right;
    padding: 1.25rem var(--space-md);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

/* Quantity */
.cart-row__cell--qty {
    text-align: center;
    padding: 1.25rem var(--space-xs);
}

.qty-control {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.qty-control:focus-within {
    border-color: #aaa;
}

.qty-control__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0;
}

.qty-control__btn:hover {
    color: var(--color-text);
    background: #f5f5f5;
}

.qty-control__input {
    width: 30px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    background: transparent;
    -moz-appearance: textfield;
    font-family: inherit;
    cursor: default;
    user-select: none;
    pointer-events: none;
}

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

/* Subtotal */
.cart-row__cell--subtotal {
    text-align: right;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    padding: 1.25rem var(--space-sm) 1.25rem var(--space-md);
}

/* Remove */
.cart-row__cell--actions {
    text-align: right;
    width: 40px;
}

.cart-row__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #d4d4d4;
    border-radius: 6px;
    transition: color 200ms ease;
}

.cart-row__remove:hover {
    color: var(--color-error);
}

/* Remove animation */
.cart-row--removing {
    pointer-events: none;
    opacity: 0.12;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .cart-table__head {
        display: none;
    }

    .cart-table,
    .cart-table tbody,
    .cart-row {
        display: block;
    }

    .cart-row {
        display: grid;
        grid-template-columns: 52px 1fr auto;
        grid-template-rows: auto auto;
        gap: 0 var(--space-sm);
        padding: var(--space-sm) 0;
        align-items: center;
    }

    .cart-row__cell {
        padding: 0;
    }

    .cart-row__cell--img {
        grid-row: 1 / 3;
        grid-column: 1;
        width: auto;
        padding-right: 0;
    }

    .cart-row__img {
        width: 44px;
        height: 56px;
    }

    .cart-row__cell--name {
        grid-row: 1;
        grid-column: 2;
        align-self: end;
        padding-right: 0;
    }

    .cart-row__price-mobile {
        display: block;
    }

    .cart-row__cell--actions {
        grid-row: 1;
        grid-column: 3;
        align-self: start;
        width: auto;
    }

    .cart-row__cell--price {
        display: none;
    }

    .cart-row__cell--qty {
        grid-row: 2;
        grid-column: 2;
        text-align: left;
        padding-top: 6px;
        align-self: start;
    }

    .cart-row__cell--subtotal {
        grid-row: 2;
        grid-column: 3;
        padding: 6px 0 0;
        align-self: start;
    }

    .qty-control__btn {
        width: 28px;
        height: 28px;
    }

    .qty-control__input {
        width: 26px;
        height: 28px;
        font-size: 0.8125rem;
    }
}
