/* Cart Badge Styles
 *
 * The badge is rendered inside the cart anchor and positioned over its top
 * right corner. The anchor is set to `position: relative; display:
 * inline-block` in JS so the offsets below work regardless of whether the
 * anchor wraps an icon (SVG) or plain text ("Cart").
 */

.cart-badge {
  position: absolute !important;
  top: -8px;
  right: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  /* Prevent theme utilities from bumping it around */
  box-sizing: border-box;
}

/* When the badge is dropped onto an icon-only anchor (the header SVG),
 * pull it in slightly so it sits on the icon's corner rather than floating. */
[data-cart-icon] > .cart-badge {
  top: -4px;
  right: -4px;
}

.cart-badge-pop {
  animation: badgePop 250ms ease-out;
}

@keyframes badgePop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-badge-pop {
    animation: none;
  }
}
