<!DOCTYPE html>

SmartCart AI | Hackathon Project

/* ========================= GLOBAL ========================= */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: Arial, sans-serif; background: #f3f4f6; color: #222; } /* ========================= NAVBAR ========================= */ .navbar { background: #131921; color: white; padding: 15px 5%; display: flex; align-items: center; gap: 25px; } .logo { font-size: 24px; font-weight: bold; white-space: nowrap; } .logo span { color: #ff9900; } .search-box { flex: 1; display: flex; } .search-box input { width: 100%; padding: 12px; border: none; outline: none; font-size: 16px; } .search-box button { width: 55px; border: none; background: #ff9900; cursor: pointer; } .nav-actions { display: flex; gap: 10px; } .nav-actions button { background: transparent; color: white; border: 1px solid #777; padding: 9px 12px; cursor: pointer; } /* ========================= MENU ========================= */ .menu { background: #232f3e; display: flex; justify-content: center; gap: 35px; padding: 12px; } .menu a { color: white; text-decoration: none; } /* ========================= HERO ========================= */ .hero { min-height: 420px; display: flex; align-items: center; justify-content: center; text-align: center; background: linear-gradient( rgba(0,0,0,.65), rgba(0,0,0,.65) ), linear-gradient(135deg,#ff9900,#146eb4); color: white; } .hero-content { max-width: 750px; padding: 20px; } .hero h1 { font-size: 50px; margin-bottom: 20px; } .hero h1 span { color: #ff9900; } .hero p { font-size: 20px; margin-bottom: 30px; } .primary-btn { background: #ff9900; border: none; padding: 14px 30px; font-size: 17px; font-weight: bold; cursor: pointer; } /* ========================= SECTION ========================= */ .section { padding: 50px 7%; } .section h2 { margin-bottom: 25px; } /* ========================= CATEGORIES ========================= */ .categories { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 20px; } .category { background: white; padding: 30px 15px; text-align: center; border-radius: 10px; box-shadow: 0 3px 10px rgba(0,0,0,.1); cursor: pointer; transition: .3s; } .category:hover { transform: translateY(-5px); } /* ========================= PRODUCTS ========================= */ .products { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 25px; } .product-card { background: white; padding: 20px; border-radius: 10px; box-shadow: 0 3px 12px rgba(0,0,0,.12); transition: .3s; } .product-card:hover { transform: translateY(-6px); } .product-image { height: 150px; display: flex; align-items: center; justify-content: center; background: #f5f5f5; font-size: 75px; margin-bottom: 15px; } .product-card h3 { margin-bottom: 10px; } .rating { margin-bottom: 10px; } .price { font-size: 22px; font-weight: bold; margin-bottom: 15px; } .product-card button, .offer-card button { width: 100%; padding: 12px; background: #ff9900; border: none; cursor: pointer; font-weight: bold; } /* ========================= AI ASSISTANT ========================= */ .ai-section { padding: 60px 7%; background: #131921; color: white; } .ai-container { max-width: 800px; margin: auto; } .ai-container h2 { margin-bottom: 10px; } .chat-box { background: white; color: #222; margin-top: 25px; border-radius: 10px; overflow: hidden; } .chat-messages { min-height: 250px; max-height: 350px; overflow-y: auto; padding: 20px; } .bot-message, .user-message { padding: 12px; margin-bottom: 10px; border-radius: 8px; max-width: 80%; } .bot-message { background: #eee; } .user-message { background: #ff9900; margin-left: auto; } .chat-input { display: flex; border-top: 1px solid #ddd; } .chat-input input { flex: 1; padding: 15px; border: none; outline: none; } .chat-input button { padding: 15px 25px; border: none; background: #ff9900; cursor: pointer; } /* ========================= OFFERS ========================= */ .offers { padding: 50px 7%; text-align: center; } .offer-card { max-width: 500px; margin: 20px auto; padding: 30px; background: white; border-radius: 10px; box-shadow: 0 3px 12px rgba(0,0,0,.1); } .offer-card p { font-size: 25px; margin: 20px; } /* ========================= FOOTER ========================= */ footer { background: #131921; color: white; text-align: center; padding: 35px; } footer p { margin-top: 10px; } /* ========================= LOGIN MODAL ========================= */ .modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); align-items: center; justify-content: center; z-index: 999; } .modal-content { width: 350px; background: white; padding: 30px; border-radius: 10px; position: relative; } .modal-content h2 { margin-bottom: 15px; } .modal-content input { width: 100%; padding: 12px; margin: 10px 0; border: 1px solid #ccc; } .modal-content button { width: 100%; padding: 12px; background: #ff9900; border: none; cursor: pointer; } .close { position: absolute; right: 15px; top: 10px; font-size: 25px; cursor: pointer; } /* ========================= MOBILE ========================= */ @media(max-width:700px) { .navbar { flex-direction: column; } .search-box { width: 100%; } .nav-actions { width: 100%; justify-content: center; } .menu { flex-wrap: wrap; gap: 15px; } .hero h1 { font-size: 35px; } }

