/* ==========================================================================
   Cart Styles — Clean table-style layout
   Inspired by modern e-commerce cart patterns
   ========================================================================== */

/* --- Page --- */
.cart-page {
    padding: 3rem 0 5rem;
    min-height: 60vh;
}

/* --- Header --- */
.cart-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}

.cart-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 2.75rem);
    color: var(--color-primary);
    margin: 0;
}

.cart-continue {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
}

.cart-continue:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* --- Table Header --- */
.cart-table-header {
    display: grid;
    grid-template-columns: 1fr 160px 140px 140px 40px;
    gap: 1rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
}

.cart-table-header span {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.cart-col-price,
.cart-col-qty,
.cart-col-total {
    text-align: center;
}

/* --- Cart Items --- */
.cart-items {
    margin-bottom: 2rem;
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr 160px 140px 140px 40px;
    gap: 1rem;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--color-border-light);
    transition: background-color 0.15s ease;
}

.cart-row:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

/* --- Product column --- */
.cart-product {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.cart-product-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--color-background);
    flex-shrink: 0;
    display: block;
}

.cart-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.cart-product-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cart-product-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    line-height: 1.3;
}

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

.cart-product-category {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.cart-preorder-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #553C9A;
    background: #F3F0FF;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* --- Price column --- */
.cart-col-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.cart-price {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.cart-price--sale {
    color: var(--color-accent);
    font-weight: 600;
}

.cart-price--original {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

/* --- Quantity controls --- */
.cart-qty-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.cart-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.cart-qty-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.cart-qty-btn:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}

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

.cart-qty-value {
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface);
}

/* --- Total column --- */
.cart-col-total {
    display: flex;
    justify-content: center;
}

.cart-line-total {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

/* --- Remove button --- */
.cart-col-remove {
    display: flex;
    justify-content: center;
}

.cart-remove-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    line-height: 1;
}

.cart-remove-btn:hover {
    color: var(--color-error);
    background: var(--color-accent-light);
}

/* --- Summary Bar --- */
.cart-summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--color-background);
    border: 1px solid var(--color-border-light);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    margin-top: 1rem;
}

.cart-summary-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.cart-item-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.cart-summary-right {
    display: flex;
    align-items: flex-end;
    gap: 2.5rem;
}

.cart-summary-lines {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 240px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 2rem;
}

.cart-summary-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.cart-summary-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
}

.cart-summary-row--total {
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.cart-summary-row--total .cart-summary-label {
    font-size: 0.75rem;
    color: var(--color-text);
}

.cart-summary-total-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}

/* --- Checkout Button --- */
.cart-checkout-btn {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cart-checkout-btn:hover {
    background: var(--color-accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(224, 51, 44, 0.3);
    color: #fff;
}

.cart-checkout-price {
    font-weight: 700;
    font-size: 1.05rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* --- Screen reader only --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .cart-table-header {
        display: none;
    }

    .cart-row {
        grid-template-columns: 80px 1fr auto;
        grid-template-rows: auto auto;
        gap: 0.75rem 1rem;
        padding: 1.25rem 0;
    }

    .cart-product-image {
        grid-row: 1 / 3;
    }

    .cart-product {
        gap: 0;
    }

    .cart-col-price {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        gap: 0.5rem;
    }

    .cart-col-qty {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-content: flex-start;
    }

    .cart-col-total {
        grid-column: 3;
        grid-row: 1;
        justify-content: flex-end;
    }

    .cart-col-remove {
        position: absolute;
        right: 0;
        top: 1.25rem;
    }

    .cart-row {
        position: relative;
    }

    .cart-summary-bar {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .cart-summary-right {
        flex-direction: column;
        width: 100%;
        gap: 1.5rem;
    }

    .cart-summary-lines {
        min-width: 100%;
    }

    .cart-checkout-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cart-header {
        flex-direction: column;
        gap: 1rem;
    }

    .cart-row {
        grid-template-columns: 64px 1fr;
    }

    .cart-product-image {
        width: 64px;
        height: 64px;
    }

    .cart-col-total {
        grid-column: 2;
    }
}
