/* Loading animation */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #9ca3af;
    animation: dot-pulse 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dot-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Scrollbar */
#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background-color: #d1d5db; border-radius: 3px; }
.dark #messages::-webkit-scrollbar-thumb { background-color: #4b5563; }

/* Message content */
.message-content p { margin-bottom: 0.5rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { font-weight: 600; }
.message-content a { color: #2563eb; text-decoration: underline; text-decoration-color: #93c5fd; }
.dark .message-content a { color: #60a5fa; }
.message-content ul, .message-content ol { margin: 0.5rem 0; padding-left: 1.5rem; }
.message-content li { margin-bottom: 0.25rem; }
.message-content h1, .message-content h2, .message-content h3 { font-weight: 600; margin-top: 0.75rem; margin-bottom: 0.25rem; }
.message-content h1 { font-size: 1.125rem; }
.message-content h2 { font-size: 1rem; }
.message-content h3 { font-size: 0.875rem; }

/* Code blocks */
.message-content pre {
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.8125rem;
}
.dark .message-content pre {
    background: #1f2937;
}
.message-content code {
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 0.8125rem;
}
.message-content p code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}
.dark .message-content p code {
    background: #374151;
}

/* Example buttons */
.example-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Sidebar conversation items */
.conv-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #374151;
    transition: background-color 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dark .conv-item { color: #d1d5db; }
.conv-item:hover { background: #f3f4f6; }
.dark .conv-item:hover { background: #374151; }
.conv-item.active { background: #dbeafe; }
.dark .conv-item.active { background: #1e3a5f; }
.conv-item .delete-btn {
    display: none;
    padding: 2px;
    border-radius: 4px;
    color: #9ca3af;
}
.conv-item:hover .delete-btn { display: block; }
.conv-item .delete-btn:hover { color: #ef4444; background: #fef2f2; }
.dark .conv-item .delete-btn:hover { background: #451a1a; }

/* Action buttons (copy, regenerate, feedback) */
.msg-actions {
    display: flex;
    gap: 2px;
    margin-top: 0.375rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.msg-wrapper:hover .msg-actions,
.flex-1:hover .msg-actions { opacity: 1; }
.msg-action-btn {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1;
    color: #6b7280;
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.15s;
}
.msg-action-btn svg { width: 12px; height: 12px; }
.dark .msg-action-btn { color: #6b7280; }
.msg-action-btn:hover { color: #3b82f6; }
.msg-action-btn.active { color: #3b82f6; }

/* Auto-resize textarea */
#chatInput { line-height: 1.5; }

/* Sidebar mobile */
@media (max-width: 767px) {
    #sidebar.mobile-open {
        display: flex !important;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        width: 280px;
    }
}

/* Upload drag state */
.upload-drag-active {
    border-color: #3b82f6 !important;
    background: #eff6ff !important;
}
.dark .upload-drag-active {
    background: #1e3a5f !important;
}
