/* ============================================================
   Bob Web UI — Dark Theme
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base:       #0d0d0f;
  --bg-sidebar:    #111114;
  --bg-card:       #18181c;
  --bg-input:      #1e1e23;
  --bg-user-msg:   #1a2a4a;
  --bg-bob-msg:    #17171b;
  --bg-tool:       #1a1a22;
  --border:        #2a2a32;
  --accent:        #4f7ef5;
  --accent-hover:  #6b95ff;
  --text-primary:  #e8e8ec;
  --text-secondary:#8888a0;
  --text-muted:    #55556a;
  --error:         #e05353;
  --success:       #4caf7a;
  --monkey-yellow: #f5c842;
  --radius:        10px;
  --radius-sm:     6px;
  --font-sans:     -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:     "Cascadia Code", "Fira Code", "JetBrains Mono", "Consolas", monospace;
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Login page
   ============================================================ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at center top, #141420 0%, var(--bg-base) 70%);
}

.login-card {
  background: #2a6fc4;
  border: 1px solid #4a8fd8;
  border-radius: 16px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-benny {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.75rem;
  mix-blend-mode: multiply;
}

.login-logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.login-subtitle {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.875rem;
  margin-top: 0.3rem;
  line-height: 1.5;
}

.login-error {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 120, 120, 0.6);
  color: #ffb3b3;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.login-form .form-group {
  margin-bottom: 1rem;
}

.login-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.login-form input {
  width: 100%;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  color: #ffffff;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

.login-form input:focus {
  border-color: rgba(255, 255, 255, 0.75);
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.btn-login {
  width: 100%;
  margin-top: 1.25rem;
  background: #ffffff;
  color: #1a4fa0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #0f3a80;
}

/* ============================================================
   Chat layout
   ============================================================ */

.chat-body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- Sidebar --- */

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-benny-wrap {
  width: 40px;
  height: 40px;
  background: #2a6fc4;
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-benny {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.sidebar-user {
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 0.2rem;
  font-weight: 600;
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0 1rem 0.5rem;
}

.conv-list {
  list-style: none;
}

.conv-list li {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: default;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-list li.conv-loading {
  color: var(--text-muted);
  font-style: italic;
}

.conv-list li.conv-item {
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin: 0 0.5rem;
  padding: 0.4rem 0.6rem;
  transition: background 0.1s;
}

.conv-list li.conv-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-help {
  display: block;
  text-align: center;
  background: rgba(79, 126, 245, 0.12);
  border: 1px solid rgba(79, 126, 245, 0.35);
  border-radius: var(--radius-sm);
  color: #7aaeff;
  padding: 0.5rem;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-help:hover {
  background: rgba(79, 126, 245, 0.22);
  color: #aac8ff;
}

.btn-logout {
  display: block;
  text-align: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 0.5rem;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-logout:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.sidebar-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  display: block;
  border-radius: var(--radius-sm);
  transition: background 0.1s;
}

.sidebar-link:hover {
  background: var(--bg-card);
}

/* --- Main chat area --- */

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.chat-header-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-connecting { background: var(--monkey-yellow); animation: pulse 1.5s infinite; }
.status-ready      { background: var(--success); }
.status-working    { background: var(--accent); animation: pulse 1s infinite; }
.status-error      { background: var(--error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* --- Messages --- */

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-bob {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.msg-bubble {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  line-height: 1.65;
  word-break: break-word;
}

.msg-user .msg-bubble {
  background: var(--bg-user-msg);
  border: 1px solid rgba(79, 126, 245, 0.2);
  color: var(--text-primary);
  border-bottom-right-radius: 3px;
}

.msg-bob .msg-bubble {
  background: var(--bg-bob-msg);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  border-bottom-left-radius: 3px;
}

/* Markdown content inside Bob messages */
.msg-bob .msg-bubble h1,
.msg-bob .msg-bubble h2,
.msg-bob .msg-bubble h3 {
  margin: 0.75em 0 0.4em;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.3;
}

.msg-bob .msg-bubble h1 { font-size: 1.2em; }
.msg-bob .msg-bubble h2 { font-size: 1.1em; }
.msg-bob .msg-bubble h3 { font-size: 1em; }

.msg-bob .msg-bubble p {
  margin: 0.4em 0;
}

.msg-bob .msg-bubble p:first-child { margin-top: 0; }
.msg-bob .msg-bubble p:last-child  { margin-bottom: 0; }

.msg-bob .msg-bubble ul,
.msg-bob .msg-bubble ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}

.msg-bob .msg-bubble li {
  margin: 0.2em 0;
}

.msg-bob .msg-bubble code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

.msg-bob .msg-bubble pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.6em 0;
}

.msg-bob .msg-bubble pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82em;
}

.msg-bob .msg-bubble strong {
  color: var(--text-primary);
  font-weight: 700;
}

.msg-bob .msg-bubble em {
  color: var(--text-secondary);
}

.msg-bob .msg-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 0.8em;
  color: var(--text-secondary);
  margin: 0.5em 0;
}

.msg-bob .msg-bubble hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75em 0;
}

/* Platform content blocks — labeled sections in Bob's output */
.msg-bob .msg-bubble h2,
.msg-bob .msg-bubble h3 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25em;
}

/* --- Thinking / loading indicator --- */

.thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.thinking-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* --- Tool indicator strip --- */

.tool-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1.5rem;
  background: var(--bg-tool);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: opacity 0.2s;
}

.tool-indicator.hidden {
  display: none;
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Input area --- */

.input-area {
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
}

.chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font-sans);
  resize: none;
  outline: none;
  max-height: 160px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--accent);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-send {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   Scrollbar styling
   ============================================================ */

::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   Help page
   ============================================================ */

.help-body {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-base);
}

.help-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* Hero */
.help-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
}

.help-benny-wrap {
  width: 90px;
  height: 90px;
  background: #2a6fc4;
  border-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
}

.help-benny {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.help-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.help-hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Sections */
.help-section {
  margin-bottom: 2.75rem;
}

.help-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.help-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.25rem 0 0.6rem;
}

.help-section > p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 1rem;
}

/* Brand cards grid */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.help-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.help-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.1rem;
}

.help-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.help-card span {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* Platform tags */
.help-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.platform-tag {
  background: rgba(79, 126, 245, 0.12);
  border: 1px solid rgba(79, 126, 245, 0.3);
  color: #7aaeff;
  border-radius: 20px;
  padding: 0.25rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Callout box */
.help-callout {
  background: rgba(79, 126, 245, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 1rem 0;
}

.help-callout code {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

/* Example prompts */
.help-examples {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prompt-pill {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: default;
  transition: border-color 0.15s, color 0.15s;
}

.prompt-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Feature list */
.help-feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.help-feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.help-feature-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.help-feature-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Cross-brand grid */
.help-cross-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.help-cross-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--monkey-yellow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Agents */
.help-agents {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.help-agent {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
}

.help-agent-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.help-agent-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.help-agent-desc code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05em 0.3em;
}

/* Tips list */
.help-tips {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 0;
  list-style: none;
}

.help-tips li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.help-tips li strong {
  color: var(--text-primary);
}

/* Keyboard keys */
kbd {
  display: inline-block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--text-primary);
}

/* Back button */
.help-back {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.btn-back-to-chat {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-back-to-chat:hover {
  background: var(--accent-hover);
}
