/* assets/css/cart.css — Cart page styles (Phase 2) */

.cart-page { padding-block: 36px; }

.cart-page-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 28px;
}

.cart-page-header h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }

/* ── Empty Cart ───────────────────────────────────────────────────────────── */
.cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.cart-empty__icon {
    width: 80px; height: 80px;
    background: var(--color-bg-alt);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--color-text-light);
}

.cart-empty h2 { font-size: 1.5rem; margin-bottom: 8px; }
.cart-empty p  { color: var(--color-text-muted); }

/* ── Cart Layout ──────────────────────────────────────────────────────────── */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
}

@media (min-width: 900px) {
    .cart-layout { grid-template-columns: 1fr 320px; }
}

/* ── Cart Table Head (desktop only) ──────────────────────────────────────── */
.cart-table-head {
    display: none;
}

@media (min-width: 640px) {
    .cart-table-head {
        display: grid;
        grid-template-columns: 2.5fr 1fr 1fr 1fr 40px;
        gap: 12px;
        padding: 10px 16px;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--color-text-light);
        background: var(--color-bg-alt);
        border-radius: var(--radius);
        margin-bottom: 8px;
    }
}

/* ── Cart Row ─────────────────────────────────────────────────────────────── */
.cart-row {
    display: grid;
    grid-template-columns: 1fr 40px;
    grid-template-areas:
        "product remove"
        "price   qty"
        "sub     sub";
    gap: 10px 12px;
    padding: 16px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    transition: opacity 300ms ease, transform 300ms ease;
}

.cart-row.is-removing {
    opacity: 0;
    transform: translateX(20px);
}

@media (min-width: 640px) {
    .cart-row {
        grid-template-columns: 2.5fr 1fr 1fr 1fr 40px;
        grid-template-areas: "product price qty sub remove";
        align-items: center;
        padding: 14px 16px;
    }
}

/* Product cell */
.cart-row__product {
    grid-area: product;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cart-row__img-link { flex-shrink: 0; text-decoration: none; }

.cart-row__img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--color-bg-alt);
    flex-shrink: 0;
}

.cart-row__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cart-row__img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-light);
}

.cart-row__info { min-width: 0; }

.cart-row__name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.3;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cart-row__name:hover { color: var(--color-accent); }

/* Price / subtotal cells */
.cart-row__unit-price { grid-area: price; font-size: 14px; color: var(--color-text-muted); }
.cart-row__subtotal   { grid-area: sub;   font-size: 14px; font-weight: 600; color: var(--color-accent); }

/* Mobile data-labels */
@media (max-width: 639px) {
    .cart-row__unit-price::before { content: attr(data-label) ": "; font-size: 11px; color: var(--color-text-light); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 2px; }
    .cart-row__subtotal::before   { content: attr(data-label) ": "; font-size: 11px; color: var(--color-text-light); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 2px; }
}

/* Qty control */
.cart-row__qty { grid-area: qty; }

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

.cart-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
    font-weight: 400;
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
    border: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.cart-qty-btn:hover { background: var(--color-border); color: var(--color-text); }

.cart-qty-input {
    width: 40px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1.5px solid var(--color-border);
    border-right: 1.5px solid var(--color-border);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-white);
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Remove button */
.cart-row__remove { grid-area: remove; display: flex; align-items: center; justify-content: flex-end; }

.cart-remove-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    color: var(--color-text-light);
    transition: background var(--transition), color var(--transition);
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cart-remove-btn:hover { background: #FBF0F0; color: var(--color-danger); }

/* ── Cart Actions ─────────────────────────────────────────────────────────── */
.cart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 8px;
}

/* ── Cart Summary Sidebar ─────────────────────────────────────────────────── */
.cart-summary {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: sticky;
    top: calc(var(--header-h) + 20px);
}

.cart-summary__title {
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.cart-summary__rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    gap: 8px;
}

.cart-summary__row--muted span { color: var(--color-text-muted); font-size: 13px; }

.cart-summary__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    padding-top: 16px;
    border-top: 2px solid var(--color-border);
    gap: 8px;
}

.cart-summary__total span:last-child { color: var(--color-accent); }

.cart-summary__note {
    font-size: 12px;
    color: var(--color-text-light);
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}
