/* --- FLOAT BUTTON --- */
.ts-sc {
  position: fixed !important;
  bottom: 30px !important;
  left: 30px !important;
  right: auto !important;
  top: auto !important;
  z-index: 10000;
}

#ts-sc-toggle {
  background: #214121;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
}
#ts-sc-toggle:hover {
  transform: scale(1.05);
}
#ts-sc-toggle.pulse {
  animation: pulse 0.6s;
}
@keyframes pulse {
  50% {
    transform: scale(1.12);
  }
}
.ts-sc__count {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #fff;
  color: #222;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* --- PANEL --- */
.ts-sc__panel {
  position: fixed;
  top: 0;
  left: -400px;
  width: 380px;
  height: 100vh;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  transition: left 0.35s ease-out;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  overflow: hidden;
}
.ts-sc--open .ts-sc__panel {
  left: 0;
}

/* --- OVERLAY --- */
.ts-sc__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: 0.35s;
  z-index: 10000;
}
.ts-sc--open .ts-sc__overlay {
  opacity: 1;
  visibility: visible;
}

/* --- HEADER --- */
.ts-sc__header {
  flex: 0 0 auto;
  padding: 18px 20px;
  border-bottom: 1px solid #e6e6e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ts-sc__close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
}

/* --- BODY (scrollable) --- */
.ts-sc__body {
  flex: 1 1 auto;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  position: relative;
  padding: 0;
}
.ts-sc__inner {
  padding: 16px 20px;
}
.ts-sc__body::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.ts-sc__body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- FOOTER (zawsze widoczny) --- */
.ts-sc__footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e6e6e6;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  text-align: center;
  justify-content: center;
  align-items: center;
}
.ts-sc__btn {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  background: #e0e8e0;
  color: #000;
  width: 100%;
}
.ts-sc__btn--primary {
  background: #1e3a1e;
  color: #fff;
}
.ts-sc__btn:hover {
  opacity: 0.9;
}

/* --- ITEMS --- */
.woocommerce-mini-cart-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 0 12px 50px;
  border-bottom: 1px solid #eee;
  position: relative;
  min-height: 80px;
  flex-wrap: wrap;
}
.woocommerce-mini-cart-item img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  margin-right: 12px;
  flex-shrink: 0;
}
.ts-sc__item-info {
  flex: 1;
  min-width: 0;
  margin-bottom: 8px;
}
.ts-sc__item-info a {
  color: #000;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.remove {
  position: absolute;
  top: 12px;
  left: 0;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #c00;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd;
  border-radius: 50%;
  text-decoration: none;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
a.remove:hover {
  background: #c00;
  color: #fff;
  border-color: #c00;
}

/* --- QTY --- */
.ts-sc__qty-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  margin-top: 8px;
}
.ts-sc__qty-input {
  width: 56px;
  height: 36px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}
.ts-sc__plus,
.ts-sc__minus {
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f8f8f8;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ts-sc__plus {
  background: #1e3a1e;
  color: #fff;
  border-color: #1e3a1e;
}
.ts-sc-subtotal {
  font-weight: 700;
  color: #000;
  margin-left: auto;
  white-space: nowrap;
}

/* --- +1 badge --- */
.ts-sc__plusone {
  position: absolute;
  bottom: 72px;
  right: 10px;
  background: #1e3a1e;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.35s;
}
.ts-sc__plusone.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- BLOKADA SCROLLA TŁA --- */
.ts-sc--open,
html.ts-sc--open {
  overflow: hidden !important;
}

/* --- ASTRA FIX --- */
.ast-mini-cart,
.ast-header-woo-cart,
.woocommerce-mini-cart {
  overflow: visible !important;
  height: auto !important;
  display: block !important;
}
.ast-mini-cart-empty {
  display: none !important;
}

/* === FIX: Scroll panelu koszyka === */
#ts-sc-panel .ts-sc__body {
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#ts-sc-panel .widget_shopping_cart_content {
  flex: 1 1 auto;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#ts-sc-panel .widget_shopping_cart_content::-webkit-scrollbar {
  display: none;
}

