/* SpiceBook Chat Widget — dark-only, floating panel */ .chat-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; width: 3rem; height: 3rem; border-radius: 50%; border: 1px solid var(--color-sb-border); background: var(--color-sb-surface); color: var(--color-sb-accent); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s, border-color 0.15s, transform 0.15s; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); } .chat-fab:hover { background: var(--color-sb-cell); border-color: var(--color-sb-accent); transform: scale(1.05); } .chat-fab.active { background: var(--color-sb-accent); color: var(--color-sb-text-bright); border-color: var(--color-sb-accent); } /* Panel */ .chat-panel { position: fixed; bottom: 5rem; right: 1.5rem; z-index: 1000; width: 24rem; max-height: 70vh; display: flex; flex-direction: column; background: var(--color-sb-bg); border: 1px solid var(--color-sb-border); border-radius: 0.75rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); overflow: hidden; animation: chat-slide-up 0.2s ease-out; } @keyframes chat-slide-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } } /* Header */ .chat-header { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-sb-border); background: var(--color-sb-surface); flex-shrink: 0; } .chat-header-title { flex: 1; font-size: 0.8125rem; font-weight: 600; color: var(--color-sb-text-bright); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .chat-header-btn { display: flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; border-radius: 0.375rem; border: none; background: transparent; color: var(--color-sb-muted); cursor: pointer; transition: background 0.1s, color 0.1s; flex-shrink: 0; } .chat-header-btn:hover { background: var(--color-sb-cell); color: var(--color-sb-text); } /* Messages */ .chat-messages { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.625rem; min-height: 200px; } .chat-messages::-webkit-scrollbar { width: 4px; } .chat-messages::-webkit-scrollbar-thumb { background: var(--color-sb-border); border-radius: 2px; } .chat-bubble { max-width: 88%; padding: 0.5rem 0.75rem; border-radius: 0.75rem; font-size: 0.8125rem; line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; } .chat-bubble.user { align-self: flex-end; background: var(--color-sb-accent); color: white; border-bottom-right-radius: 0.25rem; } .chat-bubble.assistant { align-self: flex-start; background: var(--color-sb-cell); color: var(--color-sb-text); border-bottom-left-radius: 0.25rem; } .chat-bubble.assistant strong { color: var(--color-sb-text-bright); } .chat-bubble.assistant code { font-family: var(--font-mono); font-size: 0.75rem; background: var(--color-sb-code-bg); padding: 0.0625rem 0.25rem; border-radius: 3px; color: #93c5fd; } .chat-bubble.assistant pre { background: var(--color-sb-code-bg); border: 1px solid var(--color-sb-border); border-radius: 0.375rem; padding: 0.5rem; margin: 0.375rem 0; overflow-x: auto; font-family: var(--font-mono); font-size: 0.75rem; } .chat-bubble.assistant pre code { background: transparent; padding: 0; } /* Markdown headings */ .chat-bubble.assistant h1, .chat-bubble.assistant h2, .chat-bubble.assistant h3, .chat-bubble.assistant h4 { color: var(--color-sb-text-bright); font-weight: 600; margin: 0.75rem 0 0.25rem; line-height: 1.3; } .chat-bubble.assistant h1 { font-size: 1rem; } .chat-bubble.assistant h2 { font-size: 0.9375rem; } .chat-bubble.assistant h3 { font-size: 0.875rem; } .chat-bubble.assistant h4 { font-size: 0.8125rem; } .chat-bubble.assistant h1:first-child, .chat-bubble.assistant h2:first-child, .chat-bubble.assistant h3:first-child, .chat-bubble.assistant h4:first-child { margin-top: 0; } /* Paragraphs */ .chat-bubble.assistant p { margin: 0.375rem 0; } .chat-bubble.assistant p:first-child { margin-top: 0; } .chat-bubble.assistant p:last-child { margin-bottom: 0; } /* Lists */ .chat-bubble.assistant ul, .chat-bubble.assistant ol { margin: 0.375rem 0; padding-left: 1.25rem; } .chat-bubble.assistant li { margin: 0.125rem 0; } .chat-bubble.assistant li > ul, .chat-bubble.assistant li > ol { margin: 0.125rem 0; } /* Horizontal rules */ .chat-bubble.assistant hr { border: none; border-top: 1px solid var(--color-sb-border); margin: 0.625rem 0; } /* Blockquotes */ .chat-bubble.assistant blockquote { border-left: 3px solid var(--color-sb-accent); margin: 0.5rem 0; padding: 0.375rem 0.625rem; background: rgba(59, 130, 246, 0.08); border-radius: 0 0.25rem 0.25rem 0; color: var(--color-sb-text); } .chat-bubble.assistant blockquote p { margin: 0.25rem 0; } /* Tables — wrapped in a scrollable container via overflow on the bubble */ .chat-bubble.assistant table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; font-size: 0.75rem; display: block; overflow-x: auto; } .chat-bubble.assistant th, .chat-bubble.assistant td { padding: 0.3rem 0.5rem; border: 1px solid var(--color-sb-border); text-align: left; } .chat-bubble.assistant th { background: var(--color-sb-surface); color: var(--color-sb-text-bright); font-weight: 600; } .chat-bubble.assistant tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); } /* Links */ .chat-bubble.assistant a { color: var(--color-sb-accent); text-decoration: none; } .chat-bubble.assistant a:hover { text-decoration: underline; } /* KaTeX math — dark theme overrides */ .chat-bubble.assistant .katex { font-size: 0.9em; color: var(--color-sb-text-bright); } .chat-bubble.assistant .katex-display { margin: 0.5rem 0; overflow-x: auto; overflow-y: hidden; padding: 0.375rem 0; } .chat-bubble.assistant .katex-display > .katex { white-space: normal; } /* Status messages */ .chat-status { text-align: center; font-size: 0.6875rem; color: var(--color-sb-muted); padding: 0.25rem 0; font-style: italic; } /* Reasoning (collapsed) */ .chat-reasoning { font-size: 0.6875rem; color: var(--color-sb-muted); margin-bottom: 0.25rem; } .chat-reasoning summary { cursor: pointer; color: var(--color-sb-muted); font-size: 0.6875rem; } .chat-reasoning summary:hover { color: var(--color-sb-text); } .chat-reasoning-body { margin-top: 0.25rem; padding: 0.375rem 0.5rem; background: var(--color-sb-surface); border-radius: 0.375rem; border: 1px solid var(--color-sb-border); max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; } /* Streaming cursor */ .chat-cursor { display: inline-block; width: 2px; height: 1em; background: var(--color-sb-accent); animation: chat-blink 1s step-end infinite; vertical-align: text-bottom; margin-left: 1px; } @keyframes chat-blink { 50% { opacity: 0; } } /* Input */ .chat-input-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 0.75rem; border-top: 1px solid var(--color-sb-border); background: var(--color-sb-surface); flex-shrink: 0; } .chat-input { flex: 1; background: var(--color-sb-bg); border: 1px solid var(--color-sb-border); border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.8125rem; color: var(--color-sb-text); outline: none; font-family: var(--font-sans); transition: border-color 0.15s; } .chat-input::placeholder { color: var(--color-sb-muted); } .chat-input:focus { border-color: var(--color-sb-accent); } .chat-send-btn { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 0.5rem; border: none; background: var(--color-sb-accent); color: white; cursor: pointer; transition: background 0.15s; flex-shrink: 0; } .chat-send-btn:hover:not(:disabled) { background: var(--color-sb-accent-hover); } .chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; } /* History view */ .chat-history-list { flex: 1; overflow-y: auto; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.25rem; min-height: 200px; } .chat-history-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: 0.5rem; cursor: pointer; transition: background 0.1s; border: none; background: transparent; color: var(--color-sb-text); text-align: left; font-size: 0.8125rem; width: 100%; } .chat-history-item:hover { background: var(--color-sb-cell); } .chat-history-item.active { background: var(--color-sb-cell); border: 1px solid var(--color-sb-border); } .chat-history-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .chat-history-count { font-size: 0.6875rem; color: var(--color-sb-muted); flex-shrink: 0; } .chat-history-delete { display: flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 0.25rem; border: none; background: transparent; color: var(--color-sb-muted); cursor: pointer; flex-shrink: 0; opacity: 0; transition: opacity 0.1s, color 0.1s; } .chat-history-item:hover .chat-history-delete { opacity: 1; } .chat-history-delete:hover { color: var(--color-sb-danger); } .chat-history-delete.confirm { color: var(--color-sb-danger); opacity: 1; } .chat-empty { display: flex; align-items: center; justify-content: center; flex: 1; color: var(--color-sb-muted); font-size: 0.8125rem; font-style: italic; } /* Responsive: smaller screens */ @media (max-width: 480px) { .chat-panel { width: calc(100vw - 2rem); right: 1rem; bottom: 4.5rem; max-height: 60vh; } .chat-fab { bottom: 1rem; right: 1rem; } }