mechanicgo / static /chatbot.css
ministerchief's picture
Upload 3 files
2d93a64 verified
Raw
History Blame Contribute Delete
7.36 kB
/* ============================================================
chatbot.css β€” MechanicGo Floating Help Assistant
Uses CSS variables so it auto-matches each page's theme.
============================================================ */
/* ── Floating trigger button ─────────────────────────────── */
#mg-chat-btn {
position: fixed;
bottom: 24px;
right: 24px;
z-index: 9000;
width: 56px;
height: 56px;
border-radius: 50%;
background: var(--accent, #e67e22);
color: #fff;
border: none;
cursor: pointer;
box-shadow: 0 4px 18px rgba(0,0,0,0.35);
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s, box-shadow 0.2s;
font-size: 24px;
outline: none;
}
#mg-chat-btn:hover {
transform: scale(1.1);
box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
#mg-chat-btn .mg-chat-badge {
position: absolute;
top: -4px;
right: -4px;
background: #e74c3c;
color: #fff;
border-radius: 50%;
width: 18px;
height: 18px;
font-size: 11px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid #fff;
}
/* ── Chat window ─────────────────────────────────────────── */
#mg-chat-window {
position: fixed;
bottom: 90px;
right: 24px;
z-index: 9001;
width: 340px;
max-height: 520px;
display: flex;
flex-direction: column;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 8px 40px rgba(0,0,0,0.35);
background: var(--surface, #1e2a35);
border: 1px solid var(--border, rgba(255,255,255,0.08));
transform: scale(0.92) translateY(16px);
opacity: 0;
pointer-events: none;
transition: transform 0.22s cubic-bezier(.4,0,.2,1),
opacity 0.22s ease;
}
#mg-chat-window.mg-open {
transform: scale(1) translateY(0);
opacity: 1;
pointer-events: all;
}
/* ── Header ──────────────────────────────────────────────── */
#mg-chat-header {
background: var(--accent, #e67e22);
color: #fff;
padding: 12px 16px;
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
#mg-chat-header .mg-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: rgba(255,255,255,0.2);
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
flex-shrink: 0;
}
#mg-chat-header .mg-header-info {
flex: 1;
min-width: 0;
}
#mg-chat-header .mg-header-info strong {
display: block;
font-size: 14px;
font-weight: 700;
color: #fff;
}
#mg-chat-header .mg-header-info span {
font-size: 11px;
opacity: 0.85;
color: #fff;
}
#mg-chat-close {
background: none;
border: none;
color: #fff;
cursor: pointer;
font-size: 20px;
line-height: 1;
padding: 2px 4px;
border-radius: 4px;
opacity: 0.85;
transition: opacity 0.15s;
flex-shrink: 0;
}
#mg-chat-close:hover { opacity: 1; }
/* ── Message body ────────────────────────────────────────── */
#mg-chat-body {
flex: 1;
overflow-y: auto;
padding: 14px 12px;
display: flex;
flex-direction: column;
gap: 10px;
scrollbar-width: thin;
scrollbar-color: var(--accent, #e67e22) transparent;
}
#mg-chat-body::-webkit-scrollbar { width: 4px; }
#mg-chat-body::-webkit-scrollbar-thumb {
background: var(--accent, #e67e22);
border-radius: 4px;
}
/* ── Bubbles ─────────────────────────────────────────────── */
.mg-msg {
max-width: 86%;
padding: 9px 13px;
border-radius: 14px;
font-size: 13px;
line-height: 1.5;
word-break: break-word;
animation: mgFadeIn 0.18s ease;
}
@keyframes mgFadeIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
.mg-msg.mg-bot {
background: var(--border, rgba(255,255,255,0.09));
color: var(--text, #dce6f0);
align-self: flex-start;
border-bottom-left-radius: 4px;
}
.mg-msg.mg-user {
background: var(--accent, #e67e22);
color: #fff;
align-self: flex-end;
border-bottom-right-radius: 4px;
}
.mg-msg a {
color: inherit;
text-decoration: underline;
opacity: 0.85;
}
/* Typing indicator */
.mg-typing {
display: flex;
align-items: center;
gap: 5px;
padding: 10px 14px;
background: var(--border, rgba(255,255,255,0.09));
border-radius: 14px;
border-bottom-left-radius: 4px;
align-self: flex-start;
}
.mg-typing span {
width: 7px;
height: 7px;
background: var(--accent, #e67e22);
border-radius: 50%;
display: inline-block;
animation: mgBounce 1.1s infinite ease-in-out;
opacity: 0.7;
}
.mg-typing span:nth-child(2) { animation-delay: 0.18s; }
.mg-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes mgBounce {
0%, 80%, 100% { transform: translateY(0); }
40% { transform: translateY(-6px); }
}
/* ── Quick replies ───────────────────────────────────────── */
#mg-quick-replies {
display: flex;
flex-wrap: wrap;
gap: 6px;
padding: 8px 12px 4px;
flex-shrink: 0;
border-top: 1px solid var(--border, rgba(255,255,255,0.07));
}
.mg-quick-btn {
background: none;
border: 1px solid var(--accent, #e67e22);
color: var(--accent, #e67e22);
border-radius: 20px;
padding: 5px 11px;
font-size: 11.5px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
white-space: nowrap;
font-family: inherit;
}
.mg-quick-btn:hover {
background: var(--accent, #e67e22);
color: #fff;
}
/* ── Input row ───────────────────────────────────────────── */
#mg-chat-input-row {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-top: 1px solid var(--border, rgba(255,255,255,0.07));
flex-shrink: 0;
background: var(--surface, #1e2a35);
}
#mg-chat-input {
flex: 1;
background: var(--border, rgba(255,255,255,0.07));
border: 1px solid var(--border, rgba(255,255,255,0.12));
border-radius: 20px;
color: var(--text, #dce6f0);
padding: 8px 14px;
font-size: 13px;
outline: none;
font-family: inherit;
transition: border-color 0.15s;
}
#mg-chat-input::placeholder { opacity: 0.45; }
#mg-chat-input:focus {
border-color: var(--accent, #e67e22);
}
#mg-chat-send {
background: var(--accent, #e67e22);
border: none;
color: #fff;
width: 36px;
height: 36px;
border-radius: 50%;
cursor: pointer;
font-size: 15px;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.15s, transform 0.15s;
flex-shrink: 0;
}
#mg-chat-send:hover { opacity: 0.88; transform: scale(1.08); }
/* ── Mobile adjustments ──────────────────────────────────── */
@media (max-width: 480px) {
#mg-chat-window {
width: calc(100vw - 20px);
right: 10px;
bottom: 80px;
max-height: 72vh;
}
#mg-chat-btn {
right: 16px;
bottom: 16px;
width: 50px;
height: 50px;
font-size: 21px;
}
}