chatbot-js / style.css
mr4's picture
Upload 27 files
4b05d12 verified
/* === Reset & Base === */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #f0f2f5;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 16px;
}
/* === Chat Container === */
.chat-container {
width: 100%;
max-width: 600px;
height: 90vh;
background-color: #ffffff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* === Chat Header === */
.chat-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
background-color: #4a90d9;
color: #ffffff;
}
.chat-header h1 {
font-size: 1.25rem;
font-weight: 600;
}
.header-controls {
display: flex;
align-items: center;
gap: 8px;
}
.header-controls button {
background: none;
border: none;
font-size: 1.2rem;
cursor: pointer;
padding: 4px;
border-radius: 4px;
transition: background-color 0.2s;
}
.header-controls button:hover {
background-color: rgba(255, 255, 255, 0.2);
}
#language-selector {
padding: 4px 8px;
border: 1px solid rgba(255, 255, 255, 0.4);
border-radius: 6px;
background-color: rgba(255, 255, 255, 0.15);
color: #ffffff;
font-size: 0.85rem;
cursor: pointer;
}
/* === Thinking Toggle === */
.thinking-toggle {
display: flex;
align-items: center;
cursor: pointer;
gap: 2px;
}
.thinking-toggle input[type="checkbox"] {
display: none;
}
.thinking-toggle-label {
font-size: 1.2rem;
opacity: 0.5;
transition: opacity 0.2s;
padding: 2px 4px;
border-radius: 4px;
}
.thinking-toggle input[type="checkbox"]:checked + .thinking-toggle-label {
opacity: 1;
}
.thinking-toggle:hover .thinking-toggle-label {
background-color: rgba(255, 255, 255, 0.2);
}
/* === Settings Panel === */
.settings-body {
display: flex;
flex-direction: column;
gap: 10px;
}
.setting-item {
display: flex;
flex-direction: column;
gap: 3px;
}
.setting-item label {
display: flex;
align-items: center;
gap: 6px;
font-size: 0.85rem;
color: #333;
cursor: pointer;
}
.setting-number {
width: 60px;
padding: 3px 6px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 0.85rem;
}
.setting-hint {
font-size: 0.75rem;
color: #999;
margin-left: 2px;
}
.setting-buttons {
flex-direction: row;
gap: 8px;
}
.setting-btn {
padding: 5px 12px;
font-size: 0.82rem;
border: 1px solid #ccc;
border-radius: 6px;
background: #fff;
cursor: pointer;
transition: background-color 0.2s;
}
.setting-btn:hover {
background-color: #f0f0f0;
}
.setting-btn-danger {
color: #dc3545;
border-color: #dc3545;
}
.setting-btn-danger:hover {
background-color: #dc3545;
color: #fff;
}
/* === History Dialog === */
.history-dialog {
max-width: 600px;
max-height: 85vh;
}
.history-tab-buttons {
display: flex;
gap: 4px;
margin-left: auto;
margin-right: 12px;
}
.history-tab {
padding: 3px 10px;
font-size: 0.78rem;
border: 1px solid rgba(255,255,255,0.4);
border-radius: 12px;
background: transparent;
color: rgba(255,255,255,0.7);
cursor: pointer;
transition: background-color 0.2s, color 0.2s;
}
.history-tab.active {
background: rgba(255,255,255,0.25);
color: #fff;
}
.history-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.history-item {
padding: 8px 10px;
border-radius: 8px;
border: 1px solid #e0e0e0;
}
.history-item-user {
background-color: #e3f2fd;
}
.history-item-assistant {
background-color: #f5f5f5;
}
.history-meta {
display: block;
font-size: 0.72rem;
color: #888;
margin-bottom: 3px;
}
.history-content {
display: block;
font-size: 0.85rem;
color: #333;
white-space: pre-wrap;
word-wrap: break-word;
max-height: 80px;
overflow: hidden;
text-overflow: ellipsis;
}
.history-empty {
text-align: center;
color: #999;
font-size: 0.88rem;
padding: 20px 0;
}
.history-paging {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
padding: 10px 0 0;
}
.history-page-info {
font-size: 0.78rem;
color: #888;
}
.history-page-btn {
padding: 4px 12px;
font-size: 0.8rem;
border: 1px solid #ccc;
border-radius: 4px;
background: #fff;
cursor: pointer;
}
.history-page-btn:hover {
background-color: #f0f0f0;
}
#language-selector option {
color: #333333;
background-color: #ffffff;
}
/* === Slide Panel (Rules & Macros) === */
.slide-panel {
border-bottom: 1px solid #e0e0e0;
background-color: #f8f9fa;
max-height: 280px;
display: flex;
flex-direction: column;
animation: slideDown 0.2s ease-out;
overflow: hidden; /* Prevent overflow from entire panel */
}
@keyframes slideDown {
from { max-height: 0; opacity: 0; }
to { max-height: 280px; opacity: 1; }
}
.slide-panel-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
background-color: #eef2f7;
border-bottom: 1px solid #dde3ea;
flex-shrink: 0; /* Prevent header from shrinking */
}
.slide-panel-body {
flex: 1;
overflow-y: auto; /* Allow scrolling in body */
padding: 12px 16px;
}
flex-shrink: 0;
}
.slide-panel-header h3 {
font-size: 0.88rem;
font-weight: 600;
color: #4a90d9;
margin: 0;
}
.slide-panel-close {
background: none;
border: none;
font-size: 1.2rem;
color: #888888;
cursor: pointer;
padding: 0 4px;
line-height: 1;
border-radius: 4px;
transition: color 0.2s, background-color 0.2s;
}
.slide-panel-close:hover {
color: #333333;
background-color: rgba(0, 0, 0, 0.08);
}
/* === Rules List === */
.rules-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.rules-list li {
display: inline-block;
padding: 4px 10px;
font-size: 0.82rem;
color: #4a6785;
background-color: #e8eef5;
border-radius: 12px;
border: 1px solid #d0dae6;
cursor: default;
transition: background-color 0.15s;
}
.rules-list li:hover {
background-color: #dce4ee;
}
/* === Macros List === */
.macros-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 8px;
}
.macro-item {
padding: 10px 12px;
background-color: #ffffff;
border-radius: 8px;
border: 1px solid #e0e5ec;
transition: box-shadow 0.15s;
}
.macro-item:hover {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.macro-item-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 4px;
}
.macro-item strong {
font-size: 0.85rem;
color: #333333;
}
.macro-item-badge {
display: inline-block;
font-size: 0.68rem;
padding: 1px 6px;
border-radius: 8px;
background-color: #d4edda;
color: #28a745;
font-weight: 500;
}
.macro-item p {
font-size: 0.8rem;
color: #666666;
margin: 2px 0 6px;
line-height: 1.4;
}
.macro-call-syntax {
display: inline-block;
font-family: 'Courier New', Courier, monospace;
font-size: 0.76rem;
background-color: #f0f0f0;
color: #c7254e;
padding: 3px 8px;
border-radius: 4px;
border: 1px solid #e0e0e0;
}
/* Adapter disabled state */
.macro-item.disabled {
opacity: 0.5;
}
.macro-item.disabled .macro-item-desc,
.macro-item.disabled .macro-call-syntax {
pointer-events: none;
}
/* Adapter toggle */
.macro-toggle-label {
margin-left: auto;
display: flex;
align-items: center;
cursor: pointer;
}
.macro-toggle-input {
width: 16px;
height: 16px;
cursor: pointer;
accent-color: #4a90e2;
}
/* === Message Display === */
.message-display {
flex: 1;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 10px;
}
/* === Messages === */
.message {
max-width: 80%;
padding: 10px 14px;
border-radius: 12px;
word-wrap: break-word;
line-height: 1.45;
font-size: 0.95rem;
}
.message.user {
align-self: flex-end;
background-color: #4a90d9;
color: #ffffff;
border-bottom-right-radius: 4px;
}
.message.bot {
align-self: flex-start;
background-color: #e9ecef;
color: #333333;
border-bottom-left-radius: 4px;
}
/* === Confidence === */
.confidence {
display: block;
font-size: 0.72rem;
margin-top: 4px;
font-weight: 500;
}
.confidence-high {
color: #28a745;
}
.confidence-low {
color: #dc3545;
}
/* === Adapter Path Breadcrumb === */
.adapter-path {
display: block;
font-size: 0.7rem;
margin-top: 2px;
color: #8e8e8e;
font-style: italic;
}
/* === Response Time === */
.response-time {
display: block;
font-size: 0.68rem;
margin-top: 2px;
color: #aaaaaa;
}
/* === Links in bot messages === */
.message.bot a {
color: #4a90d9;
text-decoration: underline;
word-break: break-all;
}
.message.bot a:hover {
color: #3a7bc8;
}
/* === Loading Indicator === */
.loading-indicator {
align-self: flex-start;
padding: 10px 14px;
background-color: #e9ecef;
border-radius: 12px;
font-size: 0.9rem;
color: #888888;
animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* === Input Area === */
.input-area {
display: flex;
padding: 12px 16px;
border-top: 1px solid #e0e0e0;
background-color: #ffffff;
gap: 8px;
}
.input-area input {
flex: 1;
padding: 10px 14px;
border: 1px solid #cccccc;
border-radius: 20px;
font-size: 0.95rem;
outline: none;
transition: border-color 0.2s;
}
.input-area input:focus {
border-color: #4a90d9;
}
.input-area button {
padding: 10px 20px;
background-color: #4a90d9;
color: #ffffff;
border: none;
border-radius: 20px;
font-size: 0.95rem;
cursor: pointer;
transition: background-color 0.2s;
white-space: nowrap;
}
.input-area button:hover {
background-color: #3a7bc8;
}
.input-area button:disabled,
.input-area button.disabled {
background-color: #a0bfdf;
cursor: not-allowed;
opacity: 0.7;
}
.input-area button:disabled:hover,
.input-area button.disabled:hover {
background-color: #a0bfdf;
}
/* === LLM Loading Status === */
.llm-loading-status {
align-self: flex-start;
padding: 10px 14px;
background-color: #fff3cd;
border: 1px solid #ffc107;
border-radius: 12px;
font-size: 0.88rem;
color: #856404;
animation: pulse 1.5s ease-in-out infinite;
}
/* === Attachment Preview === */
.attachment-preview {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 16px;
background-color: #f8f9fa;
border-top: 1px solid #e0e0e0;
}
.attachment-thumb {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 6px;
border: 1px solid #ddd;
}
.attachment-name {
flex: 1;
font-size: 0.82rem;
color: #555;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.attachment-remove {
background: none;
border: none;
font-size: 1.2rem;
color: #999;
cursor: pointer;
padding: 2px 6px;
border-radius: 4px;
line-height: 1;
transition: color 0.2s, background-color 0.2s;
}
.attachment-remove:hover {
color: #dc3545;
background-color: rgba(220, 53, 69, 0.1);
}
/* === Attach Button === */
#attach-button {
background: none;
border: none;
font-size: 1.3rem;
cursor: pointer;
padding: 6px;
border-radius: 50%;
transition: background-color 0.2s;
flex-shrink: 0;
}
#attach-button:hover {
background-color: #e9ecef;
}
/* === Message Image === */
.message-image {
display: block;
max-width: 100%;
max-height: 200px;
border-radius: 8px;
margin-bottom: 6px;
object-fit: contain;
}
/* === LLM Cancel Button === */
.llm-cancel-container {
align-self: flex-start;
margin-top: 4px;
}
.llm-cancel-button {
display: inline-block;
padding: 5px 14px;
font-size: 0.82rem;
color: #dc3545;
background-color: #fff;
border: 1px solid #dc3545;
border-radius: 16px;
cursor: pointer;
transition: background-color 0.2s, color 0.2s;
}
.llm-cancel-button:hover {
background-color: #dc3545;
color: #fff;
}
/* === Streaming Message === */
.message-text {
white-space: pre-wrap;
word-wrap: break-word;
}
.message.bot.streaming .message-text {
border-right: 2px solid #4a90d9;
padding-right: 2px;
animation: blink-cursor 0.8s step-end infinite;
}
@keyframes blink-cursor {
50% { border-color: transparent; }
}
/* === LLM Thinking Block === */
.llm-thinking-block {
background-color: #e8f5e9;
border-left: 3px solid #81c784;
border-radius: 6px;
padding: 8px 10px;
margin-bottom: 8px;
font-size: 0.84rem;
line-height: 1.5;
color: #2e7d32;
}
.llm-thinking-label {
display: block;
font-weight: 600;
font-size: 0.78rem;
margin-bottom: 4px;
color: #388e3c;
}
.llm-thinking-content {
display: block;
white-space: pre-wrap;
word-wrap: break-word;
color: #1b5e20;
}
/* === Utility === */
.hidden {
display: none !important;
}
/* === Responsive — Mobile (max-width: 768px, min-width: 320px) === */
@media (max-width: 768px) {
body {
padding: 0;
align-items: stretch;
}
.chat-container {
max-width: 100%;
height: 100vh;
border-radius: 0;
box-shadow: none;
}
.chat-header {
padding: 10px 12px;
}
.chat-header h1 {
font-size: 1.1rem;
}
.header-controls {
gap: 6px;
}
#language-selector {
font-size: 0.8rem;
padding: 3px 6px;
}
.message-display {
padding: 12px;
}
.message {
max-width: 88%;
font-size: 0.9rem;
}
.input-area {
padding: 10px 12px;
}
.input-area input {
padding: 8px 12px;
font-size: 0.9rem;
}
.input-area button {
padding: 8px 16px;
font-size: 0.9rem;
}
.rules-panel,
.macros-panel,
.slide-panel {
max-height: 200px;
}
}
/* === Help Dialog Overlay === */
.help-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.help-dialog {
background-color: #ffffff;
border-radius: 12px;
width: 90%;
max-width: 520px;
max-height: 80vh;
display: flex;
flex-direction: column;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
from { transform: translateY(24px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.help-dialog-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #e0e0e0;
background: linear-gradient(135deg, #4a90d9, #5ba3e6);
color: #ffffff;
border-radius: 12px 12px 0 0;
}
.help-dialog-header h2 {
font-size: 1.05rem;
font-weight: 600;
margin: 0;
}
.help-close-button {
background: none;
border: none;
color: #ffffff;
font-size: 1.5rem;
cursor: pointer;
padding: 0 4px;
line-height: 1;
border-radius: 4px;
transition: background-color 0.2s;
}
.help-close-button:hover {
background-color: rgba(255, 255, 255, 0.2);
}
.help-dialog-body {
padding: 20px;
overflow-y: auto;
font-size: 0.9rem;
line-height: 1.6;
color: #333333;
}
.help-section {
margin-bottom: 18px;
padding-bottom: 16px;
border-bottom: 1px solid #f0f0f0;
}
.help-section:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.help-section h3 {
font-size: 0.92rem;
font-weight: 600;
color: #4a90d9;
margin-bottom: 8px;
display: flex;
align-items: center;
gap: 6px;
}
.help-section p {
margin: 4px 0;
color: #555555;
}
.help-section ul {
list-style: none;
padding: 0;
margin: 6px 0 0 0;
}
.help-section li {
padding: 4px 0 4px 16px;
position: relative;
color: #555555;
}
.help-section li::before {
content: '•';
position: absolute;
left: 4px;
color: #4a90d9;
font-weight: bold;
}
.help-example {
display: inline-block;
background-color: #f0f4f8;
color: #4a90d9;
padding: 2px 8px;
border-radius: 4px;
font-size: 0.84rem;
font-family: 'Courier New', Courier, monospace;
}
.help-confidence-demo {
display: flex;
gap: 12px;
margin-top: 8px;
}
.help-confidence-item {
display: flex;
align-items: center;
gap: 6px;
font-size: 0.84rem;
}
.help-dot {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
}
.help-dot.green { background-color: #28a745; }
.help-dot.red { background-color: #dc3545; }
/* === Responsive — Help Dialog Mobile === */
@media (max-width: 768px) {
.help-dialog {
width: 95%;
max-height: 85vh;
}
.help-dialog-header {
padding: 12px 16px;
}
.help-dialog-body {
padding: 16px;
}
}
/* === Interaction Mode Badge === */
.interaction-mode-badge {
font-size: 0.85rem;
padding: 2px 6px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 10px;
cursor: pointer; /* Clickable */
user-select: none;
white-space: nowrap;
transition: background-color 0.2s ease, transform 0.1s ease;
}
.interaction-mode-badge:hover {
background-color: rgba(255, 255, 255, 0.35);
transform: scale(1.05);
}
.interaction-mode-badge:active {
transform: scale(0.95);
}
/* === Adapter Prefix Badge === */
.adapter-prefix-badge {
display: inline-block;
font-size: 0.8rem;
padding: 4px 10px;
margin-right: 8px;
background-color: #e3f2fd;
color: #1976d2;
border: 1px solid #90caf9;
border-radius: 12px;
white-space: nowrap;
transition: opacity 0.2s;
}
.adapter-prefix-badge.hidden {
display: none;
}
/* === Voice Input Button === */
#voice-input-button {
background: none;
border: none;
font-size: 1.2rem;
cursor: pointer;
padding: 6px 10px;
border-radius: 6px;
transition: background-color 0.2s, transform 0.1s;
flex-shrink: 0;
}
#voice-input-button:hover {
background-color: rgba(74, 144, 217, 0.1);
}
/* Animation pulse khi đang lắng nghe */
#voice-input-button.voice-listening {
animation: voice-pulse 1s ease-in-out infinite;
color: #dc3545;
}
@keyframes voice-pulse {
0%, 100% { transform: scale(1); opacity: 1; }
50% { transform: scale(1.2); opacity: 0.7; }
}
/* === Settings Panel — Voice Controls === */
.setting-divider {
border: none;
border-top: 1px solid #e9ecef;
margin: 12px 0;
}
.setting-label {
display: block;
font-size: 0.85rem;
color: #555;
margin-bottom: 4px;
}
.setting-select {
width: 100%;
padding: 6px 8px;
border: 1px solid #ced4da;
border-radius: 6px;
font-size: 0.85rem;
background-color: #fff;
cursor: pointer;
}
.setting-select:focus {
outline: none;
border-color: #4a90d9;
box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}
/* === History Attachment Thumbnail === */
.history-attachment-thumb {
display: block;
max-width: 80px;
max-height: 60px;
border-radius: 4px;
margin-top: 4px;
object-fit: cover;
border: 1px solid #dee2e6;
}
/* === TTS Status Indicator === */
.tts-status {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background-color: #fff3cd;
border-bottom: 1px solid #ffc107;
color: #856404;
font-size: 0.875rem;
animation: slideDown 0.3s ease-out;
}
.tts-status.hidden {
display: none;
}
.tts-spinner {
display: inline-block;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes slideDown {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}