/* main.css */

.conv_avatar_wrapper {
  position: relative;
  margin-right: 10px;
}

.conv_avatar_wrapper.unread_border::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 56px;
  height: 56px;
  border: 3px solid blue;
  border-radius: 50%;
  pointer-events: none;
}

.conv_preview {
  color: #666;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation_header {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 10px;
}

.conversation_header_avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
}
.conversation_header_title {
  font-size: 1.2em;
  font-weight: bold;
}

/* Basic layout for the conversation list */
.conversations_list {
  
  max-height: 70vh;
  overflow-y: auto;
  padding: 0;
}

#conversation_list_container {
  border-right: 1px solid #ccc;
}

/* Each conversation item */
.conversation_item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 8px 0 8px 8px; /* ✅ Added left padding */
  cursor: pointer;
  position: relative;
  overflow: hidden; /* ✅ Let the ring show */
}

.conversation_item:hover {
  background: #fafafa;
}


.conversation_item.selected {
  background-color: #e0e0e0; /* adjust as needed */
}

.conversation_item img {
  margin-right: 10px; /* space between avatar and text */
}

.conv_left_area {
  flex: 1;          /* fill remaining space */
  min-width: 0;     /* crucial for text truncation in flex layout */
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left:8px;
}
.conv_user_name,
.conv_preview {
  white-space: nowrap;       /* single line */
  overflow: hidden;          /* hide overflow */
  text-overflow: ellipsis;   /* add '...' at the end */
  line-height: normal;
}
.conv_user_name {
  font-weight: 600;
  font-size: 1em;
  margin-bottom: 0px;
}

.conv_preview {
  color: #666;
  font-size: 0.9em;
}

.conv_date_right {
  margin-left: 8px;
  font-size: 0.8em;
  color: #999;
  white-space: nowrap;
}

/* message_viewer styles */
.message_viewer {
  min-height: 50vh;
  padding: 0;
  position: relative;
}
.message_viewer .loading {
  color: #666;
}
.messages_container {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 10px;
}

/* A single message item */
.message_item {
  display: flex;
  align-items: flex-start;  /* Align items at the top */
  background: #f9f9f9;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.message_item .msg_content {
  flex: 1;
  font-size: 0.95em;
  /* Provide some right margin so text doesn't bump right against the date */
  margin-right: 10px;
}

.message_item .msg_date {
  flex: none;
  font-size: 0.8em;
  color: #999;
  white-space: nowrap;
  /* Ensure the date stays at the top */
  align-self: flex-start;
}

.message_item.my_message {
  background-color: #343a40; /* Dark background */
  color: #fff;
  margin-left: auto;
  justify-content: flex-end;
  border-color: #2c2c2c;
}

.message_item.my_message .msg_content {
  color: #fff;
}

.message_item.my_message .msg_date {
  color: #bbb;
}

/* On mobile, hide message_viewer by default */
@media (max-width: 767.98px) {
  #back_to_conversations {
    display: inline-block;
  }
  .conversation_list_container {
    width: 100%;
  }
}