Опитай:
Profile / Login Home ★ Best-Sellers Routines & Sets
Anti-Acne Program About the Brand ☎ 0888 877 064
ProfiDerm Active Serum Age Control+ 30 ml

ProfiDerm Active Serum Age Control+ 30 ml

ProfiDerm Beauty Expert · Lidera Laboratories · Code: 3800236450238 · In Stock
28.29 €
Key benefits
Anti-wrinkle
Firms & smooths
Concentrated active serum
With peptides

Action

Anti-ageing action; reduces wrinkles and firms skin

Active Ingredients

Anti-ageing peptide and vitamin complex

How to Use

Evenings before your cream, as a course

Description

Active Serum Age Control+ from the Beauty Expert line — concentrated anti-ageing, anti-wrinkle care.

Science-based formula

Dermatologically oriented care

ProfiDerm Beauty Expert · Lidera Laboratories

ProfiDerm Active Serum Age Control+
🔬Clinically based formula
🧬Exosomes & peptides
🏛️Lidera Laboratories · since 1990
🌿Dermatologically oriented
Active ingredients
Anti-ageing peptide and vitamin complex

Customer reviews

No reviews yet. Be the first!

Only registered customers can rate and review products.

Compare within the category

ProductSizeActionPrice
ProfiDerm Active Serum Age Control+ (this page) 30 ml Anti-ageing action; reduces wrinkles and firms skin 28.29 €
ProfiDerm Firming & Lifting Neck Serum 5 x 5 ml Lifting and firming effect for neck and double chin 38.50 €
ProfiDerm Tranexamic Exobright Serum 5 x 5 ml Reduces pigmentation by interrupting melanogenesis; calms redness 44.50 €
ProfiDerm Face Fitness Lifting Serum 5 x 5 ml Tones and lifts the face and eye contour; reduces under-eye bags 44.50 €
swipe →

Combine with

Catalogue

ProfiDerm Professional Care

51 clinically based products in 7 categories — cleansing, anti-acne, hydration, anti-age, brightening, serums and sun care. Choose the care for your skin type.

Bundles

Ready-made bundles

Curated combinations for a specific concern — added to the cart in one click.

See how it works

ProfiDerm in action

The products, textures and results — in 30 seconds.

ProfiDerm в действие
Anti-Acne Program
Delivery

Delivery with Speedy & Econt

Nationwide delivery. To an address — Speedy only; to an office — Speedy or Econt. Free delivery on orders over €49.90. Orders before 2:00 PM are processed the same day.

To Address (Speedy)
3,49 €
To Speedy Office
2,99 €
To Econt Office
2,99 €
✔ Free delivery on orders over €49.90
TBI BankPay in instalments with TBI Bank — up to 12 monthly instalments

Prefer to Order by Phone?

Call us — we’ll help you choose the right care for your skin

☎ 0888 877 064 Message Us on Viber Browse ProfiDerm on angelcosmetics.bg
What customers say
Отлично
★★★★★
 
★ Rate us

Cart

Your cart is empty

Complete Your Order

We will call you for confirmation

Your Name *'+pc+'%
'}).join('')+'
':'

'+(en?'No reviews yet. Be the first!':'Все още няма мнения. Бъдете първи!')+'

'; l.innerHTML=d.reviews.map(function(r){var dt='';try{dt=new Date(r.ts).toLocaleDateString(en?'en-GB':'bg-BG',{day:'2-digit',month:'2-digit',year:'numeric'})}catch(e){}var ph=(r.p||[]).map(function(id){var u='/rimg/'+encodeURIComponent(code)+'/'+encodeURIComponent(id);return ''}).join('');return '
'+esc(r.name)+''+(r.v?''+(en?'✓ Verified purchase':'✓ Потвърдена покупка')+'':'')+''+dt+'
'+prStars(r.rating)+'
'+(r.text?'

'+esc(r.text)+'

':'')+(ph?'
'+ph+'
':'')+'
'}).join('')} // „Остави мнение“ от картата на продукта: страницата се отваря на мненията и // формата се отваря — а на гост първо се показва входът (prStart го прави). (function(){if(location.hash!=='#review')return;userReady(function(u){var el=document.getElementById('pdReviews');if(!el)return;prStart();setTimeout(function(){var f=document.querySelector('#prFormWrap .pr-form')||el;f.scrollIntoView({block:'start'})},80)})})(); function prStart(){if(!USER){_afterAuth=prStart;openAuth();return}var w=document.getElementById('prFormWrap');if(!w)return;prRating=0;prFiles=[];var en=accLang()==='en'; w.innerHTML='

'+(en?'Your review':'Вашето мнение')+'

'+[1,2,3,4,5].map(function(i){return ''}).join('')+'
'+PR_LBL[en?'en':'bg'][0]+'
' +'
0/1000
' +'
📷'+(en?'Add photos (up to 3)':'Добави снимки (до 3)')+''+(en?'JPG, PNG or WebP · from your gallery or camera':'JPG, PNG или WebP · от галерията или камерата')+'
' +'
';window.scrollBy({top:0})} function prPaint(v){var bs=document.querySelectorAll('#prPick button');bs.forEach(function(b){b.classList.toggle('on',Number(b.getAttribute('data-v'))<=v)});var l=document.getElementById('prPickLbl');if(l){l.textContent=PR_LBL[accLang()==='en'?'en':'bg'][v]||PR_LBL[accLang()==='en'?'en':'bg'][0];l.classList.toggle('on',v>0)}} function prPick(v){prRating=v;prPaint(v)} function prHover(v){prPaint(v||prRating)} function prGrow(t){t.style.height='auto';t.style.height=Math.max(110,t.scrollHeight+2)+'px';var c=document.getElementById('prCnt');if(c)c.textContent=t.value.length} // Снимките се смаляват в браузъра (до 1400px, JPEG 0.82) — по-бърз ъплоуд и без EXIF. function prShrink(file){return new Promise(function(res,rej){var img=new Image(),u=URL.createObjectURL(file);img.onload=function(){URL.revokeObjectURL(u);try{var w=img.naturalWidth,h=img.naturalHeight,k=Math.min(1,1400/Math.max(w,h,1)),c=document.createElement('canvas');c.width=Math.max(1,Math.round(w*k));c.height=Math.max(1,Math.round(h*k));c.getContext('2d').drawImage(img,0,0,c.width,c.height);c.toBlob(function(b){b?res(b):rej()},'image/jpeg',0.82)}catch(e){rej()}};img.onerror=function(){URL.revokeObjectURL(u);rej()};img.src=u})} function prAddFiles(fl){var msg=document.getElementById('prPhMsg');if(!msg)return;msg.textContent='';var arr=Array.prototype.slice.call(fl||[]),room=3-prFiles.length; if(arr.length>room){msg.textContent=authT('Може да добавите най-много 3 снимки.','You can add up to 3 photos.');arr=arr.slice(0,Math.max(0,room))} arr.forEach(function(f){if(!/^image\//.test(f.type||'')){msg.textContent=authT('Разрешени са само снимки (JPG, PNG, WebP).','Only images are allowed (JPG, PNG, WebP).');return}var slot={blob:null,url:''};if(prFiles.length>=3)return;prFiles.push(slot);prShrink(f).then(function(b){slot.blob=b;slot.url=URL.createObjectURL(b);prThumbs()}).catch(function(){prFiles=prFiles.filter(function(x){return x!==slot});msg.textContent=authT('Снимката не може да бъде прочетена.','Could not read that image.');prThumbs()})})} function prThumbs(){var t=document.getElementById('prThumbs'),d=document.getElementById('prDrop');if(!t)return;t.innerHTML=prFiles.map(function(f,i){return f.url?'
':''}).join('');if(d)d.classList.toggle('full',prFiles.length>=3)} function prRmPhoto(i){var f=prFiles[i];if(f&&f.url)URL.revokeObjectURL(f.url);prFiles.splice(i,1);prThumbs()} function prSubmit(){var m=document.getElementById('prMsg');m.className='pr-form-msg';if(!prRating){m.textContent=authT('Изберете оценка от 1 до 5 звезди.','Pick a rating from 1 to 5 stars.');return}var code=(document.getElementById('pdReviews')||{}).getAttribute?document.getElementById('pdReviews').getAttribute('data-code'):'';var btn=document.getElementById('prSubmit'),was=btn.textContent;btn.disabled=true;btn.textContent=authT('Публикуване…','Publishing…'); var fd=new FormData();fd.append('code',code);fd.append('rating',prRating);fd.append('text',document.getElementById('prText').value);prFiles.forEach(function(f,i){if(f.blob)fd.append('photo',f.blob,'photo'+(i+1)+'.jpg')}); fetch('/api/product-reviews',{method:'POST',credentials:'same-origin',body:fd}).then(function(r){return r.json()}).then(function(d){btn.disabled=false;btn.textContent=was;if(!d.ok){if(d.auth===false){setUser(null);_afterAuth=prStart;openAuth();return}m.textContent=d.error||authT('Грешка.','Error.');return} prFiles.forEach(function(f){if(f.url)URL.revokeObjectURL(f.url)});prFiles=[];prRender(d);document.getElementById('prFormWrap').innerHTML='

'+authT('Благодарим! Мнението ви е публикувано.','Thank you! Your review is published.')+'

