/* --- Variables & Reset --- */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', "Segoe UI", system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    /* 优化：使用 dvh 解决移动端浏览器地址栏遮挡问题 */
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: none; /* 取消最大宽度限制 */
    margin: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

/* --- Header & Tabs --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 52px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 1. ID/Logo (绿蓝渐变，清新科技感) --- */
.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.2px;
    white-space: nowrap;
    
    /* 从品牌绿过渡到浅海蓝 */
    background: linear-gradient(135deg, #00C375 0%, #0284c7 100%);
    -webkit-background-clip: text;    
    background-clip: text;            
    -webkit-text-fill-color: transparent; 
    color: transparent;               
}

.logo svg {
    color: #00C375; /* 图标保持品牌绿 */
}

/* --- 2. 积分徽章 (浅雾蓝背景，温和素雅) --- */
.credit-badge {
    display: flex;
    align-items: center;
    background: #f0f9ff; /* 极浅的冰蓝色 */
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid #e0f2fe; /* 柔和的浅蓝边框 */
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.credit-badge:hover {
    background: #e0f2fe;
    border-color: #bae6fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.08); /* 微微的蓝色投影 */
}

.credit-badge:active {
    transform: translateY(0);
}

.credit-text {
    font-size: 12px;
    font-weight: 600;
    color: #0369a1; /* 深海蓝色文字，保证阅读清晰且不刺眼 */
    margin: 0 6px;
}

.icon-coin {
    color: #0ea5e9; /* 清爽的天蓝色图标 */
}

.icon-refresh {
    color: #7dd3fc;
    transition: color 0.2s;
}

.credit-badge:hover .icon-refresh {
    color: #0284c7; /* 悬停时加深 */
}


/* --- 新增：邀请奖励徽章 (玫瑰粉色调) --- */
.reward-badge {
    display: flex;
    align-items: center;
    background: #fff1f2; /* 极浅的粉色 */
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid #ffe4e6;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.reward-badge:hover {
    background: #ffe4e6;
    border-color: #fecdd3;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.08);
}

.reward-badge:active {
    transform: translateY(0);
}

.reward-text {
    font-size: 12px;
    font-weight: 600;
    color: #be123c; /* 深玫瑰红 */
    margin: 0 6px;
}

.icon-reward {
    color: #f43f5e; /* 明亮的粉红色 */
}

.reward-badge .icon-refresh {
    color: #fda4af;
    transition: color 0.2s;
}

.reward-badge:hover .icon-refresh {
    color: #e11d48;
}

/* --- 3. 充值按钮 (主色调蓝色，专业沉稳) --- */
.btn-recharge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    /* 使用你源码中定义的 primary-color (#2563eb) 及其相近色做渐变 */
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
    transition: all 0.25s ease;
}

.btn-recharge:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.btn-recharge:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

.tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.tab {
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.5);
}

.tab.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

/* --- Main Content --- */
main {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8fafc;
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

#llm.tab-content.active {
    display: flex;
    height: 100%;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Configuration Cards --- */
.config-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 12px 20px;
    padding-left: 24px !important;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: background-color 0.2s;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

.card-body {
    padding: 20px;
}


.config-card.has-selection .card-header {
    background-color: #eff6ff;
    border-bottom: 1px solid #bfdbfe;
}

.config-card.has-selection .card-header h3 {
    color: var(--primary-color);
    font-weight: 700;
}

.config-card.has-selection .card-header::after {
    content: '已选中';
    font-size: 11px;
    color: #fff;
    background: var(--primary-color);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 600;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
}

.badge.orange {
    background: #fff7ed;
    color: #ea580c;
}

.badge.green {
    background: #f0fdf4;
    color: #16a34a;
}

.badge.purple {
    background: #faf5ff;
    color: #9333ea;
}

.badge.dark {
    background: #f1f5f9;
    color: #475569;
}

.badge.yellow {
    background: #fef2f2;
    color: #f1cb09;
}

.badge.red {
    background: #fef2f2;
    color: #ff0000;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
    transition: color 0.2s;
}

.form-group label::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 14px;
    background-color: var(--primary-color);
    border-radius: 2px;
    margin-right: 8px;
}

.form-group:focus-within label {
    color: var(--primary-color);
}

.input-wrapper {
    position: relative;
    padding-left: 2px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Checkbox Grid System --- */
.tools-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.checkbox-card {
    display: flex;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    /* 新增：限制单个卡片最大高度 */
    max-height: 220px;
    overflow: hidden;
}


.checkbox-card:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.checkbox-card input[type="checkbox"] {
    margin-top: 3px;
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.checkbox-card:has(input:checked) {
    border-color: var(--primary-hover);
    background: #eef4ff;
}

.check-content {
    display: flex;
    flex-direction: column;
}

.check-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
}

.check-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 3px;
}