/* Przyciski zawsze widoczne */
#ts-sc-panel .ts-sc__footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e6e6e6;
  z-index: 5;
}
#ts-sc-panel {
  transition: transform 0.2s ease-out;
}

/* === MOBILE === */
@media (max-width: 768px) {
  .ts-sc__panel {
    top: auto;
    left: 0;
    right: auto;
    bottom: -100%;
    width: 100%;
    max-height: 80vh;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
    transition: bottom 0.3s ease-out;
  }
  .ts-sc--open .ts-sc__panel {
    bottom: 0;
  }
  #ts-sc-toggle {
    bottom: 20px;
    left: 20px !important;
    right: auto !important;
  }
}/* === WYGLĄD PANELU KOSZYKA (LEWA STRONA) === */
.ts-sc__panel {
  left: -400px;
  right: auto;
  width: 380px;
  height: 100vh;
  background: #fff;
  box-shadow: 3px 0 16px rgba(0, 0, 0, 0.25);
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
  overflow: hidden;
  transform: translateX(-20px);
  opacity: 0;
  transition: transform 0.35s ease-out, opacity 0.35s ease-out;
}

.ts-sc--open .ts-sc__panel {
  left: 0;
  transform: translateX(0);
  opacity: 1;
}

/* === NAGŁÓWEK === */
.ts-sc__header {
  padding: 22px 24px;
  border-bottom: 1px solid #e6e6e6;
  background: #fff;
  border-top-right-radius: 20px;
}

/* === STOPKA === */
.ts-sc__footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e6e6e6;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  justify-content: center;
  align-items: center;
  border-bottom-right-radius: 20px;
}

.ts-sc__btn {
  width: 100%;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  transition: 0.2s;
}
.ts-sc__btn:hover {
  transform: scale(1.02);
}

/* === MOBILE === */
@media (max-width: 768px) {
  .ts-sc__panel {
    top: auto;
    left: 0;
    bottom: -100%;
    width: 100%;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.35s ease-out, opacity 0.35s ease-out;
  }
  .ts-sc--open .ts-sc__panel {
    bottom: 0;
    transform: translateY(0);
    opacity: 1;
  }
}
@media (max-width: 768px) {
  #ts-sc-toggle {
    position: fixed !important;
    bottom: 5px !important; 
    left: 5px !important;
    right: auto !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 99999;
  }
}
/* przeniesienie subtotalu do stopki — BEZ zmiany HTML */
.woocommerce-mini-cart__total.total {
    position: sticky;
    bottom: 0px; /* dopasowane do Twojej stopki */
    background: #fff;
    padding: 15px 20px;
    z-index: 50;
    border-top: 1px solid #eee;
    margin: 0;
    text-align: center;
}
/* KWOTA zawsze widoczna nad listą na desktop i mobile */
#ts-sc-panel .widget_shopping_cart_content {
    position: relative !important;
}

/* Subtotal (Kwota) zawsze widoczny i nigdy nie schowany */
.woocommerce-mini-cart__total.total {
    position: sticky !important;
    bottom: 0 !important;
    background: #fff;
    padding: 15px 20px;
    z-index: 20 !important; /* ponad stopką */
    border-top: 1px solid #eee;
}
/* ============================================================
   🛠 FIX #1 — SUBTOTAL (KWOTA) NIE WYŚWIETLA SIĘ NA MOBILE
   ============================================================ */

