/* AI助手页面样式 */

/* 网格布局 */
.assistant-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto 1fr;
    gap: 20px;
    margin-bottom: 40px;
    height: calc(100vh - 180px);
    max-height: 800px;
    position: relative;
    z-index: 1;
}

/* 页面布局容器 */
.dashboard-content {
    padding: 20px 30px 50px 30px;
    overflow-y: auto;
    max-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 85vh;
}

/* 头部信息样式 */
.powered-by {
    font-size: 0.8em;
    color: #38bdf8;
    opacity: 0.8;
    margin-left: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: rgba(125, 211, 252, 0.1);
}

/* 聊天容器 */
.chat-container {
    grid-column: 1;
    grid-row: 1 / span 3;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 500px;
    overflow: hidden;
    z-index: 10;
    position: relative;
}

.chat-card {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.chat-header h3 i {
    margin-right: 10px;
}

.chat-controls {
    display: flex;
    gap: 10px;
}

.chat-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.chat-body {
    flex: 1;
    position: relative;
    height: calc(100% - 60px);
    /* 减去header高度 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
    /* 为输入框留出空间 */
    height: calc(100% - 70px);
}

.chat-message {
    display: flex;
    margin-bottom: 15px;
}

.chat-message.user {
    flex-direction: row-reverse;
    text-align: right;
}

.chat-message.user .message-content {
    text-align: right;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background-color: rgba(125, 211, 252, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar i {
    color: #38bdf8;
}

.chat-message.user .message-avatar {
    background-color: rgba(255, 255, 255, 0.2);
}

.chat-message.user .message-avatar i {
    color: #fff;
}

.message-content {
    max-width: 70%;
    margin: 0 10px;
    text-align: left;
}

.message-text {
    background-color: rgba(125, 211, 252, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.96);
    position: relative;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    text-align: left;
    will-change: contents;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    min-height: 20px;
    line-height: 1.6;
    letter-spacing: 0.015em;
    text-rendering: optimizeLegibility;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    font-weight: 400;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.01);
    word-spacing: 0.05em;
    transition: color 0.1s linear;
}

.chat-message.user .message-text {
    background-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.98);
}

.chat-message.assistant .message-text {
    background-color: rgba(125, 211, 252, 0.12);
    color: rgba(255, 255, 255, 0.96);
}

.message-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    text-align: right;
}

