/* Agent-specific styles */

/* Chat message containers */
.message {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 16px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message {
  background-color: #f0f7ff;
  color: #1a365d;
  margin-left: 2rem;
  border-top-right-radius: 0;
}

.assistant-message {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  margin-right: 2rem;
  border-top-left-radius: 0;
}

.message-role {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: #4b5563;
}

.message-content {
  line-height: 1.5;
  word-break: break-word;
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Input area */
#query-input {
  resize: none;
  overflow: hidden;
  min-height: 38px;
  max-height: 150px;
  transition: height 0.2s ease;
}

/* Thinking process styles */
#thinking-content, #tool-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* Tool call and result styles */
.tool-call {
  background-color: #1e293b;
  color: #e2e8f0;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.tool-result {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
}

.citation {
  font-size: 0.75rem;
  background-color: #dbeafe;
  padding: 0.25rem 0.5rem;
  border-radius: 1rem;
  display: inline-block;
  margin: 0.25rem 0.25rem 0 0;
  color: #1e40af;
}

/* Loading animation */
.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  border-top-color: #4f46e5;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Markdown styling */
.message-content a {
  color: #2563eb;
  text-decoration: underline;
}

.message-content code {
  padding: 2px 4px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.message-content pre {
  margin: 10px 0;
  padding: 12px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  overflow-x: auto;
}

.message-content pre code {
  background-color: transparent;
  padding: 0;
}

.message-content ul,
.message-content ol {
  margin-left: 24px;
  margin-bottom: 16px;
}

.message-content ul {
  list-style-type: disc;
}

.message-content ol {
  list-style-type: decimal;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-weight: 600;
}

.message-content blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 16px;
  margin: 16px 0;
  color: #6b7280;
}

/* Thinking/Tool panel toggle */
.thinking-header, .tool-header {
  cursor: pointer;
}

#thinking-content.collapsed,
#tool-content.collapsed {
  display: none;
}

#toggle-thinking .fa-chevron-up,
#toggle-tools .fa-chevron-up {
  transition: transform 0.3s ease;
}

#toggle-thinking.collapsed .fa-chevron-up,
#toggle-tools.collapsed .fa-chevron-up {
  transform: rotate(180deg);
}

/* Responsive layout */
@media (max-width: 768px) {
  .user-message, .assistant-message {
    max-width: 90%;
  }

  .sidebar {
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }

  #send-btn span {
    display: none;
  }

  #send-btn {
    padding: 0.5rem;
  }

  #send-btn i {
    margin-right: 0;
  }
}

#thinking-content {
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin: 0.5rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#thinking-content > div {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

#citation-text {
  transition: max-height 0.3s ease;
}

.spinner {
  border: 4px solid #cbd5e1;
  border-top: 4px solid #6366f1;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.btn-loading::after {
  content: '';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: 2px solid #fff;
  border-top: 2px solid #6366f1;
  border-radius: 50%;
  width: 1rem;
  height: 1rem;
  animation: spin 1s linear infinite;
}
