/* 聊天容器样式 */
.post-ai-chat-container {
    max-width: 1200px;
    margin: 0rem auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 0rem;
}

/* 聊天标题样式 */
.post-ai-chat-container h1,
.post-ai-chat-container h2,
.post-ai-chat-container h3 {
    font-size: 1.2rem;
    color: #333;
    padding-bottom: 0.5rem;
    margin-top: 0.5rem;
    line-height: 1.3;
}

.post-ai-chat-container h3 {
    border-bottom: 2px solid #f0f0f0;
}

/* 聊天历史区域样式 */
.post-ai-chat-history {
    min-height: 50px;
    max-height: 800px;
    overflow-y: auto;
    padding: 0.2rem;
    border-radius: 8px;
    resize: vertical;
}
.post-ai-chat-history p {
    margin: 0;
    padding:0;
}
/* 当聊天历史为空时隐藏 */
.post-ai-chat-history:empty {
    display: none;
}

/* 滚动条样式 */
.post-ai-chat-history::-webkit-scrollbar {
    width: 8px;
}

.post-ai-chat-history::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.post-ai-chat-history::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.post-ai-chat-history::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 聊天消息样式 */
.chat-message {
    margin-bottom: 0.4rem;
    padding: 0.3rem;
    border-radius: 8px;
    /* max-width:95%; */
    position: relative;
    line-height: 1.2;
}

/* 用户消息样式 */
.user-message {
    background: #007bff;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

/* AI消息样式 */
.ai-message {
    background: #fff;
    color: #333;
    margin-right: auto;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 2px;
}

/* AI消息内容样式 */
.ai-content {
    white-space: normal;
    word-wrap: break-word;
}

/* 错误消息样式 */
.error-message {
    background: #dc3545;
    color: #fff;
    margin: 1rem auto;
    text-align: center;
    max-width: 100%;
}

/* AI 思考过程样式 */
.ai-reasoning {
    margin-top: 1rem;
    border-top: 1px dashed #eee;
    padding-top: 0.8rem;
}

.ai-reasoning summary {
    cursor: pointer;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    outline: none;
}

.ai-reasoning summary:hover {
    color: #343a40;
}

.ai-reasoning pre {
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px; /* 限制最大高度 */
    overflow-y: auto; /* 超出时显示滚动条 */
}

/* 调整滚动条样式 */
.ai-reasoning pre::-webkit-scrollbar {
    width: 6px;
}

.ai-reasoning pre::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 3px;
}

.ai-reasoning pre::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 3px;
}

.ai-reasoning pre::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Gemini 思考过程样式 */
.ai-thinking {
    margin-top: 1rem;
    border-top: 1px dashed #e3f2fd;
    padding-top: 0.8rem;
}

.ai-thinking summary {
    cursor: pointer;
    color: #1976d2;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    outline: none;
    display: flex;
    align-items: center;
}

.ai-thinking summary::before {
    content: "🧠";
    margin-right: 0.5rem;
    font-size: 1rem;
}

.ai-thinking summary:hover {
    color: #1565c0;
}

.ai-thinking .thinking-content {
    background: linear-gradient(135deg, #f3f9ff 0%, #e8f4fd 100%);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1565c0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #bbdefb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

.ai-thinking .thinking-content:empty::before {
    content: "思考中...";
    color: #90caf9;
    font-style: italic;
}

/* Gemini 思考过程滚动条样式 */
.ai-thinking .thinking-content::-webkit-scrollbar {
    width: 6px;
}

.ai-thinking .thinking-content::-webkit-scrollbar-track {
    background: #e3f2fd;
    border-radius: 3px;
}

.ai-thinking .thinking-content::-webkit-scrollbar-thumb {
    background: #90caf9;
    border-radius: 3px;
}

.ai-thinking .thinking-content::-webkit-scrollbar-thumb:hover {
    background: #64b5f6;
}

/* 输入区域样式 */
.post-ai-chat-input {
    display: flex;
    padding: 0.05rem;
    border-radius: 8px;
    resize: none;
}

/* 输入框容器 */
.input-wrapper {
    flex: 1;
    position: relative;
}

/* 拉杆式模型切换按钮 */
.model-toggle-lever {
    position: absolute;
    bottom: 40px;
    left: 8px;
    z-index: 20;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 2px 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    user-select: none;
    font-size: 0.65rem;
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 48px;
    justify-content: center;
    height: 20px;
    pointer-events: auto;
}

.model-toggle-lever:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.model-toggle-lever.reasoning-mode {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-color: #ce93d8;
    color: #6a1b9a;
}

.model-toggle-lever.reasoning-mode:hover {
    background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
}

/* 拉杆内部的指示器 */
.model-toggle-lever::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #28a745;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.model-toggle-lever.reasoning-mode::before {
    background-color: #9c27b0;
}

/* 隐藏原来的切换开关 */
.model-switch-container {
    display: none;
}

/* 文本框样式 */
#post-ai-chat-question {
    width: 100%;
    min-height: 60px;
    padding: 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out;
    box-sizing: border-box;
    resize: vertical;
}

