/* ——— Mini Cart (نوار پایین — موبایل) ——— */
.mini-cart {
  --mini-cart-radius: 16px;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--bottom-nav-h, 64px) + var(--safe-bottom, 0px) + 10px);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  width: auto;
  max-width: min(380px, calc(100vw - 24px));
  margin-inline: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 31, 28, 0.08);
  border-radius: var(--mini-cart-radius);
  box-shadow: 0 8px 28px rgba(26, 31, 28, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition:
    opacity 0.28s ease,
    transform 0.36s cubic-bezier(0.22, 0.9, 0.3, 1),
    visibility 0.28s;
  cursor: pointer;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

.mini-cart.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mini-cart.bounce {
  animation: cartBounce 0.55s cubic-bezier(0.22, 0.9, 0.3, 1);
}

@keyframes cartBounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-5px); }
  65% { transform: translateY(1px); }
}

.mini-cart-icon-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--bg-alt, #f4f7f5);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mini-cart-icon-wrap svg {
  width: 22px;
  height: 22px;
  color: var(--brand, #81B061);
}

#miniCartCount {
  position: absolute;
  top: -5px;
  inset-inline-start: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(129, 176, 97, 0.35);
}

.mini-cart-info {
  flex: 1;
  min-width: 0;
}

.mini-cart-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted, #5c6560);
  display: block;
  margin-bottom: 2px;
}

.mini-cart-total {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--brand, #81B061);
  white-space: nowrap;
  line-height: 1.2;
}

.mini-cart-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.mini-cart-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ——— پرواز محصول ——— */
.fly-to-cart {
  position: fixed;
  z-index: 350;
  pointer-events: none;
  object-fit: cover;
  border-radius: 16px;
  transform: translate(-50%, -50%);
  box-shadow:
    0 14px 36px rgba(16, 28, 22, 0.22),
    0 3px 10px rgba(16, 28, 22, 0.12);
  will-change: transform, opacity;
}

.fly-to-cart--dot {
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand, #81b061) 0%, var(--brand-hover, #719552) 100%);
  box-shadow: 0 10px 24px rgba(129, 176, 97, 0.38);
}

.header-cart.cart-pop,
.mini-cart.cart-pop {
  animation: cartTargetNudge 0.78s cubic-bezier(0.33, 0.92, 0.28, 1);
}

@keyframes cartTargetNudge {
  0% { transform: translateY(0) scale(1); }
  22% { transform: translateY(-3px) scale(1.1); }
  48% { transform: translateY(0) scale(0.96); }
  72% { transform: translateY(-1px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

.product-card-add.is-adding,
.pdp-btn--primary.is-adding,
.btn-add.is-adding {
  pointer-events: none;
}

.product-card-add.is-adding {
  animation: addBtnPulse 0.72s cubic-bezier(0.33, 0.92, 0.28, 1);
}

.pdp-btn--primary.is-adding {
  animation: pdpAddBtnPulse 0.82s cubic-bezier(0.33, 0.92, 0.28, 1);
}

@keyframes addBtnPulse {
  0% { transform: scale(1); box-shadow: 0 4px 14px rgba(129, 176, 97, 0.32); }
  28% { transform: scale(0.88); box-shadow: 0 2px 8px rgba(129, 176, 97, 0.22); }
  58% { transform: scale(1.08); box-shadow: 0 8px 22px rgba(129, 176, 97, 0.42); }
  100% { transform: scale(1); box-shadow: 0 4px 14px rgba(129, 176, 97, 0.32); }
}

@keyframes pdpAddBtnPulse {
  0% { transform: scale(1); }
  24% { transform: scale(0.97); }
  52% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.product-card-img.cart-add-pulse img,
.pdp-gallery-main.cart-add-pulse img,
.pdp-gallery-frame.cart-add-pulse img {
  animation: productMediaAddPulse 0.58s cubic-bezier(0.33, 0.92, 0.28, 1);
}

@keyframes productMediaAddPulse {
  0%, 100% { transform: scale(1); }
  38% { transform: scale(0.96); }
  68% { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .header-cart.cart-pop,
  .mini-cart.cart-pop,
  .product-card-add.is-adding,
  .pdp-btn--primary.is-adding,
  .product-card-img.cart-add-pulse img,
  .pdp-gallery-main.cart-add-pulse img,
  .pdp-gallery-frame.cart-add-pulse img {
    animation: none;
  }
}

/* ——— Cart Drawer ——— */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  pointer-events: none;
  visibility: hidden;
}
.cart-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}
.cart-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 20, 0.5);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cart-drawer.is-open .cart-drawer-backdrop {
  opacity: 1;
}
.cart-drawer-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: min(92vh, 720px);
  background: #fafbfb;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: var(--font-body);
  box-shadow: 0 -12px 48px rgba(20, 28, 24, 0.14);
  transform: translateY(100%);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.35s ease;
  padding-bottom: calc(var(--safe-bottom, 0px) + 4px);
}
.cart-drawer.is-open .cart-drawer-panel {
  transform: translateY(0);
  opacity: 1;
}
.cart-drawer-handle {
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  background: var(--border, #dde4e0);
  border-radius: 999px;
  flex-shrink: 0;
}

/* دسکتاپ: مودال وسط صفحه */
@media (min-width: 640px) {
  .cart-drawer-handle { display: none; }
  .cart-drawer {
    align-items: center;
    padding: 24px 16px;
  }
  .cart-drawer-panel {
    width: min(520px, 100%);
    max-height: min(88vh, 760px);
    border-radius: var(--radius-xl, 24px);
    box-shadow: 0 24px 64px rgba(20, 28, 24, 0.22);
    transform: translateY(32px) scale(0.94);
  }
  .cart-drawer.is-open .cart-drawer-panel {
    transform: translateY(0) scale(1);
  }
}

.cart-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 1rem 1rem 0.75rem;
  background: #fff;
  border-bottom: 1px solid rgba(26, 31, 28, 0.06);
  flex-shrink: 0;
}
.cart-drawer-header-text { flex: 1; min-width: 0; }
.cart-drawer-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--text, #1a1f1c);
  letter-spacing: -0.02em;
}
.cart-drawer-subtitle {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted, #5c6560);
  margin: 2px 0 0;
}
.cart-drawer-deli {
  margin-top: 6px;
}
.cart-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #5c6560);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.cart-drawer-close:hover {
  background: rgba(26, 31, 28, 0.06);
  color: var(--text, #1a1f1c);
}

