<div class="hidden md:flex space-x-8">
<a href="#" class="nav-link text-gray-700 hover:text-yellow-600 transition">Home</a>
<a href="#" class="nav-link text-gray-700 hover:text-yellow-600 transition">Shop</a>
<a href="#" class="nav-link text-gray-700 hover:text-yellow-600 transition">Collections</a>
<a href="#" class="nav-link text-gray-700 hover:text-yellow-600 transition">About</a>
<a href="#" class="nav-link text-gray-700 hover:text-yellow-600 transition">Contact</a>
</div>
<div class="flex items-center space-x-4">
<button id="search-btn" class="text-gray-700 hover:text-yellow-600">
<i class="fas fa-search"></i>
</button>
<button id="wishlist-btn" class="text-gray-700 hover:text-yellow-600 relative">
<i class="fas fa-heart"></i>
<span class="absolute -top-2 -right-2 bg-yellow-600 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">0</span>
</button>
<button id="cart-btn" class="text-gray-700 hover:text-yellow-600 relative">
<i class="fas fa-shopping-bag"></i>
<span id="cart-count" class="absolute -top-2 -right-2 bg-yellow-600 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">0</span>
</button>
<button class="md:hidden text-gray-700" id="mobile-menu-btn">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
<!-- Mobile Menu -->
<div id="mobile-menu" class="hidden md:hidden bg-white py-2 px-4 shadow-lg">
<a href="#" class="block py-2 text-gray-700 hover:text-yellow-600">Home</a>
<a href="#" class="block py-2 text-gray-700 hover:text-yellow-600">Shop</a>
<a href="#" class="block py-2 text-gray-700 hover:text-yellow-600">Collections</a>
<a href="#" class="block py-2 text-gray-700 hover:text-yellow-600">About</a>
<a href="#" class="block py-2 text-gray-700 hover:text-yellow-600">Contact</a>
</div>
<!-- Search Bar -->
<div id="search-bar" class="hidden bg-white py-3 px-4 shadow-md">
<div class="container mx-auto flex">
<input type="text" placeholder="Search for jewelry..." class="flex-grow px-4 py-2 border border-gray-300 rounded-l focus:outline-none focus:ring-2 focus:ring-yellow-500">
<button class="bg-yellow-600 text-white px-6 py-2 rounded-r hover:bg-yellow-700 transition">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</nav>
<!-- Hero Section -->
<section class="hero-section flex items-center justify-center text-center text-white">
<div class="px-4">
<h1 class="playfair text-4xl md:text-6xl font-bold mb-4">Timeless Elegance</h1>
<p class="text-xl mb-8 max-w-2xl mx-auto">Discover our exquisite collection of handcrafted jewelry, designed to complement your unique style.</p>
<a href="#" class="bg-yellow-600 hover:bg-yellow-700 text-white px-8 py-3 rounded-md font-medium transition duration-300 inline-block">Shop Now</a>
</div>
</section>
<!-- Categories -->
<section class="py-12 bg-white">
<div class="container mx-auto px-4">
<h2 class="playfair text-3xl font-bold text-center mb-12">Our Collections</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-6">
<div class="relative overflow-hidden rounded-lg group">
<img src="https://images.unsplash.com/photo-1603974372036-1a3b5a648ac8?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Rings" class="w-full h-64 object-cover transition duration-500 group-hover:scale-110">
<div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
<h3 class="text-white playfair text-2xl font-bold">Rings</h3>
</div>
<a href="#" class="absolute inset-0"></a>
</div>
<div class="relative overflow-hidden rounded-lg group">
<img src="https://images.unsplash.com/photo-1611591437281-460914d8f56a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Necklaces" class="w-full h-64 object-cover transition duration-500 group-hover:scale-110">
<div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
<h3 class="text-white playfair text-2xl font-bold">Necklaces</h3>
</div>
<a href="#" class="absolute inset-0"></a>
</div>
<div class="relative overflow-hidden rounded-lg group">
<img src="https://images.unsplash.com/photo-1602173574767-37ac01994b2a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Earrings" class="w-full h-64 object-cover transition duration-500 group-hover:scale-110">
<div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
<h3 class="text-white playfair text-2xl font-bold">Earrings</h3>
</div>
<a href="#" class="absolute inset-0"></a>
</div>
<div class="relative overflow-hidden rounded-lg group">
<img src="https://images.unsplash.com/photo-1605106702734-205df224ecce?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Bracelets" class="w-full h-64 object-cover transition duration-500 group-hover:scale-110">
<div class="absolute inset-0 bg-black bg-opacity-40 flex items-center justify-center">
<h3 class="text-white playfair text-2xl font-bold">Bracelets</h3>
</div>
<a href="#" class="absolute inset-0"></a>
</div>
</div>
</div>
</section>
<!-- Featured Products -->
<section class="py-12 bg-gray-50">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center mb-8">
<h2 class="playfair text-3xl font-bold">Featured Jewelry</h2>
<a href="#" class="text-yellow-600 hover:text-yellow-700 font-medium">View All <i class="fas fa-arrow-right ml-1"></i></a>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8">
<!-- Product 1 -->
<div class="bg-white rounded-lg overflow-hidden shadow-md hover:shadow-lg transition duration-300 jewelry-card">
<div class="relative">
<img src="https://images.unsplash.com/photo-1603974372036-1a3b5a648ac8?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Diamond Ring" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2">
<button class="bg-white rounded-full p-2 shadow-md hover:bg-yellow-50 text-gray-700">
<i class="far fa-heart"></i>
</button>
</div>
<div class="jewelry-overlay absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center space-x-4">
<button class="bg-white text-gray-800 px-4 py-2 rounded hover:bg-gray-100 transition">
<i class="fas fa-eye mr-2"></i> Quick View
</button>
<button class="add-to-cart bg-yellow-600 text-white px-4 py-2 rounded hover:bg-yellow-700 transition" data-id="1" data-name="Diamond Solitaire Ring" data-price="899.99">
<i class="fas fa-shopping-bag mr-2"></i> Add to Cart
</button>
</div>
</div>
<div class="p-4">
<h3 class="playfair text-lg font-semibold mb-1">Diamond Solitaire Ring</h3>
<div class="flex items-center mb-2">
<div class="flex text-yellow-400">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="text-gray-500 text-sm ml-2">(42 reviews)</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-800 font-bold">$899.99</span>
<button class="text-gray-500 hover:text-yellow-600">
<i class="fas fa-share-alt"></i>
</button>
</div>
</div>
</div>
<!-- Product 2 -->
<div class="bg-white rounded-lg overflow-hidden shadow-md hover:shadow-lg transition duration-300 jewelry-card">
<div class="relative">
<img src="https://images.unsplash.com/photo-1611591437281-460914d8f56a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Gold Necklace" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2">
<button class="bg-white rounded-full p-2 shadow-md hover:bg-yellow-50 text-gray-700">
<i class="far fa-heart"></i>
</button>
</div>
<div class="jewelry-overlay absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center space-x-4">
<button class="bg-white text-gray-800 px-4 py-2 rounded hover:bg-gray-100 transition">
<i class="fas fa-eye mr-2"></i> Quick View
</button>
<button class="add-to-cart bg-yellow-600 text-white px-4 py-2 rounded hover:bg-yellow-700 transition" data-id="2" data-name="Gold Pendant Necklace" data-price="499.99">
<i class="fas fa-shopping-bag mr-2"></i> Add to Cart
</button>
</div>
</div>
<div class="p-4">
<h3 class="playfair text-lg font-semibold mb-1">Gold Pendant Necklace</h3>
<div class="flex items-center mb-2">
<div class="flex text-yellow-400">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="far fa-star"></i>
</div>
<span class="text-gray-500 text-sm ml-2">(36 reviews)</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-800 font-bold">$499.99</span>
<button class="text-gray-500 hover:text-yellow-600">
<i class="fas fa-share-alt"></i>
</button>
</div>
</div>
</div>
<!-- Product 3 -->
<div class="bg-white rounded-lg overflow-hidden shadow-md hover:shadow-lg transition duration-300 jewelry-card">
<div class="relative">
<img src="https://images.unsplash.com/photo-1602173574767-37ac01994b2a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Pearl Earrings" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2">
<button class="bg-white rounded-full p-2 shadow-md hover:bg-yellow-50 text-gray-700">
<i class="far fa-heart"></i>
</button>
</div>
<div class="jewelry-overlay absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center space-x-4">
<button class="bg-white text-gray-800 px-4 py-2 rounded hover:bg-gray-100 transition">
<i class="fas fa-eye mr-2"></i> Quick View
</button>
<button class="add-to-cart bg-yellow-600 text-white px-4 py-2 rounded hover:bg-yellow-700 transition" data-id="3" data-name="Pearl Drop Earrings" data-price="349.99">
<i class="fas fa-shopping-bag mr-2"></i> Add to Cart
</button>
</div>
</div>
<div class="p-4">
<h3 class="playfair text-lg font-semibold mb-1">Pearl Drop Earrings</h3>
<div class="flex items-center mb-2">
<div class="flex text-yellow-400">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<span class="text-gray-500 text-sm ml-2">(58 reviews)</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-800 font-bold">$349.99</span>
<button class="text-gray-500 hover:text-yellow-600">
<i class="fas fa-share-alt"></i>
</button>
</div>
</div>
</div>
<!-- Product 4 -->
<div class="bg-white rounded-lg overflow-hidden shadow-md hover:shadow-lg transition duration-300 jewelry-card">
<div class="relative">
<img src="https://images.unsplash.com/photo-1605106702734-205df224ecce?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Silver Bracelet" class="w-full h-64 object-cover">
<div class="absolute top-2 right-2">
<button class="bg-white rounded-full p-2 shadow-md hover:bg-yellow-50 text-gray-700">
<i class="far fa-heart"></i>
</button>
</div>
<div class="jewelry-overlay absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center space-x-4">
<button class="bg-white text-gray-800 px-4 py-2 rounded hover:bg-gray-100 transition">
<i class="fas fa-eye mr-2"></i> Quick View
</button>
<button class="add-to-cart bg-yellow-600 text-white px-4 py-2 rounded hover:bg-yellow-700 transition" data-id="4" data-name="Silver Charm Bracelet" data-price="279.99">
<i class="fas fa-shopping-bag mr-2"></i> Add to Cart
</button>
</div>
</div>
<div class="p-4">
<h3 class="playfair text-lg font-semibold mb-1">Silver Charm Bracelet</h3>
<div class="flex items-center mb-2">
<div class="flex text-yellow-400">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
<i class="far fa-star"></i>
</div>
<span class="text-gray-500 text-sm ml-2">(24 reviews)</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-800 font-bold">$279.99</span>
<button class="text-gray-500 hover:text-yellow-600">
<i class="fas fa-share-alt"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Banner -->
<section class="py-16 bg-yellow-50">
<div class="container mx-auto px-4">
<div class="bg-white rounded-lg shadow-md overflow-hidden">
<div class="md:flex">
<div class="md:w-1/2 p-8 md:p-12 flex flex-col justify-center">
<h2 class="playfair text-3xl font-bold mb-4">Summer Collection</h2>
<p class="text-gray-600 mb-6">Discover our limited edition summer jewelry collection, inspired by the beauty of nature and crafted with the finest materials.</p>
<a href="#" class="bg-yellow-600 hover:bg-yellow-700 text-white px-6 py-3 rounded-md font-medium transition duration-300 inline-block w-max">Explore Collection</a>
</div>
<div class="md:w-1/2">
<img src="https://images.unsplash.com/photo-1602173574767-37ac01994b2a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Summer Collection" class="w-full h-full object-cover">
</div>
</div>
</div>
</div>
</section>
<!-- Testimonials -->
<section class="py-16 bg-white">
<div class="container mx-auto px-4">
<h2 class="playfair text-3xl font-bold text-center mb-12">What Our Customers Say</h2>
<div class="grid md:grid-cols-3 gap-8">
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="flex text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<span class="text-gray-500 text-sm">5/5</span>
</div>
<p class="text-gray-600 mb-4">"The diamond ring I purchased for my anniversary is absolutely stunning. The craftsmanship is exceptional and my wife loves it!"</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/32.jpg" alt="Sarah Johnson" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Sarah Johnson</h4>
<p class="text-gray-500 text-sm">Verified Buyer</p>
</div>
</div>
</div>
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="flex text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
</div>
<span class="text-gray-500 text-sm">5/5</span>
</div>
<p class="text-gray-600 mb-4">"I've purchased several pieces from LuxeGems and each one has exceeded my expectations. Their customer service is outstanding too."</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/45.jpg" alt="Michael Chen" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Michael Chen</h4>
<p class="text-gray-500 text-sm">Verified Buyer</p>
</div>
</div>
</div>
<div class="bg-gray-50 p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<div class="flex text-yellow-400 mr-2">
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star"></i>
<i class="fas fa-star-half-alt"></i>
</div>
<span class="text-gray-500 text-sm">4.5/5</span>
</div>
<p class="text-gray-600 mb-4">"The pearl earrings are beautiful and arrived much sooner than expected. Will definitely be shopping here again for gifts."</p>
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/68.jpg" alt="Emily Rodriguez" class="w-10 h-10 rounded-full mr-3">
<div>
<h4 class="font-medium">Emily Rodriguez</h4>
<p class="text-gray-500 text-sm">Verified Buyer</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Newsletter -->
<section class="py-16 bg-gray-100">
<div class="container mx-auto px-4 text-center">
<h2 class="playfair text-3xl font-bold mb-4">Join Our Newsletter</h2>
<p class="text-gray-600 max-w-2xl mx-auto mb-8">Subscribe to receive updates on new arrivals, special offers, and exclusive jewelry collections.</p>
<form class="max-w-md mx-auto flex">
<input type="email" placeholder="Your email address" class="flex-grow px-4 py-3 border border-gray-300 rounded-l focus:outline-none focus:ring-2 focus:ring-yellow-500">
<button type="submit" class="bg-yellow-600 text-white px-6 py-3 rounded-r hover:bg-yellow-700 transition font-medium">Subscribe</button>
</form>
</div>
</section>
<!-- Footer -->
<footer class="bg-gray-900 text-white py-12">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<div class="flex items-center space-x-2 mb-4">
<i class="fas fa-gem text-2xl text-yellow-600"></i>
<a href="#" class="playfair text-2xl font-bold">LuxeGems</a>
</div>
<p class="text-gray-400 mb-4">Crafting timeless jewelry pieces that tell your unique story.</p>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook-f"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram"></i></a>
<a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-pinterest-p"></i></a>
</div>
</div>
<div>
<h3 class="playfair text-lg font-semibold mb-4">Shop</h3>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">All Jewelry</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Rings</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Necklaces</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Earrings</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Bracelets</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">New Arrivals</a></li>
</ul>
</div>
<div>
<h3 class="playfair text-lg font-semibold mb-4">Customer Service</h3>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Contact Us</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">FAQs</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Shipping & Returns</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Size Guide</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Care Guide</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Track Order</a></li>
</ul>
</div>
<div>
<h3 class="playfair text-lg font-semibold mb-4">About LuxeGems</h3>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Our Story</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Sustainability</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Ethical Sourcing</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Blog</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Careers</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Press</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-800 mt-12 pt-8 flex flex-col md:flex-row justify-between items-center">
<p class="text-gray-400 text-sm mb-4 md:mb-0">© 2023 LuxeGems. All rights reserved.</p>
<div class="flex space-x-6">
<img src="https://via.placeholder.com/40x25" alt="Visa" class="h-6">
<img src="https://via.placeholder.com/40x25" alt="Mastercard" class="h-6">
<img src="https://via.placeholder.com/40x25" alt="American Express" class="h-6">
<img src="https://via.placeholder.com/40x25" alt="PayPal" class="h-6">
</div>
</div>
</div>
</footer>
<!-- Shopping Cart Sidebar -->
<div id="cart-sidebar" class="fixed top-0 right-0 h-full w-full md:w-96 bg-white shadow-lg transform translate-x-full transition-transform duration-300 z-50 overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-center mb-6">
<h3 class="playfair text-xl font-bold">Your Cart</h3>
<button id="close-cart" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div id="cart-items" class="mb-6">
<!-- Cart items will be dynamically inserted here -->
<div class="text-center py-8 text-gray-500">
<i class="fas fa-shopping-bag text-3xl mb-2"></i>
<p>Your cart is empty</p>
</div>
</div>
<div class="border-t border-gray-200 pt-4 mb-4">
<div class="flex justify-between mb-2">
<span class="text-gray-600">Subtotal</span>
<span id="cart-subtotal" class="font-medium">$0.00</span>
</div>
<div class="flex justify-between mb-2">
<span class="text-gray-600">Shipping</span>
<span class="font-medium">Calculated at checkout</span>
</div>
<div class="flex justify-between text-lg font-bold mt-4">
<span>Total</span>
<span id="cart-total">$0.00</span>
</div>
</div>
<a href="#" class="block bg-yellow-600 hover:bg-yellow-700 text-white text-center py-3 rounded-md font-medium transition duration-300 mb-3">Checkout</a>
<a href="#" class="block border border-gray-300 text-gray-700 text-center py-3 rounded-md font-medium transition duration-300 hover:bg-gray-100">Continue Shopping</a>
</div>
</div>
<!-- Overlay -->
<div id="overlay" class="fixed inset-0 bg-black bg-opacity-50 z-40 hidden"></div>
<script>
// Mobile Menu Toggle
const mobileMenuBtn = document.getElementById('mobile-menu-btn');
const mobileMenu = document.getElementById('mobile-menu');
mobileMenuBtn.addEventListener('click', () => {
mobileMenu.classList.toggle('hidden');
});
// Search Bar Toggle
const searchBtn = document.getElementById('search-btn');
const searchBar = document.getElementById('search-bar');
searchBtn.addEventListener('click', () => {
searchBar.classList.toggle('hidden');
});
// Cart Sidebar Toggle
const cartBtn = document.getElementById('cart-btn');
const cartSidebar = document.getElementById('cart-sidebar');
const closeCart = document.getElementById('close-cart');
const overlay = document.getElementById('overlay');
cartBtn.addEventListener('click', () => {
cartSidebar.classList.remove('translate-x-full');
overlay.classList.remove('hidden');
document.body.style.overflow = 'hidden';
});
closeCart.addEventListener('click', () => {
cartSidebar.classList.add('translate-x-full');
overlay.classList.add('hidden');
document.body.style.overflow = 'auto';
});
overlay.addEventListener('click', () => {
cartSidebar.classList.add('translate-x-full');
overlay.classList.add('hidden');
document.body.style.overflow = 'auto';
});
// Shopping Cart Functionality
let cart = [];
const addToCartButtons = document.querySelectorAll('.add-to-cart');
const cartItemsContainer = document.getElementById('cart-items');
const cartCount = document.getElementById('cart-count');
const cartSubtotal = document.getElementById('cart-subtotal');
const cartTotal = document.getElementById('cart-total');
addToCartButtons.forEach(button => {
button.addEventListener('click', () => {
const id = button.getAttribute('data-id');
const name = button.getAttribute('data-name');
const price = parseFloat(button.getAttribute('data-price'));
// Check if item already exists in cart
const existingItem = cart.find(item => item.id === id);
if (existingItem) {
existingItem.quantity += 1;
} else {
cart.push({
id,
name,
price,
quantity: 1
});
}
updateCart();
// Show cart sidebar
cartSidebar.classList.remove('translate-x-full');
overlay.classList.remove('hidden');
document.body.style.overflow = 'hidden';
});
});
function updateCart() {
// Update cart count
const totalItems = cart.reduce((total, item) => total + item.quantity, 0);
cartCount.textContent = totalItems;
// Update cart items display
if (cart.length === 0) {
cartItemsContainer.innerHTML = `
<div class="text-center py-8 text-gray-500">
<i class="fas fa-shopping-bag text-3xl mb-2"></i>
<p>Your cart is empty</p>
</div>
`;
} else {
cartItemsContainer.innerHTML = '';
cart.forEach(item => {
const cartItemElement = document.createElement('div');
cartItemElement.className = 'flex py-4 border-b border-gray-200 cart-item-enter';
cartItemElement.innerHTML = `
<div class="w-20 h-20 bg-gray-100 rounded-md overflow-hidden mr-4">
<img src="https://via.placeholder.com/80x80" alt="${item.name}" class="w-full h-full object-cover">
</div>
<div class="flex-grow">
<div class="flex justify-between">
<h4 class="font-medium">${item.name}</h4>
<button class="remove-item text-gray-400 hover:text-red-500" data-id="${item.id}">
<i class="fas fa-times"></i>
</button>
</div>
<div class="flex justify-between items-center mt-2">
<div class="flex items-center border border-gray-300 rounded">
<button class="decrease-quantity px-2 py-1 text-gray-600 hover:bg-gray-100" data-id="${item.id}">-</button>
<span class="px-2 quantity">${item.quantity}</span>
<button class="increase-quantity px-2 py-1 text-gray-600 hover:bg-gray-100" data-id="${item.id}">+</button>
</div>
<span class="font-medium">$${(item.price * item.quantity).toFixed(2)}</span>
</div>
</div>
`;
cartItemsContainer.appendChild(cartItemElement);
});
// Add event listeners to new buttons
document.querySelectorAll('.remove-item').forEach(button => {
button.addEventListener('click', (e) => {
const itemId = button.getAttribute('data-id');
cart = cart.filter(item => item.id !== itemId);
updateCart();
});
});
document.querySelectorAll('.decrease-quantity').forEach(button => {
button.addEventListener('click', (e) => {
const itemId = button.getAttribute('data-id');
const item = cart.find(item => item.id === itemId);
if (item.quantity > 1) {
item.quantity -= 1;
} else {
cart = cart.filter(item => item.id !== itemId);
}
updateCart();
});
});
document.querySelectorAll('.increase-quantity').forEach(button => {
button.addEventListener('click', (e) => {
const itemId = button.getAttribute('data-id');
const item = cart.find(item => item.id === itemId);
item.quantity += 1;
updateCart();
});
});
}
// Update subtotal and total
const subtotal = cart.reduce((total, item) => total + (item.price * item.quantity), 0);
cartSubtotal.textContent = `$${subtotal.toFixed(2)}`;
cartTotal.textContent = `$${subtotal.toFixed(2)}`;
}
// Quick View Modal (placeholder functionality)
document.querySelectorAll('.jewelry-overlay button:first-child').forEach(button => {
button.addEventListener('click', (e) => {
e.preventDefault();
alert('Quick view functionality would show product details here!');
});
});
</script>