* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    position: relative;
}

/* ========== 侧边栏折叠按�?========== */
.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1200;
    transition: all 0.3s;
    display: none;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
        top: 80px;
    }
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ========== 侧边�?========== */
.sidebar {
    width: 280px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.sidebar * {
    pointer-events: auto;
}

/* 桌面端默认显�?*/
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
    }
    
    .sidebar-toggle {
        display: none; /* 桌面端隐藏折叠按�?*/
    }
}

/* 移动端可折叠 */
@media (max-width: 768px) {
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

.sidebar-header {
    padding: 24px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.sidebar-buttons {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid #eee;
    position: relative;
    z-index: 10;
}

.sidebar-btn {
    padding: 14px 16px;
    background: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #667eea;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.sidebar-btn:hover {
    background: #f8f9ff;
    color: #667eea;
}

.chat-history {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.chat-history-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.chat-history-item:hover {
    background: rgba(102, 126, 234, 0.05);
    border-left-color: #667eea;
}

.chat-history-item:hover .chat-delete-btn {
    opacity: 1;
}

.chat-history-item-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
    padding-right: 30px;
}

.chat-history-item-time {
    font-size: 12px;
    color: #999;
}

.chat-delete-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    font-size: 14px;
}

.chat-delete-btn:hover {
    background: #cc0000;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-left: 0;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

.toolbar {
    padding: 16px 24px;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid #eee;
    position: relative;
    z-index: 200;
}

.login-btn {
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.login-btn:hover {
    background: #f8f9ff;
}

/* ========== 聊天区域 ========== */
.chat-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-message {
    text-align: center;
    margin-top: 120px;
    color: #667eea;
}

.welcome-message h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -1px;
}

.welcome-message p {
    font-size: 16px;
    color: #888;
}

.message {
    margin: 8px 0;
    padding: 16px 20px;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.message.assistant {
    background: #f5f5f5;
    color: #333;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.system {
    background: #fff3cd;
    color: #856404;
    align-self: center;
    max-width: 60%;
    font-size: 14px;
    padding: 12px 16px;
}

.model-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* ========== 输入区域 ========== */
.input-area {
    padding: 16px 24px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.input-area.centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    max-width: 90%;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    border: none;
}

#messageInput {
    flex: 1;
    padding: 10px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    transition: all 0.3s;
    max-height: 200px;
    min-height: 42px;
    line-height: 1.5;
    overflow-y: auto;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.send-btn, .voice-btn {
    padding: 10px 24px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
    height: 42px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.send-btn:hover, .voice-btn:hover {
    background: #f8f9ff;
}

.voice-btn {
    background: white;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    background-image: url('/assets/pic/voice.ico');
    background-size: 24px;
    background-position: center;
    background-repeat: no-repeat;
    background-color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.voice-btn:hover {
    background-color: #f8f9ff;
    background-image: url('/assets/pic/voice.ico');
    background-size: 24px;
    background-position: center;
    background-repeat: no-repeat;
}

.voice-btn.recording {
    background-color: #ff6b6b;
    background-image: url('/assets/pic/voice.ico');
    border: none;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 30px rgba(245, 87, 108, 0.6);
    }
}

/* ========== 数据库管�?========== */
.database-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.database-area h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 28px;
}

.db-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.db-btn {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.db-btn:hover {
    background: #5568d3;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

.database-list {
    display: grid;
    gap: 16px;
}

.db-entry {
    padding: 20px;
    background: white;
    border: 2px solid #eee;
    border-radius: 12px;
    transition: all 0.3s;
}

.db-entry:hover {
    border-color: #667eea;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.15);
}

.db-entry-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.db-entry-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}

.db-entry-actions {
    display: flex;
    gap: 8px;
}

.db-action-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.db-action-btn:hover {
    background: #5568d3;
}

.db-action-btn.delete {
    background: #f5576c;
}

.db-action-btn.delete:hover {
    background: #e74c60;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 24px;
    font-size: 24px;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.modal-btn {
    padding: 14px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-right: 12px;
    transition: all 0.3s;
}

.modal-btn:hover {
    background: #5568d3;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.modal-btn.cancel-btn {
    background: #6c757d;
}

.modal-btn.cancel-btn:hover {
    background: #5a6268;
}

/* ========== 滚动条样�?========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6439);
}

/* 数据库命令结果样�?*/
.message.db-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.message.db-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* 文件类型徽章 */
.file-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #667eea;
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}

/* 分类显示 */
.db-category {
    margin-bottom: 24px;
}

.db-category-header {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    padding: 12px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
}

.db-category-items {
    display: grid;
    gap: 12px;
}

.db-entry-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* AI 创建文件的显示样�?*/
.created-files {
    margin-top: 16px;
    padding: 16px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.files-header {
    font-weight: 700;
    color: #667eea;
    margin-bottom: 12px;
    font-size: 14px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.file-item:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateX(4px);
}

.file-icon {
    font-size: 24px;
}

.file-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.file-category {
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.download-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.download-btn:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* ============================================
   新增功能样式
   ============================================ */

/* 美化模型选择�?*/
/* 美化模型选择�?*/
.model-select {
    padding: 10px 40px 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 20px !important;
    opacity: 0.6;
    transition: opacity 0.3s, border-color 0.3s;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: white;
    color: #333;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 200px;
    outline: none;
    position: relative;
    z-index: 250;
}

.model-select:hover {
    border-color: #667eea;
    background: white;
    opacity: 1;
}

.model-select:focus {
    outline: none;
    border-color: #667eea;
    border-radius: 20px !important;
}

/* 上传按钮 */
.add-btn {
    width: 42px;
    height: 42px;
    background: white;
    opacity: 0.6;
    transition: opacity 0.3s, background 0.3s;
    color: #667eea;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.add-btn:hover {
    background: #f5f5f5;
    opacity: 1;
}

/* 上传菜单 */
.upload-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 100;
    min-width: 180px;
    /* 位置�?JavaScript 动态设�?*/
}

.upload-menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s;
    color: #333;
}

.upload-menu-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* 语音按钮图标 */
.voice-icon {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    vertical-align: middle;
}

/* 代码块增�?*/
.code-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.code-action-btn {
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.code-action-btn:hover {
    background: #667eea;
    transform: translateY(-2px);
}

/* 代码块样�?*/
pre {
    background: #2d2d2d;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    position: relative;
    margin: 12px 0;
}

pre code {
    color: #f8f8f2;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* 聊天历史样式 */
.chat-history-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.chat-history-item:hover {
    background: rgba(102, 126, 234, 0.05);
    border-left-color: #667eea;
}

.chat-history-item-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.chat-history-item-time {
    font-size: 12px;
    color: #999;
}

/* 记忆显示 */
.memory-indicator {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 193, 7, 0.1);
    color: #f57c00;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

/* 数据库整理按�?*/
.digest-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.digest-btn:hover {
    box-shadow: 0 6px 16px rgba(245, 87, 108, 0.4);
    transform: translateY(-2px);
}

/* 响应式调�?*/
@media (max-width: 768px) {
    .model-select {
        min-width: 160px;
        font-size: 13px;
    }
    
    .add-btn {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
    
    .upload-menu {
        left: 12px;
        bottom: 70px;
    }
}

/* AI 消息操作按钮 */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message.assistant:hover .message-actions {
    opacity: 1;
}

.message-action-btn {
    width: 32px;
    height: 32px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.message-action-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.message-action-btn img {
    width: 18px;
    height: 18px;
}

/* 文件标签 */
.file-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    font-size: 13px;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.file-tag:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.file-tag-icon {
    font-size: 16px;
}

.file-tag-name {
    font-weight: 600;
}

.file-tag-preview {
    font-size: 11px;
    color: #999;
}

/* 文件预览模态框 */
.file-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.file-preview-modal.active {
    display: flex;
}

.file-preview-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    position: relative;
}

.file-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
}

.file-preview-close:hover {
    background: #cc0000;
}

.file-preview-body {
    margin-top: 40px;
}

.file-preview-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    max-height: 600px;
}

.file-preview-body img {
    max-width: 100%;
    border-radius: 8px;
}

/* 录音状态指�?*/
.recording-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ff6b6b;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    z-index: 100;
}

.recording-indicator.active {
    display: flex;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   UI 整体优化和美�?   ============================================ */

/* 全局滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

* {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

/* 全局过渡 */
button, a, input, textarea, select {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 数据库按钮美�?*/
.db-btn {
    padding: 10px 18px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.db-btn:hover {
    background: #f8f9ff;
}

/* 卡片式设�?*/
.message, .db-entry {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
}

/* 输入框焦点效�?*/
#messageInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* 模态框美化 */
.modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 欢迎消息美化 */
.welcome-message {
    text-align: center;
    margin-top: 80px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-message h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 发送按钮美�?*/
.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.send-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6439a0 100%);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
}

/* 工具栏美�?*/
.toolbar {
    background: linear-gradient(to right, rgba(255, 255, 255, 0.98), rgba(248, 249, 255, 0.98));
    backdrop-filter: blur(10px);
}

/* 聊天区域美化 */
.chat-area {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(248, 249, 255, 0.8));
}

/* 数据库管理区域美�?*/
.database-area {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(248, 249, 255, 0.8));
}

/* 系统消息美化 */
.message.system {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #f39c12;
}

/* 用户消息美化 */
.message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* AI 消息美化 */
.message.assistant {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
    border: 1px solid rgba(102, 126, 234, 0.1);
}

/* 响应式优�?*/
@media (max-width: 768px) {
    .welcome-message h2 {
        font-size: 24px;
    }
    
    .toolbar {
        padding: 12px 16px;
    }
    
    .input-area {
        padding: 12px 16px;
    }
    
    .input-area.centered {
        width: 95%;
    }
}

/* 加载动画 */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* 移动端专用样�?*/
@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .send-btn:not(.mobile-only) {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}
/* ============================================
   简约风格样�?- 重置
   ============================================ */

/* 自定义下拉选择�?*/
.custom-select {
    position: relative;
    min-width: 200px;
    cursor: pointer;
}

.select-selected {
    background: white;
    padding: 10px 40px 10px 16px;
    border: 2px solid #667eea;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    user-select: none;
    position: relative;
}

.select-selected:after {
    content: "�?;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #667eea;
}

.select-items {
    position: absolute;
    background: white;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99;
    margin-top: 4px;
    border: 2px solid #667eea;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.select-option {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

.select-option:hover {
    background: #f5f5f5;
}

.select-option.selected {
    background: #667eea;
    color: white;
}

/* 聊天搜索 */
.chat-search {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.chat-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
}

.chat-search input:focus {
    border-color: #667eea;
}

    .mobile-only {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* Markdown 渲染样式 */
.message-content h1, .message-content h2, .message-content h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 700;
}

.message-content h1 { font-size: 24px; }
.message-content h2 { font-size: 20px; }
.message-content h3 { font-size: 18px; }

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
}

.message-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.message-content ul, .message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 4px 0;
}

.message-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 16px;
    margin: 12px 0;
    color: #666;
}

.message-content a {
    color: #667eea;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.message-content th, .message-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message-content th {
    background: #f4f4f4;
    font-weight: 700;
}
