/* ==========================================================================
   Мини-количката (inc/minicart.php, assets/js/minicart.js): панел отдясно след
   „Добави“ и от иконката в шапката. Хартия + нефрит, злато за успеха.
   ========================================================================== */

html.nd-mc-lock { overflow: hidden; }
html.nd-mc-lock body { overflow: hidden; }

.nd-mc { position: fixed; inset: 0; z-index: 300; }
.nd-mc[hidden] { display: none; }
.nd-mc__veil {
	position: absolute; inset: 0; background: rgba(11, 26, 21, .42);
	-webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
	opacity: 0; transition: opacity .38s var(--ease);
}
.nd-mc__panel {
	position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw);
	display: flex; flex-direction: column; background: var(--paper); color: var(--ink-2);
	box-shadow: -24px 0 60px -20px rgba(11, 26, 21, .45); outline: none;
	transform: translate3d(104%, 0, 0); transition: transform .52s cubic-bezier(.2, .9, .2, 1.04);
	border-radius: 28px 0 0 28px; overflow: hidden;
}
.nd-mc.is-open .nd-mc__veil { opacity: 1; }
.nd-mc.is-open .nd-mc__panel { transform: translate3d(0, 0, 0); }

/* --- главата: отметка (при добавяне) или торбичка ----------------------- */
.nd-mc__head {
	position: relative; display: flex; align-items: center; gap: 14px; padding: 22px 20px 18px 24px;
	background: var(--jade-900); color: #f6f1e7; isolation: isolate; overflow: hidden;
}
.nd-mc__head::after { /* златният отблясък при добавяне */
	content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
	background: linear-gradient(105deg, transparent 30%, rgba(233, 205, 134, .32) 48%, transparent 66%);
	transform: translateX(-100%);
}
.nd-mc.is-added.is-open .nd-mc__head::after { animation: ndMcSheen 1.1s .25s var(--ease) both; }
@keyframes ndMcSheen { 0% { opacity: 1; transform: translateX(-100%); } 100% { opacity: 1; transform: translateX(100%); } }

.nd-mc__ok, .nd-mc__bagic { flex: none; display: grid; place-items: center; width: 48px; height: 48px; }
.nd-mc__bagic { border-radius: 50%; background: rgba(246, 241, 231, .08); font-size: 1.45rem; color: var(--gold-300); }
.nd-mc__ok { display: none; }
.nd-mc.is-added .nd-mc__ok { display: grid; }
.nd-mc.is-added .nd-mc__bagic { display: none; }
.nd-mc__ok svg { width: 48px; height: 48px; overflow: visible; }
.nd-mc__ok circle { fill: none; stroke: var(--gold-500); stroke-width: 2.5; stroke-dasharray: 145; stroke-dashoffset: 145; transform: rotate(-90deg); transform-origin: 50% 50%; }
.nd-mc__ok path { fill: none; stroke: var(--gold-300); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; }
.nd-mc.is-added.is-open .nd-mc__ok circle { animation: ndMcDraw .6s .18s var(--ease) forwards; }
.nd-mc.is-added.is-open .nd-mc__ok path { animation: ndMcDraw .42s .62s var(--ease) forwards; }
.nd-mc.is-added.is-open .nd-mc__ok svg { animation: ndMcPop .5s 1s var(--ease); }
@keyframes ndMcDraw { to { stroke-dashoffset: 0; } }
@keyframes ndMcPop { 40% { transform: scale(1.14); } }