#post-ai-chat-question:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 提交按钮样式 */
#post-ai-chat-submit {
    padding: 0.8rem 1.5rem;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out;
}

#post-ai-chat-submit:hover {
    background: #0056b3;
}

#post-ai-chat-submit:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 加载状态样式 */
.loading {
    opacity: 0.7;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .post-ai-chat-container {
        margin: 0rem;
        padding: 0rem;
    }

    .chat-message {
        max-width: 100%;
    }

    .post-ai-chat-input {
        flex-direction: column;
    }
    
    .model-toggle-lever {
        bottom: 6px;
        left: 6px;
        font-size: 0.6rem;
        padding: 2px 4px;
        min-width: 42px;
        height: 18px;
    }
    
    #post-ai-chat-question {
        padding: 0.6rem;
        min-height: 50px;
    }

    #post-ai-chat-submit {
        width: 100%;
    }
}

/* 打字机效果 */
.ai-content {
    animation: typing 0.05s steps(1, end);
}

@keyframes typing {
    from { opacity: 0; }
    to { opacity: 1; }
}

.model-info {
    margin-bottom: 10px;
    padding: 8px 12px;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    text-align: center;
}

/* 侧边栏样式 */
.widget .post-ai-chat-container {
    margin: 0;
    padding: 5px;
    box-shadow: none;
}

.widget .post-ai-chat-history {
    max-height: 400px;
}

.widget .post-ai-chat-input {
    flex-direction: column;
}

.widget #post-ai-chat-question {
    width: 100%;
    margin-bottom: 10px;
}

.widget #post-ai-chat-submit {
    width: 100%;
}

.widget .model-info {
    margin: 0 0 10px 0;
    font-size: 12px;
}

.widget .model-toggle-lever {
    bottom: 4px;
    left: 4px;
    font-size: 0.55rem;
    padding: 1px 3px;
    min-width: 36px;
    height: 16px;
}

.widget #post-ai-chat-question {
    padding: 0.5rem;
    min-height: 80px;
} 
.widget #post-ai-chat-question {
    padding: 0.5rem;
    min-height: 80px;
}

/* 工具调用块紧凑样式 */
.lafc-tool-call-block {
    margin: 0.2rem 0;
    border-radius: 6px;
    overflow: hidden;
}

.lafc-tool-call {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #fafbfc;
}

.lafc-tool-call summary {
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
    line-height: 1.2;
    transition: background-color 0.15s ease;
    outline: none;
    display: flex;
    align-items: center;
}

.lafc-tool-call summary:hover {
    background: #e9ecef;
}

.lafc-tool-name {
    font-weight: 500;
    color: #495057;
}

.lafc-tool-details {
    padding: 0.3rem 0.5rem;
    background: #fff;
    font-size: 0.8rem;
}

.lafc-tool-input,
.lafc-tool-output {
    margin-bottom: 0.3rem;
}

.lafc-tool-input:last-child,
.lafc-tool-output:last-child {
    margin-bottom: 0;
}

.lafc-tool-input strong,
.lafc-tool-output strong {
    color: #6c757d;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    display: block;
}

.lafc-code {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 0.3rem;
    margin: 0.2rem 0 0 0;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #495057;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.lafc-code::-webkit-scrollbar {
    height: 4px;
}

.lafc-code::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 2px;
}

.lafc-code::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 2px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .lafc-tool-call summary {
        padding: 0.25rem 0.4rem;
        font-size: 0.8rem;
    }

    .lafc-tool-details {
        padding: 0.25rem 0.4rem;
    }

    .lafc-code {
        font-size: 0.7rem;
        padding: 0.25rem;
    }
}