/* Chat interface — matches Axiom landing page theme exactly */

#chat-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

/* Header */
.chat-header {
  padding: 0 2rem;
  height: 56px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(13, 13, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 2rem;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

.bob-operator-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
  padding-right: 1.25rem;
  border-right: 1px solid var(--rule);
  margin-right: 1.25rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.bob-nav {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bob-nav::-webkit-scrollbar { display: none; }

.bob-nav-link {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.bob-nav-link:hover {
  color: var(--text);
  background: rgba(238, 232, 220, 0.06);
}

.bob-nav-link.active {
  color: var(--text);
  font-weight: 500;
  background: rgba(238, 232, 220, 0.08);
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.persona-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
}

.persona-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.persona-btn:not(:last-child) {
  border-right: 1px solid var(--rule);
}

.persona-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.persona-btn:hover:not(.active) {
  background: rgba(238, 232, 220, 0.05);
  color: var(--text);
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-dim);
  border: 1px solid rgba(201, 162, 39, 0.25);
  color: var(--accent);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.9rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.new-chat-btn:hover {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.4);
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 0;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 2px;
}

/* Welcome state */
.welcome-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
}

.welcome-mark {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3rem;
  font-weight: 300;
  color: var(--accent);
  margin-bottom: 1.5rem;
  line-height: 1;
}

.welcome-headline {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.welcome-sub {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.65;
}

/* Message bubbles */
.message-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 1.5rem;
}

.message-user-row {
  display: flex;
  justify-content: flex-end;
  padding: 0.25rem 2rem;
}

.message-user-bubble {
  background: var(--accent);
  color: #0d0d0a;
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  border-radius: 4px 4px 0 4px;
  max-width: min(480px, 75%);
  line-height: 1.55;
}

.message-assistant-row {
  display: flex;
  justify-content: flex-start;
  padding: 0.25rem 2rem;
}

.message-assistant-bubble {
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.65rem 1rem;
  border-radius: 0 4px 4px 4px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  max-width: min(520px, 80%);
  line-height: 1.6;
}

.message-assistant-bubble p {
  margin-bottom: 0.75em;
}
.message-assistant-bubble p:last-child {
  margin-bottom: 0;
}

.message-assistant-bubble strong {
  color: var(--text);
  font-weight: 600;
}

.message-assistant-bubble em {
  color: var(--accent);
  font-style: italic;
}

/* Thinking / loading state */
.axiom-thinking {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  max-width: min(520px, 80%);
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dot-pulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 2rem;
  flex-shrink: 0;
  background: var(--bg);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  max-width: 680px;
  margin: 0 auto;
}

.chat-textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  min-height: 48px;
  max-height: 160px;
  overflow-y: auto;
}

.chat-textarea::placeholder {
  color: var(--text-tertiary);
}

.chat-textarea:focus {
  border-color: rgba(201, 162, 39, 0.3);
}

.chat-submit-btn {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  color: #0d0d0a;
}

.chat-submit-btn:hover:not(:disabled) {
  background: #d4ad2a;
}

.chat-submit-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-submit-btn:disabled {
  background: var(--text-tertiary);
  cursor: not-allowed;
  opacity: 0.5;
}

/* Error toast */
.error-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 80, 60, 0.12);
  border: 1px solid rgba(220, 80, 60, 0.3);
  color: #e87060;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 20;
}

.error-toast.visible {
  opacity: 1;
}

/* Quick-start state */
.quickstart-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
}

.quickstart-mark {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3rem;
  font-weight: 300;
  color: var(--accent);
  margin-bottom: 1.25rem;
  line-height: 1;
}

.quickstart-headline {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 2rem;
  line-height: 1.25;
}

/* Quick-start chips */
.quickstart-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 520px;
}

.chip {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: rgba(201, 162, 39, 0.35);
  color: var(--text);
  background: var(--accent-dim);
}

/* Save to Workroom button */
.save-workroom-btn {
  margin-top: 0.75rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(201, 162, 39, 0.25);
  padding: 0.35rem 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.save-workroom-btn:hover:not(:disabled) {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.45);
}

.save-workroom-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.save-workroom-btn.saved {
  color: #6aad60;
  border-color: rgba(106, 173, 96, 0.3);
  background: rgba(106, 173, 96, 0.08);
  cursor: default;
}

/* Mobile */
@media (max-width: 768px) {
  .chat-header { padding: 0 1.25rem; height: 52px; }
  .bob-nav { display: none; }
  .persona-toggle { display: none; }
  .message-user-row, .message-assistant-row { padding: 0.25rem 1.25rem; }
  .chat-input-area { padding: 1rem 1.25rem; }
  .quickstart-headline { font-size: 1.15rem; }
  .quickstart-chips { padding: 0 1rem; }
}

@media (max-width: 520px) {
  .bob-operator-logo { display: none; }
}