.nd-mc__titles { flex: 1; min-width: 0; }
.nd-mc__kicker { display: none; margin: 0 0 2px; font-size: .74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-300); }
.nd-mc.is-added .nd-mc__kicker { display: block; }
.nd-mc__title { margin: 0; font-family: var(--font-head); font-size: 1.4rem; font-weight: 340; line-height: 1.2; color: #fbf7ee; }
.nd-mc__x {
	flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-left: auto; border: 0; border-radius: 50%;
	background: rgba(246, 241, 231, .08); color: #f6f1e7; font-size: 1.15rem; transition: background-color .25s, transform .3s var(--ease);
}
.nd-mc__x:hover { background: rgba(246, 241, 231, .18); transform: rotate(90deg); }

/* --- тялото ----------------------------------------------------------------- */
.nd-mc__body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; transition: opacity .25s; }
.nd-mc__body.is-busy > :not(.nd-mc__load) { opacity: .45; pointer-events: none; }
.nd-mc__load { display: none; gap: 8px; justify-content: center; padding: 56px 0; }
.nd-mc__body[data-stale] .nd-mc__load { display: flex; }
.nd-mc__load i { width: 10px; height: 10px; border-radius: 50%; background: var(--gold-500); animation: ndMcDot 1s infinite ease-in-out both; }
.nd-mc__load i:nth-child(2) { animation-delay: .15s; }
.nd-mc__load i:nth-child(3) { animation-delay: .3s; }
@keyframes ndMcDot { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* безплатната доставка */
.nd-mc__ship { margin: 16px 20px 4px; padding: 12px 16px 14px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line); }
.nd-mc__ship p { display: flex; align-items: center; gap: 10px; margin: 0 0 9px; font-size: .93rem; line-height: 1.35; color: var(--ink-2); }
.nd-mc__ship p .nd-i { font-size: 1.25rem; color: var(--gold-600); }
.nd-mc__ship b { font-weight: 620; color: var(--ink); }
.nd-mc__bar { display: block; height: 6px; border-radius: 99px; background: var(--paper-3); overflow: hidden; }
.nd-mc__bar i { display: block; width: var(--w); height: 100%; border-radius: inherit; background: var(--gold-grad); background-size: 200% 100%; animation: ndMcFill .9s .3s var(--ease) both, ndSheen 2.6s 1.2s linear infinite alternate; }
@keyframes ndMcFill { from { width: 0; } }
.nd-mc__ship.is-done { background: rgba(61, 118, 96, .08); border-color: rgba(61, 118, 96, .25); }
.nd-mc__ship.is-done p .nd-i { color: var(--jade-500); }
.nd-mc__ship.is-done .nd-mc__bar i { background: var(--jade-500); }