';accTrack('product_review')}).catch(function(){btn.disabled=false;btn.textContent=was;m.textContent=authT('Няма връзка. Опитайте отново.','No connection. Please try again.')})} // Lightbox за снимките към мненията: ← → между снимките на едно мнение, × / Esc / клик отвън затваря. var _prLb=null,_prLbList=[],_prLbI=0,_prLbTx=0; document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a.pr-ph'):null;if(!a)return;e.preventDefault();var all=Array.prototype.slice.call(a.parentNode.querySelectorAll('a.pr-ph')).map(function(x){return x.getAttribute('href')});prLbOpen(all,all.indexOf(a.getAttribute('href')))}); function prLbOpen(list,i){_prLbList=list;_prLbI=i<0?0:i;if(!_prLb){_prLb=document.createElement('div');_prLb.className='pr-lb';_prLb.id='prLb';_prLb.setAttribute('role','dialog');_prLb.setAttribute('aria-modal','true');_prLb.innerHTML='
';_prLb.addEventListener('click',function(e){if(e.target===_prLb)prLbClose()});_prLb.addEventListener('touchstart',function(e){_prLbTx=e.touches[0].clientX},{passive:true});_prLb.addEventListener('touchend',function(e){var dx=e.changedTouches[0].clientX-_prLbTx;if(Math.abs(dx)>50)prLbGo(dx<0?1:-1)});document.body.appendChild(_prLb)} _prLb.classList.toggle('one',list.length<2);_prLb.style.display='flex';prLbShow();document.addEventListener('keydown',prLbKey);try{_prLb.querySelector('.pr-lb-x').focus()}catch(e){}} function prLbShow(){var im=document.getElementById('prLbImg');if(im)im.src=_prLbList[_prLbI];var n=document.getElementById('prLbN');if(n)n.textContent=(_prLbI+1)+' / '+_prLbList.length} function prLbGo(d){if(_prLbList.length<2)return;_prLbI=(_prLbI+d+_prLbList.length)%_prLbList.length;prLbShow()} function prLbClose(){if(!_prLb)return;_prLb.style.display='none';document.removeEventListener('keydown',prLbKey)} function prLbKey(e){if(e.key==='Escape')prLbClose();else if(e.key==='ArrowLeft')prLbGo(-1);else if(e.key==='ArrowRight')prLbGo(1)} (function(){var lEl=document.getElementById('gr2-list');if(!lEl)return;var sEl=document.getElementById('gr2-summary'),tEl=document.getElementById('gr2-title'),stEl=document.getElementById('gr2-stars');var CK='pf_reviews_v1',TTL=259200000,LINK='https://g.page/r/CbWmiPKBF99XEAE/review';var en=(window.__INITIAL_LANG__==='en'); function toNum(x){var n=Number(x);return isFinite(n)?n:null}function clamp5(n){return Math.max(0,Math.min(5,n||0))} function initials(n){var p=String(n||'').trim().split(/\s+/);return p.length>=2?(p[0][0]+p[1][0]).toUpperCase():String(n||'?').substring(0,2).toUpperCase()} function starsStr(n){var r=Math.round(clamp5(n||5));return'★★★★★'.slice(0,r)+'☆☆☆☆☆'.slice(0,5-r)} function hStars(a){var f=Math.round(clamp5(a)),h='';for(var i=0;i<5;i++)h+=''+(i';return h} function label(a){if(!a||a>=4.8)return en?'Excellent':'Отлично';if(a>=4.5)return en?'Very good':'Много добро';return en?'Good':'Добро'} function render(d){var all=Array.isArray(d.reviews)?d.reviews:[];if(!all.length)throw new Error('empty');var avg=toNum(d.rating),tot=toNum(d.user_ratings_total);tEl.textContent=label(avg);if(avg!==null)stEl.innerHTML=hStars(avg); if(avg!==null&&tot!==null)sEl.innerHTML=''+avg.toFixed(1)+' / 5  ·  '+(en?'Based on '+Math.round(tot)+' reviews':'Базирано на '+Math.round(tot)+' отзива');else sEl.innerHTML=' '; var html='';all.slice(0,6).forEach(function(r,i){var ph=r.profile_photo_url?String(r.profile_photo_url).trim():'',ini=initials(r.author_name),ci=i%8; var av=ph?'
'+esc(ini)+'
':'
'+esc(ini)+'
'; var tx=String(r.text||'').trim();html+='
'+av+'
'+esc(r.author_name||'Клиент')+'
'+esc(r.relative_time_description||'')+'
'+starsStr(toNum(r.rating)||5)+'
'+(tx?'
'+esc(tx)+'
':'
'+(en?'Rating without comment':'Оценка без коментар')+'
')+'
'}); html+='';lEl.innerHTML=html} function hide(){var s=document.getElementById('grSection');if(s)s.style.display='none'} function load(){try{var c=JSON.parse(localStorage.getItem(CK)||'null');if(c&&c.ts&&(Date.now()-c.ts)40){go(dx<0?i+1:i-1);start()}},{passive:true});s.addEventListener('mouseenter',stop);s.addEventListener('mouseleave',start);document.addEventListener('visibilitychange',function(){if(document.hidden)stop();else start()});start()})(); var cart = []; try{ var savedCart=JSON.parse(localStorage.getItem('profiderm_cart')||'[]'); if(Array.isArray(savedCart))cart=savedCart.filter(function(x){return x&&x.id&&x.qty>0&&typeof x.price==='number'}); }catch(e){cart=[]} function getDiscount(qty){ return {rate:0, label:'', name:''}; } var FREE_DELIVERY_OVER=49.90; function getDelivery(subtotal){ var sel=document.getElementById('deliverySelect'); var type=sel?sel.value:''; var free=subtotal>=FREE_DELIVERY_OVER; var badge=document.getElementById('freeDeliveryBadge'); if(badge){ badge.style.display='block'; if(free){badge.innerHTML=i18n['cart-free'][currentLang];badge.style.color='#16a34a';} else{badge.innerHTML=(currentLang==='en'?'Add ':'Добави още ')+(FREE_DELIVERY_OVER-subtotal).toFixed(2)+(currentLang==='en'?' € more for free delivery':' € за безплатна доставка');badge.style.color='var(--text-dim)';} } var bases={address:(currentLang==='en'?'To address':'До адрес'),office:(currentLang==='en'?'To Speedy office':'До офис на Speedy'),office_econt:(currentLang==='en'?'To Econt office':'До офис на Еконт')}; if(!type||!bases[type])return{type:'',fee:0,label:'',free:free}; var fee=free?0:(type==='address'?3.49:2.99); var label=bases[type]+(free?(currentLang==='en'?' (free)':' (безплатно)'):''); return{type:type,fee:fee,label:label,free:free}; } function esc(s){var d=document.createElement('div');d.textContent=s||'';return d.innerHTML} var STAR_FULL=''; var STAR_HALF=''; var STAR_EMPTY=''; // Само истинските оценки — от мненията, които клиентите са оставили в този // сайт. Worker-ът ги слага в страницата като window.__RATINGS__ (по код на // продукта). Продукт без мнения е без звезди — нищо не се измисля. function productRating(id){ var R=window.__RATINGS__||{}; var p=(window.__PRODUCTS__||[]).filter(function(x){return String(x.id)===String(id)})[0]||{}; var x=R[String(p.code||id)]||R[String(id)]; return x&&Number(x.c)>0?{r:Number(x.r),c:Number(x.c)}:null; } function renderStars(rating){ var out=''; for(var i=1;i<=5;i++){ if(rating>=i)out+=STAR_FULL; else if(rating>=i-0.5)out+=STAR_HALF; else out+=STAR_EMPTY; } return out; } var CATS={ cleansing:{bg:'Почистване',en:'Cleansing'}, acne:{bg:'Анти-акне',en:'Anti-Acne'}, hydration:{bg:'Хидратация',en:'Hydration'}, antiage:{bg:'Анти-ейдж и лифтинг',en:'Anti-Age & Lifting'}, brightening:{bg:'Изсветляване',en:'Brightening'}, ampoules:{bg:'Серуми и ампули',en:'Serums & Ampoules'}, sun:{bg:'Слънцезащита и грим',en:'Sun Care & Makeup'}, sets:{bg:'Рутини и комплекти',en:'Routines & Sets'} }; var NEW_IDS={'39511':1,'39512':1,'39513':1,'39230':1,'44868':1,'44866':1}; var CAT_ROUTES={cleansing:'/pochistvane',acne:'/anti-akne',hydration:'/hidratacia',antiage:'/anti-age',brightening:'/izsvetlyavane',ampoules:'/serumi-ampuli',sun:'/slantsezashtita',sets:'/rutini-komplekti'}; var currentCat=window.__CAT_FILTER__||''; function catLabel(c){var m=CATS[c];return m?m[currentLang]:''} function lvLabel(){return currentLang==='en'?' BGN':' лв.'} function dispName(n){return currentLang==='en'?String(n).replace(/(\d)в(\d)/g,'$1in$2'):n} /* SMART SEARCH */ function _searchText(p){return [p.name,p.desc,p.desc_en,p.top,p.top_en,p.heart,p.heart_en,p.base,p.base_en,p.inspired,p.code,(CATS[p.cat]?CATS[p.cat].bg+' '+CATS[p.cat].en:'')].join(' ').toLowerCase();} function openSearch(){var o=document.getElementById('searchOverlay');o.classList.add('open');document.body.style.overflow='hidden';var i=document.getElementById('searchInput');i.placeholder=currentLang==='en'?'Search by name, ingredient, action…':'Търси по име, съставка, действие…';upTrack('open_search');setTimeout(function(){i.focus()},60);} function closeSearch(){document.getElementById('searchOverlay').classList.remove('open');document.body.style.overflow='';} function searchChip(q){var i=document.getElementById('searchInput');i.value=q;runSearch(q);i.focus();} var _searchHits=[]; function _searchWhy(p,toks){var fields=[currentLang==='en'?(p.heart_en||p.heart):p.heart,currentLang==='en'?(p.top_en||p.top):p.top,currentLang==='en'?(p.desc_en||p.desc):p.desc];for(var f=0;f=0){var start=Math.max(0,idx-12);return esc((start>0?'…':'')+fl.substr(start,52)+'…');}}}return esc(String(currentLang==='en'?(p.top_en||p.top):p.top||'').slice(0,60));} function runSearch(q){q=(q||'').trim().toLowerCase();var hint=document.getElementById('searchHint'),res=document.getElementById('searchResults');if(q.length<2){res.innerHTML='';hint.style.display='flex';_searchHits=[];return;}hint.style.display='none';var toks=q.split(/\s+/).filter(Boolean);var all=window.__PRODUCTS__||[];var scored=[];for(var i=0;i=0)score+=10;else if((p.heart||'').toLowerCase().indexOf(tk)>=0||(p.heart_en||'').toLowerCase().indexOf(tk)>=0)score+=4;else score+=1;}if(p.bestseller)score+=0.5;if(ok)scored.push({p:p,score:score});}scored.sort(function(a,b){return b.score-a.score;});_searchHits=scored.slice(0,8).map(function(x){return x.p;});if(!_searchHits.length){res.innerHTML='
'+(currentLang==='en'?'No results for':'Няма резултати за')+' “'+esc(q)+'”
';return;}res.innerHTML=_searchHits.map(function(p){return '
'+esc(dispName(p.name))+'
'+(p.cat&&CATS[p.cat]?''+esc(CATS[p.cat][currentLang])+' ':'')+_searchWhy(p,toks)+'
'+p.price.toFixed(2)+' €
';}).join('');} function searchGoFirst(){if(_searchHits.length){location.href=langHref('/product/'+_searchHits[0].slug);}} document.addEventListener('keydown',function(e){if(e.key==='Escape')closeSearch();}); // Keep ?lang=en on internal navigation when EN is active (placed BEFORE any #hash). function langHref(path){ if(currentLang!=='en'||!path)return path; if(/^(tel:|mailto:|javascript:|#)/i.test(path))return path; if(/^https?:\/\//i.test(path)&&path.indexOf('profiderm.angelcosmetics.bg')===-1)return path; if(path.indexOf('lang=en')!==-1)return path; var hi=path.indexOf('#'); var hash=hi>=0?path.slice(hi):''; var base=hi>=0?path.slice(0,hi):path; if(!base)return path; return base+(base.indexOf('?')>=0?'&':'?')+'lang=en'+hash; } // Rewrite all internal (root-relative) anchors so navigation keeps the EN language. function rewriteLangLinks(){ if(currentLang!=='en')return; document.querySelectorAll('a[href]').forEach(function(a){ var href=a.getAttribute('href'); if(!href||href.charAt(0)!=='/')return; a.setAttribute('href',langHref(href)); }); } function renderCatChips(){ var el=document.getElementById('catChips'); if(!el)return; var chips=[{k:'',l:(currentLang==='en'?'All':'Всички')}]; for(var k in CATS)chips.push({k:k,l:CATS[k][currentLang]}); el.innerHTML=chips.map(function(c){ var href=langHref(c.k?CAT_ROUTES[c.k]:'/'); return ''+esc(c.l)+''; }).join(''); buildNavDrops(); renderFilterBar(); } /* SMART FILTERS — Цена / Съставка / Тип кожа (dropdowns) */ var pFilter={price:'',ingr:'',skin:'',best:false}; var ING_DEFS=[ ['peptides',{bg:'Пептиди',en:'Peptides'},['пептид','peptide','eyeliss','argireline','matrixyl','матрикс']], ['hyaluron',{bg:'Хиалуронова к-на',en:'Hyaluronic acid'},['хиалурон','hyaluron']], ['collagen',{bg:'Колаген',en:'Collagen'},['колаген','collagen']], ['vitamins',{bg:'Витамини',en:'Vitamins'},['витамин','vitamin']], ['exosomes',{bg:'Екзозоми',en:'Exosomes'},['екзозом','exosome']], ['retinol',{bg:'Ретинол',en:'Retinol'},['ретинол','retinol']], ['niacinamide',{bg:'Ниацинамид',en:'Niacinamide'},['ниацинамид','niacinamide']], ['acids',{bg:'AHA/BHA киселини',en:'AHA/BHA acids'},['aha','bha','глико','салицил','ексфол','exfol']], ['allantoin',{bg:'Алантоин',en:'Allantoin'},['алантоин','allantoin']], ['aloe',{bg:'Алое',en:'Aloe'},['алое','aloe']] ]; var SKIN_DEFS=[ ['dry',{bg:'Суха',en:'Dry'},['суха','дехидр','dry']], ['oily',{bg:'Мазна / комбинирана',en:'Oily / combination'},['мазна','комбинир','себум','oily','combinat','матира']], ['sensitive',{bg:'Чувствителна',en:'Sensitive'},['чувствителна','sensitive','успокоя','раздразн','calm']], ['mature',{bg:'Зряла',en:'Mature'},['зряла','бръчк','лифтинг','стареене','анти-ейдж','mature','anti-ag','wrinkle']], ['acne',{bg:'Проблемна (акне)',en:'Problematic (acne)'},['акне','acne','несъвършен','пъпк','blemish']] ]; var CAT_SKIN={acne:['acne'],antiage:['mature'],hydration:['dry'],sun:['all'],brightening:['all'],cleansing:['all'],ampoules:[]}; function _ptext(p){return ((p.heart||'')+' '+(p.top||'')+' '+(p.name||'')+' '+(p.desc||'')+' '+(p.cat||'')).toLowerCase();} function _prodIngr(p){var t=_ptext(p),r=[];ING_DEFS.forEach(function(d){if(d[2].some(function(k){return t.indexOf(k)>=0}))r.push(d[0]);});return r;} function _prodSkin(p){var t=_ptext(p),r=[];SKIN_DEFS.forEach(function(d){if(d[2].some(function(k){return t.indexOf(k)>=0}))r.push(d[0]);});(CAT_SKIN[p.cat]||[]).forEach(function(s){if(r.indexOf(s)<0)r.push(s);});if(!r.length)r.push('all');return r;} function _priceOk(price){if(pFilter.price==='lt25')return price<25;if(pFilter.price==='25-50')return price>=25&&price<=50;if(pFilter.price==='gt50')return price>50;return true;} function _sortArr(a){a=a.slice();if(pFilter.price==='asc')a.sort(function(x,y){return x.price-y.price});else if(pFilter.price==='desc')a.sort(function(x,y){return y.price-x.price});return a;} function _ingrOk(p){return !pFilter.ingr||_prodIngr(p).indexOf(pFilter.ingr)>=0;} function _skinOk(p){if(!pFilter.skin)return true;var s=_prodSkin(p);return s.indexOf(pFilter.skin)>=0||s.indexOf('all')>=0;} function applyProductFilters(arr){return _sortArr(arr.filter(function(p){return _priceOk(p.price)&&_ingrOk(p)&&_skinOk(p)&&(!pFilter.best||p.bestseller);}));} function applyBundleFilters(arr){if(pFilter.best||pFilter.ingr||pFilter.skin)return[];return _sortArr(arr.filter(function(b){return _priceOk(b.price);}));} function renderFilterBar(){ var el=document.getElementById('filterBar');if(!el)return; if(window.__PRODUCT_PAGE__){el.innerHTML='';return;} var en=currentLang==='en'; var all=window.__PRODUCTS__||[]; var base=currentCat?(currentCat==='bestseller'?all.filter(function(p){return p.bestseller}):all.filter(function(p){return p.cat===currentCat})):all; var ingrPresent={},skinPresent={}; base.forEach(function(p){_prodIngr(p).forEach(function(k){ingrPresent[k]=1});_prodSkin(p).forEach(function(k){if(k!=='all')skinPresent[k]=1});}); var prices=[['',en?'Default':'По подразбиране'],['asc',en?'Cheapest first':'Най-евтини'],['desc',en?'Priciest first':'Най-скъпи'],['lt25','< 25 €'],['25-50','25–50 €'],['gt50','> 50 €']]; var ingrOpts=[['',en?'All ingredients':'Всички съставки']].concat(ING_DEFS.filter(function(d){return ingrPresent[d[0]]}).map(function(d){return [d[0],d[1][en?'en':'bg']]})); var skinOpts=[['',en?'All skin types':'Всеки тип кожа']].concat(SKIN_DEFS.filter(function(d){return skinPresent[d[0]]}).map(function(d){return [d[0],d[1][en?'en':'bg']]})); function sel(opts,cur,fn){return '';} el.innerHTML= '
'+(en?'Price':'Цена')+''+sel(prices,pFilter.price,'setFilterPrice')+'
'+ '
'+(en?'Ingredient':'Съставка')+''+sel(ingrOpts,pFilter.ingr,'setFilterIngr')+'
'+ '
'+(en?'Skin type':'Тип кожа')+''+sel(skinOpts,pFilter.skin,'setFilterSkin')+'
'+ (currentCat==='bestseller'?'':'')+ ''; } function setFilterPrice(v){pFilter.price=v;upTrack('filter_price_'+(v||'all'));renderProducts();} function setFilterIngr(v){pFilter.ingr=v;upTrack('filter_ingr_'+(v||'all'));renderProducts();} function setFilterSkin(v){pFilter.skin=v;upTrack('filter_skin_'+(v||'all'));renderProducts();} function toggleFilterBest(){pFilter.best=!pFilter.best;upTrack('filter_best');renderFilterBar();renderProducts();} /* SKIN QUIZ — „Кой продукт е подходящ за мен?" */ var QUIZ_Q=[ {key:'skin',qn:{bg:'Стъпка 1 от 3',en:'Step 1 of 3'},qt:{bg:'Какъв е вашият тип кожа?',en:'What is your skin type?'},opts:[ {v:'dry',em:'💧',l:{bg:'Суха / дехидратирана',en:'Dry / dehydrated'}}, {v:'oily',em:'✨',l:{bg:'Мазна / комбинирана',en:'Oily / combination'}}, {v:'sensitive',em:'🌿',l:{bg:'Чувствителна',en:'Sensitive'}}, {v:'mature',em:'⏳',l:{bg:'Зряла',en:'Mature'}}, {v:'acne',em:'🔴',l:{bg:'Проблемна (акне)',en:'Problematic (acne)'}}, {v:'',em:'🤔',l:{bg:'Не съм сигурен/а',en:'Not sure'}} ]}, {key:'cat',qn:{bg:'Стъпка 2 от 3',en:'Step 2 of 3'},qt:{bg:'Каква е основната ви грижа?',en:'What is your main concern?'},opts:[ {v:'cleansing',em:'🧼',l:{bg:'Дълбоко почистване',en:'Deep cleansing'}}, {v:'acne',em:'🎯',l:{bg:'Акне и несъвършенства',en:'Acne & blemishes'}}, {v:'hydration',em:'💦',l:{bg:'Хидратация',en:'Hydration'}}, {v:'antiage',em:'🪄',l:{bg:'Анти-ейдж и стягане',en:'Anti-age & firming'}}, {v:'brightening',em:'🌟',l:{bg:'Изсветляване / петна',en:'Brightening / spots'}}, {v:'sun',em:'🌞',l:{bg:'Слънцезащита',en:'Sun protection'}}, {v:'ampoules',em:'💉',l:{bg:'Интензивни серуми',en:'Intensive serums'}}, {v:'',em:'✨',l:{bg:'Обща грижа',en:'General care'}} ]}, {key:'ingr',qn:{bg:'Стъпка 3 от 3',en:'Step 3 of 3'},qt:{bg:'Предпочитана активна съставка?',en:'Preferred active ingredient?'},opts:[ {v:'hyaluron',em:'💧',l:{bg:'Хиалуронова киселина',en:'Hyaluronic acid'}}, {v:'peptides',em:'🧬',l:{bg:'Пептиди',en:'Peptides'}}, {v:'retinol',em:'🌙',l:{bg:'Ретинол',en:'Retinol'}}, {v:'vitamins',em:'🍊',l:{bg:'Витамини',en:'Vitamins'}}, {v:'collagen',em:'🪢',l:{bg:'Колаген',en:'Collagen'}}, {v:'',em:'🤷',l:{bg:'Нямам предпочитание',en:'No preference'}} ]} ]; var quizState={open:false,step:0,ans:{},done:false}; function _quizCount(cat,skin,ingr){ var arr=(window.__PRODUCTS__||[]); if(cat)arr=arr.filter(function(p){return p.cat===cat}); return arr.filter(function(p){ var sk=_prodSkin(p); return (!skin||sk.indexOf(skin)>=0||sk.indexOf('all')>=0)&&(!ingr||_prodIngr(p).indexOf(ingr)>=0); }).length; } function toggleQuiz(){quizState.open=!quizState.open;if(quizState.open)upTrack('quiz_open');renderQuiz();} function quizAnswer(val){ var q=QUIZ_Q[quizState.step]; quizState.ans[q.key]=val; upTrack('quiz_'+q.key+'_'+(val||'any')); if(quizState.step0){quizState.step--;quizState.done=false;renderQuiz();}} function quizRestart(){quizState.step=0;quizState.ans={};quizState.done=false;upTrack('quiz_restart');renderQuiz();} function quizApply(){ var a=quizState.ans,cat=a.cat||'',skin=a.skin||'',ingr=a.ingr||''; // Relax progressively so the result is never empty. if(_quizCount(cat,skin,ingr)===0&&ingr)ingr=''; if(_quizCount(cat,skin,ingr)===0&&skin)skin=''; if(_quizCount(cat,skin,ingr)===0&&cat)cat=''; currentCat=cat;pFilter.skin=skin;pFilter.ingr=ingr;pFilter.price='';pFilter.best=false; quizState.done=true; upTrack('quiz_done'); renderCatChips(); renderProducts(); renderQuiz(); var t=document.getElementById('collection');if(t)t.scrollIntoView({behavior:'smooth'}); } function renderQuiz(){ var box=document.getElementById('skinQuiz'); if(!box)return; if(window.__PRODUCT_PAGE__){box.innerHTML='';box.className='';return;} var en=currentLang==='en'; var ico='?'; var chev=''; var head='
'+ico+'

'+(en?'Which product is right for me?':'Кой продукт е подходящ за мен?')+'

'+(en?'Answer 3 quick questions and we\'ll pick the care for your skin.':'Отговорете на 3 кратки въпроса и ще подберем грижата за вашата кожа.')+'

'+chev+'
'; var body=''; if(quizState.open){ if(quizState.done){ var cnt=_quizCount(currentCat,pFilter.skin,pFilter.ingr); body='
✅
'+ '
'+(en?'Here are your matches':'Ето подбраните за вас продукти')+'
'+ '

'+cnt+' '+(en?(cnt===1?'product selected below for your skin.':'products selected below for your skin.'):(cnt===1?'продукт е подбран по-долу за вашата кожа.':'продукта са подбрани по-долу за вашата кожа.'))+'

'+ '
'; } else { var q=QUIZ_Q[quizState.step]; var dots='';for(var i=0;i'; var opts=q.opts.map(function(o){return '';}).join(''); body='
'+dots+'
'+ '
'+esc(q.qn[en?'en':'bg'])+'
'+esc(q.qt[en?'en':'bg'])+'
'+opts+'
'+ (quizState.step>0?'':'')+'
'; } } box.className='skin-quiz'+(quizState.open?' open':''); box.innerHTML=head+'
'+body+'
'; } function setCat(k,scroll){ currentCat=k||''; renderCatChips(); renderProducts(); upTrack('filter_'+(k||'all')); if(scroll!==false){var t=document.getElementById('collection');if(t)t.scrollIntoView({behavior:'smooth'})} } function dropItemHtml(p){ return ''; } function buildNavDrops(){ var all=window.__PRODUCTS__||[]; if(!all.length)return; var viewAll=currentLang==='en'?'View all':'Виж всички'; document.querySelectorAll('.nav-item[data-cat]').forEach(function(item){ var k=item.getAttribute('data-cat'); var ps=all.filter(function(p){return p.cat===k}); var drop=item.querySelector('.nav-drop'); if(!drop||!ps.length)return; drop.innerHTML=''+ ps.map(dropItemHtml).join('')+ ''+viewAll+' →'; }); document.querySelectorAll('.mob-cat[data-cat]').forEach(function(item){ var k=item.getAttribute('data-cat'); var ps=all.filter(function(p){return p.cat===k}); var sub=item.querySelector('.mob-sub'); if(!sub||!ps.length)return; sub.innerHTML=ps.map(dropItemHtml).join(''); }); } function toggleMobCat(btn){ var cat=btn.closest('.mob-cat'); var wasOpen=cat.classList.contains('open'); document.querySelectorAll('.mob-cat.open').forEach(function(c){c.classList.remove('open')}); if(!wasOpen)cat.classList.add('open'); } function goToProduct(cat,id){ upTrack('drop_product_'+id); // Продукт със своя страница се отваря на нея, не се превърта до картата му. var pp=(window.__PRODUCTS__||[]).filter(function(x){return String(x.id)===String(id)})[0]; if(pp&&pp.slug){location.href=langHref('/product/'+pp.slug);return} var route=CAT_ROUTES[cat]; if(route&&location.pathname!==route){location.href=langHref(route+'#product-'+id);return} closeMobileMenu(); setCat(cat,false); scrollFlashProduct(id); } function scrollFlashProduct(id){ requestAnimationFrame(function(){ setTimeout(function(){ var card=document.querySelector('.product[data-id="'+id+'"]'); if(!card){var t=document.getElementById('collection');if(t)t.scrollIntoView({behavior:'smooth'});return} card.scrollIntoView({behavior:'smooth',block:'center'}); card.classList.add('flash'); setTimeout(function(){card.classList.remove('flash')},2200); },120); }); } function navCat(k,ev){ if(ev)upTrack(ev); var grid=document.getElementById('productsGrid'); if(!grid||!window.__PRODUCTS__||!window.__PRODUCTS__.length)return true; setCat(k); return false; } function renderBundleCard(b){ var setLbl=currentLang==='en'?'SET':'КОМПЛЕКТ'; var totalLbl=currentLang==='en'?'Set price':'Обща цена'; var addLbl=currentLang==='en'?'Add the set to cart':'Добави комплекта в количката'; var viewLbl=currentLang==='en'?'View the set →':'Виж комплекта →'; var href=langHref('/komplekt/'+b.slug); var items=b.items.map(function(it){ return '
'+esc(dispName(it.name))+''+esc(dispName(it.name))+'
'+esc(it.ml||'')+'
'+it.price.toFixed(2)+' €
'; }).join('
+
'); return ''; } function addBundleToCart(bid){ var b=(window.__BUNDLES__||[]).find(function(x){return x.id===bid}); if(!b)return; b.items.forEach(function(it){ var existing=cart.find(function(x){return x.id===it.id}); if(existing){existing.qty++} else{cart.push({id:it.id,name:it.name,code:it.code,image:it.image,price:it.price,qty:1})} }); updateCartUI(); if(typeof gtag==='function')gtag('event','add_to_cart',{currency:'EUR',value:b.price,items:b.items.map(function(it){return{item_id:it.code,item_name:it.name,price:it.price,quantity:1}})}); if(typeof fbq==='function')fbq('track','AddToCart',{content_name:b.name,content_ids:b.items.map(function(it){return it.code}),content_type:'product',value:b.price,currency:'EUR'}); upTrack('add_bundle_'+bid); var btn=document.querySelector('[data-bundle="'+bid+'"] .btn-add'); if(btn){var orig=btn.textContent;btn.textContent=(currentLang==='en'?'Added':'Добавено')+' ✓';btn.classList.add('added');setTimeout(function(){btn.textContent=orig;btn.classList.remove('added')},1200)} acProductAdded(); } var HOME_PAGE_SIZE=12; var homeVisible=HOME_PAGE_SIZE; function loadMoreProducts(){ homeVisible+=HOME_PAGE_SIZE; upTrack('load_more'); renderProducts(); } function renderProducts(){ var g=document.getElementById('productsGrid'); if(!g)return; var all=window.__PRODUCTS__||[]; var products=currentCat?(currentCat==='bestseller'?all.filter(function(p){return p.bestseller}):all.filter(function(p){return p.cat===currentCat})):all; if(currentCat==='sets'||window.__PRODUCT_PAGE__)products=[]; var bundles=currentCat==='sets'?(window.__BUNDLES__||[]):(currentCat?(window.__BUNDLES__||[]).filter(function(b){return b.cat===currentCat}):[]); if(!products.length&&!bundles.length&&!pFilter.price&&!pFilter.ingr&&!pFilter.skin&&!pFilter.best){g.innerHTML='

'+((i18n['loading']&&i18n['loading'][currentLang])||(currentLang==='en'?'Loading...':'Зареждане...'))+'

';return} // smart filters (sort + price + bestseller) applied to products AND bundles products=applyProductFilters(products); if(!pFilter.price){products=products.slice().sort(function(a,b){return (a.bestRank||999)-(b.bestRank||999);});} // най-продаваните първи (по реален ранг), после останалите bundles=applyBundleFilters(bundles); var matchCount=products.length+bundles.length; var fc=document.getElementById('fbCount');if(fc)fc.textContent=matchCount+' '+(currentLang==='en'?(matchCount===1?'result':'results'):(matchCount===1?'продукт':'продукта')); if(!matchCount){g.innerHTML='

'+(currentLang==='en'?'No products match these filters.':'Няма продукти по тези филтри.')+'

';var lmx=document.getElementById('loadMoreWrap');if(lmx)lmx.innerHTML='';return} var isHome=!currentCat&&location.pathname==='/'; var total=products.length; if(isHome)products=products.slice(0,homeVisible); var lm=document.getElementById('loadMoreWrap'); if(lm){ if(isHome&&total>products.length){ var rest=total-products.length; var lbl=currentLang==='en'?('Show more products ('+rest+' more)'):('Разгърни още продукти (още '+rest+')'); lm.innerHTML=''; }else{ lm.innerHTML=''; } } g.innerHTML=bundles.map(renderBundleCard).join('')+products.map(function(p,pi){ var images=p.images&&p.images.length?p.images:[p.image]; var slides=images.map(function(src,i){ return ''; }).join(''); var galPhoto=currentLang==='en'?'Image':'Снимка'; var galPrev=currentLang==='en'?'Previous':'Предишна'; var galNext=currentLang==='en'?'Next':'Следваща'; var dots=images.length>1?'':''; var navs=images.length>1? ''+ '':''; var actionLabel=currentLang==='en'?'Action':'Действие'; var ingrLabel=currentLang==='en'?'Key Ingredients':'Активни съставки'; var useLabel=currentLang==='en'?'How to Use':'Приложение'; var r=productRating(p.id); return '
'+ ''+ '
'+ '
'+ '
'+ '

'+(p.slug?''+esc(dispName(p.name))+'':esc(dispName(p.name)))+'

'+ '
'+esc(p.ml)+' · '+(currentLang==='en'?'Code: ':'Код: ')+esc(p.code)+'
'+ '
'+(r?''+renderStars(r.r)+''+r.r.toFixed(1)+'('+r.c+' '+(currentLang==='en'?(r.c===1?'review':'reviews'):(r.c===1?'отзив':'отзива'))+')':''+renderStars(0)+'(0 '+(currentLang==='en'?'reviews':'отзива')+')')+''+(currentLang==='en'?'In Stock':'Наличен')+'
'+ '
'+ '
'+p.price.toFixed(2)+'€
'+ '
'+ '

'+esc(currentLang==='en'?(p.desc_en||p.desc):p.desc)+'

'+ '
'+ '
'+actionLabel+'
'+esc(currentLang==='en'?(p.top_en||p.top):p.top)+'
'+ '
'+ingrLabel+'
'+esc(currentLang==='en'?(p.heart_en||p.heart):p.heart)+'
'+ '
'+useLabel+'
'+esc(currentLang==='en'?(p.base_en||p.base):p.base)+'
'+ '
'+ (p.slug?'✍ '+(currentLang==='en'?'Leave a review':'Остави отзив')+'':'')+ (p.slug?''+(currentLang==='en'?'View Product':'Виж продукта')+' →':'')+ ''+ 'TBI Bank'+((i18n['tbi-badge']&&i18n['tbi-badge'][currentLang])||'')+''+ (p.srcUrl?''+(i18n['src-link'][currentLang])+' ↗':'')+ ' '+(i18n['cs-notify'][currentLang])+''+ '
'+ '
'; }).join(''); observeEls(); observeReveal(); } function navSlide(id,dir){ upTrack('gallery_slide'); var card=document.querySelector('.product[data-id="'+id+'"]'); if(!card)return; var slides=card.querySelectorAll('.gallery-slide'); var dots=card.querySelectorAll('.gallery-dot'); var cur=0; slides.forEach(function(s,i){if(s.classList.contains('active'))cur=i}); var next=(cur+dir+slides.length)%slides.length; slides[cur].classList.remove('active');slides[next].classList.add('active'); if(dots.length){dots[cur]&&dots[cur].classList.remove('active');dots[next]&&dots[next].classList.add('active')} } function gotoSlide(id,idx){ var card=document.querySelector('.product[data-id="'+id+'"]'); if(!card)return; card.querySelectorAll('.gallery-slide').forEach(function(s,i){s.classList.toggle('active',i===idx)}); card.querySelectorAll('.gallery-dot').forEach(function(d,i){d.classList.toggle('active',i===idx)}); } function toggleFaq(el){el.parentElement.classList.toggle('open')} function toggleMobileMenu(){document.getElementById('mobileMenu').classList.toggle('open');document.getElementById('hamburger').classList.toggle('open');document.body.style.overflow=document.getElementById('mobileMenu').classList.contains('open')?'hidden':''} function closeMobileMenu(){document.getElementById('mobileMenu').classList.remove('open');document.getElementById('hamburger').classList.remove('open');document.body.style.overflow=''} function scrollToCollection(){upTrack('scroll_collection');var t=document.getElementById('collection');if(t)t.scrollIntoView({behavior:'smooth'})} function scrollToProduct(id){var el=document.querySelector('.product[data-id="'+id+'"]');if(el)el.scrollIntoView({behavior:'smooth',block:'center'})} function observeReveal(){ if(!('IntersectionObserver' in window)){document.querySelectorAll('.reveal').forEach(function(e){e.classList.add('visible')});return} var obs=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting){e.target.classList.add('visible');obs.unobserve(e.target)}})},{threshold:0.08}); document.querySelectorAll('.reveal').forEach(function(e){obs.observe(e)}); } function addToCart(id){ var p=window.__PRODUCTS__.find(function(x){return x.id===id}); if(!p)return; var existing=cart.find(function(x){return x.id===id}); if(existing){existing.qty++} else{cart.push({id:p.id,name:p.name,code:p.code,image:p.image,price:p.price,qty:1})} updateCartUI(); if(typeof gtag==='function')gtag('event','add_to_cart',{currency:'EUR',value:p.price,items:[{item_id:p.code,item_name:p.name,price:p.price,quantity:1}]}); if(typeof fbq==='function')fbq('track','AddToCart',{content_name:p.name,content_ids:[p.code],content_type:'product',value:p.price,currency:'EUR'}); upTrack('add_to_cart'); var btn=document.querySelector('.product[data-id="'+id+'"] .btn-add'); if(btn){btn.textContent=i18n['cart-added'][currentLang]+' ✓';btn.classList.add('added');setTimeout(function(){btn.textContent=i18n['btn-add'][currentLang];btn.classList.remove('added')},1200)} acProductAdded(); } function addToCartStatic(id,name,code,price,img){ var existing=cart.find(function(x){return x.id===id}); if(existing){existing.qty++}else{cart.push({id:id,name:name,code:code,image:img||'',price:price,qty:1})} updateCartUI(); if(typeof gtag==='function')gtag('event','add_to_cart',{currency:'EUR',value:price,items:[{item_id:code,item_name:name,price:price,quantity:1}]}); if(typeof fbq==='function')fbq('track','AddToCart',{content_name:name,content_ids:[code],content_type:'product',value:price,currency:'EUR'}); upTrack('add_to_cart'); var btn=document.querySelector('.product[data-id="'+id+'"] .btn-add'); if(btn){btn.textContent=i18n['cart-added'][currentLang]+' ✓';btn.classList.add('added');setTimeout(function(){btn.textContent=i18n['btn-add'][currentLang];btn.classList.remove('added')},1200)} acProductAdded(); } function removeFromCart(id){cart=cart.filter(function(x){return x.id!==id});updateCartUI()} function changeQty(id,d){var item=cart.find(function(x){return x.id===id});if(!item)return;item.qty=Math.max(1,item.qty+d);updateCartUI()} function updateCartUI(){ var count=cart.reduce(function(s,x){return s+x.qty},0); var badge=document.getElementById('cartBadge'); badge.style.display=count>0?'flex':'none'; badge.textContent=count; badge.classList.remove('pop');void badge.offsetWidth;badge.classList.add('pop'); var itemsEl=document.getElementById('cartItems'); var footerEl=document.getElementById('cartFooter'); if(!cart.length){ itemsEl.innerHTML='
'+i18n['cart-empty'][currentLang]+'
'; footerEl.style.display='none';saveCartToServer();return; } footerEl.style.display='block'; itemsEl.innerHTML=cart.map(function(it){ return '
'+ ''+esc(dispName(it.name))+''+ '
'+ '

'+esc(dispName(it.name))+'

'+ '
'+it.price.toFixed(2)+' €
'+ '
'+ ''+ ''+it.qty+''+ ''+ '
'+ '
'+ ''+ '
'; }).join(''); var total=cart.reduce(function(s,x){return s+x.price*x.qty},0); var disc=getDiscount(count); var discAmount=total*disc.rate; var finalTotal=total-discAmount; var del=getDelivery(finalTotal); var grandTotal=finalTotal+del.fee; var h=''; if(disc.rate>0){ h='
'+i18n['cart-subtotal'][currentLang]+''+total.toFixed(2)+' €
'+ '
'+i18n['cart-discount'][currentLang]+' '+disc.label+' ('+disc.name+')-'+discAmount.toFixed(2)+' €
'; } if(del.type&&del.fee>0){ h+='
'+i18n['cart-delivery-lbl'][currentLang]+': '+del.label+''+del.fee.toFixed(2)+' €
'; }else if(del.type&&del.free){ h+='
'+i18n['cart-delivery-lbl'][currentLang]+': '+del.label+'0.00 €
'; } h+='
'+i18n['cart-grand'][currentLang]+''+grandTotal.toFixed(2)+' €
'; document.getElementById('cartFooter').querySelector('.cart-total').innerHTML=h; saveCartToServer(); } function saveCartToServer(){ try{localStorage.setItem('profiderm_cart',JSON.stringify(cart))}catch(e){} try{fetch('/cart/save',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({items:cart.map(function(x){return{name:x.name,code:x.code,qty:x.qty,price:x.price}})})}).catch(function(){})}catch(e){} } function toggleCart(forceOpen){ var panel=document.getElementById('cartPanel'); var overlay=document.getElementById('cartOverlay'); var isOpen=panel.classList.contains('open'); if(forceOpen===true&&isOpen)return; if(forceOpen===true||!isOpen){panel.classList.add('open');overlay.classList.add('open');upTrack('open_cart')} else{panel.classList.remove('open');overlay.classList.remove('open')} } var tsWidgetId=null; function renderTurnstile(){ var key=window.__TURNSTILE_SITE_KEY__; if(!key||typeof turnstile==='undefined')return; var host=document.getElementById('coTurnstile'); if(!host)return; if(tsWidgetId!==null){try{turnstile.reset(tsWidgetId)}catch(e){}return} try{tsWidgetId=turnstile.render('#coTurnstile',{sitekey:key,theme:'light',size:'normal'})}catch(e){} } // The basket finished in angelcosmetics.bg (the owner, 03.11.2026 — „За Profiderm може ли да направим същото“, as Upgrade). // SHOP_CHECKOUT: "on" — every customer; "test" — only this browser after ?shopco=1 (?shopco=0 — off again); anything else — // the order form here, as before. The shop reads its own prices; a line without a number keeps the form here. var SHOP_CO=(function(){var m=window.__SHOP_CO__||'',q=/[?&]shopco=([01])/.exec(location.search); try{if(q){q[1]==='1'?localStorage.setItem('ac_shopco','1'):localStorage.removeItem('ac_shopco')}}catch(e){} if(m==='on')return true;if(m!=='test')return false;try{return localStorage.getItem('ac_shopco')==='1'}catch(e){return false}})(); if(SHOP_CO)document.documentElement.classList.add('shop-co'); function shopCheckoutUrl(){ var ids=cart.map(function(x){return /^\d+$/.test(String(x.id))?x.id+':'+x.qty:''}); if(!ids.length||ids.indexOf('')>=0)return ''; return 'https://angelcosmetics.bg/cart?from=profiderm&items='+encodeURIComponent(ids.join(','))+'&utm_source=profiderm&utm_medium=landing&utm_campaign=cart'+shopClickIds(); } // The ad's click (Google / Meta / TikTok) goes along, so the order in angelcosmetics.bg is still that ad's. var CLICK_IDS=['gclid','gbraid','wbraid','fbclid','ttclid','msclkid']; (function(){try{var q=new URLSearchParams(location.search),o=JSON.parse(sessionStorage.getItem('ac_clk')||'{}'),any=false; CLICK_IDS.forEach(function(k){var v=q.get(k);if(v){o[k]=v.slice(0,200);any=true}});if(any)sessionStorage.setItem('ac_clk',JSON.stringify(o))}catch(e){}})(); function shopClickIds(){var o={};try{o=JSON.parse(sessionStorage.getItem('ac_clk')||'{}')}catch(e){} return CLICK_IDS.filter(function(k){return o[k]}).map(function(k){return '&'+k+'='+encodeURIComponent(o[k])}).join('');} function openCheckout(){ if(!cart.length)return; if(SHOP_CO){var u=shopCheckoutUrl();if(u){location.href=u;return}} var sel=document.getElementById('deliverySelect'); var count=cart.reduce(function(s,x){return s+x.qty},0); var total=cart.reduce(function(s,x){return s+x.price*x.qty},0); var disc=getDiscount(count); var finalTotal=total-total*disc.rate; if(!sel||!sel.value){alert(i18n['alert-delivery'][currentLang]);return} toggleCart(); var del=getDelivery(finalTotal); var grandTotal=finalTotal+del.fee; var el=document.getElementById('checkoutItems'); var html=cart.map(function(it){return '
'+esc(dispName(it.name))+' x'+it.qty+''+(it.price*it.qty).toFixed(2)+' €
';}).join(''); if(disc.rate>0){html+='
'+i18n['cart-discount'][currentLang]+' '+disc.label+'-'+(total*disc.rate).toFixed(2)+' €
';} if(del.fee>0){html+='
'+i18n['cart-delivery-lbl'][currentLang]+': '+del.label+''+del.fee.toFixed(2)+' €
';} else if(del.free){html+='
'+i18n['cart-delivery-lbl'][currentLang]+': '+del.label+'0.00 €
';} html+='
'+i18n['cart-grand'][currentLang]+''+grandTotal.toFixed(2)+' €
'; el.innerHTML=html; document.getElementById('checkoutOverlay').classList.add('open'); document.getElementById('coName').value=''; document.getElementById('coPhone').value=''; var ce=document.getElementById('coEmail');if(ce)ce.value='';if(USER){document.getElementById('coName').value=USER.name||'';document.getElementById('coPhone').value=USER.phone||'';if(ce)ce.value=USER.email||'';var _ca=document.getElementById('coAddress');if(_ca&&USER.address)_ca.value=USER.address;} renderTurnstile();coSyncDelivery(); if(typeof gtag==='function'){var citems=cart.map(function(x){return{item_id:x.code,item_name:x.name,price:x.price,quantity:x.qty}});gtag('event','begin_checkout',{currency:'EUR',value:grandTotal,items:citems})} if(typeof fbq==='function')fbq('track','InitiateCheckout',{content_ids:cart.map(function(x){return x.code}),content_type:'product',num_items:cart.reduce(function(s,x){return s+x.qty},0),value:grandTotal,currency:'EUR'}); upTrack('open_checkout'); } function closeCheckout(){ document.getElementById('checkoutOverlay').classList.remove('open'); if(tsWidgetId!==null&&typeof turnstile!=='undefined'){try{turnstile.reset(tsWidgetId)}catch(e){}} } var BG_TR_JS={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"y","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"ts","ч":"ch","ш":"sh","щ":"sht","ъ":"a","ь":"y","ю":"yu","я":"ya"}; function bgNormJs(s){return String(s||'').toLowerCase().trim().split('').map(function(ch){return BG_TR_JS[ch]!==undefined?BG_TR_JS[ch]:ch}).join('')} var CO_OFF={courier:'',cityId:0,cityName:'',id:'',name:'',address:''}; var _coCityT=null; function coCourier(){var s=document.getElementById('deliverySelect');var v=s?s.value:'';return v==='office'?'speedy':(v==='office_econt'?'econt':'')} function coOfficeReset(){CO_OFF={courier:'',cityId:0,cityName:'',id:'',name:'',address:''};CO_OFFICES=[];var inp=document.getElementById('coOffice');if(inp){inp.value='';inp.disabled=true;inp.placeholder=(currentLang==='en'?'Choose a town first':'Първо изберете град')}var n=document.getElementById('coOfficeNote');if(n)n.textContent='';[['coCityList'],['coOfficeList']].forEach(function(p){var l=document.getElementById(p[0]);if(l){l.hidden=true;l.innerHTML=''}})} var CO_READY={}; /* If a courier's office list was never synced — no credentials, or a first deploy — the picker would offer nothing and no order could be placed. In that case the checkout falls back to the address box it has always had. */ function coCourierReady(c,cb){ if(CO_READY[c]!==undefined){cb(CO_READY[c]);return} fetch('/api/'+c+'/status',{credentials:'same-origin'}).then(function(r){return r.json()}).then(function(d){ CO_READY[c]=!!(d&&d.ok&&d.ready);cb(CO_READY[c]); }).catch(function(){CO_READY[c]=false;cb(false)}); } /* Warm the check when the customer picks a delivery option, so the office fields are already decided by the time the checkout opens and the address box does not flash into view first. */ try{var _coDs=document.getElementById('deliverySelect');if(_coDs)_coDs.addEventListener('change',function(){var c=coCourier();if(c)coCourierReady(c,function(){})})}catch(e){} function coAddressMode(){ var wrap=document.getElementById('coOfficeWrap'),addr=document.getElementById('coAddress');if(!wrap||!addr)return; wrap.hidden=true;addr.hidden=false;addr.setAttribute('required','required');coOfficeReset();CO_OFF.courier=''; // До врата: градът се избира от списъка, в текстовото поле остава улицата. var aw=document.getElementById('coAddrWrap');if(aw)aw.hidden=false; addr.setAttribute('placeholder', currentLang==='en' ? 'Street, number, block, entrance *' : 'Улица, номер, блок, вход *'); } function coSyncDelivery(){ var wrap=document.getElementById('coOfficeWrap'),addr=document.getElementById('coAddress');if(!wrap||!addr)return; var c=coCourier(); if(!c){coAddressMode();return} coCourierReady(c,function(ready){ if(!ready||coCourier()!==c){coAddressMode();return} wrap.hidden=false;addr.hidden=true;addr.removeAttribute('required'); var aw=document.getElementById('coAddrWrap');if(aw)aw.hidden=true; CO_ADDR.cityId=0;CO_ADDR.cityName='';CO_ADDR.zip='';var ac=document.getElementById('coAddrCity');if(ac)ac.value=''; if(CO_OFF.courier!==c){coOfficeReset();CO_OFF.courier=c;var ci=document.getElementById('coCity');if(ci)ci.value=''} var ci2=document.getElementById('coCity');if(ci2)ci2.placeholder=(currentLang==='en'?'Town *':'Град *')+' — '+(c==='speedy'?'Speedy':'Еконт'); }); } // Градът при доставка до врата. Държи се отделно от офиса: показват се в // различни режими и не бива да се застъпват. Списъкът е на Спиди, защото // до адрес се доставя само с тях. var CO_ADDR = { cityId: 0, cityName: '', zip: '' }; var _coAddrT = null; function coAddrCityInput(){ var el=document.getElementById('coAddrCity'),list=document.getElementById('coAddrCityList');if(!el||!list)return; CO_ADDR.cityId=0;CO_ADDR.cityName='';CO_ADDR.zip=''; var q=el.value.trim(); if(_coAddrT)clearTimeout(_coAddrT); if(q.length<2){list.hidden=true;list.innerHTML='';return} _coAddrT=setTimeout(function(){ fetch('/api/speedy/site-search?q='+encodeURIComponent(q),{credentials:'same-origin'}).then(function(r){return r.json()}).then(function(d){ var rows=d.sites||[]; if(!rows.length){list.innerHTML='
'+(currentLang==='en'?'No town found':'Няма такъв град')+'
';list.hidden=false;return} list.innerHTML=rows.map(function(x){return ''}).join(''); list.hidden=false; }).catch(function(){list.hidden=true}); },250); } function coPickAddrCity(id,name,zip){ CO_ADDR.cityId=id;CO_ADDR.cityName=name;CO_ADDR.zip=zip||''; var el=document.getElementById('coAddrCity');if(el){el.value=name;el.blur()} var list=document.getElementById('coAddrCityList');if(list){list.hidden=true;list.innerHTML=''} var a=document.getElementById('coAddress');if(a&&!a.value.trim())a.focus(); } /** Какъв е избраният начин на доставка, независимо какво е успяло да се зареди. */ function coDeliveryMode(){ var s=document.getElementById('deliverySelect');var v=s?s.value:''; return (v==='office'||v==='office_econt')?'office':(v?'address':''); } function coCityInput(){ var el=document.getElementById('coCity'),list=document.getElementById('coCityList');if(!el||!list)return; CO_OFF.cityId=0;CO_OFF.id='';CO_OFFICES=[];var inp0=document.getElementById('coOffice');if(inp0){inp0.value='';inp0.disabled=true;inp0.placeholder=(currentLang==='en'?'Choose a town first':'Първо изберете град')}var ol=document.getElementById('coOfficeList');if(ol){ol.hidden=true;ol.innerHTML=''} var n=document.getElementById('coOfficeNote');if(n)n.textContent=''; var q=el.value.trim(); if(_coCityT)clearTimeout(_coCityT); if(q.length<2){list.hidden=true;list.innerHTML='';return} _coCityT=setTimeout(function(){ var c=coCourier();if(!c)return; var url=c==='speedy'?('/api/speedy/sites?q='+encodeURIComponent(q)):('/api/econt/cities?q='+encodeURIComponent(q)); fetch(url,{credentials:'same-origin'}).then(function(r){return r.json()}).then(function(d){ var rows=(c==='speedy'?d.sites:d.cities)||[]; if(!rows.length){list.innerHTML='
'+(currentLang==='en'?'No town found':'Няма такъв град')+'
';list.hidden=false;return} list.innerHTML=rows.map(function(s){return ''}).join(''); list.hidden=false; /* with the keyboard up the list can open below the fold */ try{list.scrollIntoView({block:'nearest'})}catch(e){} }).catch(function(){list.hidden=true}); },250); } var CO_OFFICES=[]; function coPickCity(id,name,zip){ CO_OFF.cityId=id;CO_OFF.cityName=name;CO_OFF.zip=zip||'';CO_OFF.id='';CO_OFFICES=[]; var el=document.getElementById('coCity');if(el)el.value=name; var list=document.getElementById('coCityList');if(list){list.hidden=true;list.innerHTML=''} var inp=document.getElementById('coOffice');if(!inp)return; inp.value='';inp.disabled=true;inp.placeholder=(currentLang==='en'?'Loading…':'Зареждане…'); var n=document.getElementById('coOfficeNote');if(n)n.textContent=''; var c=coCourier(); var url=c==='speedy'?('/api/speedy/offices?siteId='+id):('/api/econt/offices?cityId='+id); fetch(url,{credentials:'same-origin'}).then(function(r){return r.json()}).then(function(d){ CO_OFFICES=d.offices||[]; if(!CO_OFFICES.length){inp.placeholder=(currentLang==='en'?'No offices here':'Няма офиси в този град');return} inp.disabled=false; inp.placeholder=(currentLang==='en'?'Office or street — '+CO_OFFICES.length+' here':'Офис или улица — '+CO_OFFICES.length+' в града'); var _touch=false;try{_touch=window.matchMedia('(hover:none)').matches}catch(e){} if(!_touch)inp.focus(); coOfficeInput(true); }).catch(function(){inp.placeholder=(currentLang==='en'?'Could not load':'Грешка при зареждане')}); } /* Matches the office name and its address, so typing a street works as well as typing the branch name the courier chose for it. */ function coOfficeMatches(q){ if(!q)return CO_OFFICES.slice(0,40); var parts=q.split(/\s+/).filter(Boolean); return CO_OFFICES.filter(function(o){ var hay=bgNormJs(o.name+' '+(o.address||'')); return parts.every(function(w){return hay.indexOf(w)>=0}); }).slice(0,40); } function coOfficeInput(showAll){ var inp=document.getElementById('coOffice'),list=document.getElementById('coOfficeList'); if(!inp||!list||inp.disabled)return; var typed=inp.value.trim(); /* a confirmed pick stays put until the customer edits the field */ if(CO_OFF.id&&typed===CO_OFF.name){if(!showAll){list.hidden=true;return}} else {CO_OFF.id='';var n0=document.getElementById('coOfficeNote');if(n0)n0.textContent=''} var rows=coOfficeMatches(bgNormJs(typed)); if(!rows.length){list.innerHTML='
'+(currentLang==='en'?'No office matches':'Няма съвпадащ офис')+'
';list.hidden=false;return} list.innerHTML=rows.map(function(o,i){ return ''; }).join(''); list.hidden=false; CO_OFF._rows=rows; try{list.scrollIntoView({block:'nearest'})}catch(e){} } function coPickOffice(i){ var o=(CO_OFF._rows||[])[i];if(!o)return; CO_OFF.id=String(o.id);CO_OFF.name=o.name||'';CO_OFF.address=o.address||''; var inp=document.getElementById('coOffice');if(inp)inp.value=CO_OFF.name; var list=document.getElementById('coOfficeList');if(list){list.hidden=true;list.innerHTML=''} var n=document.getElementById('coOfficeNote'); if(n)n.textContent=(currentLang==='en'?'Delivery to: ':'Доставка до: ')+CO_OFF.name+(CO_OFF.address?' — '+CO_OFF.address:''); if(inp)inp.blur(); } function coOfficeAddress(){ if(!CO_OFF.id)return ''; /* the office address already names the town, so add it only when it is missing */ var extra=(!CO_OFF.address&&CO_OFF.cityName)?' ('+CO_OFF.cityName+')':''; return (CO_OFF.courier==='speedy'?'Офис Speedy':'Офис Еконт')+': '+CO_OFF.name+(CO_OFF.address?' — '+CO_OFF.address:'')+extra; } async function submitOrder(){ var name=document.getElementById('coName').value.trim(); var phone=document.getElementById('coPhone').value.trim(); var emailEl=document.getElementById('coEmail'); var email=emailEl?emailEl.value.trim():''; var addrEl=document.getElementById('coAddress'); var address=addrEl?addrEl.value.trim().slice(0,300):''; if(!name||!phone){alert(i18n['alert-fields'][currentLang]);return} var _mode=coDeliveryMode(); if(_mode==='office'){ if(!CO_OFF.cityId){alert(currentLang==='en'?'Please choose a town from the list.':'Моля, изберете град от списъка.');var _c=document.getElementById('coCity');if(_c)_c.focus();return} if(!CO_OFF.id){alert(currentLang==='en'?'Please choose an office from the list.':'Моля, изберете офис от списъка.');var _o=document.getElementById('coOffice');if(_o)_o.focus();return} address=coOfficeAddress(); } else if(_mode==='address'){ if(!CO_ADDR.cityId){alert(currentLang==='en'?'Please choose a town from the list.':'Моля, изберете град от списъка.');var _ac=document.getElementById('coAddrCity');if(_ac)_ac.focus();return} if(address.length<5){alert(i18n['alert-address'][currentLang]);if(addrEl){addrEl.focus()}return} address=CO_ADDR.cityName+', '+address; } else { alert(currentLang==='en'?'Please choose a delivery method.':'Моля, изберете начин на доставка.');return } if(email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)){alert(currentLang==='bg'?'Невалиден имейл адрес.':'Invalid email address.');return} var tsToken=''; if(window.__TURNSTILE_SITE_KEY__&&typeof turnstile!=='undefined'){ try{tsToken=turnstile.getResponse(tsWidgetId)||''}catch(e){} if(!tsToken){alert(currentLang==='bg'?'Моля, изчакайте проверката за сигурност.':'Please wait for the security check.');return} } var btn=document.getElementById('coSubmit'); btn.disabled=true;btn.textContent=i18n['cart-sending'][currentLang]; try{ var count=cart.reduce(function(s,x){return s+x.qty},0); var total=cart.reduce(function(s,x){return s+x.price*x.qty},0); var disc=getDiscount(count); var finalTotal=total-total*disc.rate; var del=getDelivery(finalTotal); var items=cart.map(function(x){var dp=+(x.price*(1-disc.rate)).toFixed(2);return{name:x.name,code:x.code,qty:x.qty,price:dp}}); var res=await fetch('/order',{method:'POST',headers:{'Content-Type':'application/json'}, body:JSON.stringify({name:name,phone:phone,email:email,address:address,discount:disc.label,delivery:del.label,delivery_fee:del.fee,items:items,office:(CO_OFF.id?{courier:CO_OFF.courier,cityId:CO_OFF.cityId,cityName:CO_OFF.cityName,id:CO_OFF.id,name:CO_OFF.name,address:CO_OFF.address,postCode:CO_OFF.zip||''}:null),address_city:(CO_ADDR.cityId?{cityId:CO_ADDR.cityId,cityName:CO_ADDR.cityName,postCode:CO_ADDR.zip||''}:null),source:_orderSource(),source_first:_orderSourceFirst(),turnstile_token:tsToken})}); var data=await res.json(); if(data.ok){ if(typeof gtag==='function'){var pitems=items.map(function(x){return{item_id:x.code,item_name:x.name,price:x.price,quantity:x.qty}});gtag('event','purchase',{transaction_id:data.order_id||'',currency:'EUR',value:finalTotal+del.fee,shipping:del.fee,items:pitems})} if(typeof fbq==='function')fbq('track','Purchase',{content_ids:items.map(function(x){return x.code}),content_type:'product',num_items:items.reduce(function(s,x){return s+x.qty},0),value:finalTotal+del.fee,currency:'EUR'}); upTrack('submit_order'); closeCheckout();cart=[];updateCartUI();document.getElementById('successOverlay').classList.add('open'); }else{ alert(data.error||((i18n['err-generic']&&i18n['err-generic'][currentLang])||(currentLang==='en'?'Error':'Грешка'))); if(tsWidgetId!==null&&typeof turnstile!=='undefined'){try{turnstile.reset(tsWidgetId)}catch(e){}} } }catch(e){ alert(i18n['alert-error'][currentLang]); if(tsWidgetId!==null&&typeof turnstile!=='undefined'){try{turnstile.reset(tsWidgetId)}catch(e){}} } btn.disabled=false;btn.textContent=i18n['co-submit'][currentLang]; } function closeSuccess(){document.getElementById('successOverlay').classList.remove('open')} function observeEls(){ var els=document.querySelectorAll('.product'); if(!('IntersectionObserver' in window)){els.forEach(function(e){e.classList.add('visible')});return} var obs=new IntersectionObserver(function(entries){entries.forEach(function(e){if(e.isIntersecting){e.target.classList.add('visible');obs.unobserve(e.target)}})},{threshold:0.05}); els.forEach(function(e,i){e.style.transitionDelay=(i*0.08)+'s';obs.observe(e)}); } window.addEventListener('scroll',function(){ var y=window.scrollY; document.getElementById('nav').classList.toggle('scrolled',y>50); document.getElementById('backToTop').classList.toggle('visible',y>400); }); function scrollToTop(){window.scrollTo({top:0,behavior:'smooth'})} var currentLang='bg'; var FLAG_BG="data:image/svg+xml;utf8,"; var FLAG_EN="data:image/svg+xml;utf8,"; // Translations are injected by the worker (single source of truth in worker.js) var i18n=window.__I18N__||{}; function applyLang(lang){ currentLang=lang; document.documentElement.setAttribute('lang',lang); document.getElementById('langFlag').src=lang==='bg'?FLAG_BG:FLAG_EN; document.getElementById('langCode').textContent=lang.toUpperCase(); document.querySelectorAll('[data-i18n]').forEach(function(el){ var key=el.getAttribute('data-i18n'); if(i18n[key]&&i18n[key][lang]){ if(el.tagName==='INPUT'||el.tagName==='TEXTAREA')el.placeholder=i18n[key][lang]; else el.innerHTML=i18n[key][lang]; } }); document.querySelectorAll('[data-i18n-aria]').forEach(function(el){ var key=el.getAttribute('data-i18n-aria'); if(i18n[key]&&i18n[key][lang])el.setAttribute('aria-label',i18n[key][lang]); }); renderCatChips(); if(window.__PRODUCTS__)renderProducts(); try{renderQuiz()}catch(e){} try{if(cart.length)updateCartUI()}catch(e){} rewriteLangLinks(); try{localStorage.setItem('profiderm_lang',lang)}catch(e){} try{ var u=new URL(window.location.href); if(lang==='en')u.searchParams.set('lang','en');else u.searchParams.delete('lang'); history.replaceState(null,'',u.toString()); }catch(e){} } // Full reload so the server re-renders meta tags, canonical/hreflang and the // category hero in the right language — no stale mixed-language state. function toggleLang(){ upTrack('lang_switch'); var next=currentLang==='bg'?'en':'bg'; try{localStorage.setItem('profiderm_lang',next)}catch(e){} try{ var u=new URL(window.location.href); if(next==='en')u.searchParams.set('lang','en');else u.searchParams.delete('lang'); u.hash=''; location.href=u.toString(); }catch(e){ location.href=next==='en'?(location.pathname+'?lang=en'):location.pathname; } } var CAT_ICONS={cleansing:'',acne:'',hydration:'',antiage:'',brightening:'',ampoules:'',sun:''}; function catIcon(c){return CAT_ICONS[c]||'';} var MENU_ICONS={'nav-profile':'','nav-home':'','nav-sets':'','nav-acneprog':'','nav-brand':''}; function _injIcon(sp,html){if(!html)return;if(sp.previousElementSibling&&sp.previousElementSibling.classList&&sp.previousElementSibling.classList.contains('cat-ic'))return;var w=document.createElement('span');w.className='cat-ic';w.innerHTML=html;sp.parentNode.insertBefore(w,sp);} function decorateNavIcons(){document.querySelectorAll('.nav-item[data-cat] > a > span[data-i18n], .mob-cat[data-cat] .mob-cat-row > a > span[data-i18n]').forEach(function(sp){var el=sp.closest('[data-cat]');var c=el&&el.getAttribute('data-cat');if(c&&CAT_ICONS[c])_injIcon(sp,CAT_ICONS[c]);});document.querySelectorAll('.mobile-menu > a > span[data-i18n], .nav-links > a > span[data-i18n]').forEach(function(sp){_injIcon(sp,MENU_ICONS[sp.getAttribute('data-i18n')]);});} renderCatChips(); function renderNewSection(){ try{ var sec=document.getElementById('newSection'),row=document.getElementById('newRow'); if(!sec||!row)return; if(window.__PRODUCT_PAGE__||window.__CAT_FILTER__||!/^\/(en\/?)?$/.test(location.pathname)){sec.style.display='none';return;} // само на началната страница var items=(window.__PRODUCTS__||[]).filter(function(p){return NEW_IDS[p.id]}); if(!items.length){sec.style.display='none';return;} var t=document.getElementById('newSecTitle'); if(t)t.innerHTML=currentLang==='en'?'New at ProfiDerm':'Ново в ProfiDerm'; row.innerHTML=items.map(function(p){ return ''+ '
'+(currentLang==='en'?'NEW':'НОВО')+'
'+ ''+esc(dispName(p.name))+''+ ''+esc(dispName(p.name))+''+ ''+p.price.toFixed(2)+' €
'; }).join(''); sec.style.display='block'; }catch(e){} } /* === Добавено в кошницата: тост + статична лента (вместо отваряне на количката) === */ (function(){ var st=document.createElement('style');st.textContent='#acToast{position:fixed;left:16px;right:16px;bottom:calc(88px + env(safe-area-inset-bottom,0px));z-index:160;display:none;justify-content:center;pointer-events:none}\n#acToast .ac-toast-in{max-width:520px;width:100%;background:#eef7f0;border:1px solid #bfe0c8;color:#1e6b3c;border-radius:16px;padding:14px 18px;box-shadow:0 10px 30px rgba(30,70,45,0.18);font-size:14px;line-height:1.45;animation:acToastUp .35s cubic-bezier(.16,1,.3,1)}\n#acToast .ac-toast-title{font-weight:700;display:flex;align-items:center;gap:8px;margin-bottom:3px}\n#acToast .ac-toast-hint{opacity:.9}\n@keyframes acToastUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}\n#acCartBar{position:fixed;left:16px;right:16px;bottom:calc(14px + env(safe-area-inset-bottom,0px));z-index:150;display:none;justify-content:space-between;align-items:center;gap:12px;max-width:520px;margin:0 auto;background:rgba(255,255,255,0.97);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(0,0,0,0.08);border-radius:100px;padding:9px 10px 9px 20px;box-shadow:0 12px 34px rgba(0,0,0,0.16);cursor:pointer}\n#acCartBar .ac-bar-info{font-size:13px;color:#555;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n#acCartBar .ac-bar-btn{flex-shrink:0;background:var(--gold,#b5975a);color:#fff;border-radius:100px;padding:10px 18px;font-size:13px;font-weight:700;letter-spacing:.5px}';document.head.appendChild(st); var t=document.createElement('div');t.id='acToast';t.innerHTML='
✓
';document.body.appendChild(t); var b=document.createElement('div');b.id='acCartBar';b.setAttribute('role','button');b.innerHTML='';b.onclick=function(){toggleCart(true)};document.body.appendChild(b); })(); function _acCount(){var n=0;for(var i=0;i=49.90)return en?'Free delivery unlocked ✓':'Имате безплатна доставка ✓'; var r=(49.90-t).toFixed(2); return en?('Add '+r+' € more for free delivery!'):('Добавете продукти за още '+r+' € и доставката е безплатна!'); } function updateCartBar(){ var bar=document.getElementById('acCartBar');if(!bar)return; var n=_acCount(); if(!n){bar.style.display='none';return} var en=currentLang==='en'; var total=_acDisplayTotal(); document.getElementById('acBarInfo').textContent=n+' '+(en?(n===1?'item':'items'):(n===1?'продукт':'продукта'))+' · '+total.toFixed(2)+' €'; document.getElementById('acBarBtn').textContent=en?'View cart →':'Виж кошницата →'; bar.style.display='flex'; } var _acToastTimer=null; function acProductAdded(){ try{updateCartBar()}catch(e){} var t=document.getElementById('acToast');if(!t)return; var en=currentLang==='en'; document.getElementById('acToastTitle').textContent=en?'Added to your cart':'Продуктът е добавен в кошницата'; document.getElementById('acToastHint').textContent=_acHint(); t.style.display='flex'; if(_acToastTimer)clearTimeout(_acToastTimer); _acToastTimer=setTimeout(function(){t.style.display='none'},4200); } (function(){var f=updateCartUI;updateCartUI=function(){f();try{updateCartBar()}catch(e){}};try{updateCartBar()}catch(e){}})(); function openQuizFromHero(){var q=document.getElementById('skinQuiz');if(!q)return;q.scrollIntoView({behavior:'smooth',block:'center'});setTimeout(function(){if(!q.classList.contains('open')){try{toggleQuiz()}catch(e){}}},350);} (function(){if(window.innerWidth>768)return;document.querySelectorAll('.routine-card').forEach(function(c,i){var h=c.querySelector('h3');if(!h)return;if(i>0)c.classList.add('is-collapsed');h.addEventListener('click',function(){c.classList.toggle('is-collapsed');});});})(); function renderHomeSets(){try{var g=document.getElementById('homeSetsGrid'),sec=document.getElementById('komplekti');if(!g||!sec)return;if(window.__PRODUCT_PAGE__||window.__CAT_FILTER__){sec.style.display='none';return;}var b=window.__BUNDLES__||[];if(!b.length){sec.style.display='none';return;}g.innerHTML=b.map(renderBundleCard).join('');var cards=g.querySelectorAll('.product');try{observeEls()}catch(e2){}cards.forEach(function(c,i){c.style.transitionDelay=((i%3)*0.08)+'s'});setTimeout(function(){cards.forEach(function(c){c.classList.add('visible')})},2500);}catch(e){}} function ytPlay(el){if(!el||el.dataset.playing)return;el.dataset.playing='1';var id=el.dataset.yt;var f=document.createElement('iframe');f.src='https://www.youtube-nocookie.com/embed/'+id+'?autoplay=1&rel=0&modestbranding=1&playsinline=1';f.title=el.getAttribute('aria-label')||'video';f.allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture';f.setAttribute('allowfullscreen','');f.setAttribute('referrerpolicy','strict-origin-when-cross-origin');el.innerHTML='';el.appendChild(f);} if(window.__PRODUCTS__){try{renderProducts()}catch(e){}} try{renderHomeSets()}catch(e){} try{renderNewSection()}catch(e){} try{if(window.__PRODUCT_CODE__&&typeof fbq==='function'){var _vc=(window.__PRODUCTS__||[]).find(function(x){return x.code===window.__PRODUCT_CODE__;});fbq('track','ViewContent',{content_ids:[window.__PRODUCT_CODE__],content_type:'product',content_name:_vc?_vc.name:undefined,value:_vc?_vc.price:undefined,currency:'EUR'});}}catch(e){} try{renderQuiz()}catch(e){} try{if(cart.length)updateCartUI()}catch(e){} try{decorateNavIcons();}catch(e){} observeReveal(); if(location.hash&&location.hash.indexOf('#product-')===0){scrollFlashProduct(location.hash.slice(9))} (function(){ // Priority: explicit ?lang= in the URL, then the user's saved choice, // then what the server rendered, then Bulgarian (default). var urlLang=new URLSearchParams(window.location.search).get('lang'); var stored=null; try{stored=localStorage.getItem('profiderm_lang')}catch(e){} var initial=urlLang||stored||(window.__INITIAL_LANG__)||'bg'; if(initial!=='en')initial='bg'; if(initial==='en'){ if(window.__INITIAL_LANG__!=='en'&&!urlLang){ // saved EN preference but the server rendered BG — reload the EN version try{ var u=new URL(window.location.href); u.searchParams.set('lang','en'); location.replace(u.toString()); return; }catch(e){} } applyLang('en'); }else{ try{localStorage.setItem('profiderm_lang','bg')}catch(e){} } })(); function upTrack(e,extra){var data={e:e};if(extra)for(var k in extra)data[k]=extra[k];try{navigator.sendBeacon('/t',JSON.stringify(data))}catch(ex){try{fetch('/t',{method:'POST',body:JSON.stringify(data),keepalive:true})}catch(ex2){}}} var _upDev=window.innerWidth<768?'mobile':window.innerWidth<1024?'tablet':'desktop'; var _upRef=document.referrer?new URL(document.referrer).hostname:'direct'; function _upChannel(){try{ var p=new URLSearchParams(location.search); var us=(p.get('utm_source')||'').toLowerCase(); if(p.get('gclid'))return'Google Ads'; if(p.get('fbclid'))return'Facebook'; if(us){ if(us.indexOf('angelcosmetics')>=0||us.indexOf('angel')>=0)return'Angel Cosmetics'; if(us.indexOf('facebook')>=0||us==='fb')return'Facebook'; if(us.indexOf('insta')>=0)return'Instagram'; if(us.indexOf('google')>=0)return'Google'; if(us.indexOf('tiktok')>=0)return'TikTok'; return us.charAt(0).toUpperCase()+us.slice(1); } var r=document.referrer;if(!r)return'Директен'; var h=new URL(r).hostname.replace(/^www\./,'').toLowerCase(); if(h.indexOf('facebook')>=0||h==='fb.com'||h==='fb.me'||h.indexOf('fb.')===0)return'Facebook'; if(h.indexOf('instagram')>=0)return'Instagram'; if(h.indexOf('messenger')>=0)return'Messenger'; if(h.indexOf('google')>=0)return'Google'; if(h.indexOf('bing')>=0||h.indexOf('yahoo')>=0||h.indexOf('duckduckgo')>=0||h.indexOf('ecosia')>=0)return'Друга търсачка'; if(h.indexOf('tiktok')>=0)return'TikTok'; if(h.indexOf('youtube')>=0)return'YouTube'; if(h.indexOf('angelcosmetics.bg')>=0)return'Angel Cosmetics'; return'Други сайтове'; }catch(e){return'Директен';}} upTrack('pageview',{d:_upDev,r:_upRef,ch:_upChannel()}); /* Channel attribution for orders (last non-direct touch + first touch) */ function _attribTouch(){try{var ch=_upChannel();var s=JSON.parse(localStorage.getItem('profiderm_src')||'null');if(!s){s={first:ch,last:ch,lastNonDirect:(ch!=='Директен'?ch:'')};}else{s.last=ch;if(ch!=='Директен')s.lastNonDirect=ch;if(!s.first)s.first=ch;}localStorage.setItem('profiderm_src',JSON.stringify(s));}catch(e){}} function _orderSource(){try{var s=JSON.parse(localStorage.getItem('profiderm_src')||'null');if(!s)return _upChannel();return s.lastNonDirect||s.last||s.first||'Директен';}catch(e){return 'Директен';}} function _orderSourceFirst(){try{var s=JSON.parse(localStorage.getItem('profiderm_src')||'null');return s&&s.first?s.first:'';}catch(e){return '';}} _attribTouch(); var _upStart=Date.now(); var _upSent=false; function _upSendTime(){if(_upSent)return;var secs=Math.round((Date.now()-_upStart)/1000);if(secs>2){_upSent=true;upTrack('session_time',{s:secs,ch:_upChannel()});}} document.addEventListener('visibilitychange',function(){if(document.visibilityState==='hidden')_upSendTime();else{_upStart=Date.now();_upSent=false;}}); window.addEventListener('pagehide',_upSendTime); window.addEventListener('beforeunload',_upSendTime); /* ===== любими (♡, пазят се в профила) + сравни (⇄, до 4 продукта) ===== */ var FC_SITE='profiderm',FAVS=[],CMP=[],FC_USER='',FC_MAX_CMP=4,_fcBusy=false,_fcPend=false,_fcSig=''; var FC_CFG={size:function(p){return p.ml||''},rows:function(en){return [ [en?'Action':'Действие',function(p){return en?(p.top_en||p.top):p.top}], [en?'Active ingredients':'Активни съставки',function(p){return en?(p.heart_en||p.heart):p.heart}], [en?'How to use':'Приложение',function(p){return en?(p.base_en||p.base):p.base}], [en?'Category':'Категория',function(p){try{return catLabel(p.cat)||p.cat}catch(e){return p.cat}}]]}}; function fcT(bg,en){return (typeof currentLang!=='undefined'&¤tLang==='en')?en:bg} function fcProd(id){return (window.__PRODUCTS__||[]).filter(function(x){return String(x.id)===String(id)})[0]||null} function fcLoad(k){try{var a=JSON.parse(localStorage.getItem(FC_SITE+'_'+k)||'[]');return Array.isArray(a)?a.map(String):[]}catch(e){return []}} function fcSave(k,a){try{localStorage.setItem(FC_SITE+'_'+k,JSON.stringify(a))}catch(e){}} FAVS=fcLoad('favs');CMP=fcLoad('cmp').slice(0,FC_MAX_CMP); function fcApi(body){var o={method:body?'POST':'GET',credentials:'same-origin'};if(body){o.headers={'Content-Type':'application/json'};o.body=JSON.stringify(body)}return fetch('/api/me/favorites',o).then(function(r){return r.json()})} // При вход: местният списък се слива със сървърния (POST add), после се чисти. function fcOnUser(u){var em=(u&&u.email)||'';if(em===FC_USER)return;FC_USER=em;if(!em){FAVS=fcLoad('favs');fcSync();return} var local=fcLoad('favs');(local.length?fcApi({add:local}):fcApi()).then(function(d){if(d&&d.ok){FAVS=(d.ids||[]).map(String);if(local.length)fcSave('favs',[]);fcSync()}}).catch(function(){})} function fcToggleFav(id){id=String(id);if(!fcProd(id))return;var i=FAVS.indexOf(id),on=i<0;if(on)FAVS.push(id);else FAVS.splice(i,1); if(FC_USER){fcApi(on?{add:[id]}:{remove:[id]}).then(function(d){if(d&&d.ok){FAVS=(d.ids||[]).map(String);fcSync()}}).catch(function(){})}else fcSave('favs',FAVS); fcSync();try{accTrack(on?'fav_add':'fav_remove')}catch(e){}} function fcToggleCmp(id){id=String(id);if(!fcProd(id))return;var i=CMP.indexOf(id);if(i<0){if(CMP.length>=FC_MAX_CMP){fcToast(fcT('Най-много 4 продукта за сравнение.','You can compare up to 4 products.'));return}CMP.push(id)}else CMP.splice(i,1); fcSave('cmp',CMP);fcSync();var o=document.getElementById('cmpOverlay');if(o&&o.classList.contains('open')){if(CMP.length)fcRenderCmp();else fcCloseCmp()}try{accTrack(i<0?'cmp_add':'cmp_remove')}catch(e){}} function fcClearCmp(){CMP=[];fcSave('cmp',CMP);fcSync();fcCloseCmp()} var FC_ICO_FAV=''; var FC_ICO_CMP=''; // Същата разметка строи и pdRatingHtml() в worker.js (страницата на продукта). function fcBtnsHtml(id,cls){id=esc(String(id));return '
'} function fcPrice(p){var h=Number(p.price||0).toFixed(2)+' €';var o=Number(p.oldPrice||p.old_price||0);if(o>Number(p.price||0))h+=' '+o.toFixed(2)+' €';return h} function fcName(p){var n=p.name||'';try{if(typeof dispName==='function')n=dispName(n)}catch(e){}return n} function fcHref(p){var h=p.slug?'/product/'+p.slug:'';try{if(h&&typeof langHref==='function')h=langHref(h)}catch(e){}return h} function fcAdd(id){try{addToCart(String(id))}catch(e){}} function fcItemHtml(p){var href=fcHref(p),id=esc(String(p.id)),nm=esc(fcName(p)); return '
'+(href?'':'')+''+nm+''+(href?'':'')+ '

'+(href?''+nm+'':nm)+'

'+fcPrice(p)+'
'+ '
'} function fcFavList(){return FAVS.map(fcProd).filter(Boolean)} function fcRenderFavs(){var box=document.getElementById('favItems');var list=fcFavList(); var empty='
'+fcT('Още нямате любими продукти.','You have no favourite products yet.')+'
'; if(box){box.innerHTML=list.length?list.map(fcItemHtml).join(''):empty;var ft=document.getElementById('favFoot');if(ft){ft.innerHTML=FC_USER?'':'

'+fcT('Влезте, за да ги пазим в профила ви.','Log in and we will keep them in your profile.').replace(/(Влезте|Log in)/,'$1')+'

'}} var pf=document.getElementById('pfFavsList');if(pf&&FC_USER)pf.innerHTML=list.length?list.map(fcItemHtml).join(''):empty} function toggleFavs(force){var p=document.getElementById('favPanel'),o=document.getElementById('favOverlay');if(!p)return;var open=p.classList.contains('open');if(force===true&&open)return; if(force===true||!open){try{var cp=document.getElementById('cartPanel');if(cp&&cp.classList.contains('open'))toggleCart()}catch(e){}fcRenderFavs();p.classList.add('open');o.classList.add('open');try{accTrack('favs_open')}catch(e){}}else{p.classList.remove('open');o.classList.remove('open')}} function fcToast(msg){var t=document.getElementById('fcToast');if(!t)return;t.textContent=msg;t.classList.add('show');clearTimeout(t._tm);t._tm=setTimeout(function(){t.classList.remove('show')},2600)} function fcPlace(){var bar=document.getElementById('acCartBar');var barOn=!!(bar&&bar.style.display&&bar.style.display!=='none');document.body.classList.toggle('fc-bar',barOn);document.body.classList.toggle('fc-pill',CMP.length>0)} function fcSync(){_fcBusy=true;try{ document.querySelectorAll('.product[data-id]').forEach(function(c){var id=c.getAttribute('data-id');if(!fcProd(id))return;var g=c.querySelector('.product-gallery');if(g&&!g.querySelector('.fc-btns'))g.insertAdjacentHTML('beforeend',fcBtnsHtml(id))}); var tf=[fcT('Добави в любими','Add to favourites'),fcT('Премахни от любими','Remove from favourites')],tc=[fcT('Сравни','Compare'),fcT('Махни от сравнението','Remove from comparison')]; document.querySelectorAll('.fc-btns[data-fc]').forEach(function(w){var id=w.getAttribute('data-fc'),f=w.querySelector('.fc-fav'),c=w.querySelector('.fc-cmp'),fo=FAVS.indexOf(id)>=0,co=CMP.indexOf(id)>=0; if(f){f.classList.toggle('on',fo);f.setAttribute('aria-pressed',fo?'true':'false');f.title=tf[fo?1:0];f.setAttribute('aria-label',tf[fo?1:0])} if(c){c.classList.toggle('on',co);c.setAttribute('aria-pressed',co?'true':'false');c.title=tc[co?1:0];c.setAttribute('aria-label',tc[co?1:0])}}); var b=document.getElementById('favBadge');if(b){b.textContent=FAVS.length;b.style.display=FAVS.length?'flex':'none'} var fb=document.getElementById('favBtn');if(fb){fb.setAttribute('aria-label',fcT('Любими','Favourites')+(FAVS.length?' ('+FAVS.length+')':''));fb.title=fcT('Любими','Favourites')} var pill=document.getElementById('cmpPill');if(pill){pill.style.display=CMP.length?'inline-flex':'none';var l=document.getElementById('cmpPillLbl');if(l)l.textContent=fcT('Сравни','Compare')+' ('+CMP.length+')';var x=pill.querySelector('.cmp-pill-x');if(x)x.setAttribute('aria-label',fcT('Изчисти сравнението','Clear comparison'))} var sig=FAVS.join(',')+'|'+FC_USER+'|'+fcT('bg','en')+'|'+(document.getElementById('favPanel')&&document.getElementById('favPanel').classList.contains('open')?1:0); if(sig!==_fcSig){_fcSig=sig;fcRenderFavs()} fcPlace()}catch(e){}setTimeout(function(){_fcBusy=false},0)} /* сравнение */ function fcStarsHtml(p){var r=null;try{r=productRating(p.id)}catch(e){}var en=fcT('bg','en')==='en'; return ''+(typeof renderStars==='function'?renderStars(r?r.r:0):'')+' '+(r?r.r.toFixed(1)+' ('+r.c+' '+(en?(r.c===1?'review':'reviews'):(r.c===1?'отзив':'отзива'))+')':(en?'(0 reviews)':'(0 отзива)'))+''} function fcRenderCmp(){var o=document.getElementById('cmpOverlay');if(!o)return;var list=CMP.map(fcProd).filter(Boolean),en=fcT('bg','en')==='en'; var rows=[[ '',function(p){var h=fcHref(p),im=''+esc(fcName(p))+'';return h?''+im+'':im}], [en?'Product':'Продукт',function(p){var h=fcHref(p),n=esc(fcName(p));return ''+(h?''+n+'':n)+''}], [en?'Price':'Цена',function(p){return ''+fcPrice(p)+''}], [en?'Size':'Размер',function(p){return esc(FC_CFG.size(p)||'—')}], [en?'Rating':'Оценка',fcStarsHtml]].concat(FC_CFG.rows(en).map(function(r){return [r[0],function(p){var v=r[1](p);return v?esc(String(v)):'—'}]})); rows.push(['',function(p){var id=esc(String(p.id));return ''}]); document.getElementById('cmpTitle').textContent=(en?'Compare':'Сравнение')+' ('+list.length+')'; document.getElementById('cmpBody').innerHTML=''+rows.map(function(r){return ''+list.map(function(p){return ''}).join('')+''}).join('')+'
'+esc(r[0])+''+r[1](p)+'
'} function fcOpenCmp(){var o=document.getElementById('cmpOverlay');if(!o||!CMP.length)return;fcRenderCmp();o.classList.add('open');o.setAttribute('aria-hidden','false');document.body.style.overflow='hidden';try{accTrack('cmp_open')}catch(e){}var x=o.querySelector('.cmp-x');if(x)x.focus()} function fcCloseCmp(){var o=document.getElementById('cmpOverlay');if(!o||!o.classList.contains('open'))return;o.classList.remove('open');o.setAttribute('aria-hidden','true');document.body.style.overflow=''} (function(){ var ub=document.getElementById('userBtn'); if(ub&&!document.getElementById('favBtn'))ub.insertAdjacentHTML('beforebegin',''+FC_ICO_FAV+''); if(!document.getElementById('favPanel'))document.body.insertAdjacentHTML('beforeend','

'+fcT('Любими','Favourites')+'

'+ ''+ ''+ '
'); document.addEventListener('keydown',function(e){if(e.key==='Escape'){fcCloseCmp();var p=document.getElementById('favPanel');if(p&&p.classList.contains('open'))toggleFavs()}}); try{var f0=setUser;setUser=function(u){f0(u);try{fcOnUser(u)}catch(e){}}}catch(e){} try{userReady(function(u){fcOnUser(u)})}catch(e){} try{var f1=updateCartBar;updateCartBar=function(){f1.apply(this,arguments);try{fcPlace()}catch(e){}}}catch(e){} try{new MutationObserver(function(){if(_fcBusy||_fcPend)return;_fcPend=true;setTimeout(function(){_fcPend=false;fcSync()},0)}).observe(document.body,{childList:true,subtree:true})}catch(e){} fcSync(); })();

Настройки за бисквитки