/* Auto-resize textarea */
#messageInput {
  overflow-y: hidden;
}

/* Scrollbar personalizzata */
#chatContainer::-webkit-scrollbar {
  width: 8px;
}

#chatContainer::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#chatContainer::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

#chatContainer::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animazione typing */
@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.75;
  }
  30% {
    opacity: 0.25;
  }
}

.typing-dot {
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Smooth scroll */
#chatContainer {
  scroll-behavior: smooth;
}

/* Markdown Styles */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  font-weight: 700;
  margin-top: 1em;
  margin-bottom: 0.5em;
}

.markdown-content h1 {
  font-size: 1.5em;
}

.markdown-content h2 {
  font-size: 1.3em;
}

.markdown-content h3 {
  font-size: 1.1em;
}

.markdown-content p {
  margin-bottom: 0.75em;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 1.5em;
  margin-bottom: 0.75em;
}

.markdown-content li {
  margin-bottom: 0.25em;
}

.markdown-content code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
}

.markdown-content pre {
  background-color: #f5f5f5;
  padding: 1em;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 0.75em;
}

.markdown-content pre code {
  background-color: transparent;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 3px solid #ddd;
  padding-left: 1em;
  color: #666;
  margin: 0.75em 0;
}

.markdown-content strong {
  font-weight: 700;
}

.markdown-content em {
  font-style: italic;
}

.markdown-content a {
  color: #3b82f6;
  text-decoration: underline;
}

.markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.75em;
}

.markdown-content table th,
.markdown-content table td {
  border: 1px solid #ddd;
  padding: 0.5em;
  text-align: left;
}

.markdown-content table th {
  background-color: #f5f5f5;
  font-weight: 600;
}

/* Sources styling */
.sources-container {
  margin-top: 0.75em;
  padding-top: 0.75em;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.source-item {
  font-size: 0.75rem;
  color: #666;
  padding: 0.375em 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.source-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  padding-left: 0.25em;
  padding-right: 0.25em;
}

.source-badge {
  display: inline-block;
  background-color: #e5e7eb;
  color: #374151;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  margin-right: 0.5rem;
  font-weight: 500;
}

/* Link icon animation */
.source-item a {
  opacity: 0.6;
  transition: opacity 0.2s, transform 0.2s;
}

.source-item:hover a {
  opacity: 1;
  transform: translateX(2px);
}

/* Nascondi chunk info se presente */
.source-item .chunk-info {
  display: none;
}
