Simple-Chatbot / static /style.css
Tamal321's picture
feat: initialize chatbot project with static UI and basic message handling logic
90af600
/* ========================================
CSS Variables & Reset
======================================== */
:root {
--bg-primary: #0a0a0f;
--bg-secondary: #12121a;
--bg-tertiary: #1a1a2e;
--bg-input: #16162a;
--text-primary: #e8e8f0;
--text-secondary: #9898b0;
--text-muted: #5a5a78;
--accent-purple: #a78bfa;
--accent-indigo: #6366f1;
--accent-blue: #818cf8;
--border-color: rgba(255, 255, 255, 0.06);
--border-hover: rgba(255, 255, 255, 0.12);
--glass-bg: rgba(18, 18, 26, 0.7);
--glass-border: rgba(255, 255, 255, 0.08);
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
--shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
--shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 20px;
--radius-xl: 24px;
--transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
--transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
--transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
overflow: hidden;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* ========================================
App Layout
======================================== */
.app {
display: flex;
flex-direction: column;
height: 100vh;
max-width: 900px;
margin: 0 auto;
position: relative;
overflow: hidden;
}
/* ========================================
Ambient Background Blobs
======================================== */
.bg-blob {
position: fixed;
border-radius: 50%;
filter: blur(120px);
opacity: 0.35;
pointer-events: none;
z-index: 0;
animation: float 20s ease-in-out infinite;
}
.blob-1 {
width: 400px;
height: 400px;
background: radial-gradient(circle, #6366f1 0%, transparent 70%);
top: -100px;
right: -100px;
animation-delay: 0s;
}
.blob-2 {
width: 350px;
height: 350px;
background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
bottom: 100px;
left: -150px;
animation-delay: -7s;
}
.blob-3 {
width: 300px;
height: 300px;
background: radial-gradient(circle, #818cf8 0%, transparent 70%);
top: 40%;
right: -80px;
animation-delay: -14s;
}
@keyframes float {
0%, 100% { transform: translate(0, 0) scale(1); }
33% { transform: translate(30px, -20px) scale(1.05); }
66% { transform: translate(-20px, 15px) scale(0.95); }
}
/* ========================================
Header
======================================== */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 24px;
background: var(--glass-bg);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 1px solid var(--glass-border);
z-index: 10;
position: relative;
}
.header-left {
display: flex;
align-items: center;
gap: 12px;
}
.logo {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background: rgba(99, 102, 241, 0.1);
border-radius: var(--radius-md);
border: 1px solid rgba(99, 102, 241, 0.2);
}
.header-title {
font-size: 1.1rem;
font-weight: 600;
letter-spacing: -0.02em;
background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.btn-clear {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
color: var(--text-secondary);
font-family: inherit;
font-size: 0.82rem;
font-weight: 500;
cursor: pointer;
transition: all var(--transition-fast);
}
.btn-clear:hover {
background: rgba(255, 255, 255, 0.08);
border-color: var(--border-hover);
color: var(--text-primary);
}
/* ========================================
Chat Area
======================================== */
.chat-area {
flex: 1;
overflow-y: auto;
padding: 0;
position: relative;
z-index: 1;
scroll-behavior: smooth;
}
.chat-area::-webkit-scrollbar {
width: 6px;
}
.chat-area::-webkit-scrollbar-track {
background: transparent;
}
.chat-area::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.08);
border-radius: 3px;
}
.chat-area::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.15);
}
/* ========================================
Welcome Screen
======================================== */
.welcome {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 80px 24px 40px;
animation: fadeInUp 0.6s ease-out;
}
.welcome.hidden {
display: none;
}
.welcome-icon {
width: 80px;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(99, 102, 241, 0.08);
border-radius: 50%;
border: 1px solid rgba(99, 102, 241, 0.15);
margin-bottom: 24px;
animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.1); }
50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.25); }
}
.welcome h2 {
font-size: 1.6rem;
font-weight: 600;
letter-spacing: -0.03em;
margin-bottom: 8px;
color: var(--text-primary);
}
.welcome p {
font-size: 0.95rem;
color: var(--text-secondary);
margin-bottom: 32px;
}
.suggestions {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
max-width: 600px;
}
.suggestion {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
color: var(--text-secondary);
font-family: inherit;
font-size: 0.82rem;
font-weight: 400;
cursor: pointer;
transition: all var(--transition-fast);
}
.suggestion:hover {
background: rgba(99, 102, 241, 0.08);
border-color: rgba(99, 102, 241, 0.25);
color: var(--accent-purple);
transform: translateY(-1px);
}
/* ========================================
Messages
======================================== */
.messages {
padding: 24px;
display: flex;
flex-direction: column;
gap: 4px;
}
.message {
display: flex;
gap: 12px;
padding: 16px 0;
animation: fadeInUp 0.35s ease-out;
max-width: 100%;
}
.message-avatar {
flex-shrink: 0;
width: 32px;
height: 32px;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8rem;
font-weight: 600;
margin-top: 2px;
}
.message.user .message-avatar {
background: linear-gradient(135deg, #6366f1, #4f46e5);
color: white;
}
.message.assistant .message-avatar {
background: rgba(167, 139, 250, 0.12);
border: 1px solid rgba(167, 139, 250, 0.2);
color: var(--accent-purple);
}
.message-body {
flex: 1;
min-width: 0;
}
.message-role {
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
margin-bottom: 6px;
color: var(--text-muted);
}
.message.user .message-role {
color: var(--accent-blue);
}
.message.assistant .message-role {
color: var(--accent-purple);
}
.message-content {
font-size: 0.92rem;
line-height: 1.7;
color: var(--text-primary);
word-wrap: break-word;
overflow-wrap: break-word;
}
.message-content p {
margin-bottom: 12px;
}
.message-content p:last-child {
margin-bottom: 0;
}
.message-content code {
background: rgba(99, 102, 241, 0.1);
border: 1px solid rgba(99, 102, 241, 0.15);
padding: 2px 6px;
border-radius: 4px;
font-family: 'Fira Code', 'Cascadia Code', monospace;
font-size: 0.85em;
color: var(--accent-purple);
}
.message-content pre {
background: rgba(0, 0, 0, 0.4);
border: 1px solid var(--border-color);
border-radius: var(--radius-sm);
padding: 14px 18px;
margin: 12px 0;
overflow-x: auto;
font-size: 0.84rem;
line-height: 1.6;
}
.message-content pre code {
background: none;
border: none;
padding: 0;
color: var(--text-primary);
}
/* Typing indicator */
.typing-indicator {
display: flex;
gap: 4px;
padding: 4px 0;
}
.typing-indicator span {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent-purple);
opacity: 0.4;
animation: typing-bounce 1.4s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes typing-bounce {
0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
30% { transform: translateY(-6px); opacity: 1; }
}
/* Cursor blink on streaming text */
.streaming .message-content::after {
content: '▊';
animation: blink 0.8s step-end infinite;
color: var(--accent-purple);
margin-left: 2px;
}
@keyframes blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
/* ========================================
Input Area
======================================== */
.input-area {
padding: 12px 24px 20px;
background: var(--glass-bg);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-top: 1px solid var(--glass-border);
z-index: 10;
position: relative;
}
.input-form {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.input-wrapper {
display: flex;
align-items: flex-end;
gap: 8px;
width: 100%;
background: var(--bg-input);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 6px 6px 6px 18px;
transition: all var(--transition-fast);
box-shadow: var(--shadow-sm);
}
.input-wrapper:focus-within {
border-color: rgba(99, 102, 241, 0.4);
box-shadow: var(--shadow-sm), 0 0 0 3px rgba(99, 102, 241, 0.08);
}
.input-wrapper textarea {
flex: 1;
background: none;
border: none;
outline: none;
color: var(--text-primary);
font-family: inherit;
font-size: 0.92rem;
line-height: 1.5;
padding: 8px 0;
resize: none;
max-height: 150px;
min-height: 24px;
}
.input-wrapper textarea::placeholder {
color: var(--text-muted);
}
.btn-send {
flex-shrink: 0;
width: 38px;
height: 38px;
border-radius: var(--radius-md);
border: none;
background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all var(--transition-fast);
opacity: 0.4;
}
.btn-send:not(:disabled) {
opacity: 1;
}
.btn-send:not(:disabled):hover {
transform: scale(1.05);
box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}
.btn-send:disabled {
cursor: not-allowed;
}
.disclaimer {
font-size: 0.72rem;
color: var(--text-muted);
letter-spacing: 0.01em;
}
/* ========================================
Animations
======================================== */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(12px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ========================================
Responsive
======================================== */
@media (max-width: 640px) {
.header {
padding: 12px 16px;
}
.messages {
padding: 16px;
}
.input-area {
padding: 10px 16px 16px;
}
.welcome {
padding: 60px 20px 30px;
}
.welcome h2 {
font-size: 1.3rem;
}
.suggestions {
flex-direction: column;
align-items: center;
}
}