/* 浅色主题样式 */
.light-theme .chat-card,
.light-theme .suggestions-card,
.light-theme .actions-card,
.light-theme .faq-card,
.light-theme .history-card,
.light-theme .knowledge-card {
    background-color: rgba(240, 240, 245, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .chat-header,
.light-theme .suggestions-header,
.light-theme .actions-header,
.light-theme .faq-header,
.light-theme .history-header,
.light-theme .knowledge-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .chat-header h3,
.light-theme .suggestions-header h3,
.light-theme .actions-header h3,
.light-theme .faq-header h3,
.light-theme .history-header h3,
.light-theme .knowledge-header h3 {
    color: #7dd3fc;
}

.light-theme .powered-by {
    color: #7dd3fc;
    background-color: rgba(125, 211, 252, 0.1);
}

.light-theme .chat-btn,
.light-theme .history-btn {
    background-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .chat-btn:hover,
.light-theme .history-btn:hover {
    background-color: rgba(0, 0, 0, 0.2);
    color: #000;
}

.light-theme .chat-message.user .message-text {
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .chat-message.assistant .message-text {
    background-color: rgba(125, 211, 252, 0.1);
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .message-time {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .message-avatar {
    background-color: rgba(125, 211, 252, 0.2);
}

.light-theme .message-avatar i {
    color: #7dd3fc;
}

.light-theme .chat-message.user .message-avatar {
    background-color: rgba(0, 0, 0, 0.1);
}

.light-theme .chat-message.user .message-avatar i {
    color: #333;
}

.light-theme .chat-input input {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .chat-input input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .chat-input button {
    background: linear-gradient(45deg, #3498db, #2ecc71);
}

.light-theme .suggestions-btn {
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .suggestions-btn:hover,
.light-theme .suggestions-btn.active {
    background-color: rgba(125, 211, 252, 0.2);
    color: #7dd3fc;
}

.light-theme .suggestion-item {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.light-theme .suggestion-icon {
    background-color: rgba(255, 0, 0, 0.1);
}

.light-theme .suggestion-icon i {
    color: #e74c3c;
}

.light-theme .suggestion-title {
    color: #333;
}

.light-theme .suggestion-description {
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .suggestion-action {
    background-color: rgba(125, 211, 252, 0.2);
    color: #7dd3fc;
}

.light-theme .suggestion-action:hover {
    background-color: rgba(125, 211, 252, 0.3);
}

.light-theme .action-btn {
    background-color: rgba(0, 0, 0, 0.05);
}

.light-theme .action-btn:hover {
    background-color: rgba(125, 211, 252, 0.1);
}

.light-theme .action-btn i {
    color: #7dd3fc;
}

.light-theme .action-btn span {
    color: rgba(0, 0, 0, 0.8);
}

.light-theme .faq-item {
    background-color: rgba(0, 0, 0, 0.05);
}

.light-theme .faq-question span {
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .faq-question i {
    color: rgba(0, 0, 0, 0.6);
}

.light-theme .faq-answer {
    color: rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .history-item {
    background-color: rgba(0, 0, 0, 0.05);
}

.light-theme .history-item:hover,
.light-theme .history-item.active {
    background-color: rgba(125, 211, 252, 0.1);
}

.light-theme .history-title {
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .history-time {
    color: rgba(0, 0, 0, 0.5);
}

.light-theme .knowledge-search input {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.light-theme .knowledge-search button {
    background-color: rgba(125, 211, 252, 0.2);
    color: #7dd3fc;
}

.light-theme .knowledge-search button:hover {
    background-color: rgba(125, 211, 252, 0.3);
}

.light-theme .category-item {
    background-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .category-item:hover {
    background-color: rgba(125, 211, 252, 0.1);
}

.light-theme .category-item.active {
    background-color: rgba(125, 211, 252, 0.2);
    color: #7dd3fc;
}

.light-theme .category-item i {
    color: rgba(0, 0, 0, 0.7);
}

.light-theme .category-item.active i {
    color: #7dd3fc;
}

.light-theme .knowledge-section h4 {
    color: #7dd3fc;
}

.light-theme .knowledge-section li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.9);
}

.light-theme .knowledge-section li:hover {
    background-color: rgba(125, 211, 252, 0.1);
}

.light-theme .message-text code {
    background-color: rgba(0, 0, 0, 0.07);
    color: #7dd3fc;
}

.light-theme .message-text strong {
    color: #000;
}

.light-theme .message-text em {
    color: #555;
}

/* 修复知识库和其他文本在浅色主题下的颜色 */
.light-theme .knowledge-categories,
.light-theme .knowledge-content,
.light-theme .faq-list,
.light-theme .action-grid,
.light-theme .suggestion-list,
.light-theme .history-list {
    color: #333;
}

/* 输入中指示器样式 */
.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    min-height: 20px;
    min-width: 30px;
    padding: 5px 10px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #38bdf8;
    border-radius: 50%;
    opacity: 0.6;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.6;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 光标颜色在浅色主题下的修改 */
.light-theme .typing-indicator span {
    background-color: #7dd3fc;
}

/* 段落换行淡入效果 */
.message-text p {
    margin-bottom: 8px;
    animation: paragraphFade 0.3s ease-in-out;
}

@keyframes paragraphFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加强markdown样式 */
.message-text code {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    color: #38bdf8;
    font-size: 0.95em;
    letter-spacing: 0;
}

.message-text strong {
    color: #fff;
    font-weight: bold;
}

.message-text em {
    font-style: italic;
    color: #ccc;
}

.chat-input {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    z-index: 100;
    display: flex;
    gap: 4px;
}

.chat-input input {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    color: #fff;
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-input button {
    background: linear-gradient(45deg, #7dd3fc, #38bdf8);
    border: none;
    border-radius: 20px;
    width: 40px;
    height: 40px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-input button:hover {
    transform: scale(1.05);
}

/* 聊天输入区域布局优化 */
.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    z-index: 100;
}

.chat-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-group .chat-input {
    position: static;
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 20px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    z-index: auto;
    display: block;
}

.chat-input-group .send-btn {
    background: linear-gradient(45deg, #7dd3fc, #38bdf8);
    border: none;
    border-radius: 20px;
    width: 38px;
    height: 38px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-input-group .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
}

/* 智能建议区域 */
.suggestions-container {
    grid-column: 2;
    grid-row: 1;
}

.suggestions-card {
    background: var(--bg-secondary, rgba(30, 35, 45, 0.95));
    border-radius: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);

    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
}

.suggestions-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.suggestions-header h3 i {
    margin-right: 10px;
}

.suggestions-controls {
    display: flex;
    gap: 10px;
}

.suggestions-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 15px;
    padding: 5px 10px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestions-btn:hover,
.suggestions-btn.active {
    background-color: rgba(125, 211, 252, 0.2);
    color: #38bdf8;
}

.suggestions-body {
    padding: 15px;
    flex: 1;
}

.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.suggestion-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.suggestion-icon {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background-color: rgba(255, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.suggestion-icon i {
    color: #ff5252;
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-weight: 500;
    color: #fff;
    margin-bottom: 5px;
}

.suggestion-description {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.suggestion-action {
    background-color: rgba(125, 211, 252, 0.2);
    border: none;
    border-radius: 15px;
    padding: 5px 15px;
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestion-action:hover {
    background-color: rgba(125, 211, 252, 0.3);
}

/* 快速操作区域 */
.quick-actions {
    grid-column: 2;
    grid-row: 2;
}

.actions-card {
    background: var(--bg-secondary, rgba(30, 35, 45, 0.95));
    border-radius: 12px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.actions-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
}

.actions-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.actions-header h3 i {
    margin-right: 10px;
}

.actions-body {
    padding: 15px;
    flex: 1;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.action-btn {
    background-color: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background-color: rgba(125, 211, 252, 0.1);
}

.action-btn i {
    font-size: 24px;
    color: #38bdf8;
}

.action-btn span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* 常见问题区域 */
.faq-container {
    grid-column: 2;
    grid-row: 3;
    height: auto;
    min-height: 350px;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.faq-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-secondary, rgba(30, 35, 45, 0.95));
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.faq-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
}

.faq-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.faq-header h3 i {
    margin-right: 10px;
}

.faq-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.faq-question {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.faq-question span {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.faq-question i {
    color: rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease;
}

.faq-answer {
    padding: 0 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.6;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease-out;
}

.faq-answer.expanded {
    padding: 0 20px 20px;
    max-height: 500px;
}

/* 辅助功能区域 */
.auxiliary-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
    padding-bottom: 40px;
    position: relative;
    clear: both;
    transform: translateY(0);
    will-change: transform;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    z-index: 5;
    min-height: 500px;
    /* 移除初始隐藏状态，直接显示 */
    opacity: 1;
}

/* 修复辅助容器与网格布局的间距 */
.assistant-grid+.auxiliary-container {
    margin-top: 20px;
}

/* 页面初始加载时辅助容器的位置修正 */
.auxiliary-container-ready {
    opacity: 1;
}

/* 历史会话 */
.history-card {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: 500px;
    /* 固定高度，防止内容变化导致跳动 */
    min-height: 500px;
    max-height: 500px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    background: var(--bg-secondary, rgba(30, 35, 45, 0.98));
}

.history-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.history-header h3 i {
    margin-right: 10px;
}

.history-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 5px;
    width: 30px;
    height: 30px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.history-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: calc(100% - 60px);
    /* 确保滚动条样式与其他区域一致 */
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.3) rgba(0, 0, 0, 0.1);
}

.history-body::-webkit-scrollbar {
    width: 6px;
}

.history-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.history-body::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.3);
    border-radius: 3px;
}

.history-body::-webkit-scrollbar-thumb:hover {
    background: rgba(125, 211, 252, 0.5);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.history-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover,
.history-item.active {
    background-color: rgba(125, 211, 252, 0.1);
}

.history-title {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.history-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

/* 知识库 */
.knowledge-card {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    height: 500px;
    /* 固定高度，防止内容变化导致跳动 */
    min-height: 500px;
    max-height: 500px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.knowledge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.knowledge-header h3 {
    display: flex;
    align-items: center;
    font-size: 18px;
    margin: 0;
    color: #38bdf8;
}

.knowledge-header h3 i {
    margin-right: 10px;
}

.knowledge-search {
    display: flex;
    gap: 10px;
    width: 60%;
}

.knowledge-search input {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    color: #fff;
    font-size: 14px;
}

.knowledge-search button {
    background-color: rgba(125, 211, 252, 0.2);
    border: none;
    border-radius: 20px;
    width: 32px;
    height: 32px;
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.3s ease;
}

.knowledge-search button:hover {
    background-color: rgba(125, 211, 252, 0.3);
}

.knowledge-body {
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    /* 确保滚动条样式与其他区域一致 */
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.3) rgba(0, 0, 0, 0.1);
}

.knowledge-body::-webkit-scrollbar {
    width: 6px;
}

.knowledge-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.knowledge-body::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.3);
    border-radius: 3px;
}

.knowledge-body::-webkit-scrollbar-thumb:hover {
    background: rgba(125, 211, 252, 0.5);
}

.knowledge-categories {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.category-item:hover {
    background-color: rgba(125, 211, 252, 0.1);
}

.category-item.active {
    background-color: rgba(125, 211, 252, 0.2);
    color: #38bdf8;
}

.category-item i {
    color: rgba(255, 255, 255, 0.7);
}

.category-item.active i {
    color: #38bdf8;
}

.knowledge-content {
    padding: 20px;
}

.category-content {
    display: none;
}

.category-content.active {
    display: block;
}

.knowledge-section {
    margin-bottom: 25px;
}

.knowledge-section h4 {
    font-size: 1.1em;
    margin-bottom: 12px;
    color: #38bdf8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.knowledge-section ul {
    list-style: none;
    padding: 0;
}

.knowledge-section li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
}

.knowledge-section li:hover {
    background-color: rgba(125, 211, 252, 0.1);
    padding-left: 10px;
}

.knowledge-section li:last-child {
    border-bottom: none;
}

/* 移除内部滚动条样式 */
.knowledge-content::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.knowledge-content {
    -ms-overflow-style: scrollbar;
    scrollbar-width: thin;
}

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

.chat-messages {
    -ms-overflow-style: scrollbar;
    scrollbar-width: thin;
    max-height: 86%;
    overflow-y: auto;
}

.chat-messages::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(125, 211, 252, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(125, 211, 252, 0.5);
}

/* 浅色主题下的聊天消息滚动条 */
.light-theme .chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.light-theme .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.4);
}

.light-theme .chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(125, 211, 252, 0.6);
}

.suggestions-body::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.suggestions-body {
    -ms-overflow-style: scrollbar;
    scrollbar-width: thin;
}

.faq-body::-webkit-scrollbar {
    width: 6px;
    display: block;
}

.faq-body {
    -ms-overflow-style: scrollbar;
    scrollbar-width: thin;
}

/* 移除body滚动条 */
body::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 保留sidebar-inner滚动条样式 */
.sidebar-inner::-webkit-scrollbar {
    width: 6px;
}

.sidebar-inner::-webkit-scrollbar-track {
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-inner::-webkit-scrollbar-thumb {
    background-color: rgba(125, 211, 252, 0.3);
    border-radius: 3px;
}

/* 响应式布局 */
@media (max-width: 1200px) {
    .assistant-grid {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(60vh, auto) auto auto auto;
        height: auto;
        max-height: none;
    }

    .chat-container {
        grid-row: 1;
        height: 60vh;
        min-height: 400px;
    }

    .faq-container {
        grid-column: 1;
        grid-row: 4;
        height: auto;
        min-height: 400px;
    }

    /* 添加辅助容器在小屏幕下的间距控制 */
    .assistant-grid+.auxiliary-container {
        margin-top: 20px;
    }
}

/* 数字序列格式保持 */
.message-text {
    background-color: rgba(125, 211, 252, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    text-align: left;
}

/* 保持列表格式 */
.message-text ol,
.message-text ul {
    text-align: left;
    padding-left: 20px;
    margin: 8px 0;
}

.message-text li {
    text-align: left;
    margin: 4px 0;
}

/* 字符淡入效果 - 移除闪烁效果 */
.char-animated {
    display: inline-block;
    opacity: 1;
}

/* 平滑过渡和优化渲染性能 */
.message-text {
    background-color: rgba(125, 211, 252, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    text-align: left;
    will-change: contents;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    backface-visibility: hidden;
    min-height: 20px;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.message.user .message-text {
    background-color: rgba(255, 255, 255, 0.05);
}

.light-theme .message.user .message-text {
    background-color: rgba(0, 0, 0, 0.05);
}

/* 禁用所有文本动画 */
.message-text * {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* 保持聊天容器稳定 */
.chat-messages {
    flex: 1;
    margin-bottom: 20px;
    will-change: contents;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 更流畅的打字效果 */
@media (prefers-reduced-motion: no-preference) {
    .chat-message {
        transition: opacity 0.15s ease;
    }

    .message-text br {
        line-height: 1.8;
        display: block;
        content: "";
        margin-top: 0.3em;
    }
}

/* 确保浅色主题下文本颜色有足够的对比度 - 添加在文件末尾 */
body.light-theme .assistant-grid,
body.light-theme .dashboard-content,
body.light-theme .info-bar,
body.light-theme .info-subtitle,
body.light-theme .powered-by,
body.light-theme .chat-card,
body.light-theme .chat-header h3,
body.light-theme .suggestions-card,
body.light-theme .suggestions-header h3,
body.light-theme .actions-card,
body.light-theme .actions-header h3,
body.light-theme .faq-card,
body.light-theme .faq-header h3,
body.light-theme .suggestion-title,
body.light-theme .suggestion-description,
body.light-theme .action-btn span,
body.light-theme .faq-question span,
body.light-theme .faq-answer,
body.light-theme .knowledge-card,
body.light-theme .knowledge-header h3,
body.light-theme .history-card,
body.light-theme .history-header h3,
body.light-theme .history-title,
body.light-theme .history-time,
body.light-theme .category-item,
body.light-theme .knowledge-section h4,
body.light-theme .knowledge-section li {
    color: #333 !important;
}

/* 确保文本内容在浅色主题下显示为深色 */
body.light-theme .chat-message .message-text {
    color: rgba(0, 0, 0, 0.9) !important;
}

/* 强制覆盖可能存在的其他规则 */
html[data-theme="light"] body .info-subtitle,
html[data-theme="light"] body .powered-by,
html[data-theme="light"] body .suggestion-title,
html[data-theme="light"] body .suggestion-description,
html[data-theme="light"] body .action-btn span,
html[data-theme="light"] body .faq-question span,
html[data-theme="light"] body .faq-answer,
html[data-theme="light"] body .history-title,
html[data-theme="light"] body .history-time,
html[data-theme="light"] body .category-item,
html[data-theme="light"] body .knowledge-section h4,
html[data-theme="light"] body .knowledge-section li {
    color: #333 !important;
}

/* 浅色主题下的知识库样式 - 确保所有元素都有明确定义 */
.light-theme .knowledge-card {
    background-color: rgba(240, 240, 245, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.light-theme .knowledge-body,
.light-theme .knowledge-content,
.light-theme .knowledge-categories,
.light-theme .knowledge-section,
.light-theme .category-content {
    background-color: transparent !important;
    color: #333 !important;
}

.light-theme .knowledge-item {
    background-color: rgba(255, 255, 255, 0.8) !important;
    color: #333 !important;
}

.light-theme .item-title,
.light-theme .item-desc,
.light-theme .item-tags,
.light-theme .tag {
    color: #333 !important;
}

/* 确保知识库内的图标颜色在浅色主题下正确显示 */
.light-theme .knowledge-card .fas,
.light-theme .knowledge-card .far,
.light-theme .knowledge-card .fab,
.light-theme .item-icon i {
    color: #7dd3fc !important;
}

/* 添加知识库项目的悬停效果 */
.light-theme .knowledge-item:hover {
    background-color: rgba(125, 211, 252, 0.1) !important;
}

/* 强制指定浅色主题下知识库窗口的背景色 */
html[data-theme="light"] .knowledge-card,
body.light-theme .knowledge-card {
    background-color: rgba(240, 240, 245, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* 确保内容不重叠的辅助规则 */
.assistant-grid+.auxiliary-container {
    margin-top: 20px;
}

/* 历史会话面板样式 */
.sessions-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: var(--bg-color);
    border: var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: var(--border);
    background: rgba(125, 211, 252, 0.05);
}

.sessions-header h4 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: var(--accent-color);
    background: rgba(125, 211, 252, 0.1);
}

.sessions-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 10px;
}

.sessions-list::-webkit-scrollbar {
    width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-item:hover {
    background: rgba(125, 211, 252, 0.05);
    border-color: rgba(125, 211, 252, 0.2);
    transform: translateY(-1px);
}

.session-item:last-child {
    margin-bottom: 0;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-title {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
}

.session-preview {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-meta {
    font-size: 0.7em;
    color: var(--text-muted);
}

.session-actions {
    display: flex;
    gap: 4px;
    margin-left: 10px;
}

.session-load-btn,
.session-delete-btn {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.session-load-btn {
    color: var(--accent-color);
}

.session-load-btn:hover {
    background: rgba(125, 211, 252, 0.1);
    transform: scale(1.1);
}

.session-delete-btn {
    color: #ff6b6b;
}

.session-delete-btn:hover {
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.1);
}

.no-sessions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* 聊天历史控制按钮样式优化 */
.chat-history-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.control-btn:hover {
    background: rgba(125, 211, 252, 0.1);
    border-color: rgba(125, 211, 252, 0.3);
    color: var(--accent-color);
    transform: translateY(-1px);
}

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

.control-btn i {
    font-size: 0.9em;
}