| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802 |
- // Universal Chat Module Styles
- // Clean sidebar design - reference main project style
- :root {
- // 使用主项目开放平台的 Sidebar 颜色规范
- --chat-bg-primary: #ffffff;
- --chat-bg-secondary: #ffffff; // 白色背景,与主项目一致
- --chat-text-primary: #131212; // 深灰近黑
- --chat-text-secondary: #5E5E66; // 默认文字色(加深)
- --chat-text-muted: #9CA3AF;
- --chat-border-color: #F3F4F6; // 浅边框
- --chat-hover-bg: #F3F4F6; // 悬停背景 = 激活背景
- --chat-active-bg: #F3F4F6; // 激活背景
- --chat-accent-color: #10b981;
- --chat-btn-bg: #F3F4F6; // 按钮背景(浅灰,弱干扰)
- --chat-btn-text: #5E5E66; // 按钮文字(灰色,不抢眼)
- --chat-sidebar-width: 280px;
- --chat-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
- }
- // Main container
- .universal-chat-container {
- display: flex;
- height: 100vh;
- width: 100vw;
- background: var(--chat-bg-primary);
- overflow: hidden;
- }
- // Sidebar
- .chat-sidebar {
- width: var(--chat-sidebar-width);
- background: var(--chat-bg-secondary);
- border-right: 1px solid var(--chat-border-color);
- display: flex;
- flex-direction: column;
- overflow: hidden;
- &.collapsed {
- width: 80px;
- }
- }
- .chat-sidebar-header {
- padding: 16px 20px;
- border-bottom: 1px solid var(--chat-border-color);
- .logo {
- font-size: 20px;
- font-weight: 700;
- color: var(--chat-text-primary);
- display: flex;
- align-items: center;
- gap: 8px;
- }
- }
- .chat-sidebar-body {
- flex: 1;
- overflow-y: auto;
- padding: 12px;
- scrollbar-width: none;
- -ms-overflow-style: none;
- &::-webkit-scrollbar {
- display: none;
- }
- }
- // New chat button - 弱干扰灰色系
- .new-chat-btn {
- width: calc(100% - 24px);
- margin: 12px;
- padding: 10px 16px;
- background: var(--chat-btn-bg);
- border: none;
- border-radius: 8px;
- color: var(--chat-btn-text);
- font-size: 14px;
- font-weight: 500;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 6px;
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- color: var(--chat-text-primary);
- }
- .anticon {
- font-size: 16px;
- }
- }
- // Collapsible menu
- .collapsible-menu {
- margin-bottom: 8px;
- .menu-header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10px 12px;
- cursor: pointer;
- border-radius: 8px;
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- }
- .menu-header-left {
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .menu-icon {
- font-size: 18px;
- color: var(--chat-text-secondary);
- }
- .menu-title {
- font-size: 14px;
- font-weight: 500;
- color: var(--chat-text-secondary);
- }
- .menu-search-icon {
- font-size: 14px;
- color: var(--chat-text-muted);
- margin-left: 4px;
- }
- .menu-arrow {
- font-size: 12px;
- color: var(--chat-text-muted);
- transition: transform 0.2s ease;
- &.expanded {
- transform: rotate(180deg);
- }
- }
- }
- .menu-content {
- padding: 4px 0;
- }
- }
- // Simple app item
- .simple-app-item {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 8px 12px 8px 36px;
- cursor: pointer;
- border-radius: 6px;
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- }
- .simple-app-icon {
- font-size: 18px;
- }
- .simple-app-name {
- font-size: 13px;
- color: var(--chat-text-secondary);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- flex: 1;
- }
- }
- // Empty item
- .empty-item {
- padding: 12px 36px;
- font-size: 13px;
- color: var(--chat-text-muted);
- text-align: center;
- }
- // Recent chats section
- .recent-chats-section {
- margin-top: 16px;
- padding-top: 16px;
- border-top: 1px solid var(--chat-border-color);
- .section-header {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 8px 12px;
- margin-bottom: 8px;
- font-size: 13px;
- font-weight: 500;
- color: var(--chat-text-secondary);
- }
- }
- // Date group
- .date-group {
- margin-bottom: 16px;
- .date-label {
- padding: 6px 12px;
- font-size: 12px;
- color: var(--chat-text-muted);
- font-weight: 500;
- }
- .chat-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 8px 12px 8px 24px;
- cursor: pointer;
- border-radius: 6px;
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- .chat-item-edit {
- opacity: 1;
- }
- }
- &.active {
- background: var(--chat-active-bg);
- .chat-item-title {
- color: var(--chat-text-primary);
- font-weight: 600;
- }
- }
- .chat-item-title {
- font-size: 13px;
- color: var(--chat-text-secondary);
- flex: 1;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .chat-item-edit {
- font-size: 14px;
- color: var(--chat-text-muted);
- opacity: 0;
- transition: opacity 0.2s ease;
- padding: 4px;
- cursor: pointer;
- &:hover {
- color: var(--chat-text-primary);
- }
- }
- }
- }
- // Empty chats
- .empty-chats {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 40px 20px;
- color: var(--chat-text-muted);
- p {
- margin-top: 16px;
- font-size: 13px;
- }
- }
- // Main chat area
- .chat-main {
- flex: 1;
- display: flex;
- flex-direction: column;
- background: var(--chat-bg-primary);
- overflow: hidden;
- position: relative;
- }
- // Chat messages
- .chat-messages {
- flex: 1;
- overflow-y: auto;
- padding: 24px;
- display: flex;
- flex-direction: column;
- gap: 20px;
- scrollbar-width: thin;
- &::-webkit-scrollbar {
- width: 6px;
- }
- &::-webkit-scrollbar-track {
- background: transparent;
- }
- &::-webkit-scrollbar-thumb {
- background: var(--chat-border-color);
- border-radius: 9999px;
- }
- }
- // Message bubble
- .message-bubble {
- display: flex;
- gap: 16px;
- max-width: 80%;
- &.user {
- align-self: flex-end;
- flex-direction: row-reverse;
- .bubble-content {
- background: var(--chat-accent-color);
- color: white;
- border-radius: 20px 20px 4px 20px;
- }
- }
- &.assistant {
- align-self: flex-start;
- .bubble-content {
- background: var(--chat-bg-secondary);
- color: var(--chat-text-primary);
- border-radius: 20px 20px 20px 4px;
- }
- }
- .message-avatar {
- width: 36px;
- height: 36px;
- border-radius: 9999px;
- background: var(--chat-accent-color);
- display: flex;
- align-items: center;
- justify-content: center;
- color: white;
- font-size: 16px;
- flex-shrink: 0;
- }
- .bubble-content {
- padding: 16px 20px;
- font-size: 14px;
- line-height: 1.6;
- p { margin: 0; }
- :global {
- pre {
- background: var(--chat-bg-secondary);
- padding: 16px;
- border-radius: 8px;
- overflow-x: auto;
- }
- code {
- background: var(--chat-bg-secondary);
- padding: 2px 6px;
- border-radius: 4px;
- font-family: monospace;
- }
- }
- }
- }
- // Welcome screen
- .welcome-screen {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 40px 24px;
- width: 100%;
- max-width: 800px;
- margin: 0 auto;
- .welcome-logo {
- display: flex;
- align-items: center;
- gap: 12px;
- margin-bottom: 40px;
- .logo-icon {
- width: 40px;
- height: 40px;
- object-fit: contain;
- }
- .logo-text {
- font-size: 28px;
- font-weight: 700;
- color: var(--chat-text-primary);
- }
- .logo-slogan {
- font-size: 20px;
- color: var(--chat-text-secondary);
- font-weight: 400;
- }
- }
- .welcome-input-container {
- width: 100%;
- max-width: 800px;
- margin: 0 auto 24px;
- .chat-input-wrapper {
- background: var(--chat-bg-secondary);
- border: 1px solid var(--chat-border-color);
- border-radius: 16px;
- padding: 16px 24px;
- transition: var(--chat-transition);
- &:focus-within {
- border-color: var(--chat-accent-color);
- box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
- }
- .input-placeholder {
- font-size: 15px;
- color: var(--chat-text-muted);
- min-height: 28px;
- margin-bottom: 16px;
- line-height: 1.6;
- &:empty::before {
- content: attr(data-placeholder);
- color: var(--chat-text-muted);
- }
- }
- .input-actions {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- padding-top: 8px;
- .left-actions {
- display: flex;
- align-items: center;
- gap: 8px;
- flex-wrap: wrap;
- flex: 1;
- .action-btn {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- background: transparent;
- border: none;
- cursor: pointer;
- color: var(--chat-text-secondary);
- transition: var(--chat-transition);
- display: flex;
- align-items: center;
- justify-content: center;
- &:hover {
- background: var(--chat-hover-bg);
- }
- }
- .feature-btn {
- display: flex;
- align-items: center;
- gap: 6px;
- padding: 8px 14px;
- background: var(--chat-bg-secondary);
- border: 1px solid var(--chat-border-color);
- border-radius: 20px;
- font-size: 13px;
- color: var(--chat-text-secondary);
- cursor: pointer;
- transition: var(--chat-transition);
- position: relative;
- white-space: nowrap;
- &:hover {
- background: var(--chat-hover-bg);
- }
- &.active {
- background: rgba(16, 185, 129, 0.1);
- border-color: var(--chat-accent-color);
- color: var(--chat-accent-color);
- .feature-icon {
- color: var(--chat-accent-color);
- }
- }
- .feature-icon {
- font-size: 15px;
- }
- .feature-label {
- font-size: 13px;
- }
- .new-tag {
- position: absolute;
- top: -6px;
- right: -6px;
- background: var(--chat-accent-color);
- color: white;
- font-size: 9px;
- padding: 1px 5px;
- border-radius: 4px;
- }
- }
- }
- .right-actions {
- display: flex;
- align-items: center;
- gap: 8px;
- flex-shrink: 0;
- .voice-btn {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- background: transparent;
- border: none;
- cursor: pointer;
- color: var(--chat-text-secondary);
- transition: var(--chat-transition);
- display: flex;
- align-items: center;
- justify-content: center;
- &:hover {
- background: var(--chat-hover-bg);
- }
- }
- .send-btn {
- width: 36px;
- height: 36px;
- border-radius: 50%;
- background: var(--chat-bg-secondary);
- border: none;
- cursor: pointer;
- color: var(--chat-text-muted);
- transition: var(--chat-transition);
- display: flex;
- align-items: center;
- justify-content: center;
- &:not(:disabled) {
- background: var(--chat-accent-color);
- color: white;
- }
- &:hover:not(:disabled) {
- opacity: 0.9;
- }
- &:disabled {
- cursor: not-allowed;
- }
- }
- }
- }
- }
- }
- .suggestion-container {
- text-align: center;
- .suggestion-title {
- font-size: 13px;
- color: var(--chat-text-muted);
- margin-bottom: 16px;
- }
- .suggestion-list {
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- gap: 8px;
- .suggestion-item {
- padding: 8px 16px;
- background: var(--chat-bg-secondary);
- border-radius: 20px;
- font-size: 13px;
- color: var(--chat-text-secondary);
- cursor: pointer;
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- }
- }
- }
- }
- }
- // Footer
- .chat-footer {
- padding: 16px;
- text-align: center;
- .footer-content {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 12px;
- font-size: 12px;
- color: var(--chat-text-muted);
- .footer-divider {
- color: var(--chat-border-color);
- }
- .footer-link {
- color: var(--chat-text-muted);
- text-decoration: none;
- &:hover {
- color: var(--chat-text-secondary);
- }
- }
- }
- }
- // Loading indicator
- .loading-indicator {
- display: flex;
- gap: 4px;
- padding: 12px;
- .loading-dot {
- width: 8px;
- height: 8px;
- border-radius: 9999px;
- background: var(--chat-text-muted);
- animation: loadingBounce 1.4s ease-in-out infinite both;
- &:nth-child(1) { animation-delay: -0.32s; }
- &:nth-child(2) { animation-delay: -0.16s; }
- }
- }
- @keyframes loadingBounce {
- 0%, 80%, 100% { transform: scale(0); }
- 40% { transform: scale(1); }
- }
- // Back button
- .back-btn {
- position: absolute;
- top: 20px;
- right: 20px;
- padding: 8px 16px;
- background: var(--chat-bg-secondary);
- border: 1px solid var(--chat-border-color);
- border-radius: 8px;
- cursor: pointer;
- font-size: 13px;
- color: var(--chat-text-secondary);
- transition: var(--chat-transition);
- &:hover {
- background: var(--chat-hover-bg);
- }
- }
- // Responsive
- @media (max-width: 1024px) {
- // 小屏桌面:Sidebar 自动折叠为 80px
- .chat-sidebar {
- width: 80px;
- &.collapsed {
- width: 60px;
- }
- // 隐藏文字内容,只保留图标
- .chat-sidebar-header {
- .logo {
- justify-content: center;
- .logo-text,
- .logo-slogan {
- display: none;
- }
- }
- }
- .chat-sidebar-body {
- .collapsible-menu {
- .menu-header {
- .menu-title,
- .menu-search-icon {
- display: none;
- }
- .menu-arrow {
- display: none;
- }
- }
- .menu-content {
- display: none;
- }
- }
- .recent-chats-section {
- .section-header {
- .section-title-text {
- display: none;
- }
- }
- .date-group {
- .date-label {
- display: none;
- }
- .chat-item {
- justify-content: center;
- .chat-item-title {
- display: none;
- }
- }
- }
- }
- .simple-app-item {
- justify-content: center;
- padding: 8px 12px;
- .simple-app-name {
- display: none;
- }
- }
- .new-chat-btn {
- width: 40px;
- padding: 10px 0;
- justify-content: center;
- .new-chat-text {
- display: none;
- }
- }
- }
- }
- // 主内容区域调整
- .chat-main {
- .welcome-screen {
- max-width: 600px;
- }
- }
- }
- @media (max-width: 768px) {
- .chat-sidebar {
- position: fixed;
- left: 0;
- top: 0;
- bottom: 0;
- z-index: 1000;
- transform: translateX(-100%);
- &.open {
- transform: translateX(0);
- }
- }
- .message-bubble {
- max-width: 90%;
- }
- .welcome-screen {
- padding: 24px 16px;
- .welcome-logo {
- flex-direction: column;
- gap: 8px;
- }
- }
- }
|