:root {
    --primary-color: #000000;
    --secondary-color: #555555;
    --accent-color: #007aff;
    --text-dark: #1d1d1f;
    --text-light: #f5f5f7;
    --text-secondary: #6e6e73;
    --bg-main: #ffffff;
    --bg-light-gray: #f5f5f7;
    --border-color: #d2d2d7;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --success-color: #34c759;
    --warning-color: #ff9500;
    --hover-bg: #f0f0f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes expandNode {
    from { max-height: 0; opacity: 0; }
    to { max-height: 1000px; opacity: 1; }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg-light-gray);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 80px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* 导航栏样式 */
.navbar {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 1.8em;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    margin-right: 40px;
}

.logo span {
    color: var(--accent-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 25px;
    flex-grow: 0;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    font-size: 1em;
    padding: 8px 16px;
    border-radius: 6px;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-color);
    background: rgba(0, 122, 255, 0.1);
}

/* 主容器 */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 30px;
    min-height: calc(100vh - 80px);
}

/* 页面标题 */
.page-header {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    animation: fadeIn 0.8s ease-out;
}

.page-header h1 {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 700;
}

.page-header h1 i {
    color: var(--accent-color);
    margin-right: 15px;
}

.page-header p {
    font-size: 1.2em;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* 搜索区域 */
.search-section {
    grid-column: 1 / -1;
    margin-bottom: 30px;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 20px var(--shadow-color);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 4px 25px rgba(0, 122, 255, 0.15);
}

.search-box i {
    color: var(--text-secondary);
    margin-right: 12px;
    font-size: 1.1em;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1em;
    color: var(--text-dark);
    background: transparent;
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 12px;
}

.search-box button:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

/* 知识树结构 */
.knowledge-tree {
    background: var(--bg-main);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 25px var(--shadow-color);
    animation: fadeIn 0.8s ease-out 0.4s both;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.tree-node {
    margin-bottom: 8px;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tree-node.level-1 {
    border: 1px solid var(--border-color);
    background: var(--bg-main);
}

.tree-node.level-2 {
    margin-left: 20px;
    margin-top: 8px;
    border-left: 3px solid var(--accent-color);
    background: var(--bg-light-gray);
}

.node-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.tree-node.level-1 .node-header {
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-light-gray) 100%);
    font-weight: 600;
    font-size: 1.1em;
}

.tree-node.level-2 .node-header {
    background: var(--bg-light-gray);
    font-weight: 500;
    padding-left: 15px;
}

.node-header:hover {
    background: var(--hover-bg);
    transform: translateX(3px);
}

.expand-icon {
    margin-right: 12px;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.tree-node.expanded .expand-icon {
    transform: rotate(90deg);
    color: var(--accent-color);
}

.category-icon {
    margin-right: 12px;
    color: var(--accent-color);
    font-size: 1.2em;
    width: 20px;
    text-align: center;
}

.node-title {
    flex: 1;
    font-weight: inherit;
}

.node-count {
    color: var(--text-secondary);
    font-size: 0.85em;
    background: rgba(0, 122, 255, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.node-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    opacity: 0;
}

.tree-node.expanded .node-content {
    max-height: 1000px;
    opacity: 1;
    padding-bottom: 10px;
}

.knowledge-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    margin: 4px 15px;
    background: var(--bg-main);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.knowledge-item:hover {
    background: var(--hover-bg);
    border-left-color: var(--accent-color);
    transform: translateX(5px);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.knowledge-item.active {
    background: rgba(0, 122, 255, 0.1);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.knowledge-item i {
    margin-right: 12px;
    color: var(--text-secondary);
    font-size: 0.9em;
    width: 16px;
    text-align: center;
}

.knowledge-item.active i {
    color: var(--accent-color);
}

/* 知识详情面板 */
.knowledge-panel {
    background: var(--bg-main);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 4px 25px var(--shadow-color);
    animation: fadeIn 0.8s ease-out 0.6s both;
    height: calc(100vh - 120px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-light-gray) 100%);
    flex-shrink: 0;
}

.panel-header h2 {
    color: var(--text-dark);
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
}

.close-panel {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel:hover {
    background: var(--hover-bg);
    color: var(--text-dark);
}

.panel-body {
    padding: 25px;
    line-height: 1.8;
    color: var(--text-primary);
    flex: 1;
    overflow-y: auto;
    background: white;
    max-height: calc(100vh - 200px);
    min-height: 0;
}

.panel-body h3 {
    color: var(--primary-color);
    font-size: 1.4em;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.panel-body h4 {
    color: var(--primary-color);
    font-size: 1.2em;
    margin: 25px 0 15px 0;
    font-weight: 600;
}

.panel-body h5 {
    color: var(--text-dark);
    font-size: 1.1em;
    margin: 20px 0 10px 0;
    font-weight: 500;
}

.panel-body p {
    margin-bottom: 15px;
    color: var(--text-dark);
}

.panel-body ul, .panel-body ol {
    margin: 15px 0;
    padding-left: 25px;
}

.panel-body li {
    margin: 8px 0;
    line-height: 1.6;
    color: var(--text-dark);
}

.panel-body dl {
    margin: 15px 0;
}

.panel-body dt {
    font-weight: 600;
    color: var(--text-dark);
    margin: 15px 0 5px 0;
}

.panel-body dd {
    margin: 0 0 10px 20px;
    color: var(--text-secondary);
}

.panel-body .highlight {
    background: linear-gradient(120deg, var(--accent-color) 0%, var(--primary-color) 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9em;
}

.panel-body .note {
    background: var(--bg-light-gray);
    border-left: 4px solid var(--accent-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.panel-body .note strong {
    color: var(--accent-color);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #0056b3;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* 打字效果样式 */
.typing-cursor {
    animation: blink 1s infinite;
    color: #007bff;
    font-weight: bold;
}

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

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .knowledge-panel {
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .page-header h1 {
        font-size: 2em;
    }
    
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-links {
        gap: 15px;
    }
    
    .nav-links a {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    
    .knowledge-tree {
        padding: 20px;
    }
    
    .tree-node.level-2 {
        margin-left: 10px;
    }
    
    .search-box {
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 70px;
    }
    
    .navbar {
        padding: 10px 0;
    }
    
    .logo {
        font-size: 1.5em;
        margin-right: 20px;
    }
    
    .nav-links {
        gap: 10px;
    }
    
    .nav-links a {
        padding: 5px 8px;
        font-size: 0.8em;
    }
    
    .page-header {
        padding: 30px 0;
    }
    
    .page-header h1 {
        font-size: 1.8em;
    }
    
    .page-header p {
        font-size: 1em;
    }
    
    .knowledge-tree {
        padding: 15px;
    }
    
    .panel-content {
        padding: 20px;
    }
}

/* 滚动条样式 */
.knowledge-tree::-webkit-scrollbar,
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.knowledge-tree::-webkit-scrollbar-track,
.panel-content::-webkit-scrollbar-track {
    background: var(--bg-light-gray);
    border-radius: 3px;
}

.knowledge-tree::-webkit-scrollbar-thumb,
.panel-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.knowledge-tree::-webkit-scrollbar-thumb:hover,
.panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 中文注释样式 */
.text-muted {
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 400;
    display: block;
    margin-top: 2px;
    line-height: 1.3;
}

/* AI聊天机器人样式 */
.ai-chat-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.ai-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.ai-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ai-chat-container {
    background: white;
    width: 90%;
    max-width: 650px;
    height: 85%;
    max-height: 750px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ai-chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
}

.ai-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.ai-chat-header h3::before {
    content: '🤖';
    font-size: 24px;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.ai-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.ai-message, .user-message {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    animation: messageSlideIn 0.4s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-message {
    background: white;
    color: #212529;
    font-weight: 400;
    align-self: flex-start;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 8px;
    position: relative;
}

.ai-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: white;
    border-bottom: none;
    border-left: none;
}

.user-message {
    background: #f8f9fa;
    color: #333333;
    border-left: 4px solid #007bff;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 8px;
    position: relative;
}

.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: #f8f9fa;
    border-bottom: none;
    border-right: none;
}

/* 聊天输入区域 */
.ai-chat-input {
    padding: 24px;
    border-top: 1px solid #e9ecef;
    background: linear-gradient(to top, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: center;
    position: relative;
}

.ai-chat-input::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #667eea 50%, transparent 100%);
}

.ai-chat-input input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 28px;
    font-size: 15px;
    color: #212529;
    font-weight: 400;
    outline: none;
    transition: all 0.3s ease;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.ai-chat-input input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    color: #212529;
    background: #ffffff;
}

.ai-chat-input input::placeholder {
    color: #6c757d;
    font-style: italic;
    opacity: 0.8;
}

.ai-chat-input input::-webkit-input-placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.ai-chat-input input::-moz-placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.ai-chat-input input:-ms-input-placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.ai-chat-input button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 28px;
    min-width: 120px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-chat-input button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    transition: all 0.3s ease;
}

.ai-chat-input button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.ai-chat-input button:hover:not(:disabled)::before {
    width: 100%;
    height: 100%;
}

.ai-chat-input button:active:not(:disabled) {
    transform: translateY(-1px);
}

.ai-chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.ai-chat-input button:disabled::before {
    display: none;
}

/* 建议按钮样式 */
.suggestions {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #007bff;
}

.suggestion-btn {
    display: inline-block;
    margin: 5px 5px 5px 0;
    padding: 8px 12px;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.suggestion-btn:hover {
    background: #bbdefb;
    color: #0d47a1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.suggestion-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ai-chat-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #6c757d;
    font-style: italic;
    padding: 16px 20px;
    background: white;
    border-radius: 20px;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: typingPulse 2s infinite;
    position: relative;
    overflow: hidden;
    max-width: 85%;
    align-self: flex-start;
    border-bottom-left-radius: 8px;
}

.typing-indicator::before {
    content: '🤖';
    font-size: 16px;
    margin-right: 4px;
}

.typing-indicator::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: white;
    border-bottom: none;
    border-left: none;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: modernTypingDots 1.4s infinite ease-in-out;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes modernTypingDots {
    0%, 80%, 100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2) translateY(-8px);
        opacity: 1;
    }
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0.9;
        transform: translateY(-2px);
    }
}

/* 打字指示器动画 */
.typing-indicator .dots {
    animation: typing 1.5s infinite;
}

@keyframes typing {
    0%, 20% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* 增强消息渲染样式 */

/* 聊天消息标题样式 */
.chat-h1, .chat-h2, .chat-h3 {
    margin: 15px 0 10px 0;
    font-weight: 600;
    line-height: 1.3;
}

.chat-h1 {
    font-size: 1.4em;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.chat-h2 {
    font-size: 1.2em;
    color: #34495e;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

.chat-h3 {
    font-size: 1.1em;
    color: #34495e;
}

/* 列表样式 */
.chat-li, .chat-li-numbered {
    margin: 5px 0;
    padding-left: 20px;
    position: relative;
    list-style: none;
}

.chat-li::before {
    content: "•";
    color: #3498db;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.chat-li-numbered {
    counter-increment: chat-counter;
}

.chat-li-numbered::before {
    content: counter(chat-counter) ".";
    color: #3498db;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 行内代码样式 */
.inline-code {
    background: #f8f9fa;
    color: #e83e8c;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

/* 代码块样式 */
.code-block {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.4;
}

.code-block code {
    background: none;
    padding: 0;
    border: none;
    color: #212529;
}

/* 表格样式 */
.chat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chat-table th {
    background: #3498db;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

.chat-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9em;
}

.chat-table tr:nth-child(even) {
    background: #f8f9fa;
}

.chat-table tr:hover {
    background: #e3f2fd;
}

/* 数学公式样式 */
.math-formula {
    font-family: 'Times New Roman', 'KaTeX_Main', serif;
    font-style: italic;
}

.block-formula {
    display: block;
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    font-size: 1.1em;
}

.inline-formula {
    display: inline;
    padding: 2px 4px;
    background: #f0f8ff;
    border-radius: 3px;
    margin: 0 2px;
}

.math-symbol {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-weight: bold;
    color: #2c3e50;
}

/* 技术术语高亮 */
.tech-term {
    background: linear-gradient(120deg, #a8e6cf 0%, #dcedc1 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #2c3e50;
    border: 1px solid #7fb069;
    display: inline-block;
    margin: 1px 2px;
    transition: all 0.2s ease;
}

.tech-term:hover {
    background: linear-gradient(120deg, #7fb069 0%, #a8e6cf 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 复制按钮样式 */
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.ai-message {
    position: relative;
}

.ai-message:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.copy-btn:active {
    transform: translateY(0);
}

/* 消息评价样式 */
.message-rating {
    margin-top: 12px;
    padding: 8px 0;
    border-top: 1px solid #eee;
}

.rating-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rating-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rating-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.rating-btn.helpful:hover {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.rating-btn.not-helpful:hover {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.rating-thanks {
    color: #28a745;
    font-size: 12px;
    font-weight: 500;
}

.rating-feedback {
    margin-top: 8px;
}

.rating-feedback textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    resize: vertical;
    font-family: inherit;
}

.submit-feedback {
    margin-top: 8px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-feedback:hover {
    background: #0056b3;
}

/* 快速回复建议样式 */
.quick-reply-suggestions {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.suggestions-title {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.suggestions-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.suggestion-btn {
    background: white;
    border: 1px solid #007bff;
    color: #007bff;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-btn:hover {
    background: #007bff;
    color: white;
}

/* 消息展开/折叠按钮样式 */
.message-toggle-btn {
    display: block;
    margin: 12px auto 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
}

.message-toggle-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

/* 消息容器增强 - 这些样式已在前面定义，此处删除重复定义 */

/* 特殊内容块样式 */
.formula-block {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 4px solid #fdcb6e;
    padding: 15px;
    margin: 10px 0;
    border-radius: 6px;
}

.calculation-block {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-left: 4px solid #17a2b8;
    padding: 15px;
    margin: 10px 0;
    border-radius: 6px;
}

.standard-block {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #28a745;
    padding: 15px;
    margin: 10px 0;
    border-radius: 6px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-chat-container {
        width: 95%;
        height: 80%;
        margin: 10px;
    }
    
    .ai-chat-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .ai-chat-btn span {
        display: none;
    }
    
    .ai-chat-input {
        padding: 16px;
        gap: 12px;
    }
    
    .ai-chat-input button {
        min-width: 80px;
        font-size: 14px;
        padding: 0 16px;
    }
    
    .ai-chat-input input {
        font-size: 14px;
        padding: 14px 16px;
    }
    
    .chat-table {
        font-size: 0.8em;
    }
    
    .chat-table th,
    .chat-table td {
        padding: 8px 10px;
    }
    
    .block-formula {
        font-size: 1em;
        padding: 10px;
    }
    
    .copy-btn {
        position: static;
        opacity: 1;
        margin-top: 10px;
        display: block;
        width: fit-content;
    }
    
    .rating-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rating-btn {
        justify-content: center;
    }
    
    .suggestions-buttons {
        flex-direction: column;
    }
    
    .suggestion-btn {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .ai-chat-input {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .ai-chat-input button {
        width: 100%;
        min-width: auto;
    }
}