/* Messages container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* Ensure flex child can shrink */
}

.chat-messages > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Message bubbles */
.chat-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: slideIn 0.2s ease-out;
}

.chat-message.sent {
  align-self: flex-end;
  background: #4096ff;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received {
  align-self: flex-start;
  background: #f0f2f5;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

/* System messages */
.chat-message.system {
  align-self: center;
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #e9ecef;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  max-width: 80%;
  text-align: center;
  opacity: 0.8;
  margin: 0 auto;
}

.chat-message.system.audio_start {
  background: #e8f5e8;
  color: #2e7d32;
  border-color: #4caf50;
}

.chat-message.system.audio_end {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}

.chat-message.system.video_start {
  background: #e1f5fe;
  color: #0277bd;
  border-color: #03a9f4;
}

.chat-message.system.video_end {
  background: #fce4ec;
  color: #c2185b;
  border-color: #e91e63;
}

.chat-message.system.command_send {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #2196f3;
}

.chat-message.system.command_ack {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

.chat-message.system.interrupt {
  background: #ffebee;
  color: #c62828;
  border-color: #f44336;
}

.chat-message.system.interrupt_ack {
  background: #fff3e0;
  color: #ef6c00;
  border-color: #ff9800;
}

.chat-message.system.avatar_audio_start {
  background: #e8f5e8;
  color: #2e7d32;
  border-color: #4caf50;
}

.chat-message.system.avatar_audio_end {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}

.chat-message.system.mic_start {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

.chat-message.system.mic_end {
  background: #e0f2f1;
  color: #00695c;
  border-color: #009688;
}

.chat-message.system.camera_start {
  background: #e1f5fe;
  color: #0277bd;
  border-color: #03a9f4;
}

.chat-message.system.camera_end {
  background: #fce4ec;
  color: #c2185b;
  border-color: #e91e63;
}

.chat-message.system.set_params {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #2196f3;
  cursor: help;
  transition: background-color 0.2s ease;
}

.chat-message.system.set_params:hover {
  background: #e3f2fd;
  border-color: #2196f3;
}

.chat-message.system.set_params_ack {
  background: #f3e5f5;
  color: #7b1fa2;
  border-color: #9c27b0;
}

/* Time separator */
.time-separator {
  text-align: center;
  font-size: 11px;
  color: #6c757d;
  margin: 4px 0;
  opacity: 0.7;
  align-self: center;
}

/* Animation for messages */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