/* --- Chat Interface --- */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

#chat-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-message,
.bot-message {
    max-width: 85%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.user-message {
    align-self: flex-end;
    background: #5a86e5;
    color: white;
    border-bottom-right-radius: 2px;
    white-space: pre-wrap;
}

.bot-message {
    align-self: flex-start;
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.intro-message {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0369a1;
}

/* Chat Controls */
.chat-controls-area {
    padding: 12px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.voice-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    user-select: none;
}

.voice-toggle input {
    display: none;
}

.voice-toggle .slider {
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 20px;
    position: relative;
    margin-right: 6px;
    transition: .3s;
}

.voice-toggle .slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

.voice-toggle input:checked+.slider {
    background-color: var(--primary-color);
}

.voice-toggle input:checked+.slider:before {
    transform: translateX(16px);
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    height: 100px;
    min-height: 50px;
    max-height: 300px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
    overflow-y: auto;
    font-family: inherit;
    font-size: 14px;
    background: #f8fafc;
}

#user-input:focus {
    background: #fff;
    border-color: var(--primary-color);
    outline: none;
}

.btn {
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #00C375;
    color: white;
    padding: 12px 20px;
}

.btn-primary:hover {
    background: rgb(53, 80, 234);
}

.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 6px 12px;
    border: 1px solid var(--border-color);
}

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
    padding: 6px 12px;
}

.btn-send {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    flex-shrink: 0;
}

.btn-lg {
    width: 100%;
    font-size: 15px;
    padding: 14px;
    border-radius: 8px;
}

.action-bar-sticky {
    position: sticky;
    bottom: 0;
    background: #f8fafc;
    padding-top: 15px;
    padding-bottom: 15px;
    z-index: 10;
    border-top: 1px solid var(--border-color);
    margin: 0 -20px -20px -20px;
    padding-left: 20px;
    padding-right: 20px;
}

/* --- Log Footer (Optimized for Mobile) --- */
.log-footer {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: #0f172a;
    color: #e2e8f0;
    height: 150px;
    min-height: 40px;    /* 最小高度 */
    max-height: 80vh;    /* 最大高度限制为屏幕的80% */
    position: relative;
}

.log-header {
    padding: 6px 20px;
    font-size: 12px;
    text-transform: uppercase;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    color: #94a3b8;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.log-toggle-icon {
    transition: transform 0.3s ease;
}

#log {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: #22c55e;
    font-family: 'Consolas', monospace;
    font-size: 12px;
    padding: 10px 20px;
    resize: none;
    outline: none;
}
/* --- 拖拽手柄样式 --- */
.log-resizer {
    height: 10px;
    cursor: ns-resize; /* 上下拖拽的鼠标样式 */
    background-color: #0f172a; 
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 10;
    transition: background-color 0.2s;
}

.log-resizer:hover, .log-resizer:active {
    background-color: #1e293b;
}

.resizer-line {
    width: 40px;
    height: 4px;
    background-color: #475569;
    border-radius: 2px;
}


/* 拖拽时全局禁用文本选中，提升体验 */
body.is-resizing {
    user-select: none;
    cursor: ns-resize !important;
}


/* Markdown & Credits styles... (Keep original) */
.bot-message p {
    margin-bottom: 10px;
}

.bot-message p:last-child {
    margin-bottom: 0;
}

.bot-message pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
    font-size: 13px;
}

.bot-message code {
    font-family: 'Consolas', monospace;
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    color: #d946ef;
}

.bot-message pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.bot-message ul,
.bot-message ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

/* 适配聊天框中的图片和视频 */
.bot-message img, 
.bot-message video {
    max-width: 100%;       /* 限制最大宽度，绝对不能超出当前对话气泡的宽度 */
    max-height: 300px;     /* 限制最大高度！这是控制占用篇幅的关键，数值可根据你的喜好修改（如 250px 或 400px） */
    object-fit: contain;   /* 保证图片/视频按原始比例缩放，完整显示且不会被拉伸变形 */
    border-radius: 8px;    /* 保持边缘圆角，UI 更美观 */
    margin-top: 10px;      /* 与上方的文字保持一点间距 */
    margin-bottom: 10px;   /* 与下方的文字保持一点间距 */
    display: block;        /* 确保多媒体文件独立占一行，不会和文字挤在一起 */
    background-color: #f5f5f5; /* 可选：加一个浅色背景，这样纯透明图片或没加载出来时有个占位 */
}

