.messagesContainer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  font-family: var(--font-family);
  padding: 16px 20px;
}

.emptyContainer {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.emptyState {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-gray);
  font-size: 14px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.messageWrapper {
  width: 100%;
}

.message {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
}

.messageUser {
  justify-content: flex-end;
}

.messageAssistant {
  justify-content: flex-start;
}

.messageBubble {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
}

.messageUser .messageBubble {
  background-color: var(--color-secondary);
  color: white;
  border-bottom-right-radius: 4px;
}

.messageAssistant .messageBubble {
  background-color: var(--color-surface);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
}

/* Message Metadata */
.messageMetadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.roleBadge {
  padding: 4px 8px;
  border-radius: var(--object-radius-small);
  font-weight: 500;
  background-color: var(--color-primary);
  color: var(--color-text);
  text-transform: capitalize;
}

.roleBadge[data-role="user"] {
  background-color: var(--color-secondary);
  color: white;
}

.roleBadge[data-role="assistant"] {
  background-color: var(--color-primary);
}

.statusBadge {
  padding: 4px 8px;
  border-radius: var(--object-radius-small);
  font-weight: 500;
  font-size: 11px;
  text-transform: capitalize;
}

.statusSuccess {
  background-color: #28a745;
  color: white;
}

.statusError {
  background-color: #dc3545;
  color: white;
}

.statusPending {
  background-color: #ffc107;
  color: #212529;
}

.statusDefault {
  background-color: var(--color-gray-disabled);
  color: var(--color-text);
}

.timestamp {
  color: var(--color-gray);
  font-size: 11px;
}

.progress {
  color: var(--color-secondary);
  font-size: 11px;
  font-weight: 500;
}

/* Action Info */
.actionInfo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--object-radius-small);
  font-size: 11px;
  margin-top: 4px;
}

.actionName {
  font-weight: 600;
  color: var(--color-text);
}

.actionMethod {
  color: var(--color-gray);
  font-family: monospace;
}

.actionNumbers {
  color: var(--color-gray);
  font-size: 11px;
}

/* Message Content */
.messageContent {
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.messageUser .messageContent {
  color: white;
}

.messageAssistant .messageContent {
  color: var(--color-text);
}

/* Markdown Content Styling */
.markdownContent {
  width: 100%;
}

/* Headings */
.markdownH1,
.markdownH2,
.markdownH3,
.markdownH4,
.markdownH5,
.markdownH6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  line-height: 1.3;
}

.markdownH1 {
  font-size: 24px;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 8px;
}

.markdownH2 {
  font-size: 20px;
  border-bottom: 1px solid var(--color-gray-disabled);
  padding-bottom: 6px;
}

.markdownH3 {
  font-size: 18px;
}

.markdownH4 {
  font-size: 16px;
}

.markdownH5 {
  font-size: 14px;
}

.markdownH6 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.messageUser .markdownH1,
.messageUser .markdownH2,
.messageUser .markdownH3,
.messageUser .markdownH4,
.messageUser .markdownH5,
.messageUser .markdownH6 {
  color: white;
}

.messageUser .markdownH1 {
  border-bottom-color: rgba(255, 255, 255, 0.3);
}

.messageUser .markdownH2 {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.messageAssistant .markdownH1,
.messageAssistant .markdownH2,
.messageAssistant .markdownH3,
.messageAssistant .markdownH4,
.messageAssistant .markdownH5,
.messageAssistant .markdownH6 {
  color: var(--color-text);
}

.messageAssistant .markdownH1 {
  border-bottom-color: var(--color-primary);
}

.messageAssistant .markdownH2 {
  border-bottom-color: var(--color-gray-disabled);
}

/* Paragraphs */
.markdownP {
  margin: 8px 0;
  line-height: 1.6;
  white-space: pre-line; /* Preserve line breaks */
}

.markdownP:first-child {
  margin-top: 0;
}

.markdownP:last-child {
  margin-bottom: 0;
}

/* Lists */
.markdownUl,
.markdownOl {
  margin: 8px 0;
  padding-left: 24px;
}

.markdownLi {
  margin: 4px 0;
  line-height: 1.6;
}

.markdownUl .markdownLi {
  list-style-type: disc;
}

.markdownOl .markdownLi {
  list-style-type: decimal;
}

/* Tables */
.markdownTableWrapper {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--object-radius-small);
}

.markdownTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.messageUser .markdownTable {
  background-color: rgba(255, 255, 255, 0.1);
}

