It really depends what you mean by "best". I'd say the prettiest time is in April during spring when the weather is great and the cherry blossoms and plum blossoms are in full bloom, but that is a very popular time to visit Japan so it will probably be more expensive and a bit more crowded in popular areas. If you are looking for the best time for cheap flights, I'd recommend the fall since the weather isn't too hot or cold and I've seen really great flight deals (like under $300 from LAX to Tokyo). Summer is also a very fun time to come to Japan, usually not too expensive and you would get to experience the summer fireworks festivals (which has been my favorite experience in Japan so far), but it can be super hot in Tokyo (think Texas temps but super humid). Winter can be an amazing time to visit Japan, especially if you want to ski. Japan has some of the best skiing in the world!!
I recommend at least 2 weeks for just staying in Tokyo or Tokyo and 1 more destination, and 3 weeks if visiting more than 3 destinations of Japan. If you really wanted to come but don't have a lot of time off, the ABSOLUTE minimum would be 10 days. It takes about 2 days to recover from jet lag and return to normal, so be sure to consider that when making your plans.
This is hard for me to answer because it truly depends on the type of trip you want to have, but I'll give it a shot.
For food - It's possible to spend as little as $4 per meal if you want, though I'd recommend budgeting at least $25 per day for food. You can definitely get breakfast and lunch under $5 each if you went to the konbini (convenience store), ate at many of the beef bowl places like Yoshinoya or Matsuya, or went to a $0.70 per plate conveyor belt sushi place (there is one near our apartment). But Japan has such amazing food, so I'd try not to skimp too much on the food budget. Ideally, I think $40 per day for meals would be great.
For accommodation - Well, if you stay with us, you don't have to pay anything! But we totally recommend that you stay somewhere else for at least one night of your trip. Accommodations in Japan greatly vary in price. Solo travelers can even opt for hostels or capsule hotels for around $35-$60 per night in Tokyo. For 1 room that sleeps 2, you would probably want to plan to spend around $60 per night or more. Also, I highly recommend that everyone who visits Japan stay in an onsen ryokan (a traditional Japanese inn with some sort of hot spring bath) for at least 1 night of their trip, so that can be anywhere from $100 to $1000 a night with breakfast and dinner provided.
For transportation - It's super easy to get around Tokyo. Japan's public transit in cities is amazing. There are trains and buses. Plan to spend about $40-$80 total transport to/from the airport. I'd budget about $12 per day for transit in cities, and that should be enough unless you plan to visit several neighborhoods in a day. If you are going beyond Tokyo to another city, the cost will be much more. For example, going from Omiya station (where we live) to Osaka will cost you about $100. It would be best to use Google Maps to map out your destination on public transit and see the price they state for the whole route.
For everything else - Honestly, I think Japan has some of the best shopping in the world for any budget. There are so many affordable stores and thrift/resale shops, as well as high end luxury stores, and everything in between. I promise you WILL find cool stuff you want to buy in Japan. The amount to budget for spending on miscellaneous purchases will vary for everyone, but I highly recommend you set aside enough to at least get a few nice somethings.