
/* Medad Messenger Styles - Final Improved Version */

.messenger-container {
  display: flex;
  flex-direction: row;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  height: 600px;
  max-height: 90vh;
  font-family: Tahoma, sans-serif;
}

.messenger-sidebar {
  width: 300px;
  background-color: #f0f4f8;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background: #0099cc;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 18px;
}

.search-box {
  margin-top: 8px;
  padding: 5px 10px;
}

.search-box input {
  width: 100%;
  padding: 5px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.new-conversation-btn {
  margin: 10px 10px 0 10px;
  padding: 6px 12px;
  background-color: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.new-conversation-btn:hover {
  background-color: #0b5ed7;
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex-grow: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 8px;
  border-bottom: 1px solid #ddd;
  transition: background 0.2s;
}

.conversation-item:hover,
.conversation-item.active {
  background-color: #eaf4fb;
}

.avatar img {
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.conversation-info {
  flex: 1;
  margin-right: 10px;
}

.conversation-name {
  font-weight: bold;
  font-size: 14px;
}

.last-message-preview {
  font-size: 12px;
  color: #555;
}

.last-updated-time {
  font-size: 11px;
  color: #999;
  margin-top: 3px;
}

.unread-count {
  background: #dc3545;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  padding: 2px 6px;
  margin-left: 4px;
}

.messenger-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #ddd;
  overflow: hidden;
}

.chat-header {
  background: #0099cc;
  color: #fff;
  padding: 10px;
  flex-shrink: 0;
}

.chat-header .user-info {
  margin-right: 10px;
}

.chat-header .user-name {
  font-weight: bold;
}

.chat-messages {
  flex-grow: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f8f9fa;
}

.message-wrapper {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.message-wrapper.received {
  align-items: flex-start;
}

.message-bubble {
  position: relative;
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 80%;
  word-break: break-word;
}

.message-wrapper.sent .message-bubble {
  background-color: #d1e7dd;
  color: #0f5132;
}

.message-wrapper.received .message-bubble {
  background-color: #e2e3e5;
  color: #000;
}

.message-content {
  margin: 0;
  line-height: 1.5;
}

.sender-name {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 2px;
  display: block;
}

.timestamp {
  display: block;
  font-size: 11px;
  color: #555;
  margin-top: 4px;
  text-align: left;
  line-height: 1.4;
  direction: ltr;
}

.timestamp small {
  display: block;
  font-size: 10px;
  color: #999;
}

.delete-message-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  font-size: 14px;
}

.delete-message-btn:hover {
  color: #f44336;
}

.chat-input-area {
  display: flex;
  align-items: center;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

.message-input {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
  resize: none;
}

.input-buttons-wrapper {
  display: flex;
  gap: 5px;
  margin-left: 8px;
}

.send-btn,
.attachment-btn {
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.send-btn:hover,
.attachment-btn:hover {
  background: #0b5ed7;
}

.cm-login-required {
  text-align: center;
  padding: 20px;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  border-radius: 5px;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0d6efd;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  margin: auto;
}

@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
}

.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  width: 400px;
  max-width: 90%;
  position: relative;
  text-align: center;
}

.modal-content .close-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
}

.modal-content .modal-footer {
  margin-top: 10px;
}

.modal-content .user-list {
  margin-top: 10px;
  text-align: center;
}
.modal-content .user-list button {
  background: #0d6efd;
  border: none;
  color: #fff;
  margin: 4px 0;
  width: 100%;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
}
.modal-content .user-list button:hover {
  background: #0b5ed7;
}

.empty-chat-message {
  text-align: center;
  padding: 20px;
  color: #666;
}

@media (max-width: 768px) {
  .messenger-container {
    flex-direction: column;
  }
  .messenger-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }
}
