index.scss 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. // Universal Chat Module Styles
  2. // Clean sidebar design - reference main project style
  3. :root {
  4. // 使用主项目开放平台的 Sidebar 颜色规范
  5. --chat-bg-primary: #ffffff;
  6. --chat-bg-secondary: #ffffff; // 白色背景,与主项目一致
  7. --chat-text-primary: #131212; // 深灰近黑
  8. --chat-text-secondary: #5E5E66; // 默认文字色(加深)
  9. --chat-text-muted: #9CA3AF;
  10. --chat-border-color: #F3F4F6; // 浅边框
  11. --chat-hover-bg: #F3F4F6; // 悬停背景 = 激活背景
  12. --chat-active-bg: #F3F4F6; // 激活背景
  13. --chat-accent-color: #10b981;
  14. --chat-btn-bg: #F3F4F6; // 按钮背景(浅灰,弱干扰)
  15. --chat-btn-text: #5E5E66; // 按钮文字(灰色,不抢眼)
  16. --chat-sidebar-width: 280px;
  17. --chat-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  18. }
  19. // Main container
  20. .universal-chat-container {
  21. display: flex;
  22. height: 100vh;
  23. width: 100vw;
  24. background: var(--chat-bg-primary);
  25. overflow: hidden;
  26. }
  27. // Sidebar
  28. .chat-sidebar {
  29. width: var(--chat-sidebar-width);
  30. background: var(--chat-bg-secondary);
  31. border-right: 1px solid var(--chat-border-color);
  32. display: flex;
  33. flex-direction: column;
  34. overflow: hidden;
  35. &.collapsed {
  36. width: 80px;
  37. }
  38. }
  39. .chat-sidebar-header {
  40. padding: 16px 20px;
  41. border-bottom: 1px solid var(--chat-border-color);
  42. .logo {
  43. font-size: 20px;
  44. font-weight: 700;
  45. color: var(--chat-text-primary);
  46. display: flex;
  47. align-items: center;
  48. gap: 8px;
  49. }
  50. }
  51. .chat-sidebar-body {
  52. flex: 1;
  53. overflow-y: auto;
  54. padding: 12px;
  55. scrollbar-width: none;
  56. -ms-overflow-style: none;
  57. &::-webkit-scrollbar {
  58. display: none;
  59. }
  60. }
  61. // New chat button - 弱干扰灰色系
  62. .new-chat-btn {
  63. width: calc(100% - 24px);
  64. margin: 12px;
  65. padding: 10px 16px;
  66. background: var(--chat-btn-bg);
  67. border: none;
  68. border-radius: 8px;
  69. color: var(--chat-btn-text);
  70. font-size: 14px;
  71. font-weight: 500;
  72. cursor: pointer;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. gap: 6px;
  77. transition: var(--chat-transition);
  78. &:hover {
  79. background: var(--chat-hover-bg);
  80. color: var(--chat-text-primary);
  81. }
  82. .anticon {
  83. font-size: 16px;
  84. }
  85. }
  86. // Collapsible menu
  87. .collapsible-menu {
  88. margin-bottom: 8px;
  89. .menu-header {
  90. display: flex;
  91. align-items: center;
  92. justify-content: space-between;
  93. padding: 10px 12px;
  94. cursor: pointer;
  95. border-radius: 8px;
  96. transition: var(--chat-transition);
  97. &:hover {
  98. background: var(--chat-hover-bg);
  99. }
  100. .menu-header-left {
  101. display: flex;
  102. align-items: center;
  103. gap: 8px;
  104. }
  105. .menu-icon {
  106. font-size: 18px;
  107. color: var(--chat-text-secondary);
  108. }
  109. .menu-title {
  110. font-size: 14px;
  111. font-weight: 500;
  112. color: var(--chat-text-secondary);
  113. }
  114. .menu-search-icon {
  115. font-size: 14px;
  116. color: var(--chat-text-muted);
  117. margin-left: 4px;
  118. }
  119. .menu-arrow {
  120. font-size: 12px;
  121. color: var(--chat-text-muted);
  122. transition: transform 0.2s ease;
  123. &.expanded {
  124. transform: rotate(180deg);
  125. }
  126. }
  127. }
  128. .menu-content {
  129. padding: 4px 0;
  130. }
  131. }
  132. // Simple app item
  133. .simple-app-item {
  134. display: flex;
  135. align-items: center;
  136. gap: 10px;
  137. padding: 8px 12px 8px 36px;
  138. cursor: pointer;
  139. border-radius: 6px;
  140. transition: var(--chat-transition);
  141. &:hover {
  142. background: var(--chat-hover-bg);
  143. }
  144. .simple-app-icon {
  145. font-size: 18px;
  146. }
  147. .simple-app-name {
  148. font-size: 13px;
  149. color: var(--chat-text-secondary);
  150. white-space: nowrap;
  151. overflow: hidden;
  152. text-overflow: ellipsis;
  153. flex: 1;
  154. }
  155. }
  156. // Empty item
  157. .empty-item {
  158. padding: 12px 36px;
  159. font-size: 13px;
  160. color: var(--chat-text-muted);
  161. text-align: center;
  162. }
  163. // Recent chats section
  164. .recent-chats-section {
  165. margin-top: 16px;
  166. padding-top: 16px;
  167. border-top: 1px solid var(--chat-border-color);
  168. .section-header {
  169. display: flex;
  170. align-items: center;
  171. gap: 8px;
  172. padding: 8px 12px;
  173. margin-bottom: 8px;
  174. font-size: 13px;
  175. font-weight: 500;
  176. color: var(--chat-text-secondary);
  177. }
  178. }
  179. // Date group
  180. .date-group {
  181. margin-bottom: 16px;
  182. .date-label {
  183. padding: 6px 12px;
  184. font-size: 12px;
  185. color: var(--chat-text-muted);
  186. font-weight: 500;
  187. }
  188. .chat-item {
  189. display: flex;
  190. align-items: center;
  191. justify-content: space-between;
  192. padding: 8px 12px 8px 24px;
  193. cursor: pointer;
  194. border-radius: 6px;
  195. transition: var(--chat-transition);
  196. &:hover {
  197. background: var(--chat-hover-bg);
  198. .chat-item-edit {
  199. opacity: 1;
  200. }
  201. }
  202. &.active {
  203. background: var(--chat-active-bg);
  204. .chat-item-title {
  205. color: var(--chat-text-primary);
  206. font-weight: 600;
  207. }
  208. }
  209. .chat-item-title {
  210. font-size: 13px;
  211. color: var(--chat-text-secondary);
  212. flex: 1;
  213. white-space: nowrap;
  214. overflow: hidden;
  215. text-overflow: ellipsis;
  216. }
  217. .chat-item-edit {
  218. font-size: 14px;
  219. color: var(--chat-text-muted);
  220. opacity: 0;
  221. transition: opacity 0.2s ease;
  222. padding: 4px;
  223. cursor: pointer;
  224. &:hover {
  225. color: var(--chat-text-primary);
  226. }
  227. }
  228. }
  229. }
  230. // Empty chats
  231. .empty-chats {
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. justify-content: center;
  236. padding: 40px 20px;
  237. color: var(--chat-text-muted);
  238. p {
  239. margin-top: 16px;
  240. font-size: 13px;
  241. }
  242. }
  243. // Main chat area
  244. .chat-main {
  245. flex: 1;
  246. display: flex;
  247. flex-direction: column;
  248. background: var(--chat-bg-primary);
  249. overflow: hidden;
  250. position: relative;
  251. }
  252. // Chat messages
  253. .chat-messages {
  254. flex: 1;
  255. overflow-y: auto;
  256. padding: 24px;
  257. display: flex;
  258. flex-direction: column;
  259. gap: 20px;
  260. scrollbar-width: thin;
  261. &::-webkit-scrollbar {
  262. width: 6px;
  263. }
  264. &::-webkit-scrollbar-track {
  265. background: transparent;
  266. }
  267. &::-webkit-scrollbar-thumb {
  268. background: var(--chat-border-color);
  269. border-radius: 9999px;
  270. }
  271. }
  272. // Message bubble
  273. .message-bubble {
  274. display: flex;
  275. gap: 16px;
  276. max-width: 80%;
  277. &.user {
  278. align-self: flex-end;
  279. flex-direction: row-reverse;
  280. .bubble-content {
  281. background: var(--chat-accent-color);
  282. color: white;
  283. border-radius: 20px 20px 4px 20px;
  284. }
  285. }
  286. &.assistant {
  287. align-self: flex-start;
  288. .bubble-content {
  289. background: var(--chat-bg-secondary);
  290. color: var(--chat-text-primary);
  291. border-radius: 20px 20px 20px 4px;
  292. }
  293. }
  294. .message-avatar {
  295. width: 36px;
  296. height: 36px;
  297. border-radius: 9999px;
  298. background: var(--chat-accent-color);
  299. display: flex;
  300. align-items: center;
  301. justify-content: center;
  302. color: white;
  303. font-size: 16px;
  304. flex-shrink: 0;
  305. }
  306. .bubble-content {
  307. padding: 16px 20px;
  308. font-size: 14px;
  309. line-height: 1.6;
  310. p { margin: 0; }
  311. :global {
  312. pre {
  313. background: var(--chat-bg-secondary);
  314. padding: 16px;
  315. border-radius: 8px;
  316. overflow-x: auto;
  317. }
  318. code {
  319. background: var(--chat-bg-secondary);
  320. padding: 2px 6px;
  321. border-radius: 4px;
  322. font-family: monospace;
  323. }
  324. }
  325. }
  326. }
  327. // Welcome screen
  328. .welcome-screen {
  329. flex: 1;
  330. display: flex;
  331. flex-direction: column;
  332. align-items: center;
  333. justify-content: center;
  334. padding: 40px 24px;
  335. width: 100%;
  336. max-width: 800px;
  337. margin: 0 auto;
  338. .welcome-logo {
  339. display: flex;
  340. align-items: center;
  341. gap: 12px;
  342. margin-bottom: 40px;
  343. .logo-icon {
  344. width: 40px;
  345. height: 40px;
  346. object-fit: contain;
  347. }
  348. .logo-text {
  349. font-size: 28px;
  350. font-weight: 700;
  351. color: var(--chat-text-primary);
  352. }
  353. .logo-slogan {
  354. font-size: 20px;
  355. color: var(--chat-text-secondary);
  356. font-weight: 400;
  357. }
  358. }
  359. .welcome-input-container {
  360. width: 100%;
  361. max-width: 800px;
  362. margin: 0 auto 24px;
  363. .chat-input-wrapper {
  364. background: var(--chat-bg-secondary);
  365. border: 1px solid var(--chat-border-color);
  366. border-radius: 16px;
  367. padding: 16px 24px;
  368. transition: var(--chat-transition);
  369. &:focus-within {
  370. border-color: var(--chat-accent-color);
  371. box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
  372. }
  373. .input-placeholder {
  374. font-size: 15px;
  375. color: var(--chat-text-muted);
  376. min-height: 28px;
  377. margin-bottom: 16px;
  378. line-height: 1.6;
  379. &:empty::before {
  380. content: attr(data-placeholder);
  381. color: var(--chat-text-muted);
  382. }
  383. }
  384. .input-actions {
  385. display: flex;
  386. align-items: center;
  387. justify-content: space-between;
  388. gap: 12px;
  389. padding-top: 8px;
  390. .left-actions {
  391. display: flex;
  392. align-items: center;
  393. gap: 8px;
  394. flex-wrap: wrap;
  395. flex: 1;
  396. .action-btn {
  397. width: 36px;
  398. height: 36px;
  399. border-radius: 50%;
  400. background: transparent;
  401. border: none;
  402. cursor: pointer;
  403. color: var(--chat-text-secondary);
  404. transition: var(--chat-transition);
  405. display: flex;
  406. align-items: center;
  407. justify-content: center;
  408. &:hover {
  409. background: var(--chat-hover-bg);
  410. }
  411. }
  412. .feature-btn {
  413. display: flex;
  414. align-items: center;
  415. gap: 6px;
  416. padding: 8px 14px;
  417. background: var(--chat-bg-secondary);
  418. border: 1px solid var(--chat-border-color);
  419. border-radius: 20px;
  420. font-size: 13px;
  421. color: var(--chat-text-secondary);
  422. cursor: pointer;
  423. transition: var(--chat-transition);
  424. position: relative;
  425. white-space: nowrap;
  426. &:hover {
  427. background: var(--chat-hover-bg);
  428. }
  429. &.active {
  430. background: rgba(16, 185, 129, 0.1);
  431. border-color: var(--chat-accent-color);
  432. color: var(--chat-accent-color);
  433. .feature-icon {
  434. color: var(--chat-accent-color);
  435. }
  436. }
  437. .feature-icon {
  438. font-size: 15px;
  439. }
  440. .feature-label {
  441. font-size: 13px;
  442. }
  443. .new-tag {
  444. position: absolute;
  445. top: -6px;
  446. right: -6px;
  447. background: var(--chat-accent-color);
  448. color: white;
  449. font-size: 9px;
  450. padding: 1px 5px;
  451. border-radius: 4px;
  452. }
  453. }
  454. }
  455. .right-actions {
  456. display: flex;
  457. align-items: center;
  458. gap: 8px;
  459. flex-shrink: 0;
  460. .voice-btn {
  461. width: 36px;
  462. height: 36px;
  463. border-radius: 50%;
  464. background: transparent;
  465. border: none;
  466. cursor: pointer;
  467. color: var(--chat-text-secondary);
  468. transition: var(--chat-transition);
  469. display: flex;
  470. align-items: center;
  471. justify-content: center;
  472. &:hover {
  473. background: var(--chat-hover-bg);
  474. }
  475. }
  476. .send-btn {
  477. width: 36px;
  478. height: 36px;
  479. border-radius: 50%;
  480. background: var(--chat-bg-secondary);
  481. border: none;
  482. cursor: pointer;
  483. color: var(--chat-text-muted);
  484. transition: var(--chat-transition);
  485. display: flex;
  486. align-items: center;
  487. justify-content: center;
  488. &:not(:disabled) {
  489. background: var(--chat-accent-color);
  490. color: white;
  491. }
  492. &:hover:not(:disabled) {
  493. opacity: 0.9;
  494. }
  495. &:disabled {
  496. cursor: not-allowed;
  497. }
  498. }
  499. }
  500. }
  501. }
  502. }
  503. .suggestion-container {
  504. text-align: center;
  505. .suggestion-title {
  506. font-size: 13px;
  507. color: var(--chat-text-muted);
  508. margin-bottom: 16px;
  509. }
  510. .suggestion-list {
  511. display: flex;
  512. flex-wrap: wrap;
  513. justify-content: center;
  514. gap: 8px;
  515. .suggestion-item {
  516. padding: 8px 16px;
  517. background: var(--chat-bg-secondary);
  518. border-radius: 20px;
  519. font-size: 13px;
  520. color: var(--chat-text-secondary);
  521. cursor: pointer;
  522. transition: var(--chat-transition);
  523. &:hover {
  524. background: var(--chat-hover-bg);
  525. }
  526. }
  527. }
  528. }
  529. }
  530. // Footer
  531. .chat-footer {
  532. padding: 16px;
  533. text-align: center;
  534. .footer-content {
  535. display: flex;
  536. align-items: center;
  537. justify-content: center;
  538. gap: 12px;
  539. font-size: 12px;
  540. color: var(--chat-text-muted);
  541. .footer-divider {
  542. color: var(--chat-border-color);
  543. }
  544. .footer-link {
  545. color: var(--chat-text-muted);
  546. text-decoration: none;
  547. &:hover {
  548. color: var(--chat-text-secondary);
  549. }
  550. }
  551. }
  552. }
  553. // Loading indicator
  554. .loading-indicator {
  555. display: flex;
  556. gap: 4px;
  557. padding: 12px;
  558. .loading-dot {
  559. width: 8px;
  560. height: 8px;
  561. border-radius: 9999px;
  562. background: var(--chat-text-muted);
  563. animation: loadingBounce 1.4s ease-in-out infinite both;
  564. &:nth-child(1) { animation-delay: -0.32s; }
  565. &:nth-child(2) { animation-delay: -0.16s; }
  566. }
  567. }
  568. @keyframes loadingBounce {
  569. 0%, 80%, 100% { transform: scale(0); }
  570. 40% { transform: scale(1); }
  571. }
  572. // Back button
  573. .back-btn {
  574. position: absolute;
  575. top: 20px;
  576. right: 20px;
  577. padding: 8px 16px;
  578. background: var(--chat-bg-secondary);
  579. border: 1px solid var(--chat-border-color);
  580. border-radius: 8px;
  581. cursor: pointer;
  582. font-size: 13px;
  583. color: var(--chat-text-secondary);
  584. transition: var(--chat-transition);
  585. &:hover {
  586. background: var(--chat-hover-bg);
  587. }
  588. }
  589. // Responsive
  590. @media (max-width: 1024px) {
  591. // 小屏桌面:Sidebar 自动折叠为 80px
  592. .chat-sidebar {
  593. width: 80px;
  594. &.collapsed {
  595. width: 60px;
  596. }
  597. // 隐藏文字内容,只保留图标
  598. .chat-sidebar-header {
  599. .logo {
  600. justify-content: center;
  601. .logo-text,
  602. .logo-slogan {
  603. display: none;
  604. }
  605. }
  606. }
  607. .chat-sidebar-body {
  608. .collapsible-menu {
  609. .menu-header {
  610. .menu-title,
  611. .menu-search-icon {
  612. display: none;
  613. }
  614. .menu-arrow {
  615. display: none;
  616. }
  617. }
  618. .menu-content {
  619. display: none;
  620. }
  621. }
  622. .recent-chats-section {
  623. .section-header {
  624. .section-title-text {
  625. display: none;
  626. }
  627. }
  628. .date-group {
  629. .date-label {
  630. display: none;
  631. }
  632. .chat-item {
  633. justify-content: center;
  634. .chat-item-title {
  635. display: none;
  636. }
  637. }
  638. }
  639. }
  640. .simple-app-item {
  641. justify-content: center;
  642. padding: 8px 12px;
  643. .simple-app-name {
  644. display: none;
  645. }
  646. }
  647. .new-chat-btn {
  648. width: 40px;
  649. padding: 10px 0;
  650. justify-content: center;
  651. .new-chat-text {
  652. display: none;
  653. }
  654. }
  655. }
  656. }
  657. // 主内容区域调整
  658. .chat-main {
  659. .welcome-screen {
  660. max-width: 600px;
  661. }
  662. }
  663. }
  664. @media (max-width: 768px) {
  665. .chat-sidebar {
  666. position: fixed;
  667. left: 0;
  668. top: 0;
  669. bottom: 0;
  670. z-index: 1000;
  671. transform: translateX(-100%);
  672. &.open {
  673. transform: translateX(0);
  674. }
  675. }
  676. .message-bubble {
  677. max-width: 90%;
  678. }
  679. .welcome-screen {
  680. padding: 24px 16px;
  681. .welcome-logo {
  682. flex-direction: column;
  683. gap: 8px;
  684. }
  685. }
  686. }