/* продуктите */
.nd-mc__list { margin: 0; padding: 8px 20px; list-style: none; }
.nd-mc__item {
	position: relative; display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: start;
	padding: 14px 10px; margin: 0 -10px; border-radius: var(--r-sm); border-bottom: 1px solid var(--line);
	animation: ndMcIn .45s calc(var(--i, 0) * 50ms + .15s) var(--ease) both;
}
.nd-mc__item:last-child { border-bottom: 0; }
@keyframes ndMcIn { from { opacity: 0; transform: translateX(18px); } }
.nd-mc__item.is-new { animation: ndMcNew 2.2s var(--ease) both; }
.nd-mc__item.is-new .nd-mc__img { animation: ndMcPop .6s .35s var(--ease); }
@keyframes ndMcNew { 0% { background: var(--gold-100); box-shadow: inset 3px 0 0 var(--gold-500); } 70% { background: var(--gold-100); box-shadow: inset 3px 0 0 var(--gold-500); } 100% { background: transparent; box-shadow: inset 3px 0 0 transparent; } }
.nd-mc__img { display: grid; place-items: center; width: 72px; height: 72px; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.nd-mc__img img { width: 100%; height: 100%; object-fit: contain; }
.nd-mc__info { min-width: 0; }
.nd-mc__name { margin: 0; font-size: .98rem; font-weight: 520; line-height: 1.3; color: var(--ink); }
.nd-mc__name a:hover { color: var(--gold-700); }
.nd-mc__unit { margin: 2px 0 8px; font-size: .84rem; color: var(--muted); }
.nd-mc__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nd-mc__qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); }
.nd-mc__qty button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 1.1rem; line-height: 1; color: var(--ink); transition: background-color .2s; }
.nd-mc__qty button:hover:not(:disabled) { background: var(--paper-2); }
.nd-mc__qty button:disabled { opacity: .35; cursor: default; }
.nd-mc__qty output { min-width: 26px; font-size: .95rem; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.nd-mc__qty-solo { font-size: .9rem; color: var(--muted); }
.nd-mc__line { font-size: 1rem; font-weight: 640; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nd-mc__rm { display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -4px 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: .9rem; transition: background-color .2s, color .2s; }
.nd-mc__rm:hover { background: rgba(160, 52, 40, .09); color: #9b3326; }
.nd-mc__item.is-going { animation: ndMcOut .32s var(--ease) forwards; pointer-events: none; }
@keyframes ndMcOut { to { opacity: 0; transform: translateX(30px); } }

/* двойката на баланса */
.nd-mc__pair {
	display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center;
	margin: 4px 20px 16px; padding: 12px 12px 12px 12px; border-radius: var(--r-sm);
	background: linear-gradient(120deg, var(--gold-100), var(--card)); border: 1px solid rgba(173, 129, 48, .28);
	animation: ndMcIn .5s .45s var(--ease) both;
}
.nd-mc__pair-img { display: grid; place-items: center; width: 52px; height: 52px; padding: 4px; border-radius: 12px; background: var(--card); }
.nd-mc__pair-img img { width: 100%; height: 100%; object-fit: contain; }
.nd-mc__pair p { display: grid; gap: 1px; margin: 0; font-size: .88rem; line-height: 1.35; }
.nd-mc__pair-k { display: inline-flex; align-items: center; gap: 7px; font-size: .7rem; font-weight: 620; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; color: var(--gold-700); }
.nd-mc__pair-k .nd-pair__yy { --s: 14px; }
.nd-mc__pair b { font-weight: 600; color: var(--ink); }
.nd-mc__pair-add {
	display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px 0 11px; border: 0; border-radius: 999px;
	background: var(--jade-800); color: #fbf7ee; font-size: .86rem; font-weight: 560; white-space: nowrap; transition: background-color .25s, transform .2s;
}
.nd-mc__pair-add .nd-i { color: var(--gold-300); }
.nd-mc__pair-add:hover { background: var(--jade-700); }
.nd-mc__pair-add:active { transform: scale(.96); }
.nd-mc__pair-add.is-loading { opacity: .6; pointer-events: none; }

/* празна количка */
.nd-mc__empty { display: grid; justify-items: center; gap: 6px; margin: auto; padding: 48px 28px; text-align: center; }
.nd-mc__empty-ic { display: grid; place-items: center; width: 76px; height: 76px; margin-bottom: 8px; border-radius: 50%; background: var(--paper-2); font-size: 2rem; color: var(--gold-600); }
.nd-mc__empty-t { margin: 0; font-family: var(--font-head); font-size: 1.3rem; font-weight: 340; color: var(--ink); }
.nd-mc__empty-s { margin: 0 0 16px; max-width: 30ch; font-size: .95rem; color: var(--muted); }

/* долната част: сумата и бутоните - винаги видими */
.nd-mc__foot {
	position: sticky; bottom: 0; margin-top: auto; padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
	background: linear-gradient(to bottom, rgba(246, 241, 231, .92), var(--paper) 22%); border-top: 1px solid var(--line);
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.nd-mc__sum { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; font-size: .98rem; color: var(--ink-2); }
.nd-mc__sum small { font-size: .84rem; color: var(--muted); }
.nd-mc__sum b { font-size: 1.45rem; font-weight: 640; color: var(--ink); font-variant-numeric: tabular-nums; }
.nd-mc__note { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 14px; font-size: .82rem; line-height: 1.4; color: var(--muted); }
.nd-mc__note .nd-i { flex: none; margin-top: 2px; color: var(--gold-600); }
.nd-mc__go { width: 100%; --h: 56px; font-size: 1.02rem; }
.nd-mc__more { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.nd-mc__more .nd-btn { flex: none; --h: 46px; padding: 0 20px; font-size: .92rem; }
.nd-mc__cont { flex: 1; min-height: 46px; padding: 0 6px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font-size: .92rem; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: color .2s; }
.nd-mc__cont:hover { color: var(--gold-700); }

/* броячът в шапката подскача (и извън магазина) */
.nd-tool__count.is-bump { animation: ndMcBump .6s var(--ease); }
@keyframes ndMcBump { 30% { transform: scale(1.55); } }

@media (max-width: 520px) {
	.nd-mc__panel { width: 100vw; border-radius: 0; }
	.nd-mc__head { padding: 16px 14px 14px 18px; }
	.nd-mc__list { padding: 6px 14px; }
	.nd-mc__ship { margin-inline: 14px; }
	.nd-mc__pair { margin-inline: 14px; }
	.nd-mc__foot { padding-inline: 14px; }
	.nd-mc__item { grid-template-columns: 62px 1fr auto; gap: 12px; }
	.nd-mc__img { width: 62px; height: 62px; }
	.nd-mc__pair { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 10px; }
	.nd-mc__pair-img { width: 44px; height: 44px; }
	.nd-mc__pair-k { letter-spacing: .06em; }
	.nd-mc__more .nd-btn { padding: 0 16px; }
	.nd-mc__cont { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
	.nd-mc__panel, .nd-mc__veil { transition-duration: .01s; }
	.nd-mc__item, .nd-mc__pair, .nd-mc__bar i, .nd-mc__item.is-new, .nd-mc__item.is-new .nd-mc__img, .nd-mc__ok svg, .nd-tool__count.is-bump { animation: none; }
	.nd-mc__ok circle, .nd-mc__ok path { animation: none !important; stroke-dashoffset: 0; }
	.nd-mc.is-added.is-open .nd-mc__head::after { animation: none; }
}