šŸ›’ SmartCart AI šŸ” šŸ‘¤ Login šŸ›’ Cart 0 Home Products Categories AI Assistant Today's Deals

Shop Smarter with SmartCart AI

AI-powered shopping recommendations, smart search and personalized deals.

Start Shopping

<section id="categories" class="section"

<h2>
    šŸ›ļø Shop by Category
</h2>

<div class="categories">

    <div
        class="category"
        onclick="categorySearch('Electronics')"
    >
        šŸ“± Electronics
    </div>

    <div
        class="category"
        onclick="categorySearch('Computer')"
    >
        šŸ’» Computers
    </div>

    <div
        class="category"
        onclick="categorySearch('Fashion')"
    >
        šŸ‘• Fashion
    </div>

    <div
        class="category"
        onclick="categorySearch('Home')"
    >
        šŸ  Home
    </div>

    <div
        class="category"
        onclick="categorySearch('Gaming')"
    >
        šŸŽ® Gaming
    </div>

    <div
        class="category"
        onclick="categorySearch('Book')"
    >
        šŸ“š Books
    </div>

</div>

<section id="products" class="section"

<h2>
    šŸ”„ Recommended Products
</h2>

<div
    id="productContainer"
    class="products"
>

    <!-- PRODUCT 1 -->

    <div
        class="product-card"
        data-name="Wireless Headphones"
    >

        <div class="product-image">
            šŸŽ§
        </div>

        <h3>
            Wireless Headphones
        </h3>

        <p class="rating">
            ⭐⭐⭐⭐⭐
        </p>

        <p class="price">
            ₹2,499
        </p>

        <button
            onclick="addToCart(
                'Wireless Headphones',
                2499
            )"
        >
            Add to Cart
        </button>

    </div>


    <!-- PRODUCT 2 -->

    <div
        class="product-card"
        data-name="Smart Watch"
    >

        <div class="product-image">
            ⌚
        </div>

        <h3>
            Smart Watch
        </h3>

        <p class="rating">
            ⭐⭐⭐⭐
        </p>

        <p class="price">
            ₹3,999
        </p>

        <button
            onclick="addToCart(
                'Smart Watch',
                3999
            )"
        >
            Add to Cart
        </button>

    </div>


    <!-- PRODUCT 3 -->

    <div
        class="product-card"
        data-name="Gaming Laptop"
    >

        <div class="product-image">
            šŸ’»
        </div>

        <h3>
            Gaming Laptop
        </h3>

        <p class="rating">
            ⭐⭐⭐⭐⭐
        </p>

        <p class="price">
            ₹74,999
        </p>

        <button
            onclick="addToCart(
                'Gaming Laptop',
                74999
            )"
        >
            Add to Cart
        </button>

    </div>


    <!-- PRODUCT 4 -->

    <div
        class="product-card"
        data-name="Bluetooth Speaker"
    >

        <div class="product-image">
            šŸ”Š
        </div>

        <h3>
            Bluetooth Speaker
        </h3>

        <p class="rating">
            ⭐⭐⭐⭐
        </p>

        <p class="price">
            ₹1,799
        </p>

        <button
            onclick="addToCart(
                'Bluetooth Speaker',
                1799
            )"
        >
            Add to Cart
        </button>

    </div>

