/* Toast helper styles (shared) */
.cart-toast {
  --toast-bg: var(--color-primario, #ff91b7);
  --toast-text: #ffffff;
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 120%);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px 16px;
  background: var(--toast-bg);
  color: var(--toast-text);
  border-radius: 16px;
  border: none;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.4s ease,
    opacity 0.4s ease;
  z-index: 9999;
}

.cart-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.cart-toast--error {
  --toast-bg: #ef476f;
}

.cart-toast--warning {
  --toast-bg: #f6c166;
  --toast-text: #ffffff;
}

.cart-toast--warning .cart-toast-icon {
  color: #ffffff;
}

.cart-toast--info {
  --toast-bg: #4a90e2;
}

.cart-toast-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--toast-text);
  flex-shrink: 0;
}

.cart-toast-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.cart-toast-message {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--toast-text);
  word-break: break-word;
}

.cart-toast-close {
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--toast-text) 82%, transparent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.cart-toast-close:hover {
  background: rgba(255, 255, 255, 0.22);
  color: var(--toast-text);
}

.cart-toast-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.cart-toast-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  transform-origin: left;
  animation: toast-progress var(--toast-duration, 2600ms) linear forwards;
}

.cart-toast.show .cart-toast-icon {
  animation: toast-icon-pop 0.5s ease;
}

@keyframes toast-progress {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@keyframes toast-icon-pop {
  0% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 600px) {
  .cart-toast {
    left: 16px;
    right: 16px;
    transform: translateY(120%);
    max-width: none;
    min-width: 0;
  }

  .cart-toast.show {
    transform: translateY(0);
  }

  .cart-toast-message {
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-toast {
    transition: none;
  }

  .cart-toast.show .cart-toast-icon {
    animation: none;
  }

  .cart-toast-progress::after {
    animation: none;
  }
}