/* 适配音频播放器 */
.bot-message audio {
    max-width: 300px;      /* 限制音频播放器的宽度 */
    margin-top: 10px;
    display: block;
}

/* 下载链接按钮化美化 */
.bot-message a[download],
.bot-message a[href^="/files/"] {
    display: inline-flex;
    align-items: center;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    margin-top: 5px;
    transition: background 0.2s;
}

.bot-message a[href^="/files/"]:hover {
    background: var(--primary-hover);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: spin 0.6s linear;
}

/* =========================================
   移动端响应式适配 (Mobile Responsiveness)
   ========================================= */
@media (max-width: 768px) {

    /* 头部紧凑化 */
    .app-header {
        height: auto;
        padding: 10px 15px;
        flex-direction: column;
        gap: 12px;
    }

    .header-left-group {
        width: 100%;
        justify-content: space-between;
    }

    .tabs {
        width: 100%;
        justify-content: space-between;
    }

    .tab {
        flex: 1;
        justify-content: center;
    }

    /* 主区域内边距减小 */
    main {
        padding: 12px;
    }

    /* 网格变单列，方便手指点击 */
    .tools-grid-layout {
        grid-template-columns: 1fr;
    }

    /* 聊天区域占满 */
    .chat-wrapper {
        border-radius: 8px;
        border: none;
        box-shadow: none;
    }

    #chat-container {
        padding: 10px;
    }

    .user-message,
    .bot-message {
        max-width: 90%;
    }

    /* 底部操作栏适配 */
    .action-bar-sticky {
        margin: 0 -12px -12px -12px;
        padding: 12px;
    }

    /* 默认在移动端折叠日志，节约屏幕空间 */
    .log-footer {
        height: 32px;
    }

    .log-footer:not(.collapsed) {
        height: 30dvh;
        /* 展开时占屏幕30% */
    }
}

/* 拖拽激活时的样式 */
.input-area.drag-active {
    border: 2px dashed var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    /* 或者你主题的主色调 */
    display: flex;
    align-items: center;
    transition: color 0.2s;
    margin-left: 4px;
}

.btn-icon:hover {
    color: #3b82f6;
    /* 悬停时变蓝色 */
}

/* 文件预览容器 */
.file-previews-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px 8px 12px;
    background: #fff;
}

/* 单个文件预览标签 */
.file-preview-item {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--text-main);
    max-width: 200px;
}

.file-preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 删除按钮 */
.file-remove-btn {
    margin-left: 6px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.file-remove-btn:hover {
    color: var(--danger-color);
}

.module-load-label {
    font-size: 12px;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.module-loader {
    cursor: pointer;
}

/* --- 新增：配置页侧边栏布局 --- */
#config.active {
    display: block;
    /* 覆盖之前的 tab-content 样式 */
    height: 100%;
}

.config-layout {
    display: flex;
    height: 100%;
    margin: -20px;
    /* 抵消 main 的 padding 达到全屏填充效果 */
    background: #fff;
}

.config-sidebar {
    width: 130px;
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 10px 0;
    overflow-y: auto;
}

.sidebar-item {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.sidebar-item.active {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}


/* --- 新增：侧边栏菜单项存在选中工具时的状态 --- */
.sidebar-item.has-selected {
    /* color: var(--primary-color); */
    font-weight: 500;
    position: relative;
}

/* 推荐：加一个小圆点作为视觉提示 */
.sidebar-item.has-selected::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: var(--danger-color); 
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}

/* 既有工具选中，又是当前激活的菜单时 */
.sidebar-item.has-selected.active {
    font-weight: 600;
}

.config-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfdfd;
}

.config-section {
    display: none;
    /* 默认隐藏所有分组 */
    animation: fadeIn 0.3s ease;
}

.config-section.active {
    display: block;
    /* 只显示激活的分组 */
}

/* 适配移动端：侧边栏变更为顶部横向滚动栏 */
@media (max-width: 768px) {
    .config-layout {
        flex-direction: column;
    }

    .config-sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
        padding: 5px;
        scrollbar-width: none;
        /* 隐藏滚动条 */
    }

    .config-sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-item {
        white-space: nowrap;
        padding: 8px 15px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .sidebar-item.active {
        border-bottom-color: var(--primary-color);
        background: transparent;
    }

    .config-main {
        padding: 15px;
    }
}


/* --- 过程日志样式 (Process Logs) --- */
.process-logs-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.process-logs-container:empty {
    display: none; /* 没有日志时隐藏容器 */
}

.process-log-item {
    font-size: 12px;
    color: var(--text-muted);
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid #cbd5e1;
    font-family: 'Consolas', monospace;
    white-space: pre-wrap;
    word-break: break-all;
    animation: fadeIn 0.3s ease;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.02);
}

