/* Ensure avatars are visible for both left and right aligned messages */
.chat .chat-image {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure chat-end avatars are positioned correctly */
.chat-end .chat-image {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  grid-column-start: 2 !important;
  grid-row: span 2 / span 2 !important;
}

/* Ensure chat-start avatars are positioned correctly */
.chat-start .chat-image {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  grid-column-start: 1 !important;
  grid-row: span 2 / span 2 !important;
}

/* Image width constraints for chat bubbles */
.chat-bubble {
  max-width: 100% !important;
  overflow: hidden !important;
}

.chat-bubble img {
  max-width: 280px !important;
  width: auto !important;
  height: auto !important;
  max-height: 192px !important;
  object-fit: cover !important;
  border-radius: 0.5rem !important;
}

/* Specific constraints for right-aligned messages (bg-primary) */
.chat-end .chat-bubble img {
  max-width: 280px !important;
  width: auto !important;
  height: auto !important;
  max-height: 192px !important;
  object-fit: cover !important;
}

/* Specific constraints for left-aligned messages (bg-secondary) */
.chat-start .chat-bubble img {
  max-width: 280px !important;
  width: auto !important;
  height: auto !important;
  max-height: 192px !important;
  object-fit: cover !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .chat-bubble img {
    max-width: 200px !important;
    max-height: 150px !important;
  }
  
  .chat-end .chat-bubble img,
  .chat-start .chat-bubble img {
    max-width: 200px !important;
    max-height: 150px !important;
  }
}
