/* Cart Page — mobile-first, breakpoints: 768px tablet, 1024px laptop */
.cart-page-index {
    background-color: var(--color-white);
}

.cart-page {
    padding: 1rem 0 2rem;
}

.cart-page .container {
    box-sizing: border-box;
}

.cart-page__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cart-page__list {
    display: grid;
    gap: 1rem;
}

.cart-page__checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--color-blue);
    flex-shrink: 0;
}

.cart-page__select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    min-width: 0;
}

.cart-page__select-all-text {
    font-size: 0.9375rem;
    line-height: 1.35;
    word-break: break-word;
}

.cart-page__delete {
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-black);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.cart-page__delete:hover {
    background: var(--color-blue-tertiary);
}

.cart-page__items-list {
    padding: 0;
    min-width: 0;
}

.cart-page__bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
    border: 1px solid #dfeaef;
    border-radius: 0.625rem;
    background: #fff;
    min-width: 0;
}

.cart-page__bar-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    min-width: 0;
}

.cart-page__bar-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.cart-page__total {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #33383c;
    white-space: normal;
    line-height: 1.4;
    word-break: break-word;
}

.cart-page__total-value {
    color: var(--color-red-primary);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.35;
    white-space: nowrap;
}

.cart-page__buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: 0.3125rem;
    background: var(--color-blue);
    color: var(--color-white);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9375rem;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.cart-page__buy:hover {
    filter: brightness(0.95);
}

/* Cart item — stacked card on narrow viewports */
.cart-item {
    display: grid;
    grid-template-columns: auto minmax(0, 4.5rem) minmax(0, 1fr);
    grid-template-areas:
        "sel img details"
        "actions actions actions"
        "price price price";
    align-items: start;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
    min-width: 0;
}

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

.cart-item__select {
    grid-area: sel;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
}

.cart-item__checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #397bcc;
}

.item-image {
    grid-area: img;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #dfeaef;
    background: #fff;
    flex-shrink: 0;
}

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

.item-details {
    grid-area: details;
    min-width: 0;
}

.item-name a {
    display: inline;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    line-height: 1.35;
    word-break: break-word;
}

.item-name a:hover {
    text-decoration: underline;
}

.cart-item__flash-note {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #4b5563;
    word-break: break-word;
}

.item-sale-price {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #111827;
}

.item-price {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    color: #6b7280;
    text-decoration: line-through;
}

.item-actions {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
}

.cart-item__meta-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    flex-shrink: 0;
}

.cart-item__meta-label--price {
    justify-self: end;
}

.cart-item__meta-value {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-width: 0;
}

.remove-item {
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    background: var(--color-white);
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.remove-item:hover {
    background: #f9fafb;
    color: #111827;
}

.quantity-controls {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dfeaef;
    overflow: hidden;
    background: #fff;
    flex-shrink: 0;
}

.qty-btn {
    width: 1.875rem;
    height: 1.875rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #111827;
    font-size: 1rem;
    line-height: 1;
}

.qty-btn:hover {
    background: #f9fafb;
}

.qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qty-input {
    width: 2.75rem;
    height: 1.875rem;
    border: none;
    outline: none;
    text-align: center;
    font-weight: 700;
    font-size: 0.9375rem;
    background: transparent;
}

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

.qty-input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.cart-item__price {
    grid-area: price;
    display: grid;
    justify-items: start;
    gap: 0.25rem;
    min-width: 0;
}

.cart-item__price .item-sale-price {
    margin-top: 0;
    font-size: 1rem;
    font-weight: 700;
    word-break: break-word;
}

.cart-item__price .item-price {
    margin-top: 0;
}

/* Empty state */
.cart-empty {
    padding: 2.5rem 0;
    display: grid;
    gap: 0.75rem;
    justify-items: center;
    text-align: center;
}

.cart-empty__icon {
    font-size: 2.25rem;
}

.cart-empty__text {
    color: #6b7280;
    font-size: 0.9375rem;
}

.cart-empty__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111827;
    text-decoration: none;
    font-weight: 600;
}

.cart-empty__cta:hover {
    background: #f9fafb;
}

.cart-page__head-cols {
    display: none;
}

/* Tablet: 768px+ */
@media (min-width: 48rem) {
    .cart-page {
        padding: 1.5rem 0 3rem;
    }


    .cart-page__list {
        gap: 1.25rem;
    }

    .cart-page__items-list {
        padding: 0 0.5rem;
    }

    .cart-page__bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.875rem 1rem;
    }

    .cart-page__bar-right {
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        gap: 1rem;
    }

    .cart-page__total {
        font-size: 1rem;
        text-align: right;
    }

    .cart-page__total-value {
        font-size: 1.375rem;
    }

    .cart-page__buy {
        width: auto;
        flex-shrink: 0;
    }

    .cart-item {
        grid-template-columns: auto 5rem minmax(0, 1fr) minmax(6.5rem, 8.5rem) minmax(5.5rem, 7.5rem);
        grid-template-areas: none;
        align-items: center;
        gap: 0.875rem;
    }

    .cart-item__select {
        grid-area: auto;
        margin-top: 0;
    }

    .item-image {
        grid-area: auto;
        width: 5rem;
        height: 5rem;
    }

    .item-details {
        grid-area: auto;
    }

    .item-actions {
        grid-area: auto;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0.5rem;
    }

    .cart-item__meta-value {
        justify-content: center;
    }

    .cart-item__price {
        grid-area: auto;
        justify-items: end;
    }

    .cart-item__meta-label--price {
        justify-self: end;
    }

    .qty-btn {
        width: 2rem;
        height: 2rem;
    }

    .qty-input {
        width: 3rem;
        height: 2rem;
    }
}

/* Laptop: 1024px+ — roomier grid */
@media (min-width: 64rem) {
    .cart-page {
        padding: 2rem 0 3rem;
    }

    .cart-page__items-list {
        padding: 0 1rem;
    }

    .cart-item {
        grid-template-columns: auto 5.6875rem minmax(0, 1fr) 10rem 9rem;
        gap: 1rem;
    }

    .item-image {
        width: 5.6875rem;
        height: 5.6875rem;
    }

    .cart-page__total-value {
        font-size: 1.5rem;
    }
}

/* Very narrow phones */
@media (max-width: 23.375rem) {
    .cart-page__total-value {
        font-size: 1.125rem;
    }

    .item-image {
        width: 4rem;
        height: 4rem;
    }
}
