/* Smartweb's Must Have - Cart: drawer, bublina, toast. Farby, polomer a šírku preberá z CSS premenných témy
   (--sw-cart-accent, --sw-cart-accent-ink, --sw-cart-ink, --sw-cart-mute, --sw-cart-line, --sw-cart-bg, --sw-cart-soft,
   --sw-cart-radius, --sw-cart-width); predvolené hodnoty sú len fallback vo var(), aby téma vyhrala bez ohľadu na poradie CSS. */
:root {
  --sw-cart-z: 10050;
  --sw-cart-success: #1e8e3e;
  --sw-cart-error: #c5221f;
}

/* sw-cart-critical:start */
/* ---------- bublina (aj v kritickom CSS cez filter sw_assets_critical_css, keď je hlavné CSS async) ---------- */
.sw-cart-bubble { display: inline-flex; align-items: center; gap: .35em; }
.sw-cart-bubble__count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35em; height: 1.35em; padding: 0 .3em; border-radius: 999px; background: var(--sw-cart-accent, #1b1b1b); color: var(--sw-cart-accent-ink, #fff); font-size: .72em; font-weight: 700; line-height: 1; }
.sw-cart-bubble__count[data-count="0"] { display: none; }
.sw-cart-bubble__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* návštevník s košíkom: kým JS nedoplní stav, suma z cachovanej stránky (prázdny košík) sa nezobrazí - žiadne preblikávanie 0 -> hodnota */
html.sw-cart-has-items:not(.sw-cart-ready) .sw-cart-bubble:not(.is-ready) .sw-cart-bubble__total,
html.sw-cart-has-items:not(.sw-cart-ready) .sw-cart-bubble:not(.is-ready) .sw-cart-bubble__count { visibility: hidden; }
html.sw-cart-has-items:not(.sw-cart-ready) .sw-cart-bubble:not(.is-ready)::after { content: ""; display: inline-block; width: 3.2em; height: .9em; border-radius: 999px; background: linear-gradient(90deg, rgba(0,0,0,.08), rgba(0,0,0,.16), rgba(0,0,0,.08)); background-size: 200% 100%; animation: sw-cart-shimmer 1.1s linear infinite; margin-left: -3.2em; }
@keyframes sw-cart-shimmer { to { background-position: -200% 0; } }
/* sw-cart-critical:end */

/* ---------- ikony (externé SVG cez mask, jednotná hrúbka čiar) ---------- */
.sw-cart-icon { display: inline-block; width: 20px; height: 20px; flex: none; background: currentColor; -webkit-mask: var(--sw-cart-i) center / contain no-repeat; mask: var(--sw-cart-i) center / contain no-repeat; vertical-align: middle; }
.sw-cart-icon--close { --sw-cart-i: url(../img/icons/close.svg); }
.sw-cart-icon--trash { --sw-cart-i: url(../img/icons/trash.svg); }
.sw-cart-icon--plus  { --sw-cart-i: url(../img/icons/plus.svg); }
.sw-cart-icon--minus { --sw-cart-i: url(../img/icons/minus.svg); }
.sw-cart-icon--arrow { --sw-cart-i: url(../img/icons/arrow-right.svg); }
.sw-cart-icon--cart  { --sw-cart-i: url(../img/icons/cart.svg); }
.sw-cart-icon--check { --sw-cart-i: url(../img/icons/check.svg); }

/* ---------- drawer ---------- */
.sw-cart-backdrop { position: fixed; inset: 0; z-index: calc(var(--sw-cart-z) - 1); background: rgba(16, 15, 13, .45); opacity: 0; transition: opacity .25s ease; }
.sw-cart-backdrop.is-open { opacity: 1; }
.sw-cart-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--sw-cart-z); width: min(var(--sw-cart-width, 440px), 100%); max-width: 100vw; background: var(--sw-cart-bg, #fff); color: var(--sw-cart-ink, #1b1b1b); box-shadow: -12px 0 40px rgba(0,0,0,.18); transform: translateX(102%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); outline: none; display: flex; flex-direction: column; }
.sw-cart-drawer.is-open { transform: none; }
.sw-cart-drawer__inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sw-cart-drawer.is-loading .sw-cart-drawer__inner { opacity: .5; pointer-events: none; }
.sw-cart-drawer:not(.is-loaded) .sw-cart-drawer__inner::before { content: ""; margin: 40vh auto 0; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sw-cart-line, #e5e7eb); border-top-color: var(--sw-cart-accent, #1b1b1b); animation: sw-cart-spin .8s linear infinite; }
@keyframes sw-cart-spin { to { transform: rotate(360deg); } }
html.sw-cart-open { overflow: hidden; }

.sw-cart-drawer__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--sw-cart-line, #e5e7eb); }
.sw-cart-drawer__title { margin: 0; font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5em; }
.sw-cart-drawer__count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em; border-radius: 999px; background: var(--sw-cart-soft, #f6f7f9); font-size: .75em; font-weight: 700; }
.sw-cart-drawer__close { appearance: none; border: 0; background: transparent; color: inherit; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sw-cart-drawer__close:hover, .sw-cart-drawer__close:focus-visible { background: var(--sw-cart-soft, #f6f7f9); outline: none; }

.sw-cart-progress { padding: 14px 20px 0; }
.sw-cart-progress__text { margin: 0 0 8px; font-size: .9rem; color: var(--sw-cart-mute, #6b7280); display: flex; align-items: center; gap: .4em; }
.sw-cart-progress.is-reached .sw-cart-progress__text { color: var(--sw-cart-success); font-weight: 600; }
.sw-cart-progress__bar { height: 6px; border-radius: 999px; background: var(--sw-cart-soft, #f6f7f9); overflow: hidden; }
.sw-cart-progress__bar > span { display: block; height: 100%; border-radius: 999px; background: var(--sw-cart-accent, #1b1b1b); transition: width .4s ease; }
.sw-cart-progress.is-reached .sw-cart-progress__bar > span { background: var(--sw-cart-success); }

.sw-cart-items { list-style: none; margin: 0; padding: 8px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sw-cart-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--sw-cart-line, #e5e7eb); transition: opacity .2s ease; }
.sw-cart-item:last-child { border-bottom: 0; }
.sw-cart-item.is-busy, .sw-cart-item.is-removing { opacity: .45; pointer-events: none; }
.sw-cart-item__thumb { display: block; width: 72px; height: 72px; border-radius: var(--sw-cart-radius, 12px); background: var(--sw-cart-soft, #f6f7f9); overflow: hidden; }
.sw-cart-item__thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sw-cart-item__body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sw-cart-item__name { color: inherit; text-decoration: none; font-weight: 600; font-size: .92rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-cart-item__name:hover { text-decoration: underline; }
.sw-cart-item__meta { font-size: .8rem; color: var(--sw-cart-mute, #6b7280); }
.sw-cart-item__meta dl, .sw-cart-item__meta p { margin: 0; }
.sw-cart-item__unit { font-size: .8rem; color: var(--sw-cart-mute, #6b7280); }
.sw-cart-item__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.sw-cart-item__total { font-weight: 700; white-space: nowrap; }
.sw-cart-item__remove { appearance: none; border: 0; background: transparent; color: var(--sw-cart-mute, #6b7280); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; align-self: start; }
.sw-cart-item__remove:hover, .sw-cart-item__remove:focus-visible { color: var(--sw-cart-error); background: var(--sw-cart-soft, #f6f7f9); outline: none; }
.sw-cart-item__remove .sw-cart-icon { width: 18px; height: 18px; }

.sw-cart-qty { display: inline-flex; align-items: center; border: 1px solid var(--sw-cart-line, #e5e7eb); border-radius: 999px; height: 34px; overflow: hidden; }
.sw-cart-qty--fixed { padding: 0 12px; font-size: .85rem; color: var(--sw-cart-mute, #6b7280); border: 0; }
.sw-cart-qty__btn { appearance: none; border: 0; background: transparent; color: inherit; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sw-cart-qty__btn:hover:not([disabled]), .sw-cart-qty__btn:focus-visible { background: var(--sw-cart-soft, #f6f7f9); outline: none; }
.sw-cart-qty__btn[disabled] { opacity: .35; cursor: default; }
.sw-cart-qty__btn .sw-cart-icon { width: 14px; height: 14px; }
.sw-cart-qty__input { width: 40px; height: 32px; border: 0; background: transparent; text-align: center; font: inherit; font-weight: 600; -moz-appearance: textfield; appearance: textfield; color: inherit; }
.sw-cart-qty__input::-webkit-outer-spin-button, .sw-cart-qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sw-cart-qty__input:focus { outline: none; }

.sw-cart-drawer__footer { padding: 14px 20px 20px; border-top: 1px solid var(--sw-cart-line, #e5e7eb); background: var(--sw-cart-bg, #fff); display: flex; flex-direction: column; gap: 10px; }
.sw-cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 1.05rem; }
.sw-cart-subtotal__label { color: var(--sw-cart-mute, #6b7280); }
.sw-cart-subtotal__value { font-weight: 800; font-size: 1.2rem; }
.sw-cart-note { margin: -4px 0 4px; font-size: .78rem; color: var(--sw-cart-mute, #6b7280); }
.sw-cart-btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; width: 100%; min-height: 48px; padding: 0 18px; border-radius: 999px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid var(--sw-cart-accent, #1b1b1b); transition: transform .12s ease, filter .12s ease; }
.sw-cart-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.sw-cart-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--sw-cart-accent, #1b1b1b) 40%, transparent); outline-offset: 2px; }
.sw-cart-btn--primary { background: var(--sw-cart-accent, #1b1b1b); color: var(--sw-cart-accent-ink, #fff); }
.sw-cart-btn--primary .sw-cart-icon { width: 18px; height: 18px; }
.sw-cart-btn--secondary { background: transparent; color: var(--sw-cart-accent, #1b1b1b); }
.sw-cart-link { appearance: none; border: 0; background: transparent; color: var(--sw-cart-mute, #6b7280); font: inherit; font-size: .9rem; text-decoration: underline; cursor: pointer; padding: 4px; align-self: center; }
.sw-cart-link:hover { color: var(--sw-cart-ink, #1b1b1b); }

.sw-cart-empty { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; gap: 8px; }
.sw-cart-empty__icon { width: 56px; height: 56px; color: var(--sw-cart-line, #e5e7eb); margin-bottom: 8px; }
.sw-cart-empty__title { margin: 0; font-weight: 700; font-size: 1.05rem; }
.sw-cart-empty__hint { margin: 0 0 12px; color: var(--sw-cart-mute, #6b7280); font-size: .9rem; }
.sw-cart-empty .sw-cart-btn { width: auto; min-width: 220px; }

/* ---------- toast ---------- */
.sw-cart-toast { position: fixed; left: 50%; bottom: 24px; z-index: var(--sw-cart-z); transform: translate(-50%, 12px); background: var(--sw-cart-ink, #1b1b1b); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .92rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.2); opacity: 0; transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 32px); }
.sw-cart-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sw-cart-toast.is-error { background: var(--sw-cart-error); }

/* ---------- stavy tlačidiel Do košíka (karty aj detail) ---------- */
.add_to_cart_button.is-loading, .single_add_to_cart_button.is-loading, [data-sw-cart="add"].is-loading { opacity: .7; pointer-events: none; }
.single_add_to_cart_button.is-added { background: var(--sw-cart-success) !important; border-color: var(--sw-cart-success) !important; color: #fff !important; }

@media (max-width: 480px) {
  .sw-cart-item { grid-template-columns: 64px 1fr auto; gap: 10px; }
  .sw-cart-item__thumb { width: 64px; height: 64px; }
  .sw-cart-drawer__header, .sw-cart-items, .sw-cart-drawer__footer, .sw-cart-progress { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sw-cart-drawer, .sw-cart-backdrop, .sw-cart-toast, .sw-cart-btn, .sw-cart-progress__bar > span { transition: none; }
  .sw-cart-bubble::after, .sw-cart-drawer:not(.is-loaded) .sw-cart-drawer__inner::before { animation: none; }
}

/* ---------- cenové prípony pluginov (s DPH / bez DPH) v draweri ---------- */
.sw-cart-item__total .tax_label, .sw-cart-subtotal .tax_label { font-size: .7em; font-weight: 400; color: var(--sw-cart-mute, #6b7280); margin-left: .25em; }
.sw-cart-item__total .price-vat-container, .sw-cart-subtotal .price-vat-container { display: block; font-size: .72em; font-weight: 400; color: var(--sw-cart-mute, #6b7280); line-height: 1.2; }
.sw-cart-item__unit .tax_label, .sw-cart-item__unit .price-vat-container { display: none; }
.sw-cart-item__total { text-align: right; }
