/**
 * Nova Commerce Suite - Interaction Feedback & Cart Resilience.
 */

.ncd-toast {
  display: flex;
  align-items: center;
  gap: var(--ncd-space-2);
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--ncd-color-primary) 18%, transparent);
  border-radius: var(--ncd-radius-pill);
  background: color-mix(in srgb, var(--ncd-color-surface) 96%, var(--ncd-color-primary));
  color: var(--ncd-color-text);
  box-shadow: var(--ncd-shadow-sm);
}

.ncd-toast::before {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--ncd-color-primary);
  color: #fff;
  content: "✓";
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.ncd-toast.is-error {
  border-color: rgb(185 28 28 / 0.22);
  background: #fff7f7;
  color: #991b1b;
}

.ncd-toast.is-error::before {
  background: #b91c1c;
  content: "!";
}

.ncd-toast.is-info::before {
  background: var(--ncd-color-interactive);
  content: "i";
}

.ncd-cart-item.is-action-loading,
.ncd-coupon-form.is-action-loading {
  position: relative;
}

.ncd-cart-item.is-action-loading::after,
.ncd-coupon-form.is-action-loading::after {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgb(255 255 255 / 0.72);
  border-top-color: var(--ncd-color-primary);
  border-radius: 50%;
  content: "";
  animation: ncd-action-spin 650ms linear infinite;
  pointer-events: none;
}

.ncd-cart-item.is-action-loading > *,
.ncd-coupon-form.is-action-loading > * {
  opacity: 0.58;
}

.ncd-recommendations-error {
  display: block;
  padding: var(--ncd-space-3);
  border: 1px dashed var(--ncd-color-border);
  border-radius: var(--ncd-radius-md);
  color: var(--ncd-color-muted);
  font-size: 12px;
  text-align: center;
}

@keyframes ncd-action-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ncd-cart-item.is-action-loading::after,
  .ncd-coupon-form.is-action-loading::after {
    animation-duration: 1.5s !important;
  }
}
