629 lines
11 KiB
CSS
629 lines
11 KiB
CSS
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
:root {
|
|
--primary: #667eea;
|
|
--primary-dark: #5a67d8;
|
|
--bg-color: #f7fafc;
|
|
--card-bg: #ffffff;
|
|
--text-color: #2d3748;
|
|
--text-light: #718096;
|
|
--border-color: #e2e8f0;
|
|
--user-msg: #667eea;
|
|
--ai-msg: #f7fafc;
|
|
--shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background: var(--bg-color);
|
|
color: var(--text-color);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
#app {
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
}
|
|
|
|
/* ==================== 对话列表页面 ==================== */
|
|
|
|
.conversation-list-page {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
background: var(--card-bg);
|
|
}
|
|
|
|
.list-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12px 16px;
|
|
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
|
|
color: white;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
}
|
|
|
|
.list-header .header-title {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.list-header .logo {
|
|
font-size: 24px;
|
|
}
|
|
|
|
.list-header h1 {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.list-content {
|
|
flex: 1;
|
|
padding: 16px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* Header 中的新建对话按钮 - 美化版 */
|
|
.new-chat-btn-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 44px;
|
|
height: 44px;
|
|
background: rgba(255,255,255,0.95);
|
|
border: none;
|
|
border-radius: 50%;
|
|
color: var(--primary);
|
|
cursor: pointer;
|
|
transition: all 0.25s ease;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.5);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.new-chat-btn-header::before {
|
|
content: '';
|
|
position: absolute;
|
|
inset: 0;
|
|
background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0.7) 100%);
|
|
opacity: 0;
|
|
transition: opacity 0.25s;
|
|
}
|
|
|
|
.new-chat-btn-header:hover {
|
|
transform: scale(1.08);
|
|
box-shadow: 0 4px 16px rgba(102,126,234,0.4), 0 2px 8px rgba(0,0,0,0.2);
|
|
color: #5a67d8;
|
|
}
|
|
|
|
.new-chat-btn-header:hover::before {
|
|
opacity: 1;
|
|
}
|
|
|
|
.new-chat-btn-header:active {
|
|
transform: scale(0.95);
|
|
box-shadow: 0 1px 4px rgba(0,0,0,0.2);
|
|
}
|
|
|
|
.new-chat-btn-header svg {
|
|
filter: drop-shadow(0 1px 2px rgba(102,126,234,0.3));
|
|
}
|
|
|
|
/* 原样式保留(备用) */
|
|
.new-chat-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
padding: 12px 20px;
|
|
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 12px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
margin-bottom: 16px;
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.new-chat-btn:active {
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.conversation-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
}
|
|
|
|
.empty-list {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: var(--text-light);
|
|
}
|
|
|
|
.conversation-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 12px 16px;
|
|
background: white;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 12px;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
position: relative;
|
|
}
|
|
|
|
.conversation-item:hover {
|
|
border-color: var(--primary);
|
|
background: rgba(102, 126, 234, 0.05);
|
|
}
|
|
|
|
.conversation-item:active {
|
|
background: rgba(102, 126, 234, 0.1);
|
|
}
|
|
|
|
.conv-title {
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
color: var(--text-color);
|
|
margin-bottom: 4px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.conv-meta {
|
|
font-size: 12px;
|
|
color: var(--text-light);
|
|
}
|
|
|
|
.conv-delete-btn {
|
|
position: absolute;
|
|
right: 12px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
background: transparent;
|
|
border: none;
|
|
color: var(--text-light);
|
|
padding: 6px;
|
|
cursor: pointer;
|
|
opacity: 0;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.conversation-item:hover .conv-delete-btn {
|
|
opacity: 1;
|
|
}
|
|
|
|
.conv-delete-btn:hover {
|
|
color: #e53e3e;
|
|
}
|
|
|
|
/* ==================== 对话页面 ==================== */
|
|
|
|
#chatPage {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100vh;
|
|
height: 100dvh;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
background: var(--card-bg);
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 12px 16px;
|
|
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
|
|
color: white;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
}
|
|
|
|
.back-btn {
|
|
background: transparent;
|
|
border: none;
|
|
color: white;
|
|
padding: 8px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.back-btn:active {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.header-title {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
flex: 1;
|
|
margin-left: 8px;
|
|
}
|
|
|
|
.header-title h1 {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 20px;
|
|
}
|
|
|
|
.clear-btn {
|
|
background: rgba(255,255,255,0.2);
|
|
border: none;
|
|
border-radius: 8px;
|
|
padding: 8px;
|
|
color: white;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.clear-btn:active {
|
|
background: rgba(255,255,255,0.3);
|
|
}
|
|
|
|
.messages-container {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 16px;
|
|
-webkit-overflow-scrolling: touch;
|
|
}
|
|
|
|
.welcome {
|
|
text-align: center;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.welcome-icon {
|
|
font-size: 48px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.welcome h2 {
|
|
font-size: 20px;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.welcome p {
|
|
color: var(--text-light);
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.quick-actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 8px;
|
|
justify-content: center;
|
|
}
|
|
|
|
.quick-actions button {
|
|
padding: 8px 16px;
|
|
border: 1px solid var(--primary);
|
|
background: white;
|
|
color: var(--primary);
|
|
border-radius: 20px;
|
|
font-size: 14px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.quick-actions button:active {
|
|
background: var(--primary);
|
|
color: white;
|
|
}
|
|
|
|
.messages {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
}
|
|
|
|
.message {
|
|
display: flex;
|
|
gap: 12px;
|
|
animation: fadeIn 0.3s ease;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
.message.user {
|
|
flex-direction: row-reverse;
|
|
}
|
|
|
|
.message-avatar {
|
|
width: 36px;
|
|
height: 36px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 18px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.message.user .message-avatar {
|
|
background: var(--user-msg);
|
|
color: white;
|
|
}
|
|
|
|
.message.assistant .message-avatar {
|
|
background: var(--primary);
|
|
color: white;
|
|
}
|
|
|
|
.message-content {
|
|
padding: 12px 16px;
|
|
border-radius: 18px;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.message.user .message-content {
|
|
background: var(--user-msg);
|
|
color: white;
|
|
border-bottom-right-radius: 4px;
|
|
}
|
|
|
|
.message.assistant .message-content {
|
|
background: var(--ai-msg);
|
|
color: var(--text-color);
|
|
border-bottom-left-radius: 4px;
|
|
border: 1px solid var(--border-color);
|
|
}
|
|
|
|
.message-content code {
|
|
background: rgba(0,0,0,0.1);
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
font-family: 'Monaco', 'Menlo', monospace;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.message-content pre {
|
|
background: #1a1a2e;
|
|
color: #eee;
|
|
padding: 12px;
|
|
border-radius: 8px;
|
|
overflow-x: auto;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.message-content pre code {
|
|
background: transparent;
|
|
padding: 0;
|
|
}
|
|
|
|
.message.user .message-content pre {
|
|
background: rgba(0,0,0,0.2);
|
|
}
|
|
|
|
/* 流式输出光标 */
|
|
.streaming-cursor {
|
|
animation: blink 1s infinite;
|
|
color: var(--primary);
|
|
font-weight: bold;
|
|
}
|
|
|
|
@keyframes blink {
|
|
0%, 50% { opacity: 1; }
|
|
51%, 100% { opacity: 0; }
|
|
}
|
|
|
|
/* 消息结构 */
|
|
.message-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.message.user .message-body {
|
|
max-width: 85%;
|
|
}
|
|
|
|
.message.assistant .message-body {
|
|
max-width: 80%;
|
|
}
|
|
|
|
/* 消息操作按钮 */
|
|
.message-actions {
|
|
display: flex;
|
|
gap: 6px;
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.message:hover .message-actions {
|
|
opacity: 1;
|
|
}
|
|
|
|
.action-btn {
|
|
background: transparent;
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 6px;
|
|
padding: 4px 6px;
|
|
color: var(--text-light);
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.action-btn:hover {
|
|
background: var(--border-color);
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.action-btn.copy-btn:hover {
|
|
background: #dbeafe;
|
|
border-color: var(--primary);
|
|
color: var(--primary);
|
|
}
|
|
|
|
.action-btn.delete-btn:hover {
|
|
background: #fee2e2;
|
|
border-color: #e53e3e;
|
|
color: #e53e3e;
|
|
}
|
|
|
|
.action-btn.regenerate-btn:hover {
|
|
background: #dbeafe;
|
|
border-color: var(--primary);
|
|
color: var(--primary);
|
|
}
|
|
|
|
/* Markdown 内容样式 */
|
|
.message-content h1, .message-content h2, .message-content h3 {
|
|
margin: 12px 0 8px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.message-content h1 { font-size: 1.3em; }
|
|
.message-content h2 { font-size: 1.2em; }
|
|
.message-content h3 { font-size: 1.1em; }
|
|
|
|
.message-content ul, .message-content ol {
|
|
margin: 8px 0;
|
|
padding-left: 20px;
|
|
}
|
|
|
|
.message-content li {
|
|
margin: 4px 0;
|
|
}
|
|
|
|
.message-content strong {
|
|
font-weight: 600;
|
|
}
|
|
|
|
.message-content em {
|
|
font-style: italic;
|
|
}
|
|
|
|
.message-content a {
|
|
color: var(--primary);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.message-content blockquote {
|
|
margin: 8px 0;
|
|
padding: 8px 12px;
|
|
border-left: 3px solid var(--primary);
|
|
background: rgba(102, 126, 234, 0.1);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.message-content table {
|
|
margin: 8px 0;
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
}
|
|
|
|
.message-content th, .message-content td {
|
|
border: 1px solid var(--border-color);
|
|
padding: 6px 10px;
|
|
text-align: left;
|
|
}
|
|
|
|
.message-content th {
|
|
background: var(--bg-color);
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* 输入区域 */
|
|
.input-area {
|
|
display: flex;
|
|
gap: 10px;
|
|
padding: 12px 16px;
|
|
background: white;
|
|
border-top: 1px solid var(--border-color);
|
|
position: sticky;
|
|
bottom: 0;
|
|
}
|
|
|
|
#userInput {
|
|
flex: 1;
|
|
padding: 12px 16px;
|
|
border: 2px solid var(--border-color);
|
|
border-radius: 24px;
|
|
font-size: 16px;
|
|
resize: none;
|
|
outline: none;
|
|
font-family: inherit;
|
|
max-height: 120px;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
#userInput:focus {
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.send-btn {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 50%;
|
|
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
|
|
border: none;
|
|
color: white;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: transform 0.2s, opacity 0.2s;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.send-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.send-btn:disabled {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Toast 提示 */
|
|
.toast {
|
|
position: fixed;
|
|
top: 80px;
|
|
left: 50%;
|
|
transform: translateX(-50%) translateY(-20px);
|
|
background: var(--text-color);
|
|
color: white;
|
|
padding: 12px 24px;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
opacity: 0;
|
|
transition: all 0.3s ease;
|
|
z-index: 1000;
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
|
}
|
|
|
|
.toast.show {
|
|
opacity: 1;
|
|
transform: translateX(-50%) translateY(0);
|
|
}
|
|
|
|
/* 安全区域适配(刘海屏) */
|
|
@supports (padding: env(safe-area-inset-bottom)) {
|
|
.input-area {
|
|
padding-bottom: calc(12px + env(safe-area-inset-bottom));
|
|
}
|
|
} |