طور هذا الكود : 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive E-commerce</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        @media (min-width: 640px) {
            .grid-cols-custom {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (min-width: 1024px) {
            .grid-cols-custom {
                grid-template-columns: 1fr 1fr 1fr;
            }
        }

        .quantity-button {
            cursor: pointer;
            background-color: #f0f0f0;
            padding: 0.25rem;
            font-size: 1rem;
            border-radius: 0.25rem;
        }

        .quantity-button:hover {
            background-color: #e0e0e0;
        }
    </style>
</head>
<body class="bg-gray-100">
    <!-- Discover Page -->
    <section id="discover" class="px-4 py-6 lg:max-w-4xl lg:mx-auto">
        <div class="flex justify-between items-center mb-6">
            <h2 class="text-2xl font-bold">Discover</h2>
            <button class="relative">
                <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3h18M9 21h6M7 6h10M7 12h10m-7 6h4" />
                </svg>
                <span class="absolute top-0 right-0 text-xs bg-red-500 text-white rounded-full px-1">3</span>
            </button>
        </div>

        <!-- Clearance Sale Section -->
        <div class="mb-6">
            <div class="relative h-48 overflow-hidden rounded-lg shadow-lg bg-white">
                <img src="https://source.unsplash.com/random/400x400?iphone" alt="Clearance iPhone" class="w-full h-full object-cover object-center">
                <div class="absolute top-0 left-0 bg-green-500 text-white p-2 rounded-br-lg">
                    <p>Clearance Sales</p>
                    <p class="text-sm">Up to 50%</p>
                </div>
            </div>
        </div>

        <!-- Categories Section -->
        <h3 class="text-xl font-semibold mb-4">Categories</h3>
        <div class="grid grid-cols-2 gap-4 md:grid-cols-custom">
            <!-- Smartphone Category -->
            <div class="p-4 bg-white rounded-lg shadow-lg text-center hover:shadow-2xl transition">
                <img src="https://source.unsplash.com/random/100x100?smartphone" alt="Smartphones" class="mx-auto mb-4 w-16 h-16">
                <p>Smartphones</p>
            </div>
            <!-- Headphones Category -->
            <div class="p-4 bg-white rounded-lg shadow-lg text-center hover:shadow-2xl transition">
                <img src="https://source.unsplash.com/random/100x100?headphones" alt="Headphones" class="mx-auto mb-4 w-16 h-16">
                <p>Headphones</p>
            </div>
            <!-- Laptops Category -->
            <div class="p-4 bg-white rounded-lg shadow-lg text-center hover:shadow-2xl transition">
                <img src="https://source.unsplash.com/random/100x100?laptop" alt="Laptops" class="mx-auto mb-4 w-16 h-16">
                <p>Laptops</p>
            </div>
        </div>
    </section>

    <!-- Product Detail Page -->
    <section id="product" class="hidden px-4 py-6 lg:max-w-4xl lg:mx-auto">
        <div class="flex justify-between items-center mb-6">
            <button onclick="togglePage('discover')" class="text-gray-700">&larr; Back</button>
            <button class="text-gray-700">My Cart (3)</button>
        </div>

        <div class="mb-6">
            <img src="https://source.unsplash.com/random/400x400?xbox" alt="Xbox Series X" class="w-full h-64 object-cover rounded-lg">
        </div>

        <h3 class="text-2xl font-bold mb-4">Xbox Series X</h3>
        <p class="text-gray-700 mb-4">1TB SSD, 8K Gaming Console</p>
        <p class="text-xl font-semibold mb-4 text-green-500">$570.00</p>
        <button class="bg-green-500 text-white w-full py-3 rounded-full hover:bg-green-600 transition">Add to Cart</button>
    </section>

    <!-- Cart Page -->
    <section id="cart" class="hidden px-4 py-6 lg:max-w-4xl lg:mx-auto">
        <div class="flex justify-between items-center mb-6">
            <button onclick="togglePage('discover')" class="text-gray-700">&larr; Back</button>
            <button class="text-gray-700">My Cart (3)</button>
        </div>

        <ul class="mb-6">
            <!-- Cart Items -->
            <li class="flex justify-between items-center mb-4">
                <div class="flex items-center">
                    <img src="https://source.unsplash.com/random/50x50?xbox" alt="Xbox Series X" class="w-12 h-12 rounded-lg">
                    <div class="ml-2">
                        <p>Xbox Series X</p>
                        <p class="text-gray-500">$570.00</p>
                    </div>
                </div>
                <div class="flex items-center space-x-2">
                    <button class="quantity-button" onclick="decrementQuantity()">-</button>
                    <input type="number" value="1" class="border w-12 text-center">
                    <button class="quantity-button" onclick="incrementQuantity()">+</button>
                </div>
            </li>
        </ul>

        <!-- Cart Summary -->
        <div class="bg-white p-4 rounded-lg shadow-lg">
            <div class="flex justify-between mb-2">
                <p>Subtotal</p>
                <p>$800.00</p>
            </div>
            <div class="flex justify-between mb-2">
                <p>Delivery Fee</p>
                <p>$5.00</p>
            </div>
            <div class="flex justify-between mb-2 text-green-500">
                <p>Discount</p>
                <p>40%</p>
            </div>
            <div class="flex justify-between text-xl font-bold">
                <p>Total</p>
                <p>$480.00</p>
            </div>
        </div>

        <!-- Checkout Button -->
        <button class="mt-6 bg-green-500 text-white w-full py-3 rounded-full hover:bg-green-600 transition">
            Checkout for $480.00
        </button>
    </section>

    <!-- Toggle Pages -->
    <script>
        function togglePage(pageId) {
            document.getElementById('discover').classList.add('hidden');
            document.getElementById('product').classList.add('hidden');
            document.getElementById('cart').classList.add('hidden');

            document.getElementById(pageId).classList.remove('hidden');
        }

        function incrementQuantity() {
            // Increment product quantity logic
        }

        function decrementQuantity() {
            // Decrement product quantity logic
        }
    </script>
</body>
</html>