/* Sticky subtotal musi działać — pełna poprawka */
@media (max-width: 768px) {

  /* Usunięcie overflow:hidden z rodzica – blokowało sticky */
  #ts-sc-panel .ts-sc__body {
      overflow: visible !important;
  }

  /* Kontener scrollujący — musi być relative */
  #ts-sc-panel .widget_shopping_cart_content {
      position: relative !important;
      display: flex !important;
      flex-direction: column !important;
  }

  /* Subtotal na samym dole listy i zawsze widoczny */
  .woocommerce-mini-cart__total.total {
      order: 999 !important;
      position: sticky !important;
      bottom: 0 !important;
      background: #fff !important;
      padding: 15px 20px !important;
      margin: 0 !important;
      z-index: 50 !important;
      border-top: 1px solid #eee !important;
      text-align: center;
  }
}

/* ============================================================
   🛠 FIX #2 — IKONA KOSZYKA NIE NACHODZI NA TREŚĆ NA MOBILE
   ============================================================ */
@media (max-width: 768px) {
  #ts-sc-toggle {
      position: fixed !important;
      bottom: 20px !important;
      left: 20px !important;
      right: auto !important;
      z-index: 99999 !important;
      transform: none !important;
  }
}

/* ============================================================
   🛠 FIX #3 — ZABEZPIECZENIE PRZECIWKO NADPISANIOM TŁA / SCROLLA
   ============================================================ */

/* Lista produktów zawsze scrollowana poprawnie, także na desktop */
#ts-sc-panel .widget_shopping_cart_content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none;
}
#ts-sc-panel .widget_shopping_cart_content::-webkit-scrollbar {
    display: none;
}

/* Powtórne zabezpieczenie sticky subtotalu na desktop */
.woocommerce-mini-cart__total.total {
    background: #fff;
    z-index: 20;
}

/* ============================================================
   🛠 FIX #4 — UKRYCIE +1 (jeśli nadal istnieje w DOM)
   ============================================================ */
.ts-sc__plusone {
    display: none !important;
}
/* ============================================================
   🛠 FIX #1 — SUBTOTAL (KWOTA) NIE WYŚWIETLA SIĘ NA MOBILE
   ============================================================ */

/* Sticky subtotal musi działać — pełna poprawka */
@media (max-width: 768px) {

  /* Usunięcie overflow:hidden z rodzica – blokowało sticky */
  #ts-sc-panel .ts-sc__body {
      overflow: visible !important;
  }

  /* Kontener scrollujący — musi być relative */
  #ts-sc-panel .widget_shopping_cart_content {
      position: relative !important;
      display: flex !important;
      flex-direction: column !important;
  }

  /* Subtotal na samym dole listy i zawsze widoczny */
  .woocommerce-mini-cart__total.total {
      order: 999 !important;
      position: sticky !important;
      bottom: 0 !important;
      background: #fff !important;
      padding: 15px 20px !important;
      margin: 0 !important;
      z-index: 50 !important;
      border-top: 1px solid #eee !important;
      text-align: center;
  }
}

/* ============================================================
   🛠 FIX #2 — IKONA KOSZYKA NIE NACHODZI NA TREŚĆ NA MOBILE
   ============================================================ */
@media (max-width: 768px) {
  #ts-sc-toggle {
      position: fixed !important;
      bottom: 20px !important;
      left: 20px !important;
      right: auto !important;
      z-index: 99999 !important;
      transform: none !important;
  }
}

/* ============================================================
   🛠 FIX #3 — ZABEZPIECZENIE PRZECIWKO NADPISANIOM TŁA / SCROLLA
   ============================================================ */

/* Lista produktów zawsze scrollowana poprawnie, także na desktop */
#ts-sc-panel .widget_shopping_cart_content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none;
}
#ts-sc-panel .widget_shopping_cart_content::-webkit-scrollbar {
    display: none;
}

/* Powtórne zabezpieczenie sticky subtotalu na desktop */
.woocommerce-mini-cart__total.total {
    background: #fff;
    z-index: 20;
}

/* ============================================================
   🛠 FIX #4 — UKRYCIE +1 (jeśli nadal istnieje w DOM)
   ============================================================ */
.ts-sc__plusone {
    display: none !important;
}
