/* Отстъпки на продуктите — етикет, зачертана цена, „Спестявате“ с брояч. Споделено от менюто, началната страница (оферти), прозореца на продукта и количката.
   Анимациите тръгват САМО когато картата се види (client/assets/js/deal-fx.js слага .fx-in; безкрайните са само докато е видима — .fx-live) и са само transform/opacity.
   Началните „скрити“ състояния важат САМО ако скриптът е заредил (html.fx-js) — без JS всичко е видимо. Android („лек“ режим) няма безкрайни анимации. */

/* ── етикет „−X%“ ── */
.discount-badge, .product-image .discount-badge {
    position: absolute; left: 10px; right: auto; top: auto; bottom: 10px; z-index: 10;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px 5px 10px; border-radius: 4px;
    background: linear-gradient(135deg, #ff7f45 0%, #e15829 48%, #c63f14 100%);
    color: #fff; font-family: 'Zaglaviq', Arial, sans-serif; font-size: 17px; font-weight: 800; line-height: 1; letter-spacing: .3px; white-space: nowrap;
    box-shadow: 0 6px 16px rgba(225, 88, 41, .42), inset 0 1px 0 rgba(255, 255, 255, .38);
    transform: rotate(-2deg); transform-origin: left bottom; overflow: hidden; isolation: isolate; pointer-events: none;
    transition: transform .3s cubic-bezier(.2, .9, .3, 1.3), box-shadow .3s;
}
.discount-badge::before { content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, .38); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .35); }
.discount-badge::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 32%, rgba(255, 255, 255, .6) 50%, transparent 68%); transform: translateX(-130%); }
.discount-badge.hot { background: linear-gradient(135deg, #ff6a2b 0%, #ec3f12 50%, #b9300c 100%); box-shadow: 0 7px 20px rgba(236, 63, 18, .55), inset 0 1px 0 rgba(255, 255, 255, .4); }
.product-card:hover .discount-badge, .offer-card:hover .discount-badge { transform: rotate(-1deg) scale(1.07); box-shadow: 0 9px 22px rgba(225, 88, 41, .55), inset 0 1px 0 rgba(255, 255, 255, .4); }
.product-detail-image .discount-badge { left: auto; right: 12px; bottom: 12px; transform-origin: right bottom; transform: rotate(3deg); }
.cart-item-image .discount-badge { left: 3px; bottom: 3px; top: auto; right: auto; padding: 2px 6px 2px 5px; font-size: 10px; gap: 4px; border-radius: 3px; }
.cart-item-image .discount-badge::before { width: 4px; height: 4px; }

/* ── зачертана стара цена: линията се „чертае“ ── */
.discount-pricing .original-price { position: relative; text-decoration: none !important; color: #9c9c9c; }
.discount-pricing .original-price::after { content: ''; position: absolute; left: -1px; right: -1px; top: 52%; height: 2px; border-radius: 2px; background: #ff5a4d; transform-origin: left center; }
/* 18.11.2026: в малките карти с предложения (прозорецът на продукта, количката) старата цена беше блок на цялата ширина → чертата минаваше под
   цялата карта; а при шрифта на сайта (цифрите стоят високо в реда) чертата по средата на блока изглеждаше като подчертаване. Тук: блокът е колкото
   цената, а зачертаването е вграденото на браузъра (следва шрифта — винаги през цифрите). */
.upsell-mini-card .discount-pricing .original-price, .cu-row .discount-pricing .original-price { display: inline-flex !important; align-items: center; line-height: 1 !important; width: max-content !important; max-width: 100%; align-self: flex-start; }
.upsell-mini-card .discount-pricing .original-price::after, .cu-row .discount-pricing .original-price::after { display: none !important; }
.upsell-mini-card .discount-pricing .original-price span, .cu-row .discount-pricing .original-price span { text-decoration: line-through !important; text-decoration-color: #ff5a4d !important; text-decoration-thickness: 2px; }

/* ── „Спестявате X €“: зелена лента с брояч ── */
.pp-save {
    position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; order: 5;
    padding: 3px 10px 3px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 800; letter-spacing: .2px; color: #4ade80;
    background: rgba(74, 222, 128, .11); border: 1px solid rgba(74, 222, 128, .32); font-variant-numeric: tabular-nums;
}
.pp-save::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); }
.pp-save::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%); transform: translateX(-130%); }
.pp-save { word-spacing: -2px; max-width: 100%; white-space: nowrap; }
.pp-save .pp-n { font-weight: 800; }
.product-card .pp-save, .offer-card .pp-save { margin-top: 1px; }
.product-detail-pricing .pp-save { font-size: 14px; padding: 4px 12px 4px 9px; }
html[data-theme="light"] .pp-save { color: #15803d; background: rgba(21, 128, 61, .09); border-color: rgba(21, 128, 61, .3); }
html[data-theme="light"] .pp-save::before { background: #15803d; }

/* ── анимации: всичко чака .fx-in (картата е видима) ── */
.fx-js .product-card:not(.fx-in) .discount-badge, .fx-js .offer-card:not(.fx-in) .discount-badge, .fx-js .product-detail:not(.fx-in) .discount-badge { opacity: 0; transform: scale(.3) rotate(-18deg); }
.fx-js .product-card:not(.fx-in) .discount-pricing .original-price::after, .fx-js .offer-card:not(.fx-in) .discount-pricing .original-price::after, .fx-js .product-detail:not(.fx-in) .discount-pricing .original-price::after { transform: scaleX(0); }
.fx-js .product-card:not(.fx-in) .discount-pricing .current-price, .fx-js .offer-card:not(.fx-in) .discount-pricing .current-price, .fx-js .product-detail:not(.fx-in) .discount-pricing .current-price { opacity: 0; }
.fx-js .product-card:not(.fx-in) .pp-save, .fx-js .offer-card:not(.fx-in) .pp-save, .fx-js .product-detail:not(.fx-in) .pp-save { opacity: 0; }

.fx-in .discount-badge { animation: dealPop .5s cubic-bezier(.2, .9, .3, 1.35) 0s both; }
.fx-in .discount-badge::after { animation: dealShine .9s ease .45s 1 both; }
.fx-in .discount-pricing .current-price { animation: dealDrop .45s cubic-bezier(.2, .9, .3, 1.5) .08s both; }
.fx-in .discount-pricing .original-price::after { animation: dealStrike .38s cubic-bezier(.6, 0, .2, 1) .3s both; }
.fx-in .pp-save { animation: dealSlide .42s cubic-bezier(.2, .9, .3, 1.1) .36s both; }
.fx-in .pp-save::after { animation: dealShine .8s ease .8s 1 both; }
@keyframes dealPop { 0% { opacity: 0; transform: translateX(-14px) scale(.5) rotate(-12deg); } 55% { opacity: 1; transform: translateX(2px) scale(1.12) rotate(-1deg); } 100% { opacity: 1; transform: rotate(-2deg) scale(1); } }
.product-detail-image .fx-in .discount-badge, .product-detail.fx-in .discount-badge { animation-name: dealPopR; }
@keyframes dealPopR { 0% { opacity: 0; transform: scale(.3) rotate(18deg); } 60% { opacity: 1; transform: scale(1.14) rotate(1deg); } 100% { opacity: 1; transform: rotate(3deg) scale(1); } }
@keyframes dealShine { to { transform: translateX(130%); } }
@keyframes dealDrop { 0% { opacity: 0; transform: translateY(-9px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes dealStrike { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dealSlide { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

/* безкрайни — само за видими карти: „горещите“ (≥20%) пулсират, точката при „Спестявате“ мига, блясъкът се повтаря рядко */
/* „Горещите“ (≥20%) нямат безкрайно пулсиране на сянката (то рисуваше пръстен около етикета, който „премигваше“) — само еднократното появяване и блясък като при всички */
.fx-live .pp-save::before { animation: dealPing 2.2s ease-out 1.6s infinite; }
@keyframes dealGlow { 50% { box-shadow: 0 7px 26px rgba(255, 90, 40, .85), 0 0 0 5px rgba(255, 106, 43, .18), inset 0 1px 0 rgba(255, 255, 255, .4); } }
@keyframes dealPing { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .65); } 70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }

/* телефон: малко по-компактно, да не пречи на снимката */
@media (max-width: 768px) {
    .product-card .pp-save, .offer-card .pp-save { flex: 0 1 auto; }
    .discount-badge, .product-image .discount-badge { font-size: 14px; padding: 4px 10px 4px 8px; gap: 6px; left: 8px; bottom: 8px; border-radius: 4px; }
    .discount-badge::before { width: 6px; height: 6px; }
    .pp-save { font-size: 11px; letter-spacing: 0; gap: 5px; padding: 2px 7px 2px 6px; max-width: 100%; white-space: nowrap; }
    .pp-save::before { width: 6px; height: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .fx-in .discount-badge, .fx-in .discount-badge::after, .fx-in .discount-pricing .current-price, .fx-in .discount-pricing .original-price::after, .fx-in .pp-save, .fx-in .pp-save::after,
    .fx-live .pp-save::before { animation: none !important; }
    .fx-js .product-card:not(.fx-in) .discount-badge, .fx-js .offer-card:not(.fx-in) .discount-badge { opacity: 1; transform: rotate(-3deg); }
    .fx-js .product-card:not(.fx-in) .discount-pricing .original-price::after, .fx-js .offer-card:not(.fx-in) .discount-pricing .original-price::after { transform: none; }
    .fx-js .product-card:not(.fx-in) .discount-pricing .current-price, .fx-js .offer-card:not(.fx-in) .discount-pricing .current-price,
    .fx-js .product-card:not(.fx-in) .pp-save, .fx-js .offer-card:not(.fx-in) .pp-save { opacity: 1; }
}
