luckay-knows-demo/konws-web/css/main.css
liushuang 98d7406a99 init
2025-03-05 14:14:54 +08:00

337 lines
5.1 KiB
CSS

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 0;
background-color: #f5f5f5;
height: 100vh;
display: flex;
flex-direction: column;
}
#chatBox {
flex: 1;
background: #ededed;
padding: 20px;
overflow-y: auto;
margin: 50px;
border-radius: 18px;
position: relative;
display: flex;
flex-direction: column;
padding-bottom: 80px;
scrollbar-width: none;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
/* Firefox */
-ms-overflow-style: none;
/* IE and Edge */
}
#chatBox::-webkit-scrollbar {
display: none;
/* Chrome, Safari, Opera */
}
.messages-container {
flex: 1;
overflow-y: auto;
padding: 20px;
scrollbar-width: none;
/* Firefox */
-ms-overflow-style: none;
/* IE and Edge */
}
.messages-container::-webkit-scrollbar {
display: none;
/* Chrome, Safari, Opera */
}
.message {
margin: 10px 0;
padding: 10px 15px;
border-radius: 4px;
max-width: 70%;
word-wrap: break-word;
position: relative;
line-height: 1.5;
font-size: 15px;
width: max-content;
display: flex;
align-items: flex-start;
gap: 10px;
}
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
flex-shrink: 0;
}
.message-content {
padding: 10px 15px;
border-radius: 15px;
}
.user-message {
width: max-content;
margin-left: auto;
flex-direction: row-reverse;
}
.user-message .message-content {
background: #95ec69;
border-radius: 15px 0 15px 15px;
}
.bot-message {
background: white;
margin-right: auto;
border-radius: 0 15px 15px 15px;
}
#inputArea {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
padding: 15px;
background: white;
border-radius: 20px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
width: calc(100% - 100px);
max-width: 600px;
box-sizing: border-box;
}
#userInput {
flex-grow: 1;
padding: 8px 12px;
border: 1px solid #ddd;
border: none;
border-radius: 4px;
font-size: 15px;
background: white;
outline: none;
}
#userInput:focus {
border-color: #07c160;
}
button {
display: flex;
justify-content: center;
align-items: center;
background: #07c160;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background 0.2s;
font-size: 15px;
border-radius: 50%;
width: 40px;
height: 40px;
position: absolute;
right: 18px;
}
button:hover {
background: #06ae56;
}
button:disabled {
background: #9fd7b5;
cursor: not-allowed;
}
/* Markdown 样式优化 */
.message pre {
background: #f8f9fa;
padding: 12px;
border-radius: 4px;
overflow-x: auto;
margin: 8px 0;
font-size: 14px;
}
.message code {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
background: rgba(0, 0, 0, 0.05);
padding: 2px 4px;
border-radius: 3px;
font-size: 14px;
}
.message p {
margin: 0;
}
.message p+p {
margin-top: 8px;
}
/* 滚动条样式 */
#chatBox::-webkit-scrollbar {
width: 6px;
}
#chatBox::-webkit-scrollbar-track {
background: #f1f1f1;
}
#chatBox::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 3px;
}
#chatBox::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}
/* 适配移动端 */
@media (max-width: 768px) {
body {
max-width: 100%;
height: 100vh;
padding: 0;
}
.message {
max-width: 85%;
}
#inputArea {
padding: 10px;
}
}
.upload-button-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
}
.upload-btn {
background-color: #000;
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
bottom: 50px;
}
.upload-btn:hover {
background-color: #1a1a1a;
}
.upload-dialog {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1001;
}
.upload-dialog-content {
position: relative;
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border-radius: 5px;
width: 60%;
max-width: 500px;
}
.close-btn {
position: absolute;
right: 10px;
top: 5px;
font-size: 24px;
cursor: pointer;
color: #888;
}
.close-btn:hover {
color: #555;
}
.upload-area {
border: 2px dashed #ccc;
border-radius: 5px;
padding: 20px;
text-align: center;
margin: 20px 0;
cursor: pointer;
transition: border-color 0.3s;
}
.upload-area:hover {
border-color: #4caf50;
}
.upload-placeholder {
color: #666;
}
.upload-placeholder i {
font-size: 48px;
color: #4caf50;
margin-bottom: 10px;
}
.supported-formats {
font-size: 12px;
color: #888;
margin-top: 5px;
}
.upload-progress {
margin: 15px 0;
}
.progress-bar {
width: 100%;
height: 20px;
background-color: #f0f0f0;
border-radius: 10px;
overflow: hidden;
}
.progress-fill {
width: 0%;
height: 100%;
background-color: #4caf50;
transition: width 0.3s;
}
.progress-text {
display: block;
text-align: center;
margin-top: 5px;
color: #666;
}
.upload-status {
margin-top: 10px;
text-align: center;
color: #666;
}
.upload-status.success {
color: #4caf50;
}
.upload-status.error {
color: #f44336;
}