<!DOCTYPE html>
<html lang="en" class="scroll-smooth">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AURÉLIA PARFUMS | Haute Parfumerie & Atelier Studio</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Google Fonts: Playfair Display & Plus Jakarta Sans -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- FontAwesome for crisp luxury icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
alabaster: '#FAF8F5',
cream: '#F3EFEA',
charcoal: '#1C1917',
stone: '#57534E',
gold: {
DEFAULT: '#B48A4E',
light: '#D4B27D',
dark: '#8E6934',
pale: '#F6EFE4'
}
},
fontFamily: {
serif: ['"Playfair Display"', 'Georgia', 'serif'],
sans: ['"Plus Jakarta Sans"', 'system-ui', 'sans-serif'],
},
boxShadow: {
'luxury': '0 10px 40px -10px rgba(28, 25, 23, 0.08)',
'gold': '0 8px 25px -5px rgba(180, 138, 78, 0.25)',
}
}
}
}
</script>
<style>
body {
background-color: #FAF8F5;
color: #1C1917;
font-family: 'Plus Jakarta Sans', sans-serif;
overflow-x: hidden;
}
h1, h2, h3, .font-serif {
font-family: 'Playfair Display', serif;
}
/* Custom subtle scrollbar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #FAF8F5;
}
::-webkit-scrollbar-thumb {
background: #D6CFC7;
border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
background: #B48A4E;
}
/* Smooth slide-over drawer transitions */
.drawer-backdrop {
transition: opacity 0.3s ease;
}
.drawer-panel {
transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Luxury bottle card hover */
.perfume-card:hover .bottle-art {
transform: translateY(-6px) scale(1.03);
}
.bottle-art {
transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
</style>
</head>
<body class="antialiased selection:bg-gold selection:text-white">
<!-- ==================== TOAST NOTIFICATION CONTAINER ==================== -->
<div id="toast-container" class="fixed bottom-5 right-5 z-[100] flex flex-col gap-2 pointer-events-none"></div>
<!-- ==================== TOP ANNOUNCEMENT BAR ==================== -->
<div id="announcement-bar" class="bg-charcoal text-alabaster text-xs tracking-widest uppercase py-2.5 px-4 text-center font-medium">
Complimentary Express Delivery on Orders Over $150 • Free 2ml Discovery Sample With Every Bottle
</div>
<!-- ==================== MAIN NAVIGATION BAR ==================== -->
<header class="sticky top-0 z-40 bg-alabaster/90 backdrop-blur-md border-b border-stone/10">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-20 flex items-center justify-between gap-4">
<!-- Brand Logo -->
<a href="#" onclick="switchMode('store'); return false;" class="flex items-center gap-3 group">
<div class="w-9 h-9 rounded-full border border-gold flex items-center justify-center text-gold group-hover:bg-gold group-hover:text-white transition-colors">
<i class="fa-solid fa-spray-can-sparkles text-sm"></i>
</div>
<div>
<span class="font-serif text-xl sm:text-2xl tracking-[0.18em] font-semibold text-charcoal block leading-none">AURÉLIA</span>
<span class="text-[9px] tracking-[0.32em] uppercase text-gold font-semibold block mt-0.5">Haute Parfumerie</span>
</div>
</a>
<!-- Center Mode Switcher / Navigation -->
<nav class="hidden md:flex items-center gap-8 text-sm font-medium text-stone">
<button onclick="switchMode('store'); scrollToCatalog()" class="hover:text-gold transition-colors">Collection</button>
<button onclick="switchMode('store'); filterByFamily('Woody & Oud'); scrollToCatalog()" class="hover:text-gold transition-colors">Oud & Amber</button>
<button onclick="switchMode('store'); filterByFamily('Floral'); scrollToCatalog()" class="hover:text-gold transition-colors">Florals</button>
<button onclick="switchMode('store'); filterByFamily('Fresh & Citrus'); scrollToCatalog()" class="hover:text-gold transition-colors">Citrus & Fresh</button>
</nav>
<!-- Right Actions: Seller Toggle + Cart Button -->
<div class="flex items-center gap-2.5 sm:gap-4">
<!-- Seller Studio Toggle Pill -->
<button id="mode-toggle-btn" onclick="toggleAppMode()" class="flex items-center gap-2 px-3.5 py-2 rounded-full text-xs font-semibold border border-gold/40 bg-gold-pale/60 text-charcoal hover:bg-gold hover:text-white transition-all shadow-sm">
<i id="mode-toggle-icon" class="fa-solid fa-store text-gold"></i>
<span id="mode-toggle-text">Seller Admin</span>
</button>
<!-- Shopping Bag Trigger (Visible in Storefront) -->
<button id="header-cart-btn" onclick="openCart()" class="relative flex items-center gap-2.5 bg-charcoal text-alabaster hover:bg-gold transition-colors px-4 py-2.5 rounded-full text-xs sm:text-sm font-medium shadow-sm">
<i class="fa-solid fa-bag-shopping"></i>
<span class="hidden sm:inline">Bag</span>
<span id="cart-badge" class="bg-gold text-white text-[11px] font-bold w-5 h-5 rounded-full flex items-center justify-center">0</span>
</button>
</div>
</div>
</header>
<!-- =========================================================================
VIEW 1: CUSTOMER STOREFRONT VIEW
========================================================================= -->
<main id="storefront-view" class="block">
<!-- HERO SECTION -->
<section class="relative overflow-hidden border-b border-stone/10 bg-gradient-to-br from-alabaster via-cream to-[#EDE5D8]">
<!-- Subtle decorative radial glow -->
<div class="absolute -top-24 -right-24 w-96 h-96 bg-gold/10 rounded-full blur-3xl pointer-events-none"></div>
<div class="absolute -bottom-24 -left-24 w-80 h-80 bg-gold/10 rounded-full blur-3xl pointer-events-none"></div>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-14 sm:py-20 lg:py-24 grid grid-cols-1 lg:grid-cols-12 gap-10 items-center">
<!-- Left Copy -->
<div class="lg:col-span-7 space-y-6 text-center lg:text-left">
<div class="inline-flex items-center gap-2 px-3.5 py-1.5 rounded-full bg-white/80 border border-gold/30 text-gold text-xs font-semibold tracking-widest uppercase">
<span class="w-1.5 h-1.5 rounded-full bg-gold animate-pulse"></span>
Grasse • Cairo • Paris Atelier
</div>
<h1 class="font-serif text-4xl sm:text-5xl lg:text-6xl font-medium text-charcoal leading-[1.12]">
Scents Crafted Like <span class="italic text-gold">Liquid Memory.</span>
</h1>
<p class="text-stone text-base sm:text-lg max-w-xl mx-auto lg:mx-0 leading-relaxed font-normal">
Small-batch Extrait and Eau de Parfum creations macerated for 90 days using rare Cambodian oud, Damask rose, and sun-drenched Calabrian bergamot.
</p>
<div class="flex flex-col sm:flex-row items-center justify-center lg:justify-start gap-3.5 pt-2">
<button onclick="scrollToCatalog()" class="w-full sm:w-auto px-8 py-4 rounded-full bg-charcoal text-alabaster hover:bg-gold transition-all font-medium text-sm tracking-wide shadow-luxury flex items-center justify-center gap-2.5">
<span>Explore the Collection</span>
<i class="fa-solid fa-arrow-down text-xs"></i>
</button>
<button onclick="filterByConcentration('Extrait'); scrollToCatalog()" class="w-full sm:w-auto px-7 py-4 rounded-full bg-white/80 hover:bg-white text-charcoal border border-stone/15 transition-all font-medium text-sm">
Discover Pure Extraits
</button>
</div>
<!-- Trust Highlights -->
<div class="pt-4 grid grid-cols-3 gap-4 max-w-md mx-auto lg:mx-0 border-t border-stone/10 text-left">
<div>
<p class="font-serif text-lg font-semibold text-charcoal">30%+</p>
<p class="text-xs text-stone">Extrait Oil Concentration</p>
</div>
<div>
<p class="font-serif text-lg font-semibold text-charcoal">12+ Hrs</p>
<p class="text-xs text-stone">Skin Longevity</p>
</div>
<div>
<p class="font-serif text-lg font-semibold text-charcoal">COD / Card</p>
<p class="text-xs text-stone">Express Door Delivery</p>
</div>
</div>
</div>
<!-- Right Showcase Visual (Bespoke Illustrated Luxury Flacon + Featured Card) -->
<div class="lg:col-span-5 flex justify-center">
<div class="relative w-full max-w-sm bg-white/80 backdrop-blur-md border border-gold/25 rounded-3xl p-7 shadow-luxury">
<div class="flex justify-between items-center mb-4">
<span class="text-[11px] uppercase tracking-widest font-semibold text-gold">Signature Reserve</span>
<span class="px-2.5 py-1 rounded-full bg-cream text-charcoal text-[11px] font-medium">Bestseller</span>
</div>
<!-- Custom SVG Luxury Flacon Display -->
<div class="h-56 rounded-2xl bg-gradient-to-b from-cream to-[#EAE1D3] flex items-center justify-center relative overflow-hidden mb-5">
<svg class="w-36 h-44 drop-shadow-xl" viewBox="0 0 160 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Cap -->
<rect x="62" y="14" width="36" height="26" rx="4" fill="#1C1917"/>
<rect x="65" y="18" width="30" height="4" rx="1" fill="#B48A4E"/>
<!-- Collar -->
<rect x="68" y="40" width="24" height="10" rx="2" fill="#B48A4E"/>
<!-- Glass Bottle -->
<rect x="34" y="50" width="92" height="132" rx="14" fill="url(#heroGlass)" stroke="#B48A4E" stroke-width="1.5"/>
<!-- Inner Liquid -->
<rect x="40" y="64" width="80" height="112" rx="10" fill="url(#heroLiquid)"/>
<!-- Label -->
<rect x="48" y="84" width="64" height="68" rx="4" fill="#FAF8F5" stroke="#D4B27D" stroke-width="1"/>
<text x="80" y="106" text-anchor="middle" fill="#1C1917" font-family="Playfair Display, serif" font-size="10" font-weight="bold" letter-spacing="2">AURÉLIA</text>
<line x1="60" y1="113" x2="100" y2="113" stroke="#B48A4E" stroke-width="0.8"/>
<text x="80" y="126" text-anchor="middle" fill="#57534E" font-family="Plus Jakarta Sans, sans-serif" font-size="6.5" letter-spacing="1.2">OUD IMPÉRIAL</text>
<text x="80" y="140" text-anchor="middle" fill="#B48A4E" font-family="Plus Jakarta Sans, sans-serif" font-size="5.5" font-weight="bold">EXTRAIT DE PARFUM</text>
<defs>
<linearGradient id="heroGlass" x1="34" y1="50" x2="126" y2="182" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFFFFF" stop-opacity="0.9"/>
<stop offset="1" stop-color="#E7DFD3" stop-opacity="0.6"/>
</linearGradient>
<linearGradient id="heroLiquid" x1="80" y1="64" x2="80" y2="176" gradientUnits="userSpaceOnUse">
<stop stop-color="#D4A359" stop-opacity="0.45"/>
<stop offset="1" stop-color="#8E5A24" stop-opacity="0.75"/>
</linearGradient>
</defs>
</svg>
</div>
<div class="flex items-end justify-between">
<div>
<h3 class="font-serif text-xl font-semibold text-charcoal">Oud Impérial No. 01</h3>
<p class="text-xs text-stone mt-0.5">Saffron • Aged Oud • Ambergris</p>
</div>
<button onclick="quickAddHero()" class="px-4 py-2.5 rounded-full bg-gold text-white hover:bg-gold-dark text-xs font-semibold transition-colors shadow-gold">
Quick Add • $165
</button>
</div>
</div>
</div>
</div>
</section>
<!-- CATALOG FILTER & SEARCH BAR -->
<section id="catalog-section" class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-12 pb-6">
<div class="flex flex-col md:flex-row md:items-end justify-between gap-6 pb-8 border-b border-stone/10">
<div>
<span class="text-xs uppercase tracking-[0.25em] text-gold font-semibold">The Olfactory Wardrobe</span>
<h2 class="font-serif text-3xl sm:text-4xl font-medium text-charcoal mt-1">Curated Fragrances</h2>
</div>
<!-- Search & Concentration Filter -->
<div class="flex flex-col sm:flex-row items-stretch sm:items-center gap-3 w-full md:w-auto">
<!-- Search Input -->
<div class="relative flex-1 sm:w-64">
<i class="fa-solid fa-magnifying-glass absolute left-3.5 top-1/2 -translate-y-1/2 text-stone/60 text-xs"></i>
<input id="search-input" type="text" oninput="handleSearch(this.value)" placeholder="Search scent, rose, oud, vanilla..." class="w-full pl-9 pr-4 py-2.5 rounded-full bg-white border border-stone/15 text-sm text-charcoal placeholder:text-stone/50 focus:outline-none focus:border-gold transition-colors">
</div>
<!-- Concentration Dropdown -->
<select id="concentration-filter" onchange="filterByConcentration(this.value)" class="px-4 py-2.5 rounded-full bg-white border border-stone/15 text-sm text-charcoal font-medium focus:outline-none focus:border-gold cursor-pointer">
<option value="All">All Concentrations</option>
<option value="Extrait">Extrait de Parfum</option>
<option value="EDP">Eau de Parfum (EDP)</option>
<option value="EDT">Eau de Toilette (EDT)</option>
</select>
</div>
</div>
<!-- Scent Family Pills -->
<div class="flex items-center gap-2 overflow-x-auto py-5 no-scrollbar" id="family-pills">
<!-- Populated dynamically by JS -->
</div>
<!-- Results Count -->
<div class="flex items-center justify-between text-xs text-stone mb-6">
<p id="catalog-count">Showing all fragrances</p>
<button onclick="resetFilters()" id="reset-filters-btn" class="hidden text-gold hover:underline font-medium">
<i class="fa-solid fa-rotate-left mr-1"></i> Reset Filters
</button>
</div>
<!-- PRODUCT GRID -->
<div id="product-grid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-7 pb-20">
<!-- Product Cards rendered here by JS -->
</div>
</section>
<!-- FOOTER -->
<footer class="bg-charcoal text-alabaster/80 border-t border-stone/20">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 grid grid-cols-1 md:grid-cols-3 gap-8 items-center">
<div>
<span class="font-serif text-xl tracking-[0.2em] text-white font-semibold">AURÉLIA PARFUMS</span>
<p class="text-xs text-alabaster/60 mt-2 max-w-xs leading-relaxed">
Artisanal perfumery crafted in small numbered batches. Cruelty-free, phthalate-free, and bottled with sustainable French glass.
</p>
</div>
<div class="flex flex-wrap gap-6 text-xs uppercase tracking-wider text-alabaster/70 md:justify-center">
<button onclick="scrollToCatalog()" class="hover:text-gold transition-colors">All Scents</button>
<button onclick="openCart()" class="hover:text-gold transition-colors">Shopping Bag</button>
<button onclick="switchMode('seller')" class="hover:text-gold transition-colors">Seller Portal</button>
</div>
<div class="md:text-right text-xs text-alabaster/50">
<p>© 2026 Aurélia Parfums Atelier. All rights reserved.</p>
</div>
</div>
</footer>
</main>
<!-- =========================================================================
VIEW 2: SELLER DASHBOARD STUDIO
========================================================================= -->
<section id="seller-view" class="hidden max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-12">
<!-- Seller Header -->
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 pb-8 border-b border-stone/15">
<div>
<div class="inline-flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-gold mb-1">
<i class="fa-solid fa-sliders"></i> Merchant Workspace
</div>
<h1 class="font-serif text-3xl sm:text-4xl font-medium text-charcoal">Atelier Seller Studio</h1>
<p class="text-sm text-stone mt-1">Manage your fragrance catalog, pricing, stock availability, and fulfill incoming customer orders.</p>
</div>
<div class="flex flex-wrap items-center gap-3">
<button onclick="resetDemoData()" class="px-4 py-2.5 rounded-full border border-stone/20 bg-white hover:bg-cream text-stone text-xs font-semibold transition-colors">
<i class="fa-solid fa-rotate mr-1.5"></i> Reset Demo Data
</button>
<button onclick="switchMode('store')" class="px-5 py-2.5 rounded-full bg-charcoal text-white hover:bg-gold text-xs font-semibold transition-colors shadow-sm">
<i class="fa-solid fa-arrow-up-right-from-square mr-1.5"></i> View Live Storefront
</button>
</div>
</div>
<!-- KPI STATS CARDS -->
<div class="grid grid-cols-2 lg:grid-cols-4 gap-4 sm:gap-6 my-8">
<div class="bg-white p-5 sm:p-6 rounded-2xl border border-stone/10 shadow-sm">
<div class="flex items-center justify-between text-stone mb-2">
<span class="text-xs font-semibold uppercase tracking-wider">Total Revenue</span>
<span class="w-8 h-8 rounded-full bg-gold-pale text-gold flex items-center justify-center text-xs"><i class="fa-solid fa-dollar-sign"></i></span>
</div>
<p id="stat-revenue" class="font-serif text-2xl sm:text-3xl font-semibold text-charcoal">$0</p>
<p class="text-xs text-emerald-600 mt-1 font-medium"><i class="fa-solid fa-arrow-trend-up mr-1"></i>Live store sales</p>
</div>
<div class="bg-white p-5 sm:p-6 rounded-2xl border border-stone/10 shadow-sm">
<div class="flex items-center justify-between text-stone mb-2">
<span class="text-xs font-semibold uppercase tracking-wider">Total Orders</span>
<span class="w-8 h-8 rounded-full bg-gold-pale text-gold flex items-center justify-center text-xs"><i class="fa-solid fa-box-open"></i></span>
</div>
<p id="stat-orders" class="font-serif text-2xl sm:text-3xl font-semibold text-charcoal">0</p>
<p id="stat-pending-orders" class="text-xs text-gold mt-1 font-medium">0 awaiting fulfillment</p>
</div>
<div class="bg-white p-5 sm:p-6 rounded-2xl border border-stone/10 shadow-sm">
<div class="flex items-center justify-between text-stone mb-2">
<span class="text-xs font-semibold uppercase tracking-wider">Active Scents</span>
<span class="w-8 h-8 rounded-full bg-gold-pale text-gold flex items-center justify-center text-xs"><i class="fa-solid fa-wine-bottle"></i></span>
</div>
<p id="stat-products" class="font-serif text-2xl sm:text-3xl font-semibold text-charcoal">0</p>
<p class="text-xs text-stone mt-1">Listed in boutique</p>
</div>
<div class="bg-white p-5 sm:p-6 rounded-2xl border border-stone/10 shadow-sm">
<div class="flex items-center justify-between text-stone mb-2">
<span class="text-xs font-semibold uppercase tracking-wider">Sold Out Alerts</span>
<span class="w-8 h-8 rounded-full bg-rose-50 text-rose-600 flex items-center justify-center text-xs"><i class="fa-solid fa-triangle-exclamation"></i></span>
</div>
<p id="stat-soldout" class="font-serif text-2xl sm:text-3xl font-semibold text-charcoal">0</p>
<p class="text-xs text-stone mt-1">Click status to restock</p>
</div>
</div>
<!-- SELLER TABS NAVIGATION -->
<div class="flex items-center gap-2 border-b border-stone/15 mb-8">
<button id="tab-btn-orders" onclick="switchSellerTab('orders')" class="px-5 py-3 text-sm font-semibold border-b-2 border-gold text-charcoal flex items-center gap-2 transition-colors">
<i class="fa-solid fa-receipt text-gold"></i>
<span>Customer Orders</span>
<span id="orders-tab-badge" class="px-2 py-0.5 text-[11px] rounded-full bg-gold text-white">0</span>
</button>
<button id="tab-btn-inventory" onclick="switchSellerTab('inventory')" class="px-5 py-3 text-sm font-semibold border-b-2 border-transparent text-stone hover:text-charcoal flex items-center gap-2 transition-colors">
<i class="fa-solid fa-flask text-gold"></i>
<span>Perfume Inventory & Add New</span>
</button>
</div>
<!-- TAB 1: CUSTOMER ORDERS MANAGEMENT -->
<div id="seller-tab-orders" class="space-y-4">
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-4">
<h2 class="font-serif text-2xl font-medium text-charcoal">Incoming Customer Orders</h2>
<div class="flex items-center gap-2 text-xs">
<span class="text-stone">Filter status:</span>
<select id="order-status-filter" onchange="renderSellerOrders()" class="px-3 py-1.5 rounded-full bg-white border border-stone/20 text-charcoal font-medium focus:outline-none focus:border-gold">
<option value="All">All Orders</option>
<option value="Pending">Pending</option>
<option value="Packed">Packed</option>
<option value="Shipped">Shipped</option>
<option value="Delivered">Delivered</option>
</select>
</div>
</div>
<div id="seller-orders-list" class="space-y-4">
<!-- Orders rendered dynamically via JS -->
</div>
</div>
<!-- TAB 2: INVENTORY & ADD/EDIT PERFUME FORM -->
<div id="seller-tab-inventory" class="hidden grid grid-cols-1 lg:grid-cols-12 gap-8 items-start">
<!-- Left 5 Cols: Add / Edit Perfume Form -->
<div class="lg:col-span-5 bg-white p-6 sm:p-7 rounded-3xl border border-stone/15 shadow-luxury sticky top-24">
<div class="flex items-center justify-between mb-5">
<div>
<span id="form-mode-label" class="text-[11px] uppercase tracking-widest font-bold text-gold">Create New Creation</span>
<h3 id="form-heading" class="font-serif text-2xl font-medium text-charcoal">Add a Perfume</h3>
</div>
<button id="cancel-edit-btn" onclick="resetPerfumeForm()" class="hidden text-xs text-stone hover:text-charcoal underline">
Cancel Edit
</button>
</div>
<form id="perfume-form" onsubmit="handleSavePerfume(event)" class="space-y-4">
<input type="hidden" id="edit-perfume-id" value="">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">Perfume Name *</label>
<input type="text" id="p-name" required placeholder="e.g. Velvet Santal" class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
</div>
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">Collection / Line</label>
<input type="text" id="p-brand" placeholder="e.g. Privé Reserve" value="Aurélia Privé" class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3.5">
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">Scent Family *</label>
<select id="p-family" required class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
<option value="Woody & Oud">Woody & Oud</option>
<option value="Floral">Floral</option>
<option value="Fresh & Citrus">Fresh & Citrus</option>
<option value="Oriental & Spicy">Oriental & Spicy</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">Concentration *</label>
<select id="p-concentration" required class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
<option value="Extrait">Extrait de Parfum</option>
<option value="EDP">Eau de Parfum (EDP)</option>
<option value="EDT">Eau de Toilette (EDT)</option>
</select>
</div>
</div>
<!-- Dynamic Bottle Size Pricing -->
<div class="grid grid-cols-2 gap-3.5 bg-cream/60 p-3.5 rounded-2xl border border-gold/20">
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">50ml Price ($) *</label>
<input type="number" id="p-price50" required min="10" step="1" placeholder="125" class="w-full px-3.5 py-2 rounded-xl bg-white border border-stone/15 text-sm font-semibold focus:outline-none focus:border-gold">
</div>
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">100ml Price ($) *</label>
<input type="number" id="p-price100" required min="15" step="1" placeholder="185" class="w-full px-3.5 py-2 rounded-xl bg-white border border-stone/15 text-sm font-semibold focus:outline-none focus:border-gold">
</div>
</div>
<!-- Fragrance Pyramid Notes -->
<div class="space-y-2.5">
<label class="block text-xs font-semibold text-charcoal">Olfactory Pyramid Notes *</label>
<input type="text" id="p-top" required placeholder="Top Notes (e.g. Pink Pepper, Bergamot)" class="w-full px-3.5 py-2 rounded-xl bg-alabaster border border-stone/15 text-xs focus:outline-none focus:border-gold">
<input type="text" id="p-heart" required placeholder="Heart Notes (e.g. Damask Rose, Iris)" class="w-full px-3.5 py-2 rounded-xl bg-alabaster border border-stone/15 text-xs focus:outline-none focus:border-gold">
<input type="text" id="p-base" required placeholder="Base Notes (e.g. Sandalwood, White Musk)" class="w-full px-3.5 py-2 rounded-xl bg-alabaster border border-stone/15 text-xs focus:outline-none focus:border-gold">
</div>
<!-- Bottle Aesthetic Theme Preset -->
<div>
<label class="block text-xs font-semibold text-charcoal mb-1.5">Flacon Glass & Juice Aesthetic</label>
<select id="p-theme" class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
<option value="amber">Royal Amber Gold (Warm & Rich)</option>
<option value="rose">Blush Damask Rose (Soft Pink)</option>
<option value="noir">Obsidian Noir & Gold (Smoky Oud)</option>
<option value="citrus">Neroli Sunlit Citrine (Crisp & Fresh)</option>
<option value="emerald">Botanical Vetiver Green (Herbal & Earthy)</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold text-charcoal mb-1">Story & Description *</label>
<textarea id="p-desc" rows="2" required placeholder="Describe the mood, inspiration, and sillage of this fragrance..." class="w-full px-3.5 py-2 rounded-xl bg-alabaster border border-stone/15 text-xs focus:outline-none focus:border-gold"></textarea>
</div>
<div class="flex items-center justify-between pt-1">
<label class="inline-flex items-center gap-2 cursor-pointer text-xs font-medium text-charcoal">
<input type="checkbox" id="p-instock" checked class="w-4 h-4 accent-gold rounded">
<span>Available In Stock immediately</span>
</label>
</div>
<button type="submit" id="save-perfume-btn" class="w-full py-3.5 rounded-full bg-charcoal hover:bg-gold text-white font-semibold text-sm transition-colors shadow-luxury">
<i class="fa-solid fa-plus mr-1.5"></i> Publish Fragrance to Store
</button>
</form>
</div>
<!-- Right 7 Cols: Existing Inventory List -->
<div class="lg:col-span-7 space-y-4">
<div class="flex items-center justify-between">
<h3 class="font-serif text-2xl font-medium text-charcoal">Manage Perfume Catalog</h3>
<span id="inventory-count-label" class="text-xs text-stone font-medium">0 items</span>
</div>
<div id="seller-inventory-list" class="space-y-3.5">
<!-- Inventory items rendered dynamically via JS -->
</div>
</div>
</div>
</section>
<!-- =========================================================================
PRODUCT DETAIL & SCENT PYRAMID MODAL
========================================================================= -->
<div id="product-modal" class="fixed inset-0 z-50 hidden items-center justify-center p-4 bg-charcoal/60 backdrop-blur-sm">
<div class="bg-alabaster border border-gold/25 rounded-3xl max-w-3xl w-full max-h-[90vh] overflow-y-auto shadow-2xl relative animate-fadeIn">
<button onclick="closeProductModal()" class="absolute top-4 right-4 z-10 w-9 h-9 rounded-full bg-white/90 hover:bg-charcoal hover:text-white text-charcoal flex items-center justify-center transition-colors shadow-sm">
<i class="fa-solid fa-xmark"></i>
</button>
<div id="product-modal-content" class="grid grid-cols-1 md:grid-cols-12">
<!-- Populated dynamically -->
</div>
</div>
</div>
<!-- =========================================================================
SLIDE-OVER SHOPPING BAG & 1-STEP CHECKOUT DRAWER
========================================================================= -->
<div id="cart-drawer" class="fixed inset-0 z-50 hidden">
<!-- Backdrop -->
<div onclick="closeCart()" class="drawer-backdrop fixed inset-0 bg-charcoal/55 backdrop-blur-xs"></div>
<!-- Slide-Over Panel -->
<div class="drawer-panel fixed top-0 right-0 bottom-0 w-full max-w-md bg-alabaster shadow-2xl flex flex-col border-l border-gold/20">
<!-- Drawer Header -->
<div class="px-6 py-5 border-b border-stone/10 flex items-center justify-between bg-white">
<div class="flex items-center gap-2.5">
<i class="fa-solid fa-bag-shopping text-gold"></i>
<h2 class="font-serif text-xl font-semibold text-charcoal">Your Fragrance Bag</h2>
</div>
<button onclick="closeCart()" class="w-8 h-8 rounded-full hover:bg-cream flex items-center justify-center text-stone hover:text-charcoal transition-colors">
<i class="fa-solid fa-xmark"></i>
</button>
</div>
<!-- Free Shipping Progress Bar -->
<div class="px-6 py-3 bg-gold-pale/70 border-b border-gold/15">
<div class="flex justify-between text-xs font-medium text-charcoal mb-1.5">
<span id="shipping-msg">Add $150 more for Complimentary Express Shipping</span>
<span id="shipping-pct" class="text-gold font-bold">0%</span>
</div>
<div class="w-full h-1.5 bg-white rounded-full overflow-hidden">
<div id="shipping-bar" class="h-full bg-gold transition-all duration-300 rounded-full" style="width: 0%"></div>
</div>
</div>
<!-- Scrollable Cart Items & Checkout Body -->
<div class="flex-1 overflow-y-auto px-6 py-5 space-y-6">
<!-- Cart Items List -->
<div id="cart-items-container" class="space-y-3.5">
<!-- Populated dynamically -->
</div>
<!-- 1-Step Express Checkout Form (Shown when cart has items) -->
<div id="checkout-section" class="hidden pt-5 border-t border-stone/15">
<div class="flex items-center gap-2 mb-3">
<span class="w-5 h-5 rounded-full bg-gold text-white text-[11px] font-bold flex items-center justify-center">1</span>
<h3 class="font-serif text-lg font-semibold text-charcoal">Express 1-Step Checkout</h3>
</div>
<form id="checkout-form" onsubmit="handlePlaceOrder(event)" class="space-y-3 bg-white p-4 rounded-2xl border border-stone/10 shadow-sm">
<div>
<label class="block text-[11px] font-semibold uppercase tracking-wider text-stone mb-1">Full Name *</label>
<input type="text" id="cust-name" required placeholder="e.g. Layla Al-Mansoor" class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
</div>
<div>
<label class="block text-[11px] font-semibold uppercase tracking-wider text-stone mb-1">Phone / WhatsApp Number *</label>
<input type="tel" id="cust-phone" required placeholder="e.g. +20 100 555 0192" class="w-full px-3.5 py-2.5 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold">
</div>
<div>
<label class="block text-[11px] font-semibold uppercase tracking-wider text-stone mb-1">Delivery Address *</label>
<textarea id="cust-address" rows="2" required placeholder="City, Neighborhood, Street & Building..." class="w-full px-3.5 py-2 rounded-xl bg-alabaster border border-stone/15 text-sm focus:outline-none focus:border-gold"></textarea>
</div>
<div>
<label class="block text-[11px] font-semibold uppercase tracking-wider text-stone mb-1.5">Payment Method</label>
<div class="grid grid-cols-2 gap-2.5">
<label class="cursor-pointer">
<input type="radio" name="paymentMethod" value="Cash on Delivery" checked class="peer sr-only">
<div class="p-2.5 rounded-xl border border-stone/15 bg-alabaster peer-checked:border-gold peer-checked:bg-gold-pale/60 text-center transition-all">
<i class="fa-solid fa-money-bill-wave text-gold text-xs block mb-0.5"></i>
<span class="text-xs font-semibold text-charcoal">Cash on Delivery</span>
</div>
</label>
<label class="cursor-pointer">
<input type="radio" name="paymentMethod" value="Credit / Debit Card" class="peer sr-only">
<div class="p-2.5 rounded-xl border border-stone/15 bg-alabaster peer-checked:border-gold peer-checked:bg-gold-pale/60 text-center transition-all">
<i class="fa-regular fa-credit-card text-gold text-xs block mb-0.5"></i>
<span class="text-xs font-semibold text-charcoal">Card on Arrival / Link</span>
</div>
</label>
</div>
</div>
<!-- Totals Summary -->
<div class="pt-3 border-t border-stone/10 space-y-1.5 text-xs">
<div class="flex justify-between text-stone">
<span>Subtotal</span>
<span id="cart-subtotal" class="font-medium text-charcoal">$0</span>
</div>
<div class="flex justify-between text-stone">
<span>Express Boutique Courier</span>
<span id="cart-shipping" class="font-medium text-charcoal">$12</span>
</div>
<div class="flex justify-between text-base font-serif font-semibold text-charcoal pt-1.5 border-t border-stone/10">
<span>Total Due</span>
<span id="cart-total" class="text-gold-dark">$0</span>
</div>
</div>
<button type="submit" class="w-full py-3.5 rounded-full bg-charcoal hover:bg-gold text-white font-semibold text-sm transition-colors shadow-gold flex items-center justify-center gap-2 mt-2">
<i class="fa-solid fa-lock text-xs"></i>
<span>Complete Order Now</span>
</button>
</form>
</div>
</div>
</div>
</div>
<!-- =========================================================================
ORDER RECEIPT CONFIRMATION MODAL
========================================================================= -->
<div id="receipt-modal" class="fixed inset-0 z-50 hidden items-center justify-center p-4 bg-charcoal/65 backdrop-blur-sm">
<div class="bg-white border border-gold/30 rounded-3xl max-w-md w-full p-7 shadow-2xl text-center relative">
<div class="w-16 h-16 rounded-full bg-emerald-50 text-emerald-600 border border-emerald-200 flex items-center justify-center mx-auto mb-4 text-2xl">
<i class="fa-solid fa-check"></i>
</div>
<span class="text-[11px] uppercase tracking-widest font-bold text-gold">Order Confirmed</span>
<h3 class="font-serif text-2xl font-semibold text-charcoal mt-1">Thank You for Your Order</h3>
<p class="text-xs text-stone mt-1.5">Your bespoke fragrance parcel is now queued at our Atelier.</p>
<div id="receipt-details" class="my-5 p-4 rounded-2xl bg-alabaster border border-stone/10 text-left text-xs space-y-2">
<!-- Populated dynamically -->
</div>
<div class="flex flex-col sm:flex-row gap-2.5">
<button onclick="closeReceiptModal()" class="flex-1 py-3 rounded-full bg-charcoal text-white hover:bg-gold text-xs font-semibold transition-colors">
Continue Shopping
</button>
<button onclick="closeReceiptModal(); switchMode('seller'); switchSellerTab('orders');" class="flex-1 py-3 rounded-full border border-gold text-gold-dark hover:bg-gold-pale text-xs font-semibold transition-colors">
View in Seller Studio
</button>
</div>
</div>
</div>
<!-- =========================================================================
APPLICATION JAVASCRIPT (State, LocalStorage, Storefront & Seller Logic)
========================================================================= -->
<script>
// --- 1. INITIAL SEED DATA ---
const DEFAULT_PERFUMES = [
{
id: 'perf-1',
name: 'Oud Impérial No. 01',
brand: 'Aurélia Privé',
family: 'Woody & Oud',
concentration: 'Extrait',
price50: 165,
price100: 245,
topNotes: 'Iranian Saffron, Pink Pepper, Bergamot',
heartNotes: 'Aged Cambodian Oud, Damask Rose, Incense',
baseNotes: 'Ambergris, Mysore Sandalwood, Benzoin',
description: 'A commanding, velvety elixir balancing rare smoky Cambodian oud with crimson saffron threads and warm golden ambergris.',
theme: 'amber',
inStock: true,
longevity: 95,
sillage: 90
},
{
id: 'perf-2',
name: 'Rose de Minuit',
brand: 'Fleurs Nocturnes',
family: 'Floral',
concentration: 'EDP',
price50: 135,
price100: 195,
topNotes: 'Lychee, Mandarin Zest, Cassis',
heartNotes: 'Turkish Rose Absolute, Peony, Violet Leaf',
baseNotes: 'Cashmere Wood, White Musk, Madagascar Vanilla',
description: 'Dew-kissed midnight roses wrapped in gossamer white musk and creamy cashmere woods. Romantic, luminous, and unforgettable.',
theme: 'rose',
inStock: true,
longevity: 85,
sillage: 80
},
{
id: 'perf-3',
name: 'Néroli Soleil',
brand: 'Riviera Collection',
family: 'Fresh & Citrus',
concentration: 'EDT',
price50: 110,
price100: 160,
topNotes: 'Calabrian Bergamot, Sicilian Lemon, Petitgrain',
heartNotes: 'Tunisian Neroli, Orange Blossom, Jasmine Tea',
baseNotes: 'White Cedar, Sea Salt, Ambrette Seed',
description: 'Sunlit Mediterranean groves captured in a crisp, effervescent citrus-floral splash that lingers effortlessly on warm skin.',
theme: 'citrus',
inStock: true,
longevity: 75,
sillage: 70
},
{
id: 'perf-4',
name: 'Ambre Mystique',
brand: 'Aurélia Privé',
family: 'Oriental & Spicy',
concentration: 'Extrait',
price50: 155,
price100: 230,
topNotes: 'Cardamom Pod, Cinnamon Bark, Nutmeg',
heartNotes: 'Labdanum Resin, Roasted Tonka Bean, Plum',
baseNotes: 'Bourbon Vanilla, Patchouli Leaf, Smoked Myrrh',
description: 'Opulent spiced amber and caramelized tonka bean layered over sacred myrrh resins for an intoxicating evening aura.',
theme: 'noir',
inStock: true,
longevity: 96,
sillage: 92
},
{
id: 'perf-5',
name: 'Vétiver Jardin',
brand: 'Botanica Atelier',
family: 'Woody & Oud',
concentration: 'EDP',
price50: 125,
price100: 180,
topNotes: 'Grapefruit Peel, Crushed Fig Leaf, Juniper',
heartNotes: 'Haitian Vetiver, Clary Sage, Iris Root',
baseNotes: 'Oakmoss, Atlas Cedarwood, Dry Amber',
description: 'Crisp green fig leaves and earthy Haitian vetiver rooted in noble cedarwood. Effortlessly tailored and architectural.',
theme: 'emerald',
inStock: true,
longevity: 84,
sillage: 75
},
{
id: 'perf-6',
name: 'Jasmin Blanc',
brand: 'Fleurs Nocturnes',
family: 'Floral',
concentration: 'Extrait',
price50: 150,
price100: 220,
topNotes: 'Green Pear, Neroli Blossom, White Tea',
heartNotes: 'Egyptian Jasmine Sambac, Tuberose, Ylang-Ylang',
baseNotes: 'Sandalwood Milk, Benzoin, Skin Musk',
description: 'Hand-harvested Egyptian jasmine petals steeped in creamy sandalwood milk for a sensual, radiant white floral signature.',
theme: 'rose',
inStock: false,
longevity: 90,
sillage: 85
}
];
const DEFAULT_ORDERS = [
{
id: 'ORD-8492',
date: 'Nov 27, 2026 • 14:20',
customerName: 'Nadia El-Khoury',
phone: '+20 102 884 1920',
address: 'Villa 14, Zamalek, Cairo, Egypt',
paymentMethod: 'Cash on Delivery',
status: 'Pending',
items: [
{ perfumeId: 'perf-1', name: 'Oud Impérial No. 01', size: '100ml', price: 245, qty: 1 },
{ perfumeId: 'perf-3', name: 'Néroli Soleil', size: '50ml', price: 110, qty: 1 }
],
subtotal: 355,
shipping: 0,
total: 355
},
{
id: 'ORD-8489',
date: 'Nov 26, 2026 • 19:05',
customerName: 'Tariq Al-Sabah',
phone: '+965 9912 4410',
address: 'Apartment 9B, Marina Tower, Salmiya',
paymentMethod: 'Credit / Debit Card',
status: 'Shipped',
items: [
{ perfumeId: 'perf-4', name: 'Ambre Mystique', size: '50ml', price: 155, qty: 2 }
],
subtotal: 310,
shipping: 0,
total: 310
}
];
// --- 2. STATE MANAGEMENT ---
let perfumes = [];
let orders = [];
let cart = [];
let selectedSizes = {}; // { perfumeId: '50ml' | '100ml' }
let activeFamily = 'All';
let activeConcentration = 'All';
let searchQuery = '';
let currentMode = 'store'; // 'store' | 'seller'
const STORAGE_KEYS = {
PERFUMES: 'aurelia_perfumes_v1',
ORDERS: 'aurelia_orders_v1',
CART: 'aurelia_cart_v1'
};
// --- 3. INITIALIZATION ---
function initApp() {
const savedPerfumes = localStorage.getItem(STORAGE_KEYS.PERFUMES);
const savedOrders = localStorage.getItem(STORAGE_KEYS.ORDERS);
const savedCart = localStorage.getItem(STORAGE_KEYS.CART);
perfumes = savedPerfumes ? JSON.parse(savedPerfumes) : JSON.parse(JSON.stringify(DEFAULT_PERFUMES));
orders = savedOrders ? JSON.parse(savedOrders) : JSON.parse(JSON.stringify(DEFAULT_ORDERS));
cart = savedCart ? JSON.parse(savedCart) : [];
perfumes.forEach(p => {
if (!selectedSizes[p.id]) selectedSizes[p.id] = '50ml';
});
saveState();
renderFamilyPills();
renderStorefront();
updateCartUI();
renderSellerDashboard();
}
function saveState() {
localStorage.setItem(STORAGE_KEYS.PERFUMES, JSON.stringify(perfumes));
localStorage.setItem(STORAGE_KEYS.ORDERS, JSON.stringify(orders));
localStorage.setItem(STORAGE_KEYS.CART, JSON.stringify(cart));
}
function resetDemoData() {
perfumes = JSON.parse(JSON.stringify(DEFAULT_PERFUMES));
orders = JSON.parse(JSON.stringify(DEFAULT_ORDERS));
cart = [];
perfumes.forEach(p => selectedSizes[p.id] = '50ml');
saveState();
renderStorefront();
updateCartUI();
renderSellerDashboard();
showToast('Demo store data restored to default.', 'info');
}
// --- 4. LUXURY SVG BOTTLE ART GENERATOR (Zero Broken Images) ---
function getBottleSVG(perfume, sizeClass = "w-32 h-40") {
const themes = {
amber: {
bg: 'from-[#F7EFE2] to-[#E8D5B7]',
cap: '#1C1917',
collar: '#B48A4E',
liquidTop: '#E2B46D',
liquidBot: '#9A6326',
labelBg: '#FAF8F5',
text: '#1C1917'
},
rose: {
bg: 'from-[#FAF0F0] to-[#EED9DA]',
cap: '#3B282A',
collar: '#C89B7B',
liquidTop: '#F0C3C7',
liquidBot: '#C98A92',
labelBg: '#FFFDFD',
text: '#2E1E20'
},
noir: {
bg: 'from-[#EAE7E3] to-[#D4CEC7]',
cap: '#141210',
collar: '#D4B27D',
liquidTop: '#4A3F35',
liquidBot: '#1C1917',
labelBg: '#1C1917',
text: '#FAF8F5'
},
citrus: {
bg: 'from-[#FAF7E8] to-[#EFE6C5]',
cap: '#2D3128',
collar: '#C5A059',
liquidTop: '#F5E08E',
liquidBot: '#D4B24C',
labelBg: '#FAF8F5',
text: '#1C1917'
},
emerald: {
bg: 'from-[#EEF3EE] to-[#D5E0D5]',
cap: '#1B2A21',
collar: '#B48A4E',
liquidTop: '#A6C2A8',
liquidBot: '#5A7D60',
labelBg: '#FAF8F5',
text: '#1B2A21'
}
};
const t = themes[perfume.theme] || themes.amber;
const uid = perfume.id + '-' + Math.random().toString(36).substring(2, 6);
const shortTitle = perfume.name.length > 15 ? perfume.name.substring(0, 14) + '…' : perfume.name;
return `
<div class="w-full h-full bg-gradient-to-b ${t.bg} flex items-center justify-center relative overflow-hidden">
<svg class="${sizeClass} bottle-art drop-shadow-md" viewBox="0 0 160 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<!-- Cap -->
<rect x="62" y="16" width="36" height="24" rx="4" fill="${t.cap}"/>
<rect x="65" y="20" width="30" height="3" rx="1" fill="${t.collar}"/>
<!-- Atomizer Collar -->
<rect x="68" y="40" width="24" height="10" rx="2" fill="${t.collar}"/>
<!-- Heavy Glass Flacon -->
<rect x="34" y="50" width="92" height="130" rx="14" fill="white" fill-opacity="0.65" stroke="${t.collar}" stroke-width="1.4"/>
<!-- Perfume Juice -->
<rect x="40" y="64" width="80" height="110" rx="10" fill="url(#liq-${uid})" fill-opacity="0.72"/>
<!-- Glass Highlight -->
<rect x="43" y="68" width="6" height="102" rx="3" fill="white" fill-opacity="0.45"/>
<!-- Boutique Label -->
<rect x="48" y="84" width="64" height="68" rx="4" fill="${t.labelBg}" stroke="${t.collar}" stroke-width="0.9"/>
<text x="80" y="104" text-anchor="middle" fill="${t.collar}" font-family="Plus Jakarta Sans, sans-serif" font-size="5.5" font-weight="700" letter-spacing="1.6">AURÉLIA</text>
<line x1="60" y1="109" x2="100" y2="109" stroke="${t.collar}" stroke-width="0.6" stroke-opacity="0.6"/>
<text x="80" y="124" text-anchor="middle" fill="${t.text}" font-family="Playfair Display, serif" font-size="8" font-weight="600">${escapeHtml(shortTitle)}</text>
<text x="80" y="139" text-anchor="middle" fill="${t.collar}" font-family="Plus Jakarta Sans, sans-serif" font-size="5.5" font-weight="600" letter-spacing="1">${escapeHtml(perfume.concentration.toUpperCase())}</text>
<defs>
<linearGradient id="liq-${uid}" x1="80" y1="64" x2="80" y2="174" gradientUnits="userSpaceOnUse">
<stop stop-color="${t.liquidTop}"/>
<stop offset="1" stop-color="${t.liquidBot}"/>
</linearGradient>
</defs>
</svg>
</div>
`;
}
// --- 5. STOREFRONT RENDERING & FILTERING ---
function renderFamilyPills() {
const families = ['All', 'Woody & Oud', 'Floral', 'Fresh & Citrus', 'Oriental & Spicy'];
const container = document.getElementById('family-pills');
container.innerHTML = families.map(fam => {
const isActive = activeFamily === fam;
return `
<button onclick="filterByFamily('${fam}')"
class="whitespace-nowrap px-5 py-2 rounded-full text-xs font-semibold transition-all ${
isActive
? 'bg-charcoal text-white shadow-sm'
: 'bg-white text-stone border border-stone/15 hover:border-gold hover:text-charcoal'
}">
${fam === 'All' ? 'All Scent Families' : fam}
</button>
`;
}).join('');
}
function filterByFamily(family) {
activeFamily = family;
renderFamilyPills();
renderStorefront();
}
function filterByConcentration(conc) {
activeConcentration = conc;
document.getElementById('concentration-filter').value = conc;
renderStorefront();
}
function handleSearch(val) {
searchQuery = val.trim().toLowerCase();
renderStorefront();
}
function resetFilters() {
activeFamily = 'All';
activeConcentration = 'All';
searchQuery = '';
document.getElementById('search-input').value = '';
document.getElementById('concentration-filter').value = 'All';
renderFamilyPills();
renderStorefront();
}
function renderStorefront() {
const grid = document.getElementById('product-grid');
const countLabel = document.getElementById('catalog-count');
const resetBtn = document.getElementById('reset-filters-btn');
const isFiltered = activeFamily !== 'All' || activeConcentration !== 'All' || searchQuery !== '';
resetBtn.classList.toggle('hidden', !isFiltered);
const filtered = perfumes.filter(p => {
const matchFam = activeFamily === 'All' || p.family === activeFamily;
const matchConc = activeConcentration === 'All' || p.concentration === activeConcentration;
const haystack = `${p.name} ${p.brand} ${p.family} ${p.topNotes} ${p.heartNotes} ${p.baseNotes} ${p.description}`.toLowerCase();
const matchSearch = !searchQuery || haystack.includes(searchQuery);
return matchFam && matchConc && matchSearch;
});
countLabel.textContent = `Showing ${filtered.length} of ${perfumes.length} signature creations`;
if (filtered.length === 0) {
grid.innerHTML = `
<div class="col-span-full py-16 text-center bg-white rounded-3xl border border-stone/10">
<i class="fa-solid fa-wind text-3xl text-gold/60 mb-3"></i>
<h3 class="font-serif text-xl font-medium text-charcoal">No matching fragrances found</h3>
<p class="text-xs text-stone mt-1 mb-4">Try clearing your search or exploring another olfactory family.</p>
<button onclick="resetFilters()" class="px-5 py-2.5 rounded-full bg-charcoal text-white text-xs font-semibold hover:bg-gold transition-colors">
Show All Fragrances
</button>
</div>
`;
return;
}
grid.innerHTML = filtered.map(p => {
const currentSize = selectedSizes[p.id] || '50ml';
const activePrice = currentSize === '50ml' ? p.price50 : p.price100;
return `
<article class="perfume-card bg-white rounded-3xl border border-stone/10 overflow-hidden shadow-sm hover:shadow-luxury transition-all flex flex-col justify-between group">
<div>
<!-- Top Visual Box -->
<div class="relative h-60 cursor-pointer" onclick="openProductModal('${p.id}')">
${getBottleSVG(p)}
<!-- Badges -->
<div class="absolute top-3.5 left-3.5 flex flex-wrap gap-1.5">
<span class="px-3 py-1 rounded-full bg-white/90 backdrop-blur-xs text-[11px] font-semibold text-charcoal shadow-2xs">
${escapeHtml(p.family)}
</span>
</div>
<div class="absolute top-3.5 right-3.5">
<span class="px-2.5 py-1 rounded-full bg-charcoal/85 text-alabaster text-[10px] font-bold tracking-wider uppercase">
${escapeHtml(p.concentration)}
</span>
</div>
${!p.inStock ? `
<div class="absolute inset-0 bg-charcoal/45 backdrop-blur-[1px] flex items-center justify-center">
<span class="px-4 py-1.5 rounded-full bg-white text-charcoal text-xs font-bold uppercase tracking-widest shadow-md">
Sold Out
</span>
</div>
` : ''}
</div>
<!-- Card Body -->
<div class="p-6 pb-4">
<div class="flex items-start justify-between gap-2">
<div>
<p class="text-[11px] uppercase tracking-widest text-gold font-semibold">${escapeHtml(p.brand)}</p>
<h3 onclick="openProductModal('${p.id}')" class="font-serif text-xl font-semibold text-charcoal hover:text-gold transition-colors cursor-pointer mt-0.5">
${escapeHtml(p.name)}
</h3>
</div>
<p class="font-serif text-xl font-semibold text-charcoal">$${activePrice}</p>
</div>
<!-- Scent Notes Preview -->
<div class="mt-3.5 pt-3.5 border-t border-stone/10 space-y-1.5 text-xs">
<p class="text-stone truncate"><span class="font-semibold text-charcoal">Top:</span> ${escapeHtml(p.topNotes)}</p>
<p class="text-stone truncate"><span class="font-semibold text-charcoal">Heart:</span> ${escapeHtml(p.heartNotes)}</p>
<p class="text-stone truncate"><span class="font-semibold text-charcoal">Base:</span> ${escapeHtml(p.baseNotes)}</p>
</div>
</div>
</div>
<!-- Size Selector & Action Buttons -->
<div class="px-6 pb-6 pt-2 space-y-3">
<!-- 50ml / 100ml Toggle -->
<div class="grid grid-cols-2 gap-2 bg-alabaster p-1 rounded-full border border-stone/10">
<button type="button" onclick="selectCardSize('${p.id}', '50ml')"
class="py-1.5 rounded-full text-xs font-semibold transition-all ${
currentSize === '50ml'
? 'bg-white text-charcoal shadow-2xs border border-gold/30'
: 'text-stone hover:text-charcoal'
}">
50ml • $${p.price50}
</button>
<button type="button" onclick="selectCardSize('${p.id}', '100ml')"
class="py-1.5 rounded-full text-xs font-semibold transition-all ${
currentSize === '100ml'
? 'bg-white text-charcoal shadow-2xs border border-gold/30'
: 'text-stone hover:text-charcoal'
}">
100ml • $${p.price100}
</button>
</div>
<div class="flex items-center gap-2">
<button onclick="openProductModal('${p.id}')" class="px-4 py-3 rounded-full border border-stone/20 hover:border-gold text-charcoal text-xs font-semibold transition-colors">
Notes
</button>
<button onclick="addToCart('${p.id}')" ${!p.inStock ? 'disabled' : ''}
class="flex-1 py-3 rounded-full text-xs font-semibold transition-all flex items-center justify-center gap-2 ${
p.inStock
? 'bg-charcoal hover:bg-gold text-white shadow-sm'
: 'bg-stone/20 text-stone cursor-not-allowed'
}">
<i class="fa-solid fa-bag-shopping"></i>
<span>${p.inStock ? 'Add to Bag' : 'Out of Stock'}</span>
</button>
</div>
</div>
</article>
`;
}).join('');
}
function selectCardSize(perfumeId, size) {
selectedSizes[perfumeId] = size;
renderStorefront();
}
function quickAddHero() {
const heroItem = perfumes[0];
if (heroItem && heroItem.inStock) {
selectedSizes[heroItem.id] = '50ml';
addToCart(heroItem.id);
} else {
scrollToCatalog();
}
}
// --- 6. PRODUCT DETAIL MODAL ---
function openProductModal(perfumeId) {
const p = perfumes.find(item => item.id === perfumeId);
if (!p) return;
const currentSize = selectedSizes[p.id] || '50ml';
const price = currentSize === '50ml' ? p.price50 : p.price100;
const modalContent = document.getElementById('product-modal-content');
modalContent.innerHTML = `
<div class="md:col-span-5 min-h-[280px] md:min-h-full">
${getBottleSVG(p, 'w-40 h-48')}
</div>
<div class="md:col-span-7 p-6 sm:p-8 flex flex-col justify-between space-y-5">
<div>
<div class="flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-gold">
<span>${escapeHtml(p.brand)}</span>
<span>•</span>
<span>${escapeHtml(p.concentration)}</span>
</div>
<h2 class="font-serif text-3xl font-semibold text-charcoal mt-1">${escapeHtml(p.name)}</h2>
<p class="text-sm text-stone mt-3 leading-relaxed">${escapeHtml(p.description)}</p>
<!-- Olfactory Pyramid -->
<div class="mt-5 bg-white p-4 rounded-2xl border border-stone/10 space-y-2.5">
<p class="text-[11px] uppercase tracking-widest font-bold text-gold">Olfactory Pyramid</p>
<div class="grid grid-cols-1 gap-2 text-xs">
<div class="flex items-start gap-2.5">
<span class="px-2 py-0.5 rounded bg-gold-pale text-gold-dark font-bold text-[10px] uppercase w-14 text-center shrink-0">Top</span>
<span class="text-charcoal font-medium">${escapeHtml(p.topNotes)}</span>
</div>
<div class="flex items-start gap-2.5">
<span class="px-2 py-0.5 rounded bg-gold-pale text-gold-dark font-bold text-[10px] uppercase w-14 text-center shrink-0">Heart</span>
<span class="text-charcoal font-medium">${escapeHtml(p.heartNotes)}</span>
</div>
<div class="flex items-start gap-2.5">
<span class="px-2 py-0.5 rounded bg-gold-pale text-gold-dark font-bold text-[10px] uppercase w-14 text-center shrink-0">Base</span>
<span class="text-charcoal font-medium">${escapeHtml(p.baseNotes)}</span>
</div>
</div>
</div>
<!-- Performance Bars -->
<div class="grid grid-cols-2 gap-4 mt-4 text-xs">
<div>
<div class="flex justify-between font-medium text-stone mb-1">
<span>Longevity</span>
<span class="text-charcoal font-semibold">${p.longevity || 85}%</span>
</div>
<div class="w-full h-1.5 bg-stone/15 rounded-full overflow-hidden">
<div class="h-full bg-gold rounded-full" style="width: ${p.longevity || 85}%"></div>
</div>
</div>
<div>
<div class="flex justify-between font-medium text-stone mb-1">
<span>Sillage / Trail</span>
<span class="text-charcoal font-semibold">${p.sillage || 80}%</span>
</div>
<div class="w-full h-1.5 bg-stone/15 rounded-full overflow-hidden">
<div class="h-full bg-charcoal rounded-full" style="width: ${p.sillage || 80}%"></div>
</div>
</div>
</div>
</div>
<!-- Size Picker & CTA -->
<div class="pt-4 border-t border-stone/10 space-y-3">
<div class="grid grid-cols-2 gap-3">
<button onclick="selectModalSize('${p.id}', '50ml')"
class="p-3 rounded-2xl border text-left transition-all ${
currentSize === '50ml' ? 'border-gold bg-gold-pale/50' : 'border-stone/15 bg-white'
}">
<span class="block text-xs font-bold text-charcoal">50ml Flacon</span>
<span class="font-serif text-base font-semibold text-gold-dark">$${p.price50}</span>
</button>
<button onclick="selectModalSize('${p.id}', '100ml')"
class="p-3 rounded-2xl border text-left transition-all ${
currentSize === '100ml' ? 'border-gold bg-gold-pale/50' : 'border-stone/15 bg-white'
}">
<span class="block text-xs font-bold text-charcoal">100ml Flacon</span>
<span class="font-serif text-base font-semibold text-gold-dark">$${p.price100}</span>
</button>
</div>
<button onclick="addToCart('${p.id}'); closeProductModal();" ${!p.inStock ? 'disabled' : ''}
class="w-full py-3.5 rounded-full text-sm font-semibold transition-all flex items-center justify-center gap-2 ${
p.inStock
? 'bg-charcoal hover:bg-gold text-white shadow-gold'
: 'bg-stone/20 text-stone cursor-not-allowed'
}">
<i class="fa-solid fa-bag-shopping"></i>
<span>${p.inStock ? `Add ${currentSize} to Bag — $${price}` : 'Currently Sold Out'}</span>
</button>
</div>
</div>
`;
const modal = document.getElementById('product-modal');
modal.classList.remove('hidden');
modal.classList.add('flex');
}
function selectModalSize(perfumeId, size) {
selectedSizes[perfumeId] = size;
renderStorefront();
openProductModal(perfumeId);
}
function closeProductModal() {
const modal = document.getElementById('product-modal');
modal.classList.add('hidden');
modal.classList.remove('flex');
}
// --- 7. SHOPPING CART & 1-STEP CHECKOUT ---
function addToCart(perfumeId) {
const p = perfumes.find(item => item.id === perfumeId);
if (!p || !p.inStock) return;
const size = selectedSizes[perfumeId] || '50ml';
const price = size === '50ml' ? p.price50 : p.price100;
const cartKey = `${perfumeId}_${size}`;
const existing = cart.find(item => item.key === cartKey);
if (existing) {
existing.qty += 1;
} else {
cart.push({
key: cartKey,
perfumeId: p.id,
name: p.name,
concentration: p.concentration,
theme: p.theme,
size: size,
price: price,
qty: 1
});
}
saveState();
updateCartUI();
showToast(`Added ${p.name} (${size}) to your bag.`);
}
function updateCartQty(cartKey, delta) {
const index = cart.findIndex(item => item.key === cartKey);
if (index === -1) return;
cart[index].qty += delta;
if (cart[index].qty <= 0) {
cart.splice(index, 1);
}
saveState();
updateCartUI();
}
function updateCartUI() {
const totalItems = cart.reduce((sum, item) => sum + item.qty, 0);
document.getElementById('cart-badge').textContent = totalItems;
const container = document.getElementById('cart-items-container');
const checkoutSection = document.getElementById('checkout-section');
const subtotal = cart.reduce((sum, item) => sum + (item.price * item.qty), 0);
const freeShipThreshold = 150;
const shippingCost = subtotal === 0 || subtotal >= freeShipThreshold ? 0 : 12;
const total = subtotal + shippingCost;
// Update Free Shipping Progress Bar
const pct = Math.min(100, Math.round((subtotal / freeShipThreshold) * 100));
document.getElementById('shipping-bar').style.width = `${pct}%`;
document.getElementById('shipping-pct').textContent = `${pct}%`;
document.getElementById('shipping-msg').textContent = subtotal >= freeShipThreshold
? 'Unlocked Complimentary Express Delivery!'
: `Add $${freeShipThreshold - subtotal} more for Free Express Shipping`;
if (cart.length === 0) {
checkoutSection.classList.add('hidden');
container.innerHTML = `
<div class="py-12 text-center space-y-3">
<div class="w-14 h-14 rounded-full bg-cream text-gold flex items-center justify-center mx-auto text-xl">
<i class="fa-solid fa-bag-shopping"></i>
</div>
<h3 class="font-serif text-xl font-medium text-charcoal">Your bag is empty</h3>
<p class="text-xs text-stone max-w-xs mx-auto">Explore our signature extraits and eau de parfums to find your next olfactory signature.</p>
<button onclick="closeCart(); scrollToCatalog();" class="mt-2 px-6 py-2.5 rounded-full bg-charcoal text-white text-xs font-semibold hover:bg-gold transition-colors">
Browse Collection
</button>
</div>
`;
return;
}
checkoutSection.classList.remove('hidden');
container.innerHTML = cart.map(item => `
<div class="flex items-center justify-between gap-3 bg-white p-3.5 rounded-2xl border border-stone/10 shadow-2xs">
<div class="flex items-center gap-3 min-w-0">
<div class="w-12 h-14 rounded-xl bg-cream flex items-center justify-center shrink-0 text-gold">
<i class="fa-solid fa-wine-bottle text-lg"></i>
</div>
<div class="min-w-0">
<h4 class="font-serif text-sm font-semibold text-charcoal truncate">${escapeHtml(item.name)}</h4>
<p class="text-[11px] text-stone">${escapeHtml(item.size)} • $${item.price} each</p>
</div>
</div>
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center border border-stone/15 rounded-full bg-alabaster">
<button onclick="updateCartQty('${item.key}', -1)" class="w-7 h-7 flex items-center justify-center text-xs text-charcoal hover:text-gold font-bold">-</button>
<span class="px-2 text-xs font-semibold text-charcoal">${item.qty}</span>
<button onclick="updateCartQty('${item.key}', 1)" class="w-7 h-7 flex items-center justify-center text-xs text-charcoal hover:text-gold font-bold">+</button>
</div>
</div>
</div>
`).join('');
document.getElementById('cart-subtotal').textContent = `$${subtotal}`;
document.getElementById('cart-shipping').textContent = shippingCost === 0 ? 'FREE' : `$${shippingCost}`;
document.getElementById('cart-total').textContent = `$${total}`;
}
function openCart() {
document.getElementById('cart-drawer').classList.remove('hidden');
}
function closeCart() {
document.getElementById('cart-drawer').classList.add('hidden');
}
function handlePlaceOrder(e) {
e.preventDefault();
if (cart.length === 0) return;
const name = document.getElementById('cust-name').value.trim();
const phone = document.getElementById('cust-phone').value.trim();
const address = document.getElementById('cust-address').value.trim();
const paymentMethod = document.querySelector('input[name="paymentMethod"]:checked').value;
const subtotal = cart.reduce((sum, item) => sum + (item.price * item.qty), 0);
const shipping = subtotal >= 150 ? 0 : 12;
const total = subtotal + shipping;
const now = new Date();
const formattedDate = now.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) +
' • ' + now.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false });
const newOrder = {
id: 'ORD-' + Math.floor(1000 + Math.random() * 9000),
date: formattedDate,
customerName: name,
phone: phone,
address: address,
paymentMethod: paymentMethod,
status: 'Pending',
items: cart.map(c => ({
perfumeId: c.perfumeId,
name: c.name,
size: c.size,
price: c.price,
qty: c.qty
})),
subtotal,
shipping,
total
};
orders.unshift(newOrder);
cart = [];
saveState();
document.getElementById('checkout-form').reset();
updateCartUI();
closeCart();
renderSellerDashboard();
showReceiptModal(newOrder);
}
function showReceiptModal(order) {
const details = document.getElementById('receipt-details');
details.innerHTML = `
<div class="flex justify-between border-b border-stone/10 pb-2">
<span class="text-stone">Order Reference</span>
<span class="font-bold text-charcoal">${order.id}</span>
</div>
<div class="flex justify-between">
<span class="text-stone">Recipient</span>
<span class="font-semibold text-charcoal">${escapeHtml(order.customerName)}</span>
</div>
<div class="flex justify-between">
<span class="text-stone">Phone / WhatsApp</span>
<span class="text-charcoal">${escapeHtml(order.phone)}</span>
</div>
<div class="pt-1">
<span class="text-stone block mb-1">Fragrances Ordered:</span>
${order.items.map(i => `
<div class="flex justify-between font-medium text-charcoal">
<span>${i.qty}x ${escapeHtml(i.name)} (${i.size})</span>
<span>$${i.price * i.qty}</span>
</div>
`).join('')}
</div>
<div class="flex justify-between border-t border-stone/10 pt-2 text-sm font-bold text-gold-dark">
<span>Total Paid (${escapeHtml(order.paymentMethod)})</span>
<span>$${order.total}</span>
</div>
`;
const modal = document.getElementById('receipt-modal');
modal.classList.remove('hidden');
modal.classList.add('flex');
}
function closeReceiptModal() {
const modal = document.getElementById('receipt-modal');
modal.classList.add('hidden');
modal.classList.remove('flex');
}
// --- 8. SELLER STUDIO DASHBOARD LOGIC ---
function toggleAppMode() {
switchMode(currentMode === 'store' ? 'seller' : 'store');
}
function switchMode(mode) {
currentMode = mode;
const storeView = document.getElementById('storefront-view');
const sellerView = document.getElementById('seller-view');
const toggleText = document.getElementById('mode-toggle-text');
const toggleIcon = document.getElementById('mode-toggle-icon');
const headerCartBtn = document.getElementById('header-cart-btn');
if (mode === 'seller') {
storeView.classList.add('hidden');
sellerView.classList.remove('hidden');
toggleText.textContent = 'Back to Store';
toggleIcon.className = 'fa-solid fa-bag-shopping';
headerCartBtn.classList.add('hidden');
renderSellerDashboard();
} else {
sellerView.classList.add('hidden');
storeView.classList.remove('hidden');
toggleText.textContent = 'Seller Admin';
toggleIcon.className = 'fa-solid fa-store text-gold';
headerCartBtn.classList.remove('hidden');
renderStorefront();
}
window.scrollTo({ top: 0, behavior: 'smooth' });
}
function switchSellerTab(tab) {
const ordersTab = document.getElementById('seller-tab-orders');
const invTab = document.getElementById('seller-tab-inventory');
const btnOrders = document.getElementById('tab-btn-orders');
const btnInv = document.getElementById('tab-btn-inventory');
if (tab === 'orders') {
ordersTab.classList.remove('hidden');
invTab.classList.add('hidden');
btnOrders.classList.add('border-gold', 'text-charcoal');
btnOrders.classList.remove('border-transparent', 'text-stone');
btnInv.classList.remove('border-gold', 'text-charcoal');
btnInv.classList.add('border-transparent', 'text-stone');
} else {
invTab.classList.remove('hidden');
ordersTab.classList.add('hidden');
btnInv.classList.add('border-gold', 'text-charcoal');
btnInv.classList.remove('border-transparent', 'text-stone');
btnOrders.classList.remove('border-gold', 'text-charcoal');
btnOrders.classList.add('border-transparent', 'text-stone');
}
}
function renderSellerDashboard() {
// 1. Update KPI Stats
const totalRevenue = orders.reduce((sum, o) => sum + o.total, 0);
const pendingCount = orders.filter(o => o.status === 'Pending').length;
const activeScents = perfumes.filter(p => p.inStock).length;
const soldOutScents = perfumes.filter(p => !p.inStock).length;
document.getElementById('stat-revenue').textContent = `$${totalRevenue.toLocaleString()}`;
document.getElementById('stat-orders').textContent = orders.length;
document.getElementById('stat-pending-orders').textContent = `${pendingCount} awaiting fulfillment`;
document.getElementById('stat-products').textContent = activeScents;
document.getElementById('stat-soldout').textContent = soldOutScents;
document.getElementById('orders-tab-badge').textContent = orders.length;
// 2. Render Orders & Inventory
renderSellerOrders();
renderSellerInventory();
}
function renderSellerOrders() {
const list = document.getElementById('seller-orders-list');
const filter = document.getElementById('order-status-filter').value;
const filteredOrders = filter === 'All' ? orders : orders.filter(o => o.status === filter);
if (filteredOrders.length === 0) {
list.innerHTML = `
<div class="bg-white rounded-2xl p-10 text-center border border-stone/10">
<p class="font-serif text-lg text-charcoal">No orders in this category yet</p>
<p class="text-xs text-stone mt-1">Orders placed on your customer storefront appear here instantly.</p>
</div>
`;
return;
}
const statusColors = {
'Pending': 'bg-amber-50 text-amber-700 border-amber-200',
'Packed': 'bg-blue-50 text-blue-700 border-blue-200',
'Shipped': 'bg-purple-50 text-purple-700 border-purple-200',
'Delivered': 'bg-emerald-50 text-emerald-700 border-emerald-200'
};
const nextStatusMap = {
'Pending': 'Packed',
'Packed': 'Shipped',
'Shipped': 'Delivered',
'Delivered': null
};
list.innerHTML = filteredOrders.map(order => {
const nextStatus = nextStatusMap[order.status];
return `
<div class="bg-white rounded-2xl p-5 sm:p-6 border border-stone/10 shadow-2xs flex flex-col lg:flex-row lg:items-center justify-between gap-5">
<div class="space-y-2 flex-1">
<div class="flex flex-wrap items-center gap-2.5">
<span class="font-bold text-sm text-charcoal">${escapeHtml(order.id)}</span>
<span class="px-3 py-0.5 rounded-full text-[11px] font-bold border ${statusColors[order.status] || 'bg-cream text-charcoal'}">
${escapeHtml(order.status)}
</span>
<span class="text-xs text-stone">${escapeHtml(order.date)}</span>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 text-xs pt-1">
<div>
<p class="font-semibold text-charcoal"><i class="fa-regular fa-user text-gold mr-1.5"></i>${escapeHtml(order.customerName)}</p>
<p class="text-stone mt-0.5"><i class="fa-brands fa-whatsapp text-gold mr-1.5"></i>${escapeHtml(order.phone)}</p>
</div>
<div>
<p class="text-stone"><i class="fa-solid fa-location-dot text-gold mr-1.5"></i>${escapeHtml(order.address)}</p>
<p class="text-stone mt-0.5"><i class="fa-solid fa-wallet text-gold mr-1.5"></i>${escapeHtml(order.paymentMethod)}</p>
</div>
</div>
<!-- Ordered Scents Pills -->
<div class="flex flex-wrap gap-2 pt-2">
${order.items.map(item => `
<span class="px-3 py-1 rounded-lg bg-alabaster border border-stone/10 text-xs font-medium text-charcoal">
${item.qty}x <strong>${escapeHtml(item.name)}</strong> (${item.size}) — $${item.price * item.qty}
</span>
`).join('')}
</div>
</div>
<!-- Right Total & One-Click Status Progression -->
<div class="flex sm:items-center justify-between lg:flex-col lg:items-end gap-3 pt-3 lg:pt-0 border-t lg:border-t-0 border-stone/10 shrink-0">
<div class="lg:text-right">
<span class="text-[11px] uppercase tracking-wider text-stone block">Order Total</span>
<span class="font-serif text-2xl font-semibold text-charcoal">$${order.total}</span>
</div>
<div class="flex items-center gap-2">
${nextStatus ? `
<button onclick="advanceOrderStatus('${order.id}', '${nextStatus}')"
class="px-4 py-2 rounded-full bg-charcoal hover:bg-gold text-white text-xs font-semibold transition-colors shadow-2xs">
Mark as ${nextStatus} <i class="fa-solid fa-arrow-right ml-1"></i>
</button>
` : `
<span class="px-3.5 py-1.5 rounded-full bg-emerald-50 text-emerald-700 text-xs font-semibold">
<i class="fa-solid fa-circle-check mr-1"></i> Fulfilled
</span>
`}
</div>
</div>
</div>
`;
}).join('');
}
function advanceOrderStatus(orderId, newStatus) {
const order = orders.find(o => o.id === orderId);
if (!order) return;
order.status = newStatus;
saveState();
renderSellerDashboard();
showToast(`Order ${orderId} updated to ${newStatus}.`);
}
// --- 9. SELLER INVENTORY MANAGEMENT (ADD / EDIT / TOGGLE STOCK / DELETE) ---
function renderSellerInventory() {
const list = document.getElementById('seller-inventory-list');
document.getElementById('inventory-count-label').textContent = `${perfumes.length} fragrances in catalog`;
list.innerHTML = perfumes.map(p => `
<div class="bg-white p-4 rounded-2xl border border-stone/10 shadow-2xs flex flex-col sm:flex-row sm:items-center justify-between gap-4">
<div class="flex items-center gap-3.5">
<div class="w-16 h-20 rounded-xl overflow-hidden shrink-0 border border-stone/10">
${getBottleSVG(p, 'w-14 h-16')}
</div>
<div>
<div class="flex flex-wrap items-center gap-2">
<h4 class="font-serif text-lg font-semibold text-charcoal">${escapeHtml(p.name)}</h4>
<span class="px-2 py-0.5 rounded bg-cream text-stone text-[10px] font-bold uppercase">${escapeHtml(p.concentration)}</span>
</div>
<p class="text-xs text-stone mt-0.5">${escapeHtml(p.family)} • 50ml: <strong>$${p.price50}</strong> | 100ml: <strong>$${p.price100}</strong></p>
<p class="text-[11px] text-stone/80 mt-1 line-clamp-1">Notes: ${escapeHtml(p.topNotes)} / ${escapeHtml(p.heartNotes)}</p>
</div>
</div>
<div class="flex items-center justify-end gap-2 shrink-0 pt-2 sm:pt-0 border-t sm:border-t-0 border-stone/10">
<!-- 1-Click Stock Toggle -->
<button onclick="togglePerfumeStock('${p.id}')"
class="px-3 py-1.5 rounded-full text-xs font-semibold border transition-colors ${
p.inStock
? 'bg-emerald-50 text-emerald-700 border-emerald-200 hover:bg-emerald-100'
: 'bg-rose-50 text-rose-700 border-rose-200 hover:bg-rose-100'
}">
<i class="fa-solid ${p.inStock ? 'fa-check' : 'fa-ban'} mr-1"></i>
${p.inStock ? 'In Stock' : 'Sold Out'}
</button>
<!-- Edit Button -->
<button onclick="startEditPerfume('${p.id}')" title="Edit Perfume"
class="w-8 h-8 rounded-full bg-alabaster hover:bg-gold hover:text-white text-charcoal border border-stone/15 flex items-center justify-center text-xs transition-colors">
<i class="fa-solid fa-pen"></i>
</button>
<!-- Delete Button -->
<button onclick="deletePerfume('${p.id}')" title="Remove Perfume"
class="w-8 h-8 rounded-full bg-alabaster hover:bg-rose-600 hover:text-white text-stone border border-stone/15 flex items-center justify-center text-xs transition-colors">
<i class="fa-solid fa-trash"></i>
</button>
</div>
</div>
`).join('');
}
function handleSavePerfume(e) {
e.preventDefault();
const editId = document.getElementById('edit-perfume-id').value;
const perfumeData = {
name: document.getElementById('p-name').value.trim(),
brand: document.getElementById('p-brand').value.trim() || 'Aurélia Privé',
family: document.getElementById('p-family').value,
concentration: document.getElementById('p-concentration').value,
price50: Number(document.getElementById('p-price50').value),
price100: Number(document.getElementById('p-price100').value),
topNotes: document.getElementById('p-top').value.trim(),
heartNotes: document.getElementById('p-heart').value.trim(),
baseNotes: document.getElementById('p-base').value.trim(),
theme: document.getElementById('p-theme').value,
description: document.getElementById('p-desc').value.trim(),
inStock: document.getElementById('p-instock').checked,
longevity: 88,
sillage: 84
};
if (editId) {
const idx = perfumes.findIndex(p => p.id === editId);
if (idx !== -1) {
perfumes[idx] = { ...perfumes[idx], ...perfumeData };
showToast(`Updated "${perfumeData.name}" in catalog.`);
}
} else {
const newPerfume = {
id: 'perf-' + Date.now(),
...perfumeData
};
perfumes.unshift(newPerfume);
selectedSizes[newPerfume.id] = '50ml';
showToast(`Published "${newPerfume.name}" to your live boutique!`);
}
saveState();
resetPerfumeForm();
renderSellerDashboard();
renderStorefront();
}
function startEditPerfume(perfumeId) {
const p = perfumes.find(item => item.id === perfumeId);
if (!p) return;
document.getElementById('edit-perfume-id').value = p.id;
document.getElementById('p-name').value = p.name;
document.getElementById('p-brand').value = p.brand;
document.getElementById('p-family').value = p.family;
document.getElementById('p-concentration').value = p.concentration;
document.getElementById('p-price50').value = p.price50;
document.getElementById('p-price100').value = p.price100;
document.getElementById('p-top').value = p.topNotes;
document.getElementById('p-heart').value = p.heartNotes;
document.getElementById('p-base').value = p.baseNotes;
document.getElementById('p-theme').value = p.theme;
document.getElementById('p-desc').value = p.description;
document.getElementById('p-instock').checked = p.inStock;
document.getElementById('form-mode-label').textContent = 'Editing Fragrance';
document.getElementById('form-heading').textContent = `Edit ${p.name}`;
document.getElementById('save-perfume-btn').innerHTML = `<i class="fa-solid fa-check mr-1.5"></i> Save Fragrance Changes`;
document.getElementById('cancel-edit-btn').classList.remove('hidden');
document.getElementById('perfume-form').scrollIntoView({ behavior: 'smooth', block: 'center' });
}
function resetPerfumeForm() {
document.getElementById('perfume-form').reset();
document.getElementById('edit-perfume-id').value = '';
document.getElementById('p-brand').value = 'Aurélia Privé';
document.getElementById('p-instock').checked = true;
document.getElementById('form-mode-label').textContent = 'Create New Creation';
document.getElementById('form-heading').textContent = 'Add a Perfume';
document.getElementById('save-perfume-btn').innerHTML = `<i class="fa-solid fa-plus mr-1.5"></i> Publish Fragrance to Store`;
document.getElementById('cancel-edit-btn').classList.add('hidden');
}
function togglePerfumeStock(perfumeId) {
const p = perfumes.find(item => item.id === perfumeId);
if (!p) return;
p.inStock = !p.inStock;
saveState();
renderSellerDashboard();
renderStorefront();
showToast(`${p.name} marked as ${p.inStock ? 'In Stock' : 'Sold Out'}.`);
}
function deletePerfume(perfumeId) {
const p = perfumes.find(item => item.id === perfumeId);
if (!p) return;
perfumes = perfumes.filter(item => item.id !== perfumeId);
cart = cart.filter(item => item.perfumeId !== perfumeId);
saveState();
updateCartUI();
renderSellerDashboard();
renderStorefront();
showToast(`Removed "${p.name}" from catalog.`);
}
// --- 10. UTILITIES ---
function scrollToCatalog() {
const el = document.getElementById('catalog-section');
if (el) el.scrollIntoView({ behavior: 'smooth' });
}
function showToast(message) {
const container = document.getElementById('toast-container');
const toast = document.createElement('div');
toast.className = 'pointer-events-auto bg-charcoal text-alabaster px-4 py-3 rounded-2xl shadow-xl border border-gold/30 text-xs font-medium flex items-center gap-2.5 transform transition-all duration-300 translate-y-2 opacity-0';
toast.innerHTML = `
<span class="w-5 h-5 rounded-full bg-gold text-white flex items-center justify-center text-[10px] shrink-0">
<i class="fa-solid fa-sparkles"></i>
</span>
<span>${escapeHtml(message)}</span>
`;
container.appendChild(toast);
requestAnimationFrame(() => {
toast.classList.remove('translate-y-2', 'opacity-0');
});
setTimeout(() => {
toast.classList.add('opacity-0', 'translate-y-2');
setTimeout(() => toast.remove(), 300);
}, 3000);
}
function escapeHtml(str) {
if (str === null || str === undefined) return '';
return String(str)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
// Boot application on load
window.addEventListener('DOMContentLoaded', initApp);
</script>
</body>
</html>