/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Message bubbles */
.message-user {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.message-assistant {
  background: #374151;
}

/* Markdown content styling */
.markdown-content {
  line-height: 1.6;
}

.markdown-content p {
  margin-bottom: 0.75rem;
}

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

.markdown-content pre {
  background: #1f2937;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.markdown-content code {
  font-family: 'Fira Code', 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
}

.markdown-content :not(pre) > code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

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

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

.markdown-content li {
  margin-bottom: 0.25rem;
}

.markdown-content blockquote {
  border-left: 3px solid #6366f1;
  padding-left: 1rem;
  margin: 0.75rem 0;
  color: #9ca3af;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-content h1 {
  font-size: 1.5rem;
}

.markdown-content h2 {
  font-size: 1.25rem;
}

.markdown-content h3 {
  font-size: 1.125rem;
}

.markdown-content a {
  color: #818cf8;
  text-decoration: underline;
}

.markdown-content a:hover {
  color: #a5b4fc;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #4b5563;
  padding: 0.5rem;
  text-align: left;
}

.markdown-content th {
  background: #1f2937;
}

/* Conversation item */
.conversation-item {
  transition: all 0.15s ease;
}

.conversation-item:hover {
  background: #374151;
}

.conversation-item.active {
  background: #4b5563;
}

/* Textarea auto-resize */
#message-input {
  min-height: 48px;
}

/* Thinking/Reasoning section */
.thinking-section {
  font-size: 0.9rem;
}

.thinking-toggle {
  cursor: pointer;
  user-select: none;
}

.thinking-toggle:hover .thinking-icon {
  color: #a78bfa;
}

.thinking-icon {
  transition: transform 0.2s ease;
}

.thinking-icon.rotate-90 {
  transform: rotate(90deg);
}

.thinking-content {
  max-height: 300px;
  overflow-y: auto;
  animation: fadeIn 0.2s ease;
}

.thinking-content.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Streaming animation for content */
.message-content {
  animation: contentFade 0.1s ease;
}

@keyframes contentFade {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 1;
  }
}

/* Message stats */
.message-stats {
  font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
  opacity: 0.7;
}

/* Token streaming cursor effect */
.streaming-cursor::after {
  content: '▊';
  animation: blink 1s infinite;
  color: #8b5cf6;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* Loading animation */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

/* Mobile sidebar overlay */
@media (max-width: 768px) {
  #sidebar.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 50;
  }
}

/* Smooth transitions */
* {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
