function getDetailTemplate(product, baseUrl) {
    const img = product.gambar ? baseUrl + '/storage/uploads' + product.gambar.path : 'https://via.placeholder.com/400';
    const harga = Number(product.harga).toLocaleString('id-ID');
    const desc = product.deskripsi || 'Produk herbal premium pilihan yang diproses secara alami dan higienis.';
    const stok = product.stok !== undefined && product.stok !== null ? parseInt(product.stok) : 'Tersedia';
    const habis = stok !== 'Tersedia' && stok <= 0;
    const badge = habis ? '<div class="badge-habis">Stok Habis</div>' : '';
    const btnCart = habis ? '<button class="btn-cart-detail disabled" disabled>Stok Habis</button>' : `<button class="btn-cart-detail" onclick="addToCart('${product._id}')">Beli Sekarang +</button>`;
    const btnWA = habis ? '<a class="btn-wa-detail disabled"><i class="fab fa-whatsapp"></i> Stok Habis</a>' : `<a href="https://wa.me/628123456789?text=${encodeURIComponent('Halo Nadhief Herbal, saya mau tanya tentang: ' + product.nama_produk)}" target="_blank" class="btn-wa-detail"><i class="fab fa-whatsapp"></i> Tanya Admin</a>`;
    return `<div class="detail-img-wrapper">${badge}<img src="${img}" alt="${product.nama_produk}" loading="lazy"></div><div class="detail-info"><h1>${product.nama_produk}</h1><p class="detail-price">Rp ${harga}</p><p class="detail-desc">${desc}</p><div class="detail-actions">${btnCart}${btnWA}</div><div class="meta-info"><div class="meta-item"><strong>SKU:</strong> ${product._id.substring(0,8).toUpperCase()}</div><div class="meta-item"><strong>Kategori:</strong> <span onclick="showCategoryPage('${product.kategori || 'Herbal'}')" style="cursor:pointer; color:var(--primary);">${product.kategori || 'Herbal'}</span></div><div class="meta-item"><strong>Sisa Stok:</strong> ${stok}</div></div></div>`;
}