.cart-drawer-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.cart-drawer-body {
  padding: 0.65rem 1rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cart-drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2.5rem 1rem;
  color: var(--text-muted, #5c6560);
  font-size: 0.9rem;
}
.cart-drawer-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border, #e8ece9);
  border-top-color: var(--brand, #81B061);
  border-radius: 50%;
  animation: cartSpin 0.7s linear infinite;
}
@keyframes cartSpin {
  to { transform: rotate(360deg); }
}

/* ——— سبد خالی (مینیمال) ——— */
.cart-drawer.is-cart-empty .cart-drawer-body {
  padding: 0.35rem 1rem 0;
}

.cart-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.5rem 0.85rem;
  gap: 0.35rem;
}

.cart-empty-state__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(26, 31, 28, 0.04);
  color: rgba(26, 31, 28, 0.28);
  margin-bottom: 0.15rem;
}

.cart-empty-state__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text, #1a1f1c);
  letter-spacing: -0.02em;
}

.cart-empty-state__msg {
  margin: 0;
  max-width: 16rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-muted, #5c6560);
}

.cart-empty-state__shop {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand, #81B061);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.cart-empty-state__shop--muted {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.85;
}

.cart-empty-state__shop:hover {
  color: var(--brand-hover, #719552);
  border-bottom-color: currentColor;
}

/* ——— آیتم سبد (فشرده) ——— */
.cart-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(26, 31, 28, 0.06);
  animation: cartItemIn 0.3s ease backwards;
}
@keyframes cartItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.cart-item-media {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-alt, #f4f7f5);
  text-decoration: none;
}
.cart-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-item-img.is-placeholder {
  opacity: 0;
}
.cart-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.cart-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cart-item-row--top {
  align-items: flex-start;
}
.cart-item-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.45;
}
.cart-item-title a {
  color: var(--text, #1a1f1c);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cart-item-title a:hover {
  color: var(--brand, #81B061);
}
.cart-item-row--foot {
  justify-content: space-between;
}
.cart-item-prices {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cart-item-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand, #81B061);
  white-space: nowrap;
}
.cart-item-line-total {
  font-size: 0.72rem;
  color: var(--text-muted, #5c6560);
}
.cart-qty-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--bg-alt, #f4f7f5);
  border-radius: 999px;
  padding: 2px;
  flex-shrink: 0;
}
.cart-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #fff;
  border-radius: 999px;
  font-size: 1rem;
  font-family: var(--font-body);
  cursor: pointer;
  line-height: 1;
  color: var(--text, #1a1f1c);
  box-shadow: 0 1px 2px rgba(26, 31, 28, 0.06);
  transition: background 0.15s, color 0.15s;
}
.cart-qty-btn:hover {
  color: var(--brand, #81B061);
}
.cart-qty-val {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text, #1a1f1c);
}
.cart-item-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted, #8a9490);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.cart-item-remove:hover {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.08);
}

/* ——— بخش پیشنهاد دِلی (ادغام‌شده) ——— */
.cart-deli-reco-section {
  padding: 0.85rem 0 1rem;
  margin-top: 6px;
  border-top: 1px solid rgba(129, 176, 97, 0.14);
  background: linear-gradient(180deg, rgba(129, 176, 97, 0.05) 0%, transparent 100%);
}

/* پیشنهاد وقتی سبد خالی است — لیست مینیمال */
.cart-deli-reco-section--empty {
  padding: 0.5rem 0 0.75rem;
  margin-top: 0;
  border-top: 1px solid rgba(26, 31, 28, 0.06);
  background: transparent;
}

.cart-deli-reco-section--empty .cart-deli-reco-head {
  padding: 0 1rem 0.45rem;
  gap: 0;
}

.cart-deli-reco-section--empty .cart-deli-reco-avatar,
.cart-deli-reco-section--empty .cart-deli-reco-lead {
  display: none;
}

.cart-deli-reco-section--empty .cart-drawer-section-title {
  margin: 0;
  padding: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted, #8a9490);
}

.cart-empty-picks {
  display: flex;
  flex-direction: column;
  padding: 0 1rem 0.25rem;
  margin: 0;
  list-style: none;
}

.cart-empty-pick {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(26, 31, 28, 0.05);
  animation: cartItemIn 0.28s ease backwards;
}

.cart-empty-pick:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cart-empty-pick__media {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(26, 31, 28, 0.04);
  flex-shrink: 0;
  text-decoration: none;
}

.cart-empty-pick__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-empty-pick__ph {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f2f5f3 0%, #e8ece9 100%);
}

.cart-empty-pick__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-empty-pick__name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text, #1a1f1c);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-empty-pick__name:hover {
  color: var(--brand, #81B061);
}

.cart-empty-pick__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cart-empty-pick__tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(192, 57, 43, 0.08);
  color: #b03a2e;
  line-height: 1.3;
}

.cart-empty-pick__price {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text, #1a1f1c);
  white-space: nowrap;
}

.cart-empty-pick__add {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(129, 176, 97, 0.35);
  border-radius: 50%;
  background: #fff;
  color: var(--brand, #81B061);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.cart-empty-pick__add span {
  margin-top: -1px;
}

.cart-empty-pick__add:hover {
  background: var(--brand, #81B061);
  border-color: var(--brand, #81B061);
  color: #fff;
}

.cart-empty-pick__add.is-adding {
  animation: addBtnPulse 0.72s cubic-bezier(0.33, 0.92, 0.28, 1);
}

@media (min-width: 640px) {
  .cart-drawer.is-cart-empty .cart-drawer-body {
    padding-inline: 1.25rem;
  }

  .cart-empty-state {
    padding-top: 1.5rem;
  }

  .cart-deli-reco-section--empty .cart-deli-reco-head,
  .cart-empty-picks {
    padding-inline: 1.25rem;
  }

  .cart-empty-pick {
    padding: 11px 0;
  }
}

.cart-deli-reco-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0 1rem 0.65rem;
}

.cart-deli-reco-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(129, 176, 97, 0.28);
  box-shadow: 0 4px 12px rgba(129, 176, 97, 0.18);
}

.cart-deli-reco-head-text {
  flex: 1;
  min-width: 0;
}

.cart-deli-reco-head .cart-drawer-section-title {
  margin: 0 0 2px;
  padding: 0;
  font-size: 0.86rem;
  color: var(--text, #1a1f1c);
}

.cart-deli-reco-lead {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--text-muted, #5c6560);
}

.cart-drawer-section {
  padding: 0.75rem 0 0.85rem;
  margin-top: 4px;
  border-top: 1px solid rgba(26, 31, 28, 0.06);
  background: transparent;
}
.cart-drawer-section-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  margin: 0 0 0.55rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted, #5c6560);
  letter-spacing: 0.01em;
}
.cart-section-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(129, 176, 97, 0.1);
  border-radius: 6px;
  flex-shrink: 0;
  color: var(--brand, #81B061);
}
.cart-section-icon .deliche-icon {
  width: 14px;
  height: 14px;
}
.cart-product-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 1rem 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(129, 176, 97, 0.25) transparent;
  align-items: stretch;
}
.cart-product-rail::-webkit-scrollbar {
  height: 4px;
}
.cart-product-rail::-webkit-scrollbar-thumb {
  background: rgba(129, 176, 97, 0.25);
  border-radius: 999px;
}

/* کارت پیشنهاد — همان استایل فروشگاه، چیدمان افقی */
.cart-drawer .cart-product-rail .product-card--rail {
  flex: 0 0 168px;
  width: 168px;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100%;
  background: var(--surface-strong, #fff);
  border: 1px solid var(--line, #dfe8e2);
  border-radius: 16px;
  overflow: hidden;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.cart-drawer .cart-product-rail .product-card--rail:hover {
  border-color: color-mix(in srgb, var(--brand, #81B061) 38%, var(--line, #dfe8e2));
  box-shadow: 0 10px 26px rgba(26, 31, 28, 0.08);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-link {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  text-decoration: none;
  color: inherit;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-img {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: linear-gradient(145deg, #f4f9f5 0%, #eef4ef 100%);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.cart-drawer .cart-product-rail .product-card--rail:hover .product-card-img img {
  transform: scale(1.04);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.72rem;
  color: var(--text-muted, #8a9490);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-body {
  padding: 9px 10px 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text, #1a1f1c);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-excerpt {
  font-size: 0.66rem;
  line-height: 1.45;
  color: var(--text-muted, #5c6560);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 4px;
  margin: 2px 0 0;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-meta {
  font-size: 0.6rem;
  color: var(--text-muted, #5c6560);
  line-height: 1.3;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-badge {
  font-size: 0.58rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(129, 176, 97, 0.12);
  color: var(--brand, #81B061);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-badge--organic {
  background: rgba(76, 140, 74, 0.15);
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 10px 10px;
  margin-top: auto;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-foot-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-price {
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--brand, #81B061);
  line-height: 1.25;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-cta {
  display: none;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-add {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand, #81B061);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(129, 176, 97, 0.32);
  transition: transform 0.18s ease, background 0.18s ease;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-add-icon {
  font-size: 1.15rem;
  line-height: 1;
  margin-top: -1px;
}

.cart-drawer .cart-product-rail .product-card--rail .product-card-add:hover {
  background: var(--brand-hover, #719552);
  transform: scale(1.06);
}

.cart-drawer .cart-product-rail .product-card--rail.product-card--out {
  opacity: 0.92;
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer .cart-product-rail .product-card--rail:hover .product-card-img img,
  .cart-drawer .cart-product-rail .product-card--rail .product-card-add:hover {
    transform: none;
  }
}

/* ——— کد تخفیف ——— */
.cart-promo {
  margin-bottom: 0.75rem;
}
.cart-promo-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #5c6560);
}
.cart-promo-row {
  display: flex;
  gap: 0.45rem;
}
.cart-promo-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border, #dce5df);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  background: #fff;
}
.cart-promo-input:focus {
  outline: none;
  border-color: var(--brand, #81B061);
  box-shadow: 0 0 0 3px rgba(129, 176, 97, 0.12);
}
.cart-promo-msg {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: #b42318;
}
.cart-promo-msg.is-success {
  color: var(--brand, #81B061);
}
.cart-promo-applied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: rgba(129, 176, 97, 0.08);
  font-size: 0.82rem;
  color: #1a5c2a;
}
.cart-promo-remove {
  border: none;
  background: transparent;
  color: #8b2e2e;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cart-drawer-discount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #1a5c2a;
}
.cart-drawer-discount strong {
  font-weight: 700;
  color: #1a5c2a;
}

/* ——— فوتر (دو مرحله: خلاصه / تسویه) ——— */
.cart-drawer-footer {
  padding: 0;
  border-top: 1px solid rgba(26, 31, 28, 0.06);
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 -4px 24px rgba(26, 31, 28, 0.06);
}

.cart-footer-browse {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 0.75rem 1rem calc(0.85rem + var(--safe-bottom, 0px));
}

.cart-footer-total-bar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cart-footer-total-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted, #5c6560);
}

.cart-footer-total-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text, #1a1f1c);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.cart-footer-browse .cart-footer-cta {
  grid-column: 2;
  align-self: stretch;
  min-width: 90px;
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.cart-footer-checkout {
  padding: 0.75rem 1rem calc(0.9rem + var(--safe-bottom, 0px));
  background: #fff;
}

.cart-drawer-footer--checkout .cart-footer-browse {
  display: none;
}

.cart-drawer-footer--checkout .cart-footer-checkout {
  display: block;
}

.cart-footer-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #5c6560);
  cursor: pointer;
  transition: color 0.15s;
}

.cart-footer-back:hover {
  color: var(--brand, #81B061);
}

.cart-drawer-panel:has(.cart-drawer-footer--browse:not([hidden])) .cart-drawer-scroll {
  /* فضای بیشتر برای پیشنهادهای دلی وقتی فوتر خلاصه است */
  padding-bottom: 0.25rem;
}
.cart-drawer-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.84rem;
  color: var(--text-muted, #5c6560);
}
.cart-drawer-subtotal strong {
  font-weight: 700;
  color: var(--text, #1a1f1c);
  font-size: 0.88rem;
}
.cart-drawer-subtotal--final {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(26, 31, 28, 0.06);
  font-size: 0.9rem;
  color: var(--text, #1a1f1c);
}
.cart-drawer-subtotal--final strong {
  font-size: 1.05rem;
  color: var(--brand, #81B061);
}
.cart-drawer-footer .btn {
  font-weight: 700;
  border-radius: 12px;
}
.cart-footer-checkout .btn-block {
  width: 100%;
  margin-top: 0.5rem;
  padding: 12px;
  font-size: 0.9rem;
}
.cart-promo {
  margin-bottom: 0.65rem;
}
.cart-promo-label {
  font-size: 0.76rem;
}
.cart-promo-input {
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  border-radius: 10px;
  border-color: rgba(26, 31, 28, 0.1);
}

@media (max-width: 380px) {
  .cart-footer-browse {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .cart-footer-browse .cart-footer-cta {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  .mini-cart {
    left: auto;
    right: 12px;
    inset-inline-start: 12px;
    inset-inline-end: auto;
    margin-inline: 0;
    max-width: min(208px, calc(100vw - 92px));
    padding: 7px 9px;
    gap: 7px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(26, 31, 28, 0.14);
  }

  .mini-cart-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .mini-cart-icon-wrap svg {
    width: 18px;
    height: 18px;
  }

  #miniCartCount {
    top: -4px;
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
    padding: 0 4px;
  }

  .mini-cart-info {
    flex: 1 1 auto;
  }

  .mini-cart-label {
    display: none;
  }

  .mini-cart-total {
    font-size: 0.82rem;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mini-cart-action {
    padding: 0.32rem;
    border-radius: 8px;
    gap: 0;
  }

  .mini-cart-action > span:first-child {
    display: none;
  }

  .mini-cart-action svg {
    width: 13px;
    height: 13px;
  }
}

@media (min-width: 769px) {
  .mini-cart {
    inset-inline: auto;
    left: auto;
    right: 20px;
    bottom: 24px;
    width: min(360px, calc(100vw - 40px));
  }
}

@media (min-width: 1025px) {
  .mini-cart {
    display: none !important;
  }
}

/* ——— تأیید حذف از سبد ——— */
.cart-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-auth-modal, 1200) + 2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.cart-confirm-modal:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

body.cart-confirm-open {
  overflow: hidden;
}

.cart-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 20, 0.48);
  backdrop-filter: blur(4px);
}

.cart-confirm-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 20px;
  background: var(--surface-strong, #fff);
  border: 1px solid rgba(129, 176, 97, 0.18);
  box-shadow: 0 24px 60px rgba(18, 24, 20, 0.22);
  text-align: center;
  transform: translateY(12px) scale(0.96);
  transition: transform 0.24s cubic-bezier(0.33, 0.92, 0.28, 1);
}

.cart-confirm-modal:not([hidden]) .cart-confirm-panel {
  transform: translateY(0) scale(1);
}

.cart-confirm-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem;
  border: 2px solid rgba(129, 176, 97, 0.25);
  box-shadow: 0 8px 20px rgba(129, 176, 97, 0.2);
}

.cart-confirm-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text, #1a1f1c);
}

.cart-confirm-text {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-muted, #5c6560);
}

.cart-confirm-actions {
  display: flex;
  gap: 8px;
}

.cart-confirm-actions .btn {
  flex: 1;
  min-height: 42px;
  font-size: 0.86rem;
}

.cart-confirm-ok {
  background: #c0392b;
  border-color: #c0392b;
}

.cart-confirm-ok:hover {
  background: #a93226;
  border-color: #a93226;
}

@media (prefers-reduced-motion: reduce) {
  .cart-confirm-modal,
  .cart-confirm-panel {
    transition: none;
  }

  .cart-confirm-modal:not([hidden]) .cart-confirm-panel {
    transform: none;
  }
}