</div>

<section id="ai" class="ai-section"

<div class="ai-container">

    <h2>
        šŸ¤– SmartCart AI Assistant
    </h2>

    <p>
        Ask me what product you should buy.
    </p>


    <div class="chat-box">

        <div
            id="chatMessages"
            class="chat-messages"
        >

            <div class="bot-message">

                šŸ‘‹ Hello!
                I'm SmartCart AI.

                <br><br>

                Tell me what you're
                looking for.

            </div>

        </div>


        <div class="chat-input">

            <input
                type="text"
                id="aiInput"
                placeholder="Ask AI..."
                onkeypress="handleEnter(event)"
            >

            <button onclick="askAI()">
                Send
            </button>

        </div>

    </div>

</div>

<section id="offers" class="offers"

<h2>
    šŸ”„ Today's Deals
</h2>

<div class="offer-card">

    <h3>
        Smart Electronics Sale
    </h3>

    <p>
        Up to 40% OFF
    </p>

    <button
        onclick="scrollToProducts()"
    >
        Shop Now
    </button>

</div>

šŸ›’ SmartCart AI

Amazon Hackathon Project

Built with HTML • CSS • JavaScript • TypeScript

Ā© 2026 SmartCart AI

<div id="loginModal" class="modal"

<div class="modal-content">

    <span
        class="close"
        onclick="closeLogin()"
    >
        Ɨ
    </span>

    <h2>
        šŸ‘¤ Login
    </h2>

    <input
        id="email"
        type="email"
        placeholder="Email"
    >

    <input
        id="password"
        type="password"
        placeholder="Password"
    >

    <button onclick="login()">
        Login
    </button>

</div>

