Voice-AI-Agent / frontend /style.css
rakib72642's picture
added communication full layer
5dabf9d
raw
history blame
17.5 kB
/* ── Reset & base ── */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg: #07090f;
--bg2: #0d1117;
--bg3: #121820;
--border: rgba(255, 255, 255, 0.07);
--border2: rgba(255, 255, 255, 0.12);
--text: #e2e8f0;
--text2: #8892a4;
--text3: #4a5568;
--accent: #22d3ee;
--accent2: #818cf8;
--accent3: #f472b6;
--green: #4ade80;
--red: #f87171;
--yellow: #fbbf24;
--user-bg: rgba(34, 211, 238, 0.1);
--ai-bg: rgba(129, 140, 248, 0.08);
--sidebar-w: 270px;
--transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
html,
body {
height: 100%;
background: var(--bg);
color: var(--text);
font-family: 'Hind Siliguri', 'Syne', sans-serif;
overflow: hidden;
}
/* ── Ambient orbs ── */
.bg-orb {
position: fixed;
border-radius: 50%;
filter: blur(80px);
pointer-events: none;
z-index: 0;
opacity: 0.18;
animation: orb-float 12s ease-in-out infinite;
}
.orb-1 {
width: 500px; height: 500px;
background: radial-gradient(circle, #22d3ee, transparent);
top: -200px; left: -150px;
animation-delay: 0s;
}
.orb-2 {
width: 400px; height: 400px;
background: radial-gradient(circle, #818cf8, transparent);
bottom: -100px; right: -100px;
animation-delay: -4s;
}
.orb-3 {
width: 300px; height: 300px;
background: radial-gradient(circle, #f472b6, transparent);
top: 50%; left: 50%;
transform: translate(-50%, -50%);
animation-delay: -8s;
}
@keyframes orb-float {
0%, 100% { transform: translate(0, 0) scale(1); }
33% { transform: translate(30px, -20px) scale(1.05); }
66% { transform: translate(-20px, 15px) scale(0.97); }
}
/* ── Init overlay ── */
.init-overlay {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg);
transition: opacity 0.6s ease, visibility 0.6s ease;
}
.init-overlay.hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.init-card {
background: var(--bg2);
border: 1px solid var(--border2);
border-radius: 24px;
padding: 48px 56px;
width: 480px;
max-width: 95vw;
text-align: center;
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.init-logo {
margin-bottom: 20px;
animation: logo-pulse 2s ease-in-out infinite;
}
@keyframes logo-pulse {
0%, 100% { filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.4)); transform: scale(1); }
50% { filter: drop-shadow(0 0 24px rgba(129, 140, 248, 0.6)); transform: scale(1.06); }
}
.init-title {
font-family: 'Syne', sans-serif;
font-size: 26px;
font-weight: 800;
background: linear-gradient(135deg, var(--accent), var(--accent2));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 6px;
}
.init-subtitle {
font-family: 'Hind Siliguri', sans-serif;
color: var(--text2);
font-size: 15px;
margin-bottom: 36px;
}
.init-stages {
text-align: left;
margin-bottom: 28px;
}
.stage {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 0;
font-size: 13px;
color: var(--text3);
border-bottom: 1px solid var(--border);
transition: color 0.3s;
}
.stage.active { color: var(--accent); }
.stage.done { color: var(--green); }
.stage-dot {
width: 8px; height: 8px;
border-radius: 50%;
background: var(--text3);
flex-shrink: 0;
transition: background 0.3s, box-shadow 0.3s;
}
.stage.active .stage-dot {
background: var(--accent);
box-shadow: 0 0 8px var(--accent);
animation: blink-dot 0.8s ease-in-out infinite;
}
.stage.done .stage-dot { background: var(--green); }
@keyframes blink-dot {
0%, 100% { opacity: 1; }
50% { opacity: 0.3; }
}
.stage-check {
margin-left: auto;
opacity: 0;
transition: opacity 0.3s;
}
.stage.done .stage-check { opacity: 1; }
.stage span {
flex: 1;
font-family: 'Hind Siliguri', sans-serif;
}
.init-bar-wrap {
background: var(--bg3);
border-radius: 99px;
height: 6px;
overflow: hidden;
margin-bottom: 16px;
border: 1px solid var(--border);
}
.init-bar {
height: 100%;
background: linear-gradient(90deg, var(--accent), var(--accent2));
border-radius: 99px;
width: 0%;
transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
}
.init-status {
font-size: 12px;
color: var(--text2);
font-family: 'JetBrains Mono', monospace;
}
/* ── App layout ──
FIX-7: App is hidden by default via opacity/pointer-events.
JS adds class .visible after init overlay closes. This prevents
any flash of unstyled content (FOUC) during JS execution.
── */
.app {
position: fixed;
inset: 0;
z-index: 1;
display: flex;
opacity: 0;
pointer-events: none;
transition: opacity 0.5s ease;
}
.app.visible {
opacity: 1;
pointer-events: auto;
}
/* ── Sidebar ── */
.sidebar {
width: var(--sidebar-w);
background: var(--bg2);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
flex-shrink: 0;
overflow-y: auto;
transition: width var(--transition), transform var(--transition);
z-index: 10;
}
.sidebar.collapsed {
width: 0;
overflow: hidden;
}
.sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 16px 16px;
border-bottom: 1px solid var(--border);
}
.brand {
display: flex;
align-items: center;
gap: 10px;
font-family: 'Syne', sans-serif;
font-weight: 700;
font-size: 14px;
color: var(--text);
}
.sidebar-toggle {
background: none;
border: 1px solid var(--border);
color: var(--text2);
border-radius: 8px;
padding: 4px 8px;
cursor: pointer;
font-size: 16px;
transition: all var(--transition);
}
.sidebar-toggle:hover {
background: var(--border);
color: var(--text);
}
.status-panel { padding: 16px; }
.status-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 0;
}
.status-label { font-size: 12px; color: var(--text2); }
.status-badge {
font-size: 10px;
font-family: 'JetBrains Mono', monospace;
padding: 2px 8px;
border-radius: 99px;
font-weight: 600;
letter-spacing: 0.03em;
}
.badge-green { background: rgba(74, 222, 128, 0.12); color: var(--green); }
.badge-yellow { background: rgba(251, 191, 36, 0.12); color: var(--yellow); }
.badge-red { background: rgba(248, 113, 113, 0.12); color: var(--red); }
.sidebar-divider { height: 1px; background: var(--border); margin: 4px 0; }
.dash-section { padding: 16px; }
.dash-title {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text2);
margin-bottom: 12px;
}
.metric-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.metric-card {
background: var(--bg3);
border: 1px solid var(--border);
border-radius: 10px;
padding: 10px;
text-align: center;
}
.metric-val {
font-family: 'JetBrains Mono', monospace;
font-size: 18px;
font-weight: 400;
color: var(--accent);
line-height: 1;
margin-bottom: 4px;
}
.metric-label { font-size: 10px; color: var(--text3); }
.setting-row { margin-bottom: 14px; }
.setting-row label {
display: block;
font-size: 11px;
color: var(--text2);
margin-bottom: 6px;
}
.slider-wrap { display: flex; align-items: center; gap: 8px; }
.slider-wrap input[type='range'] {
flex: 1;
accent-color: var(--accent);
height: 4px;
cursor: pointer;
}
.slider-wrap span {
font-size: 11px;
font-family: 'JetBrains Mono', monospace;
color: var(--accent);
min-width: 58px;
text-align: right;
}
.setting-select {
width: 100%;
background: var(--bg3);
border: 1px solid var(--border);
color: var(--text);
border-radius: 8px;
padding: 6px 10px;
font-size: 12px;
font-family: 'Hind Siliguri', sans-serif;
cursor: pointer;
}
.setting-select:focus { outline: none; border-color: var(--accent); }
.queue-vis {
display: flex;
align-items: flex-end;
gap: 4px;
height: 48px;
margin-bottom: 8px;
}
.queue-bar {
flex: 1;
background: var(--accent);
border-radius: 3px;
opacity: 0.3;
transition: height 0.15s ease, opacity 0.15s ease;
min-height: 4px;
}
.queue-bar.active { opacity: 0.9; }
.queue-label {
font-size: 11px;
color: var(--text2);
font-family: 'JetBrains Mono', monospace;
}
/* ── Main ── */
.main {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
min-width: 0;
}
/* ── Topbar ── */
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 20px;
background: var(--bg2);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-center {
font-family: 'Syne', sans-serif;
font-weight: 700;
font-size: 15px;
color: var(--text);
position: absolute;
left: 50%;
transform: translateX(-50%);
}
.topbar-right { display: flex; gap: 8px; }
.mobile-menu-btn {
display: none;
background: none;
border: 1px solid var(--border);
color: var(--text2);
border-radius: 8px;
padding: 6px 10px;
cursor: pointer;
font-size: 16px;
}
.state-dot {
width: 8px; height: 8px;
border-radius: 50%;
background: var(--green);
box-shadow: 0 0 6px var(--green);
flex-shrink: 0;
transition: background 0.3s, box-shadow 0.3s;
}
.state-dot.listening { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink-dot 0.8s infinite; }
.state-dot.recording { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink-dot 0.4s infinite; }
.state-dot.processing { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); animation: blink-dot 1s infinite; }
.state-dot.speaking { background: var(--accent2); box-shadow: 0 0 10px var(--accent2);animation: blink-dot 0.6s infinite; }
#state-label { font-size: 13px; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
.clear-btn {
background: none;
border: 1px solid var(--border);
color: var(--text2);
border-radius: 8px;
padding: 6px 12px;
cursor: pointer;
font-size: 12px;
font-family: 'Syne', sans-serif;
transition: all var(--transition);
}
.clear-btn:hover { border-color: var(--accent); color: var(--accent); }
/* ── Chat ── */
#chat-box {
flex: 1;
overflow-y: auto;
padding: 24px 20px 12px;
display: flex;
flex-direction: column;
gap: 12px;
scroll-behavior: smooth;
}
#chat-box::-webkit-scrollbar { width: 4px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
.message {
max-width: 75%;
padding: 14px 18px;
border-radius: 16px;
line-height: 1.65;
font-size: 14.5px;
word-wrap: break-word;
overflow-wrap: break-word;
animation: msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
font-family: 'Hind Siliguri', sans-serif;
}
@keyframes msg-in {
from { opacity: 0; transform: translateY(10px) scale(0.97); }
to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.user {
background: var(--user-bg);
border: 1px solid rgba(34, 211, 238, 0.2);
margin-left: auto;
border-bottom-right-radius: 4px;
}
.message.ai {
background: var(--ai-bg);
border: 1px solid rgba(129, 140, 248, 0.15);
border-bottom-left-radius: 4px;
}
.message.system {
background: rgba(251, 191, 36, 0.08);
border: 1px solid rgba(251, 191, 36, 0.2);
color: var(--yellow);
font-size: 12px;
font-family: 'JetBrains Mono', monospace;
align-self: center;
max-width: 90%;
}
.message ul, .message ol { padding-left: 20px; margin: 8px 0; }
.message li { margin-bottom: 4px; }
.message p { margin: 6px 0; }
.message code {
background: rgba(0, 0, 0, 0.3);
border-radius: 4px;
padding: 1px 6px;
font-family: 'JetBrains Mono', monospace;
font-size: 13px;
}
.message pre {
background: rgba(0, 0, 0, 0.3);
border-radius: 8px;
padding: 12px;
overflow-x: auto;
margin: 8px 0;
}
/* ── Voice visualizer ── */
.voice-visualizer {
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
height: 0;
overflow: hidden;
transition: height 0.3s ease;
padding: 0 20px;
}
.voice-visualizer.active { height: 56px; }
.viz-bar {
width: 4px;
border-radius: 99px;
background: linear-gradient(180deg, var(--accent), var(--accent2));
height: 6px;
transition: height 0.08s ease;
flex-shrink: 0;
}
/* ── Controls ── */
.controls {
padding: 16px 20px 20px;
background: var(--bg2);
border-top: 1px solid var(--border);
flex-shrink: 0;
}
.text-row {
display: flex;
gap: 10px;
margin-bottom: 12px;
align-items: flex-end; /* FIX-4: align send button to bottom when textarea grows */
}
/* ── FIX-4: Auto-growing textarea replaces <input type="text"> ── */
#text-input {
flex: 1;
background: var(--bg3);
border: 1px solid var(--border);
border-radius: 12px;
padding: 12px 16px;
color: var(--text);
font-size: 14px;
font-family: 'Hind Siliguri', sans-serif;
outline: none;
transition: border-color var(--transition);
resize: none; /* FIX-4: no manual resize handle */
overflow-y: hidden; /* hidden until 10 lines exceeded; JS manages */
line-height: 1.57; /* ~22px per line at font-size 14px */
min-height: 44px; /* single line min */
max-height: 226px; /* 10 lines Γ— 22px + 16px padding */
display: block;
/* smooth height animation */
transition: border-color var(--transition), height 0.1s ease;
}
#text-input::placeholder { color: var(--text3); }
#text-input:focus { border-color: var(--accent); }
/* Custom scrollbar inside textarea once > 10 lines */
#text-input::-webkit-scrollbar { width: 4px; }
#text-input::-webkit-scrollbar-track { background: transparent; }
#text-input::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
#send-btn {
background: linear-gradient(135deg, var(--accent), var(--accent2));
border: none;
border-radius: 12px;
padding: 12px 16px;
cursor: pointer;
color: #000;
display: flex;
align-items: center;
transition: opacity var(--transition), transform 0.1s;
flex-shrink: 0;
align-self: flex-end; /* FIX-4: stays at bottom as textarea grows */
height: 44px;
}
#send-btn:hover { opacity: 0.88; }
#send-btn:active { transform: scale(0.95); }
.voice-row { display: flex; gap: 10px; }
.mic-btn {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 13px 20px;
border-radius: 14px;
border: 1.5px solid var(--border2);
background: var(--bg3);
color: var(--text);
cursor: pointer;
font-size: 14px;
font-family: 'Hind Siliguri', sans-serif;
transition: all var(--transition);
position: relative;
overflow: hidden;
}
.mic-btn::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, var(--accent), var(--accent2));
opacity: 0;
transition: opacity var(--transition);
}
.mic-btn:hover::before { opacity: 0.08; }
.mic-btn.mic-listening {
border-color: var(--accent);
box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.2), inset 0 0 20px rgba(34, 211, 238, 0.05);
}
.mic-btn.mic-recording {
border-color: var(--red);
animation: pulse-red 0.8s ease-in-out infinite;
}
@keyframes pulse-red {
0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}
.mic-btn.mic-processing {
border-color: var(--yellow);
box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}
.mic-icon { font-size: 18px; position: relative; z-index: 1; }
.mic-label { position: relative; z-index: 1; }
.stop-btn {
background: rgba(248, 113, 113, 0.1);
border: 1.5px solid rgba(248, 113, 113, 0.3);
color: var(--red);
border-radius: 14px;
padding: 13px 16px;
cursor: pointer;
font-size: 13px;
font-family: 'Hind Siliguri', sans-serif;
display: flex;
align-items: center;
gap: 6px;
transition: all var(--transition);
}
.stop-btn:hover { background: rgba(248, 113, 113, 0.2); border-color: var(--red); }
.stop-btn:active { transform: scale(0.95); }
/* ── Scrollbar (sidebar) ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
/* ── Responsive ── */
@media (max-width: 680px) {
.sidebar {
position: fixed;
left: 0; top: 0; bottom: 0;
transform: translateX(-100%);
z-index: 100;
}
.sidebar.mobile-open { transform: translateX(0); }
.mobile-menu-btn { display: flex; }
.topbar-center { font-size: 13px; }
.message { max-width: 90%; font-size: 14px; }
}
/* ── Thinking bubble (animated "..." while AI processes) ── */
.message.thinking {
display: flex;
align-items: center;
gap: 5px;
padding: 12px 16px;
background: var(--ai-bg);
border: 1px solid var(--border);
border-radius: 16px 16px 16px 4px;
align-self: flex-start;
max-width: 80px;
}
.message.thinking .dot {
display: inline-block;
width: 7px; height: 7px;
border-radius: 50%;
background: var(--accent2);
opacity: 0.4;
animation: dot-bounce 1.2s ease-in-out infinite;
}
.message.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.message.thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
40% { transform: translateY(-6px); opacity: 1; }
}