/* 针对不同日志类型增加高亮标识色 */
.process-log-item.skill { border-left-color: #9333ea; }  /* 紫色：命中技能 */
.process-log-item.tool-load { border-left-color: #f59e0b; } /* 橙色：加载工具 */
.process-log-item.execute { border-left-color: #3b82f6; } /* 蓝色：执行动作 */
.process-log-item.result { border-left-color: #10b981; } /* 绿色：返回结果 */
.process-log-item.error { border-left-color: #ef4444;background: #fef2f2; color: #b91c1c; } /* 红色：警示错误 */


/* --- 充值弹窗样式 (Recharge Modal) --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-md);
    width: 320px;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 16px; margin: 0; color: var(--text-main); }
.close-modal { font-size: 24px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.close-modal:hover { color: var(--danger-color); }
.modal-body { padding: 20px; }


/* --- 充值弹窗高级美化样式 --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.45); /* 深色半透明 */
    backdrop-filter: blur(5px); /* 高级毛玻璃模糊特效 */
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #ffffff;
    border-radius: 16px; /* 现代大圆角 */
    width: 350px;
    max-width: 92%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-title-icon {
    color: var(--primary-color);
}

.modal-header h3 { 
    font-size: 15px; 
    font-weight: 600;
    margin: 0; 
    color: #0f172a; 
}

.close-modal { 
    font-size: 22px; 
    cursor: pointer; 
    color: #94a3b8; 
    line-height: 1;
    transition: color 0.2s;
}
.close-modal:hover { color: var(--danger-color); }

.modal-body { padding: 20px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 8px;
}

/* 快捷金额格子 */
.amount-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.preset-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eff6ff;
}

.preset-btn.active {
    border-color: var(--primary-color);
    color: #ffffff;
    background: var(--primary-color);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

/* 修改快捷金额按钮使其支持两行显示 */
.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    padding: 8px 0;
    /* 保留你原有的边框、圆角等其他样式 */
}

/* 按钮内金额文字 */
.preset-amount {
    font-size: 14px;
    font-weight: 700;
}

/* 按钮内积分文字 */
.preset-points {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    transition: color 0.2s ease;
}

.preset-btn:hover .preset-points {
    color: var(--primary-color);
    opacity: 0.8;
}

.preset-btn.active .preset-points {
    color: #e0f2fe; /* 激活时变为柔和的白/浅蓝色 */
}

/* 动态积分提示条的样式 */
.points-calc-hint {
    font-size: 12px;
    color: var(--primary-color);
    margin-top: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff; /* 浅蓝色背景强调 */
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px dashed #bfdbfe;
}

/* 在提示前加一个小图标（使用 CSS 数据格式注入） */
.points-calc-hint::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="%232563eb" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-size: cover;
}

/* 输入框美化 */
.custom-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.custom-input-wrapper input {
    width: 100%;
    padding: 11px 12px 11px 32px;
    font-size: 16px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
}

.custom-input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* 立即支付按钮 */
.btn-pay-submit {
    width: 100%;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}
.btn-pay-submit:hover { background: var(--primary-hover); }
.btn-pay-submit:disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; }

/* 二维码区域样式优化 */
.qr-container {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    animation: qrFadeIn 0.3s ease forwards;
}

.qr-wrapper {
    display: inline-block;
    background: #ffffff;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.qr-wrapper canvas { display: block; }

.qr-hint {
    margin: 10px 0 12px 0;
    color: #64748b;
    font-size: 12px;
}

/* 动态状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #f1f5f9;
    color: #475569;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status-badge.waiting {
    background: #eff6ff;
    color: var(--primary-color);
}

.status-badge.success {
    background: #ecfdf5;
    color: var(--success-color);
}

/* 旋转加载动画 */
.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(37, 99, 235, 0.15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes qrFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- 思考模式下拉菜单样式 --- */
.thinking-dropdown {
    position: relative;
    display: inline-block;
}

.thinking-btn-custom {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    user-select: none;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: #fff;
    transition: all 0.2s;
}

.thinking-btn-custom:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* 当选择了除“关闭”以外的级别时，激活蓝色高亮状态 */
.thinking-btn-custom.is-active {
    background: #eff6ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.thinking-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px); /* 向上弹出，避免被聊天框底边遮挡 */
    left: 0;
    background-color: #fff;
    min-width: 90px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.thinking-menu.show {
    display: block;
}

.thinking-item {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.thinking-item:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.thinking-item.active {
    background-color: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
}

.btn-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 复制按钮样式 */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 12px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}