Input.css 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /* 极简主义:灰色背景 + 黑色线条 - 美化版 - 纯 Flex 布局 */
  2. .input-container {
  3. display: flex;
  4. align-items: center;
  5. justify-content: center;
  6. position: relative;
  7. width: 100%;
  8. height: 100%;
  9. padding: clamp(10px, 2.5cqw, 18px);
  10. box-sizing: border-box;
  11. container-type: inline-size;
  12. font-size: clamp(13px, 2.5cqw, 16px);
  13. gap: clamp(8px, 2cqw, 12px);
  14. }
  15. /* 输入框 - 响应式缩放 - 长方形 - 宽度90% - 自动缩放 - Flex 布局 */
  16. .input-text {
  17. flex: 1;
  18. width: 100%;
  19. min-width: 0;
  20. max-width: 100%;
  21. height: clamp(32px, 6cqw, 40px);
  22. min-height: clamp(32px, 6cqw, 40px);
  23. background: #ffffff;
  24. color: #0f0f0f;
  25. border: 2px solid #0f0f0f;
  26. border-radius: clamp(2px, 0.5cqw, 4px);
  27. padding: 0 clamp(3em, 5cqw, 3.5em) 0 clamp(3em, 5cqw, 3.5em);
  28. font-size: clamp(12px, 2.2cqw, 16px);
  29. line-height: clamp(32px, 6cqw, 40px);
  30. outline: none;
  31. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  32. box-sizing: border-box;
  33. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  34. font-weight: 400;
  35. overflow: hidden;
  36. text-overflow: ellipsis;
  37. }
  38. .input-text::placeholder {
  39. color: #999;
  40. font-size: 1em;
  41. opacity: 0.7;
  42. }
  43. .input-text:focus {
  44. border-color: #000;
  45. background: #ffffff;
  46. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(0, 0, 0, 0.05);
  47. }
  48. .input-text:hover:not(:focus) {
  49. border-color: #333;
  50. box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  51. }
  52. /* 发送按钮现在直接在容器中,不需要单独的容器 */
  53. /* 上传按钮 - 小回形针图标 - Flex 布局 - 无边框 */
  54. .upload-btn {
  55. display: flex;
  56. align-items: center;
  57. justify-content: center;
  58. width: clamp(32px, 6cqw, 40px);
  59. height: clamp(32px, 6cqw, 40px);
  60. min-width: clamp(32px, 6cqw, 40px);
  61. min-height: clamp(32px, 6cqw, 40px);
  62. aspect-ratio: 1;
  63. padding: 0;
  64. border: none;
  65. background: transparent;
  66. color: #0f0f0f;
  67. cursor: pointer;
  68. transition: background 0.2s ease, opacity 0.2s ease;
  69. box-sizing: border-box;
  70. box-shadow: none;
  71. flex-shrink: 0;
  72. overflow: hidden;
  73. outline: none;
  74. position: absolute;
  75. left: clamp(12px, 2.5cqw, 16px);
  76. top: 50%;
  77. transform: translateY(-50%);
  78. z-index: 2;
  79. }
  80. .upload-btn svg {
  81. width: clamp(12px, 2cqw, 14px);
  82. height: clamp(12px, 2cqw, 14px);
  83. flex-shrink: 0;
  84. }
  85. /* 发送按钮 - 圆形图标按钮 - Flex 布局 - 自动缩放 - 纵向对齐 */
  86. .send-btn {
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. width: clamp(32px, 6cqw, 40px);
  91. height: clamp(32px, 6cqw, 40px);
  92. min-width: clamp(32px, 6cqw, 40px);
  93. min-height: clamp(32px, 6cqw, 40px);
  94. padding: 0;
  95. border-radius: 50%;
  96. border: 2px solid #0f0f0f;
  97. background: #ffffff;
  98. color: #0f0f0f;
  99. cursor: pointer;
  100. transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  101. box-sizing: border-box;
  102. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  103. flex-shrink: 0;
  104. overflow: hidden;
  105. aspect-ratio: 1;
  106. position: absolute;
  107. right: clamp(12px, 2.5cqw, 16px);
  108. top: 50%;
  109. transform: translateY(-50%);
  110. z-index: 2;
  111. }
  112. .upload-btn svg,
  113. .send-btn svg {
  114. flex-shrink: 0;
  115. transition: transform 0.2s ease;
  116. }
  117. .send-btn svg {
  118. width: clamp(14px, 2.5cqw, 18px);
  119. height: clamp(14px, 2.5cqw, 18px);
  120. flex-shrink: 0;
  121. }
  122. .upload-btn:hover {
  123. background: rgba(0, 0, 0, 0.05);
  124. }
  125. .send-btn:hover {
  126. background: #f8f8f8;
  127. border-color: #000;
  128. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  129. }
  130. .upload-btn:hover svg,
  131. .send-btn:hover svg {
  132. transform: scale(1.1);
  133. }
  134. .upload-btn:active {
  135. background: rgba(0, 0, 0, 0.1);
  136. }
  137. .send-btn:active {
  138. background: #f0f0f0;
  139. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  140. }
  141. .send-btn:disabled {
  142. color: #aaa;
  143. border-color: #ccc;
  144. background: #f5f5f5;
  145. cursor: not-allowed;
  146. transform: none;
  147. box-shadow: none;
  148. opacity: 0.6;
  149. }
  150. .send-btn:not(:disabled) {
  151. background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
  152. }
  153. .send-btn:not(:disabled):hover {
  154. background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
  155. }
  156. .file-input {
  157. display: none;
  158. }
  159. /* 按钮文字样式优化 - 自动缩放 */
  160. .upload-btn span {
  161. font-weight: 500;
  162. letter-spacing: 0.02em;
  163. flex-shrink: 0;
  164. overflow: hidden;
  165. text-overflow: ellipsis;
  166. }
  167. /* 焦点可见性增强 */
  168. .input-text:focus-visible,
  169. .upload-btn:focus-visible,
  170. .send-btn:focus-visible {
  171. outline: 2px solid #0f0f0f;
  172. outline-offset: 2px;
  173. }
  174. /* 加载状态(未来可扩展) */
  175. .send-btn:disabled::after {
  176. content: '';
  177. position: absolute;
  178. width: 100%;
  179. height: 100%;
  180. background: rgba(0, 0, 0, 0.05);
  181. border-radius: inherit;
  182. }
  183. /* 平滑滚动 */
  184. .input-container {
  185. scroll-behavior: smooth;
  186. }
  187. /* 响应式:小屏幕优化 - 自动缩放 - Flex 布局 */
  188. @media (max-width: 480px) {
  189. .input-text {
  190. flex: 1;
  191. width: 100%;
  192. max-width: 100%;
  193. padding: 0 clamp(2.6em, 4.5cqw, 3em) 0 clamp(2.6em, 4.5cqw, 3em);
  194. font-size: clamp(11px, 2cqw, 15px);
  195. }
  196. .upload-btn {
  197. width: clamp(28px, 5.5cqw, 36px);
  198. height: clamp(28px, 5.5cqw, 36px);
  199. min-width: clamp(28px, 5.5cqw, 36px);
  200. min-height: clamp(28px, 5.5cqw, 36px);
  201. left: clamp(10px, 2cqw, 14px);
  202. }
  203. .upload-btn svg {
  204. width: clamp(10px, 1.8cqw, 12px);
  205. height: clamp(10px, 1.8cqw, 12px);
  206. }
  207. .send-btn {
  208. width: clamp(28px, 5.5cqw, 36px);
  209. height: clamp(28px, 5.5cqw, 36px);
  210. min-width: clamp(28px, 5.5cqw, 36px);
  211. min-height: clamp(28px, 5.5cqw, 36px);
  212. right: clamp(10px, 2cqw, 14px);
  213. }
  214. .send-btn svg {
  215. width: clamp(12px, 2.2cqw, 16px);
  216. height: clamp(12px, 2.2cqw, 16px);
  217. }
  218. }
  219. /* 超小屏幕:只显示图标 */
  220. @media (max-width: 320px) {
  221. .upload-btn,
  222. .send-btn {
  223. padding: 0.7em;
  224. }
  225. }