/* 基础变量 */ :root { --primary-color: #6e48aa; --primary-light: #9d50bb; --secondary-color: #4776e6; --text-primary: #2d3748; --text-secondary: #718096; --bg-color: #f8f9fa; --bg-elevated: #ffffff; --border-color: #e2e8f0; --user-bubble: #edf2f7; --ai-bubble: #ffffff; --shadow-sm: 0 1px 3px rgba(0,0,0,0.12); --shadow-md: 0 4px 6px rgba(0,0,0,0.1); --radius-md: 8px; --radius-lg: 12px; } /* 动画定义 */ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } @keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.7; } 100% { transform: scale(1); opacity: 1; } } @keyframes typing { 0% { opacity: 0.4; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } 100% { opacity: 0.4; transform: translateY(0); } } /* 主容器 */ .chat-container { display: flex; flex-direction: column; height: 100vh; background-color: var(--bg-color); position: relative; overflow: hidden; } /* 顶部导航栏 */ .chat-header { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); color: white; padding: 0.75rem 1.5rem; box-shadow: var(--shadow-md); z-index: 10; .header-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; } .ai-identity { display: flex; align-items: center; gap: 0.75rem; h1 { font-size: 1.25rem; font-weight: 600; margin: 0; } } .avatar-pulse { position: relative; .avatar { width: 36px; height: 36px; border-radius: 50%; background-color: white; color: var(--primary-color); display: flex; align-items: center; justify-content: center; font-weight: bold; z-index: 2; position: relative; } .pulse-ring { position: absolute; top: -4px; left: -4px; right: -4px; bottom: -4px; background: rgba(255,255,255,0.3); border-radius: 50%; z-index: 1; opacity: 0; transition: opacity 0.3s ease; &.active { opacity: 1; animation: pulse 2s infinite; } } } .status-indicator { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; background: rgba(255,255,255,0.15); padding: 0.25rem 0.75rem; border-radius: 1rem; transition: all 0.3s ease; &.error { background: rgba(239, 68, 68, 0.2); color: #fef2f2; } &.loading { .status-light { animation: pulse 1.5s infinite; } } .status-light { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; .error & { background: #ef4444; } .loading & { background: #fbbf24; } } } } /* 消息区域 */ .chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; scroll-behavior: smooth; display: flex; flex-direction: column; gap: 0.5rem; max-width: 1200px; margin: 0 auto; width: 100%; box-sizing: border-box; .message-wrapper { &.new-group { margin-top: 1.25rem; position: relative; &::before { content: ''; position: absolute; top: -0.75rem; left: 50%; transform: translateX(-50%); width: 60%; height: 1px; background: var(--border-color); opacity: 0.6; } } } .message { max-width: 85%; margin: 0 auto; animation: fadeIn 0.3s ease-out forwards; opacity: 0; &.user { margin-left: auto; margin-right: 0; .message-content { flex-direction: row-reverse; } .message-bubble { background-color: var(--user-bubble); border-top-right-radius: 4px; } } &.assistant { margin-left: 0; margin-right: auto; .message-bubble { background-color: var(--ai-bubble); border-top-left-radius: 4px; box-shadow: var(--shadow-sm); } } .message-content { display: flex; gap: 0.75rem; align-items: flex-end; } .avatar-container { .avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-light), var(--secondary-color)); color: white; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: bold; flex-shrink: 0; &.user { background: var(--text-secondary); } } } .bubble-container { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; min-width: 0; } .message-bubble { padding: 0.75rem 1rem; border-radius: var(--radius-md); line-height: 1.5; word-wrap: break-word; position: relative; transition: transform 0.2s ease; &:hover { .message-actions { opacity: 1; } } } .message-actions { position: absolute; right: 0; top: -24px; display: flex; gap: 0.25rem; background: white; padding: 0.25rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); opacity: 0; transition: opacity 0.2s ease; } .action-button { width: 24px; height: 24px; border-radius: 4px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; &:hover { background: var(--bg-color); color: var(--primary-color); } } .timestamp { font-size: 0.75rem; color: var(--text-secondary); padding: 0 0.5rem; } .typing-indicator { display: flex; gap: 0.25rem; padding: 0.5rem 0; .dot { width: 8px; height: 8px; border-radius: 50%; background-color: var(--text-secondary); opacity: 0.4; animation: typing 1.4s infinite ease-in-out; &:nth-child(1) { animation-delay: 0s; } &:nth-child(2) { animation-delay: 0.2s; } &:nth-child(3) { animation-delay: 0.4s; } } } } } /* 输入区域 */ .chat-input-container { background: var(--bg-elevated); border-top: 1px solid var(--border-color); padding: 1rem; position: relative; max-width: 1200px; margin: 0 auto; width: 100%; box-sizing: border-box; .input-tools { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; } .tool-button { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; &:hover { background: var(--bg-color); color: var(--primary-color); } } .input-wrapper { display: flex; background: var(--bg-elevated); border-radius: var(--radius-lg); border: 1px solid var(--border-color); transition: all 0.2s ease; overflow: hidden; &.focused { border-color: var(--primary-color); box-shadow: 0 0 0 1px var(--primary-color); } textarea { flex: 1; border: none; padding: 0.75rem 1rem; resize: none; max-height: 150px; min-height: 44px; font-family: inherit; line-height: 1.5; background: transparent; color: var(--text-primary); &:focus { outline: none; } &::placeholder { color: var(--text-secondary); opacity: 0.6; } } .input-actions { display: flex; align-items: flex-end; padding: 0 0.5rem 0.5rem; } .send-button { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--primary-color); border: none; color: white; cursor: pointer; transition: all 0.2s ease; position: relative; overflow: hidden; &:disabled { background: var(--border-color); cursor: not-allowed; svg { opacity: 0.5; } } &:not(:disabled):hover { background: var(--primary-light); transform: translateY(-2px); } &.loading { background: var(--border-color); } svg { transition: all 0.2s ease; &.active { color: white; } } .spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: white; animation: spin 1s ease-in-out infinite; } } } } /* 历史面板 */ .history-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 300px; background: var(--bg-elevated); border-left: 1px solid var(--border-color); z-index: 20; display: flex; flex-direction: column; box-shadow: -4px 0 12px rgba(0,0,0,0.05); transform: translateX(100%); animation: slideIn 0.3s ease-out forwards; .panel-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border-color); h3 { margin: 0; font-size: 1rem; color: var(--text-primary); } .close-button { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; &:hover { background: var(--bg-color); } } } .history-list { flex: 1; overflow-y: auto; padding: 0.5rem; } .history-item { padding: 0.75rem; border-radius: var(--radius-md); margin-bottom: 0.5rem; cursor: pointer; transition: all 0.2s ease; &:hover { background: var(--bg-color); } .item-content { font-size: 0.875rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 0.25rem; } .item-time { font-size: 0.75rem; color: var(--text-secondary); } } } /* 动画定义 */ @keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } } @keyframes spin { to { transform: rotate(360deg); } } /* 响应式调整 */ @media (max-width: 768px) { .chat-messages { padding: 1rem; .message { max-width: 90%; } } .history-panel { width: 280px; } } .action-button { font-size: 1.2em; line-height: 1; } .send-button { font-size: 1.5em; }