/* 客服知识查询系统 — 自定义样式 */

/* Tab 按钮状态 */
.tab-btn {
    color: #6b7280;
    background: transparent;
}
.tab-btn:hover {
    color: #374151;
    background: #f3f4f6;
}
.tab-btn.active {
    color: #4f46e5;
    background: #eef2ff;
}

/* 分类项状态 */
.category-item.active {
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 500;
}

/* 知识卡片 */
.knowledge-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
    cursor: pointer;
}
.knowledge-card:hover {
    border-color: #a5b4fc;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
}

/* 聊天气泡 */
.chat-bubble-user {
    background: #4f46e5;
    color: white;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    padding: 12px 18px;
    margin-left: auto;
    font-size: 14px;
    line-height: 1.6;
}
.chat-bubble-assistant {
    background: #f3f4f6;
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.7;
}
.chat-bubble-assistant p {
    margin: 0.5em 0;
}
.chat-bubble-assistant p:first-child {
    margin-top: 0;
}
.chat-bubble-assistant p:last-child {
    margin-bottom: 0;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
    background: #f3f4f6;
    border-radius: 18px 18px 18px 4px;
    max-width: 80px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: bounce 1.4s infinite;
}
.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* 参考来源标签 */
.source-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.source-tag:hover {
    background: #e0e7ff;
}

/* 会话项 */
.session-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.session-item:hover {
    background: #f3f4f6;
}
.session-item.active {
    background: #eef2ff;
    color: #4f46e5;
}
.session-item .delete-btn {
    opacity: 0;
    transition: opacity 0.2s;
}
.session-item:hover .delete-btn {
    opacity: 1;
}

/* Prose 样式覆盖 */
.prose h1, .prose h2, .prose h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
}
.prose ul, .prose ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}
.prose li {
    margin: 0.25em 0;
}
.prose img {
    border-radius: 8px;
    margin: 1em 0;
}
.prose code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.prose pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
}
.prose pre code {
    background: transparent;
    padding: 0;
}
.prose blockquote {
    border-left: 3px solid #a5b4fc;
    padding-left: 1em;
    color: #6b7280;
    margin: 1em 0;
}

/* Toast 动画 */
#toast {
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 分页按钮 */
.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}
.page-btn:hover {
    background: #f3f4f6;
}
.page-btn.active {
    background: #4f46e5;
    color: white;
}

/* Upload spinner */
.upload-spinner {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Line clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Drop zone hover */
#drop-zone.drag-over {
    border-color: #4f46e5;
    background: #eef2ff;
}
