/* ========== 主题色变量 ========== */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --code-bg: #f5f5f5;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --code-bg: #2d2d2d;
}

/* ========== 布局 ========== */
#deepseek-chat-container {
    display: flex;
    height: calc(100vh - 70px);
    background: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#deepseek-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

#deepseek-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    margin: 0 auto;
    width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#deepseek-chat-history {
    width: 260px;
    background: #f9f9f9;
    border-right: 1px solid #e5e5e5;
    padding: 16px;
    overflow-y: auto;
}

#deepseek-chat-history ul {
    padding: 0;
    margin: 0;
}

#deepseek-chat-history li {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    background: white;
    border: 1px solid #e5e5e5;
    transition: all 0.2s;
    position: relative;
}

#deepseek-chat-history li:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

#deepseek-chat-history li.active {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

.deepseek-delete-log {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #666;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

#deepseek-chat-history li:hover .deepseek-delete-log {
    opacity: 1;
}

/* ========== 聊天功能 ========== */
#deepseek-new-chat {
    width: 100%;
    padding: 12px;
    background: #0d9488;
    color: white;
    border: none;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

#deepseek-new-chat:hover {
    background: #0f766e;
}

/* 消息气泡 */
.message-bubble {
    position: relative;
    max-width: 85%;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 12px;
    line-height: 1.5;
    transition: opacity 0.3s;
}

.message-bubble.user {
    background: #007bff;
    color: white;
    margin-left: auto;
}

.message-bubble.bot {
    background: white;
    color: #333;
    border: 1px solid #e5e5e5;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message-bubble.loading {
    color: #666;
    font-style: italic;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}
.message-bubble.loading:not(:last-child) {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}
.message-bubble.error {
    background-color: #ffe6e6;
    color: #cc0000;
}

.message-content {
    white-space: pre-wrap;
    font-family: monospace;
}

/* ========== 代码块样式 ========== */
.code-block-container {
    position: relative;
    display: flex;
    border-radius: 8px;
    background: #1E1E1E;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex-direction: column;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #50505a;
    border-bottom: 1px solid #3A3A3A;
}

.code-lang {
    font-size: 0.85em;
    color: #9CDCFE;
    font-family: 'Fira Code', monospace;
    font-weight: 500;
}

.code-copy {
    display: flex; 
    opacity: 0;
}

.code-block-header:hover .code-copy {
    background: transparent;
    color: var(--bg-color);
    opacity: 1;
}

.code-block-container pre {
    margin-bottom: 0;
}

pre code.hljs {
    display: block;
    padding: 1rem;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    color: #D4D4D4;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #4F4F4F #1E1E1E;
}

pre code.hljs::-webkit-scrollbar {
    height: 8px;
    background-color: #1E1E1E;
}

pre code.hljs::-webkit-scrollbar-thumb {
    background-color: #4F4F4F;
    border-radius: 4px;
}

.line-numbers {
  padding: 1em 0.5em;
  text-align: right;
  background: #f8f8f8;
  border-right: 1px solid #ddd;
  user-select: none;
  color: #666;
}

.ln {
  line-height: 1.5em; 
}

/* ========== 代码高亮主题 ========== */
.hljs-keyword { color: #569CD6; }
.hljs-built_in { color: #4EC9B0; }
.hljs-type { color: #4EC9B0; }
.hljs-literal { color: #569CD6; }
.hljs-number { color: #B5CEA8; }
.hljs-string { color: #CE9178; }
.hljs-comment { color: #6A9955; font-style: italic; }
.hljs-meta { color: #9B9B9B; }
.hljs-function { color: #DCDCAA; }
.hljs-params { color: #9CDCFE; }
.hljs-title { color: #DCDCAA; }
.hljs-variable { color: #9CDCFE; }
.hljs-attr { color: #9CDCFE; }
.hljs-tag { color: #569CD6; }
.hljs-name { color: #569CD6; }

/* ========== 交互优化 ========== */
.message-bubble:hover .code-copy {
    opacity: 1;
}

.code-block-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease;
}

/* ========== 输入框和发送 ========== */
#deepseek-chat-input-container {
    position: relative;
    padding: 16px 24px;
    background: white;
    border-top: 1px solid #e5e5e5;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#deepseek-chat-input {
    flex: 1;
    padding: 12px 48px 12px 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.5;
    min-height: 44px;
    max-height: 120px;
    resize: none;
    transition: all 0.2s;
    overflow-y: hidden;
}

#deepseek-chat-send {
    position: absolute;
    right: 36px;
    bottom: 20px;
    background: #0d9488;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

#deepseek-chat-send:hover {
    background: #0f766e;
    transform: scale(1.05);
}

#deepseek-chat-input:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.1);
}
/* 自定义提示词板块样式 */
#deepseek-custom-prompts {
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
    text-align: center;
}

#deepseek-custom-prompts .deepseek-prompt {
    display: inline-block;
    background: #4a90e2;
    color: #fff;
    padding: 8px 16px;
    margin: 6px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#deepseek-custom-prompts .deepseek-prompt:hover {
    background: #357ab8;
    transform: translateY(-2px);
}
/* ========== 提示和错误 ========== */
.deepseek-login-prompt {
    margin: 20px auto;
    max-width: 600px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.chat-text{
    display: inline-block;
    background: linear-gradient(270deg, rgb(174, 121, 204) 3%, rgb(19, 102, 236) 96%) text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
    font-size: 36px;
}
.chat-message.error a {
    color: #0073aa;
    text-decoration: underline;
}

.chat-message.error a:hover {
    color: #005177;
}
/* 添加过渡效果 */
#chatbot-prompt,
#deepseek-custom-prompts {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hidden-prompts {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}
/* ========== 复制功能 ========== */
.deepseek-copy-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
}

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


/* ========== 动画和交互 ========== */
.typing-indicator {
    display: inline-flex;
    padding: 8px;
    background: #f1f1f1;
    border-radius: 12px;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background: #666;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite;
}

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

@keyframes typing-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ========== 移动端优化 ========== */
@media (max-width: 768px) {
    #deepseek-chat-history {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: 0.3s;
        z-index: 1000;
        display: block !important;
    }

    #deepseek-chat-history.active {
        transform: translateX(260px);
    }

    #mobile-menu-toggle {
        display: block;
        position: fixed;
        background: #0d9488;
        color: white;
        padding: 8px 12px;
        border-radius: 6px;
        z-index: 99;
        border: none;
        cursor: pointer;
    }

    .deepseek-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        display: none;
        z-index: 999;
    }

    .deepseek-overlay.active {
        display: block;
    }

    .deepseek-prompt {
        font-size: 13px;
        padding: 10px 12px;
    }

    .message-bubble {
        max-width: 90%;
        padding: 10px 14px;
    }

    .code-block-container {
        margin: 1rem 0;
        border-radius: 6px;
    }

    pre code.hljs {
        padding: 1rem;
        font-size: 0.85em;
    }

    .code-lang {
        font-size: 0.8em;
    }

    .code-copy {
        padding: 4px 8px;
        font-size: 0.8em;
    }
}

.deepseek-mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .deepseek-mobile-only {
        display: block;
    }
}
