* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; background-color: #f4f4f4; } header { background-color: #333; color: #fff; padding: 1rem 0; position: sticky; top: 0; z-index: 1000; } nav { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 2rem; } .logo { font-size: 1.5rem; font-weight: bold; } nav ul { display: flex; list-style: none; } nav ul li { margin-left: 2rem; } nav ul li a { color: #fff; text-decoration: none; transition: color 0.3s; } nav ul li a:hover { color: #4CAF50; } .cart-icon { position: relative; cursor: pointer; } .cart-count { position: absolute; top: -10px; right: -10px; background-color: #4CAF50; color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; display: flex; align-items: center; justify-content: center; } .container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; } .hero { background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url(https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=modern%20ecommerce%20shopping%20website%20hero%20banner&image_size=landscape_16_9); background-size: cover; background-position: center; color: #fff; padding: 6rem 0; text-align: center; } .hero h1 { font-size: 3rem; margin-bottom: 1rem; } .hero p { font-size: 1.2rem; margin-bottom: 2rem; } .btn { display: inline-block; background-color: #4CAF50; color: #fff; padding: 0.8rem 1.5rem; text-decoration: none; border-radius: 5px; transition: background-color 0.3s; } .btn:hover { background-color: #45a049; } .section { padding: 4rem 0; } .section-title { text-align: center; margin-bottom: 3rem; font-size: 2rem; color: #333; } .products { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; margin-top: 3rem; } .product { background-color: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.1); transition: transform 0.3s; } .product:hover { transform: translateY(-5px); } .product-image { width: 100%; height: 200px; overflow: hidden; } .product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; } .product:hover .product-image img { transform: scale(1.1); } .product-info { padding: 1.5rem; } .product-title { font-size: 1.2rem; margin-bottom: 0.5rem; color: #333; } .product-price { font-size: 1.5rem; font-weight: bold; color: #4CAF50; margin-bottom: 1rem; } .add-to-cart { width: 100%; padding: 0.8rem; background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s; } .add-to-cart:hover { background-color: #45a049; } .cart { position: fixed; right: -400px; top: 0; width: 400px; height: 100vh; background-color: #fff; box-shadow: -2px 0 5px rgba(0,0,0,0.3); transition: right 0.3s; z-index: 2000; padding: 2rem; overflow-y: auto; } .cart.active { right: 0; } .cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; } .cart-title { font-size: 1.5rem; font-weight: bold; } .close-cart { background: none; border: none; font-size: 1.5rem; cursor: pointer; } .cart-items { margin-bottom: 2rem; } .cart-item { display: flex; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #eee; } .cart-item-image { width: 80px; height: 80px; margin-right: 1rem; } .cart-item-image img { width: 100%; height: 100%; object-fit: cover; } .cart-item-info { flex: 1; } .cart-item-title { font-size: 1rem; margin-bottom: 0.5rem; } .cart-item-price { font-weight: bold; color: #4CAF50; margin-bottom: 0.5rem; } .cart-item-quantity { display: flex; align-items: center; } .quantity-btn { width: 30px; height: 30px; background-color: #f4f4f4; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; cursor: pointer; } .quantity { margin: 0 1rem; } .remove-item { background: none; border: none; color: #ff4444; cursor: pointer; } .cart-total { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #eee; } .total-price { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: bold; margin-bottom: 1rem; } .checkout-btn { width: 100%; padding: 1rem; background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 1rem; transition: background-color 0.3s; } .checkout-btn:hover { background-color: #45a049; } .overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 1500; display: none; } .overlay.active { display: block; } .footer { background-color: #333; color: #fff; padding: 3rem 0; margin-top: 4rem; } .footer-content { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; padding: 0 2rem; } .footer-section h3 { margin-bottom: 1rem; color: #4CAF50; } .footer-section p, .footer-section li { margin-bottom: 0.5rem; } .footer-section ul { list-style: none; } .footer-section a { color: #fff; text-decoration: none; transition: color 0.3s; } .footer-section a:hover { color: #4CAF50; } .footer-bottom { text-align: center; padding-top: 2rem; margin-top: 2rem; border-top: 1px solid #555; } @media (max-width: 768px) { nav { flex-direction: column; padding: 1rem; } nav ul { margin-top: 1rem; } nav ul li { margin: 0 1rem; } .hero h1 { font-size: 2rem; } .cart { width: 100%; right: -100%; } }
