/**
 * Eco Core — Side Cart Upsell slider.
 * Rendered server-side by the theme inside .eco-sidecart__upsell, between the
 * cart body and footer. Horizontal scroll-snap track + prev/next nav.
 * Mobile-first; works on touch (native swipe) and desktop (buttons + drag).
 */
.eco-sidecart__upsell:empty {
  display: none;
}

.eco-sidecart__upsell {
  flex: 0 0 auto;
  padding: 0 16px;
}

.eco-sidecart-upsell {
  --eco-su-gap: 10px;
  margin: 14px 0 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
}

.eco-sidecart-upsell__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.eco-sidecart-upsell__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #1e293b;
}

.eco-sidecart-upsell__nav {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.eco-sidecart-upsell__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 50%;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.eco-sidecart-upsell__btn:hover {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}

.eco-sidecart-upsell__btn:active {
  transform: scale(0.94);
}

.eco-sidecart-upsell__btn[disabled] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.eco-sidecart-upsell__track {
  display: flex;
  gap: var(--eco-su-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.eco-sidecart-upsell__track::-webkit-scrollbar {
  display: none;
}

.eco-sidecart-card {
  flex: 0 0 calc((100% - var(--eco-su-gap)) / 2);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.eco-sidecart-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 22px -12px rgba(15, 23, 42, 0.35);
}

.eco-sidecart-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.eco-sidecart-card__image {
  display: block;
  aspect-ratio: 1 / 1;
  background: #f1f5f9;
  overflow: hidden;
}

.eco-sidecart-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eco-sidecart-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 10px 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: #1e293b;
  min-height: 2.7em;
}

.eco-sidecart-card__foot {
  margin-top: auto;
  padding: 8px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.eco-sidecart-card__price {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.eco-sidecart-card__price del {
  font-weight: 400;
  opacity: 0.55;
  font-size: 11px;
  margin-right: 3px;
}

.eco-sidecart-card__price ins {
  text-decoration: none;
}

.eco-sidecart-card__add.button {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 11px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  background: #4338ca;
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.eco-sidecart-card__add.button:hover {
  background: #3730a3;
}

.eco-sidecart-card__add.button.loading,
.eco-sidecart-card__add.button.added {
  opacity: 0.85;
}

.eco-sidecart-card__add.button.added::after {
  display: none;
}

/* Wider cards once the side cart panel is roomy enough. */
@media (min-width: 420px) {
  .eco-sidecart-card {
    flex-basis: calc((100% - var(--eco-su-gap) * 2) / 2.4);
  }
}

@media (prefers-color-scheme: dark) {
  .eco-sidecart-upsell {
    border-top-color: rgba(148, 163, 184, 0.22);
  }
  .eco-sidecart-upsell__title {
    color: #e2e8f0;
  }
  .eco-sidecart-upsell__btn {
    background: #1e293b;
    border-color: rgba(148, 163, 184, 0.28);
    color: #e2e8f0;
  }
  .eco-sidecart-card {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.22);
  }
  .eco-sidecart-card__title {
    color: #e2e8f0;
  }
  .eco-sidecart-card__price {
    color: #f8fafc;
  }
}