.messageAssistant .markdownTable {
  background-color: var(--color-surface);
  border: 1px solid var(--color-gray-disabled);
}

.markdownThead {
  background-color: var(--color-primary);
}

.messageUser .markdownThead {
  background-color: rgba(255, 255, 255, 0.2);
}

.markdownTh {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--color-primary);
}

.messageUser .markdownTh {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.3);
}

.messageAssistant .markdownTh {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
}

.markdownTd {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-gray-disabled);
}

.messageUser .markdownTd {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.messageAssistant .markdownTd {
  color: var(--color-text);
  border-bottom-color: var(--color-gray-disabled);
}

.markdownTr:last-child .markdownTd {
  border-bottom: none;
}

.markdownTr:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.messageUser .markdownTr:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Code */
.markdownCodeInline {
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.messageUser .markdownCodeInline {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.messageAssistant .markdownCodeInline {
  background-color: var(--color-highlight-gray);
  color: var(--color-secondary);
}

.markdownPre {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: var(--object-radius-small);
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.messageUser .markdownPre {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
}

.messageAssistant .markdownPre {
  background-color: var(--color-highlight-gray);
  color: var(--color-text);
  border: 1px solid var(--color-gray-disabled);
}

.markdownCodeBlock {
  display: block;
  width: 100%;
}

/* Blockquote */
.markdownBlockquote {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--color-primary);
  border-radius: var(--object-radius-small);
  font-style: italic;
}

.messageUser .markdownBlockquote {
  background-color: rgba(255, 255, 255, 0.1);
  border-left-color: rgba(255, 255, 255, 0.5);
  color: rgba(255, 255, 255, 0.9);
}

.messageAssistant .markdownBlockquote {
  background-color: var(--color-highlight-gray);
  border-left-color: var(--color-primary);
  color: var(--color-text);
}

/* Strong and Emphasis */
.markdownStrong {
  font-weight: 600;
}

.messageUser .markdownStrong {
  color: white;
}

.messageAssistant .markdownStrong {
  color: var(--color-text);
}

.markdownEm {
  font-style: italic;
}

/* Links */
.markdownLink {
  color: var(--color-secondary);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.markdownLink:hover {
  opacity: 0.8;
}

.messageUser .markdownLink {
  color: rgba(255, 255, 255, 0.9);
}

/* Links in tables - rendered as text */
.markdownLinkText {
  color: inherit;
  text-decoration: none;
}

.messageUser .markdownLinkText {
  color: white;
}

.messageAssistant .markdownLinkText {
  color: var(--color-text);
}

/* Horizontal Rule */
.markdownHr {
  margin: 16px 0;
  border: none;
  border-top: 1px solid var(--color-gray-disabled);
}

.messageUser .markdownHr {
  border-top-color: rgba(255, 255, 255, 0.2);
}

.messageAssistant .markdownHr {
  border-top-color: var(--color-gray-disabled);
}

.messageTimestamp {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  align-self: flex-end;
}

.messageUser .messageTimestamp {
  color: rgba(255, 255, 255, 0.8);
}

.messageAssistant .messageTimestamp {
  color: var(--color-gray);
}

.messageSummary {
  padding: 8px 12px;
  border-radius: var(--object-radius-small);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}

.messageUser .messageSummary {
  background-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

.messageUser .messageSummary strong {
  color: white;
  font-weight: 600;
}

.messageAssistant .messageSummary {
  background-color: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.messageAssistant .messageSummary strong {
  color: var(--color-secondary);
  font-weight: 600;
}

/* Documents */
.documentsContainer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.documentsLabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.documentsList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documentItem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background-color: var(--color-surface);
  border-radius: var(--object-radius-small);
  transition: all 0.2s ease;
}

.documentItem:hover {
  background-color: var(--color-highlight-gray);
}

.documentIcon {
  font-size: 18px;
  flex-shrink: 0;
}

.documentInfo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.documentName {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documentMeta {
  font-size: 11px;
  color: var(--color-gray);
}

/* Dark theme support */
[data-theme="dark"] .message {
  background-color: var(--color-surface);
  border-color: var(--color-primary);
}

[data-theme="dark"] .message:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .actionInfo {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .messageSummary {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .documentItem {
  background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .documentItem:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Responsive design */
@media (max-width: 640px) {
  .message {
    padding: 12px;
  }
  
  .messageMetadata {
    font-size: 11px;
  }
  
  .messageContent {
    font-size: 13px;
  }
  
  .documentItem {
    padding: 8px 10px;
  }
}

