llm-web-simple / style.css
Danmoreng
feat: Implement dark mode and conversational memory
5341614
Raw History Blame Contribute Delete
10.3 kB
/* --- Base & Variables --- */
:root {
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
/* Light Theme */
--bg-color: #f8fafc;
--text-color: #1e293b;
--text-muted-color: #64748b;
--header-bg-color: #ffffff;
--border-color: #e2e8f0;
--input-bg-color: #f1f5f9;
--input-border-color: #cbd5e1;
--primary-color: #2563eb;
--primary-hover-color: #1d4ed8;
--user-bubble-bg: #2563eb;
--user-bubble-text: #ffffff;
--bot-bubble-bg: #ffffff;
--bot-bubble-text: #334155;
--bot-avatar-bg: #dbeafe;
--bot-avatar-text: #2563eb;
--debug-bg: #f1f5f9;
--debug-header-bg: #e2e8f0;
--theme-toggle-hover-bg: #f1f5f9;
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}
html.dark {
/* Mistral Dark Theme */
--bg-color: #1E1E1E;
--text-color: #E9E2CB;
--text-muted-color: #FFF0C3;
--header-bg-color: #1E1E1E;
--border-color: #4a4a4a;
--input-bg-color: #333333;
--input-border-color: #4a4a4a;
--primary-color: #FA500F;
--primary-hover-color: #E1470D;
--user-bubble-bg: #FA500F;
--user-bubble-text: #ffffff;
--bot-bubble-bg: #2a2a2a;
--bot-bubble-text: #E9E2CB;
--bot-avatar-bg: #FA500F;
--bot-avatar-text: #1E1E1E;
--debug-bg: #000000;
--debug-header-bg: #333333;
--debug-text: #00ff00;
--theme-toggle-hover-bg: #333333;
--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.2);
}
/* --- General --- */
body {
background-color: var(--bg-color);
color: var(--text-color);
font-family: var(--font-sans);
display: flex;
flex-direction: column;
height: 100vh;
margin: 0;
}
button {
cursor: pointer;
transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* --- Header --- */
.header {
background-color: var(--header-bg-color);
border-bottom: 1px solid var(--border-color);
padding: 0.75rem 1rem;
box-shadow: var(--shadow);
z-index: 10;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.header-title {
display: flex;
align-items: center;
gap: 0.75rem;
}
.header-logo {
width: 2rem;
height: 2rem;
background-color: var(--primary-color);
color: white;
border-radius: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
}
.header-title h1 {
font-weight: bold;
font-size: 1.125rem;
color: var(--text-color);
margin: 0;
}
.theme-toggle-btn {
background: none;
border: none;
color: var(--text-muted-color);
margin-left: 1rem;
padding: 0.5rem;
border-radius: 0.5rem;
}
.theme-toggle-btn:hover {
background-color: var(--theme-toggle-hover-bg);
}
.header-controls {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.model-select, .custom-model-input {
background-color: var(--input-bg-color);
border: 1px solid var(--input-border-color);
color: var(--text-color);
font-size: 0.875rem;
border-radius: 0.5rem;
padding: 0.625rem;
outline: none;
transition: border-color 0.2s;
width: 100%;
}
.custom-model-input.hidden {
display: none;
}
.action-btn {
color: white;
background-color: var(--primary-color);
font-weight: 500;
border-radius: 0.5rem;
font-size: 0.875rem;
padding: 0.625rem 1.25rem;
text-align: center;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
border: none;
}
.action-btn:hover {
background-color: var(--primary-hover-color);
}
.action-btn.success {
background-color: #22c55e;
}
.action-btn.success:hover {
background-color: #16a34a;
}
.action-btn.error {
background-color: #ef4444;
}
.action-btn.error:hover {
background-color: #dc2626;
}
/* --- Main Chat Area --- */
.chat-container {
flex: 1;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 1.5rem;
scroll-behavior: smooth;
}
.message-wrapper {
display: flex;
align-items: flex-start;
gap: 1rem;
max-width: 48rem;
width: 100%; /* Ensure it takes full width for margin auto to work */
}
.message-wrapper.user {
flex-direction: row-reverse;
margin-left: auto; /* Push to the right */
}
.message-wrapper.assistant {
margin-right: auto; /* Push to the left (default for flex-start items) */
}
.avatar {
width: 2rem;
height: 2rem;
border-radius: 9999px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-top: 0.25rem;
}
.avatar.user {
background-color: #334155; /* slate-700 */
color: white;
}
.avatar.assistant {
background-color: var(--bot-avatar-bg);
color: var(--bot-avatar-text);
}
html.dark .avatar.assistant {
opacity: 0.8;
}
.message-bubble {
padding: 1rem 1.5rem;
border-radius: 1.125rem;
box-shadow: var(--shadow);
line-height: 1.625;
word-wrap: break-word;
}
.message-bubble.user {
background-color: var(--user-bubble-bg);
color: var(--user-bubble-text);
border-top-right-radius: 0;
}
.message-bubble.assistant {
background-color: var(--bot-bubble-bg);
color: var(--bot-bubble-text);
border: 1px solid var(--border-color);
border-top-left-radius: 0;
}
.message-bubble img {
width: 12rem;
height: 12rem;
object-fit: cover;
border-radius: 0.5rem;
margin-bottom: 0.5rem;
}
/* --- Footer / Input Area --- */
.footer {
background-color: var(--header-bg-color);
border-top: 1px solid var(--border-color);
padding: 1rem;
}
.input-area {
max-width: 48rem;
margin-left: auto;
margin-right: auto;
position: relative;
}
.input-wrapper {
display: flex;
align-items: flex-end;
gap: 0.5rem;
background-color: var(--input-bg-color);
border: 1px solid var(--input-border-color);
border-radius: 0.75rem;
padding: 0.5rem;
box-shadow: var(--shadow);
transition: all 0.2s;
}
.input-wrapper:focus-within {
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--shadow, 0 0 #0000) !important;
--tw-ring-color: #dbeafe;
border-color: #60a5fa;
}
.icon-btn {
background: none;
border: none;
color: var(--text-muted-color);
padding: 0.625rem;
height: 2.5rem;
width: 2.5rem;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 0.25rem;
border-radius: 0.5rem;
}
.icon-btn:hover {
background-color: var(--bg-color);
color: var(--primary-color);
}
.message-input {
width: 100%;
background-color: transparent;
border: none;
color: var(--text-color);
resize: none;
padding: 0.75rem 0.5rem;
max-height: 8rem;
outline: none;
}
.message-input::placeholder {
color: var(--text-muted-color);
}
.send-btn {
background-color: var(--primary-color);
color: white;
height: 2.5rem;
width: 2.5rem;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 0.25rem;
border-radius: 0.5rem;
border: none;
}
.send-btn:hover {
background-color: var(--primary-hover-color);
}
.image-preview-container {
margin-bottom: 0.5rem;
position: relative;
width: 6rem;
height: 6rem;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
box-shadow: var(--shadow);
}
.image-preview-container.hidden {
display: none;
}
.image-preview {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 0.5rem;
}
.remove-image-btn {
position: absolute;
top: -0.5rem;
right: -0.5rem;
background-color: #ef4444;
color: white;
width: 1.5rem;
height: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 9999px;
border: none;
}
.remove-image-btn:hover {
background-color: #dc2626;
}
.footer-text {
text-align: center;
margin-top: 0.5rem;
}
.footer-text p {
font-size: 0.75rem;
color: var(--text-muted-color);
margin: 0;
}
#image-upload-input.hidden {
display: none;
}
/* --- Status & Debug --- */
.status-bar {
padding: 0.25rem 1rem;
text-align: center;
font-size: 0.75rem;
color: var(--text-muted-color);
background-color: var(--header-bg-color);
border-top: 1px solid var(--border-color);
}
.status-bar.hidden {
display: none;
}
.debug-toggle {
width: 100%;
text-align: left;
padding: 0.5rem 1rem;
font-size: 0.75rem;
font-family: 'Courier New', Courier, monospace;
color: var(--text-muted-color);
background-color: var(--debug-header-bg);
border-top: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: none;
}
.debug-toggle:hover {
background-color: var(--input-bg-color);
}
#debug-arrow.rotate-180 {
transform: rotate(180deg);
}
.debug-console {
background-color: var(--debug-bg);
color: var(--debug-text);
height: 8rem;
overflow-y: auto;
padding: 1rem;
font-family: 'Courier New', Courier, monospace;
font-size: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.debug-console.hidden {
display: none;
}
/* --- Custom Scrollbar --- */
.chat-container::-webkit-scrollbar {
width: 8px;
}
.chat-container::-webkit-scrollbar-track {
background: var(--bg-color);
}
.chat-container::-webkit-scrollbar-thumb {
background: var(--input-border-color);
border-radius: 4px;
}
.chat-container::-webkit-scrollbar-thumb:hover {
background: var(--text-muted-color);
}
/* --- Media Queries --- */
@media (min-width: 768px) {
.header {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.header-controls {
flex-direction: row;
width: auto;
}
.model-select {
width: 18rem;
}
.custom-model-input {
width: 12rem;
}
.chat-container {
padding: 2rem;
}
}