</p> <h1 id="part-59707e">/*</h1> <p>SMARTCART AI</p> <h1 id="javascript-typescript-style">JAVASCRIPT + TYPESCRIPT STYLE</h1> <p>*/</p> <p>/* ========================= PRODUCT TYPE ========================= */</p> <p>/* TypeScript equivalent:</p> <p>interface Product { name: string; price: number; }</p> <p>JavaScript implementation: */</p> <p>let cart = [];</p> <p>/* ========================= ADD PRODUCT ========================= */</p> <p>function addToCart(name, price) {</p> <pre class="language-nolang"><code>const product = { name: name, price: price }; cart.push(product); updateCartCount(); alert( name + &quot; added to cart šŸ›’&quot; ); </code></pre> <p>}</p> <p>/* ========================= CART COUNT ========================= */</p> <p>function updateCartCount() {</p> <pre class="language-nolang"><code>document.getElementById( &quot;cartCount&quot; ).innerText = cart.length; </code></pre> <p>}</p> <p>/* ========================= SHOW CART ========================= */</p> <p>function showCart() {</p> <pre class="language-nolang"><code>if (cart.length === 0) { alert( &quot;Your cart is empty šŸ›’&quot; ); return; } let message = &quot;šŸ›’ YOUR CART\n\n&quot;; let total = 0; cart.forEach( function(item, index) { message += (index + 1) + &quot;. &quot; + item.name + &quot; - ₹&quot; + item.price + &quot;\n&quot;; total += item.price; } ); message += &quot;\nšŸ’° Total: ₹&quot; + total; alert(message); </code></pre> <p>}</p> <p>/* ========================= SEARCH ========================= */</p> <p>function searchProducts() {</p> <pre class="language-nolang"><code>const input = document.getElementById( &quot;searchInput&quot; ).value.toLowerCase(); const products = document.querySelectorAll( &quot;.product-card&quot; ); products.forEach( function(product) { const name = product .getAttribute( &quot;data-name&quot; ) .toLowerCase(); if ( name.includes(input) ) { product.style.display = &quot;block&quot;; } else { product.style.display = &quot;none&quot;; } } ); </code></pre> <p>}</p> <p>/* ========================= CATEGORY SEARCH ========================= */</p> <p>function categorySearch(category) {</p> <pre class="language-nolang"><code>document.getElementById( &quot;searchInput&quot; ).value = category; searchProducts(); scrollToProducts(); </code></pre> <p>}</p> <p>/* ========================= AI ASSISTANT ========================= */</p> <p>function askAI() {</p> <pre class="language-nolang"><code>const input = document.getElementById( &quot;aiInput&quot; ); const message = input.value.trim(); if (message === &quot;&quot;) { return; } const chat = document.getElementById( &quot;chatMessages&quot; ); /* USER MESSAGE */ const userMessage = document.createElement( &quot;div&quot; ); userMessage.className = &quot;user-message&quot;; userMessage.innerText = message; chat.appendChild( userMessage ); /* AI RESPONSE */ const response = generateAIResponse( message ); setTimeout( function() { const botMessage = document.createElement( &quot;div&quot; ); botMessage.className = &quot;bot-message&quot;; botMessage.innerText = response; chat.appendChild( botMessage ); chat.scrollTop = chat.scrollHeight; }, 500 ); input.value = &quot;&quot;; </code></pre> <p>}</p> <p>/* ========================= AI LOGIC ========================= */</p> <p>function generateAIResponse( message ) {</p> <pre class="language-nolang"><code>const text = message.toLowerCase(); if ( text.includes( &quot;laptop&quot; ) ) { return ` </code></pre> <p>šŸ’» Laptop Recommendation:</p> <p>Look for: • Intel/AMD processor • 16GB RAM • 512GB SSD • Good battery • High-quality display</p> <p>For gaming, choose a dedicated GPU. `;</p> <pre class="language-nolang"><code>} if ( text.includes( &quot;phone&quot; ) ) { return ` </code></pre> <p>šŸ“± Smartphone Recommendation:</p> <p>Compare: • Processor • Camera • Battery • Display • Storage</p> <p>I recommend choosing a phone based on your budget and usage. `;</p> <pre class="language-nolang"><code>} if ( text.includes( &quot;headphone&quot; ) ) { return ` </code></pre> <p>šŸŽ§ Headphone Recommendation:</p> <p>Look for: • Active Noise Cancellation • Good battery life • Comfortable design • Bluetooth 5+ • Good microphone `;</p> <pre class="language-nolang"><code>} if ( text.includes( &quot;cheap&quot; ) || text.includes( &quot;budget&quot; ) ) { return ` </code></pre> <p>šŸ’° Budget Shopping:</p> <p>Tell me your budget, for example:</p> <p>&quot;Best laptop under ₹50,000&quot;</p> <p>or</p> <p>&quot;Best headphones under ₹3,000&quot; `;</p> <pre class="language-nolang"><code>} return ` </code></pre> <p>šŸ¤– SmartCart AI:</p> <p>I can help you with:</p> <p>šŸ“± Phones šŸ’» Laptops šŸŽ§ Headphones ⌚ Smart Watches šŸŽ® Gaming šŸ’° Budget products</p> <p>Try asking:</p> <p>&quot;Best laptop under ₹50,000&quot; `; }</p> <p>/* ========================= ENTER KEY ========================= */</p> <p>function handleEnter(event) {</p> <pre class="language-nolang"><code>if ( event.key === &quot;Enter&quot; ) { askAI(); } </code></pre> <p>}</p> <p>/* ========================= LOGIN ========================= */</p> <p>function openLogin() {</p> <pre class="language-nolang"><code>document.getElementById( &quot;loginModal&quot; ).style.display = &quot;flex&quot;; </code></pre> <p>}</p> <p>function closeLogin() {</p> <pre class="language-nolang"><code>document.getElementById( &quot;loginModal&quot; ).style.display = &quot;none&quot;; </code></pre> <p>}</p> <p>function logi</p>

Share this project:

Updates

Submission history