/* Mobile-first cart (Shopee-style) */
.store-cart-page {
    --cart-border: #f0f0f0;
    --cart-muted: #757575;
    --cart-bg: #f5f5f5;
    background: var(--cart-bg);
    margin: -1.5rem calc(-0.5 * var(--bs-gutter-x, 0.75rem)) 0;
    padding: 0.75rem calc(var(--bs-gutter-x, 0.75rem) * 0.5) 0;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    min-height: 50vh;
}

.store-cart-page .store-cart-top {
    align-items: center;
    margin-bottom: 0.75rem;
}

.store-cart-page .store-cart-top h1 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.store-cart-page .store-cart-count {
    font-weight: 400;
    color: var(--cart-muted);
    font-size: 0.95em;
}

.store-cart-hint {
    background: #fff;
    border-radius: 0.25rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--cart-muted);
    margin-bottom: 0.75rem;
    border: 1px solid var(--cart-border);
}

.cart-group {
    background: #fff;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    overflow: hidden;
}

.cart-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--cart-border);
    font-size: 0.875rem;
}

.cart-group-head .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
    flex-shrink: 0;
}

.cart-group-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-group-subtotal-wrap {
    font-size: 0.75rem;
    color: var(--cart-muted);
    white-space: nowrap;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--cart-border);
    transition: opacity 0.15s ease;
}

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

.cart-item.is-unchecked {
    opacity: 0.55;
}

.cart-item > .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 2.25rem 0 0;
    flex-shrink: 0;
}

.cart-item-thumb {
    flex-shrink: 0;
    width: 5rem;
    height: 5rem;
    border-radius: 0.25rem;
    overflow: hidden;
    background: #fafafa;
    border: 1px solid var(--cart-border);
}

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

.cart-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.cart-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.875rem;
    line-height: 1.35;
    color: #222;
    text-decoration: none;
}

.cart-item-title:hover {
    color: var(--shop-primary);
}

.cart-item-variant {
    font-size: 0.75rem;
    color: var(--cart-muted);
}

.cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cart-qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 0.25rem;
    overflow: hidden;
    background: #fff;
}

.cart-qty-stepper .qty-btn {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    background: #fafafa;
    color: #555;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-qty-stepper .qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cart-qty-stepper.is-busy {
    opacity: 0.6;
    pointer-events: none;
}

.cart-qty-stepper .cart-qty-input {
    width: 2.25rem;
    height: 1.75rem;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
    font-size: 0.8125rem;
    padding: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

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

.cart-item-price {
    text-align: right;
    flex-shrink: 0;
}

.cart-item-price .line-total-text {
    font-size: 1rem;
    font-weight: 700;
    color: var(--shop-primary);
}

.cart-item-price .unit-price-hint {
    display: block;
    font-size: 0.6875rem;
    color: var(--cart-muted);
    font-weight: 400;
}

.cart-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.cart-item-foot .shared-stock-hint {
    margin: 0;
}

.btn-remove-item {
    border: none;
    background: none;
    color: var(--cart-muted);
    font-size: 0.75rem;
    padding: 0;
    text-decoration: underline;
}

.btn-remove-item:hover {
    color: #c62828;
}

.cart-summary-panel {
    background: #fff;
    border-radius: 0.25rem;
    border: 1px solid var(--cart-border);
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
}

.cart-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.cart-checkout-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid var(--cart-border);
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.cart-select-all-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.cart-select-all-wrap .form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
}

.cart-checkout-total {
    flex: 1;
    min-width: 0;
    text-align: right;
    line-height: 1.2;
}

.cart-checkout-total .cart-total-label {
    display: block;
    font-size: 0.6875rem;
    color: var(--cart-muted);
}

.cart-checkout-total .cart-total-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--shop-primary);
}

.cart-checkout-btn {
    flex-shrink: 0;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.55rem 1rem;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .store-cart-page {
        padding-bottom: 1rem;
    }

    .cart-checkout-bar {
        position: static;
        box-shadow: none;
        border: 1px solid var(--cart-border);
        border-radius: 0.25rem;
        margin-top: 1rem;
        padding: 0.75rem 1rem;
    }

    .cart-item-thumb {
        width: 5.5rem;
        height: 5.5rem;
    }

    .cart-item-title {
        font-size: 0.9375rem;
    }
}
