/* עגלת קניות - מרכז שטרן */
/* משתמש במשתני CSS הקיימים של האתר */

.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.cart-backdrop.on {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(360px, 90vw);
  background: #fff;
  z-index: 9600;
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 18px;
  box-shadow: -20px 0 40px -20px rgba(15, 23, 42, 0.35);
}
[dir="rtl"] .cart-drawer {
  transform: translateX(-105%);
}
.cart-drawer.on,
.cart-drawer.open {
  transform: none;
}

.cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.cart-drawer-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.cart-drawer-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.18s ease, color 0.18s ease;
}
.cart-drawer-close:hover {
  border-color: var(--mine);
  color: var(--green);
}
.cart-drawer-close svg {
  width: 18px;
  height: 18px;
}

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  margin: 0 -18px;
  padding-inline: 18px;
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
}
.cart-empty svg {
  width: 48px;
  height: 48px;
  color: var(--soft);
  margin: 0 auto 16px;
}
.cart-empty p {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
}
.btn-cart-browse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.18s ease;
}
.btn-cart-browse:hover {
  background: var(--green-dark);
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.cart-item:last-child {
  border-bottom: 0;
}
.cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--green-light);
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.cart-item-price.no-price {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}
.cart-item-remove {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  flex: 0 0 auto;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.cart-item-remove:hover {
  border-color: #e04040;
  color: #e04040;
  background: #fff5f5;
}
.cart-item-remove svg {
  width: 16px;
  height: 16px;
}

.cart-drawer-foot {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}
.cart-total strong {
  font-size: 20px;
  color: var(--accent);
}
.btn-cart-checkout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  transition: background 0.18s ease, transform 0.18s ease;
  min-height: 48px;
}
.btn-cart-checkout:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.btn-cart-checkout:active {
  transform: translateY(0);
}

/* Toast */
.cart-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 20px);
  z-index: 9900;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 14px 30px -14px rgba(15, 23, 42, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.cart-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* כפתורי דף קורס */
.course-cta-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.btn-buy-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 32px;
  box-shadow: 0 10px 24px -12px rgba(118, 25, 48, 0.65);
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  min-height: 48px;
  min-width: 160px;
}
.btn-buy-now:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -14px rgba(118, 25, 48, 0.75);
}
.btn-buy-now:active {
  transform: translateY(0);
}

.btn-add-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--green);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  padding: 13px 28px;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  min-height: 48px;
  min-width: 160px;
}
.btn-add-cart:hover {
  border-color: var(--green-dark);
  background: var(--green-lighter);
  color: var(--green);
}
.btn-add-cart:active {
  transform: translateY(1px);
}
.btn-add-cart.in-cart {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
  cursor: default;
}
.btn-add-cart.in-cart:hover {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
}

.cta-contact-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}
.cta-contact-link:hover {
  color: var(--green-dark);
}

/* פס דביק במובייל */
.sticky-buy-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 9500;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px -18px rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sticky-buy-bar.show {
  transform: translateY(0);
}
.sticky-buy-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.sticky-buy-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}
.sticky-buy-text {
  min-width: 0;
}
.sticky-buy-text b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.sticky-buy-text span {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}
.sticky-buy-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}
.sticky-buy-actions button {
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  border: 0;
}
.btn-sticky-buy {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(118, 25, 48, 0.65);
}
.btn-sticky-buy:hover {
  background: var(--accent-dark);
}
.btn-sticky-add {
  background: #fff;
  color: var(--green-dark);
  border: 2px solid var(--green) !important;
}
.btn-sticky-add:hover {
  background: var(--green-lighter);
  color: var(--green);
}
.btn-sticky-add.in-cart {
  background: var(--green-light);
  color: var(--green-dark);
  border-color: var(--green) !important;
}

/* כפתור הוסף לעגלה בכרטיס בקטלוג */
.btn-add-catalog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: var(--green-dark);
  border: 1.5px solid var(--green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  min-height: 36px;
}
.btn-add-catalog:hover {
  border-color: var(--green-dark);
  background: var(--green-lighter);
  color: var(--green);
}
.btn-add-catalog.added {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green-dark);
}

/* התאמה למונה עגלה קיים */
.cart-count {
  background: var(--accent) !important;
}

/* מובייל - הסתרת פס דביק בדסקטופ */
@media (min-width: 761px) {
  .sticky-buy-bar {
    display: none !important;
  }
}

@media (max-width: 760px) {
  .course-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-buy-now,
  .btn-add-cart {
    width: 100%;
    min-width: 0;
  }
  .sticky-buy-info {
    flex: 1;
  }
  .sticky-buy-text b {
    font-size: 13px;
  }
  .sticky-buy-text span {
    font-size: 14px;
  }
  .sticky-buy-actions {
    flex-direction: column;
    width: 100%;
  }
  .sticky-buy-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .cart-drawer {
    width: 100vw;
    padding: 14px;
  }
  .cart-drawer-body {
    margin: 0 -14px;
    padding-inline: 14px;
  }
  .cart-item-img {
    width: 56px;
    height: 56px;
  }
  .btn-buy-now,
  .btn-add-cart {
    font-size: 15px;
    padding: 14px 20px;
  }
}

/* Floating cart button for course pages */
.floating-cart-btn {
  position: fixed;
  bottom: 20px;
  inset-inline-start: 20px;
  z-index: 9000;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 26px -10px rgba(15, 23, 42, 0.45);
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.floating-cart-btn:hover {
  border-color: var(--mine);
  color: var(--green);
  transform: scale(1.05);
}
.floating-cart-btn .cart-count {
  background: var(--accent);
}

/* Mobile adjustments for floating cart button */
@media (max-width: 760px) {
  .floating-cart-btn {
    bottom: 90px; /* Above sticky buy bar */
    inset-inline-start: 14px;
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .floating-cart-btn {
    bottom: 100px;
    inset-inline-start: 14px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cart-backdrop,
  .cart-drawer,
  .cart-toast,
  .sticky-buy-bar {
    transition: none !important;
  }
}
/* תיקון 10.11: פס דביק בטלפון - שני כפתורים זה ליד זה, בלי פרטי הקורס */
@media (max-width: 760px) {
  .sticky-buy-bar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .sticky-buy-info { display: none; }
  .sticky-buy-actions { flex-direction: row; width: 100%; gap: 10px; }
  .sticky-buy-actions button { flex: 1 1 0; width: auto; min-height: 48px; font-size: 15px; }
  .btn-sticky-add { background: #fff; color: var(--ink); border: 1.5px solid var(--ink) !important; }
  .floating-cart-btn, body .floating-cart-btn { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
