/* Mermaid diagram blocks */

/* Right pane: chat stream */
.spec-chat-stream {
  width: 360px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.spec-chat-stream__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.spec-chat-stream__title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spec-chat-stream__header-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.spec-chat-clear-btn,
.spec-chat-fold-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  line-height: 1.4;
}

.spec-chat-clear-btn:hover,
.spec-chat-fold-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.spec-chat-send-group {
  display: flex;
  flex-shrink: 0;
}

.spec-chat-send-group .spec-chat-send-btn {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.spec-chat-mode-btn {
  font-size: 10px;
  padding: 5px 5px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1;
}

.spec-chat-mode-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.spec-chat-stream__messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Thread tab bar above chat messages. Mirrors the workspace-group-tab
 * look (see ui/css/header.css) so multi-tab UX is consistent across
 * the header and the specs chat. */
.spec-chat-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  min-height: 28px;
}

.spec-chat-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
}

.spec-chat-tab:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.spec-chat-tab--active {
  color: var(--text);
  background: var(--bg-card);
  border-color: var(--border);
  position: relative;
  /* Nudge the active tab down so its bottom border meets the
   * container's border-bottom and appears to "sit on" the content. */
  margin-bottom: -1px;
  border-bottom: 1px solid var(--bg-card);
}

.spec-chat-tab__label {
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 160px;
}

.spec-chat-tab__unread {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #2b7cff);
  display: inline-block;
}

.spec-chat-tab__pencil,
.spec-chat-tab__close {
  background: transparent;
  border: none;
  padding: 0 2px;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
  line-height: 1;
}

.spec-chat-tab__pencil:hover,
.spec-chat-tab__close:hover {
  opacity: 1;
}

.spec-chat-tab__new-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}

.spec-chat-tab__new,
.spec-chat-tab__archived-trigger {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  font-size: 14px;
}

.spec-chat-tab__new:hover,
.spec-chat-tab__archived-trigger:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.spec-chat-tab__rename-input {
  font: inherit;
  color: var(--text);
  background: var(--bg-input, var(--bg));
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  width: 120px;
  outline: none;
}

.spec-chat-archived-menu {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-width: 180px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
  padding: 4px 0;
  z-index: 10000;
}

.spec-chat-archived-menu__header {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px 6px;
  border-bottom: 1px solid var(--border);
}

.spec-chat-archived-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.spec-chat-archived-menu__item:hover {
  background: var(--bg-hover);
}

/* Composer: Slack-style bordered container with textarea + action bar */
.spec-chat-composer {
  margin: 6px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input, var(--bg));
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.15s;
}

.spec-chat-composer:focus-within {
  border-color: var(--accent);
}

.spec-chat-composer__input {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px 4px;
  min-height: 24px;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.spec-chat-composer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 6px;
}

.spec-chat-composer__actions {
  display: flex;
  gap: 2px;
}

.spec-chat-composer__action {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}

.spec-chat-composer__action:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.spec-chat-composer__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spec-chat-composer__hint {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.spec-chat-send-group {
  display: flex;
  flex-shrink: 0;
}

.spec-chat-composer__send {
  padding: 4px 10px;
  font-size: 14px;
  border: none;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  background: var(--accent, #2563eb);
  color: #fff;
  line-height: 1;
}

.spec-chat-composer__send:hover {
  opacity: 0.9;
}

.spec-chat-composer__send-toggle {
  padding: 4px 5px;
  font-size: 10px;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  background: var(--accent, #2563eb);
  color: #fff;
  line-height: 1;
}

.spec-chat-composer__send-toggle:hover {
  opacity: 0.9;
}

/* Resize handle between focused view and chat */
.spec-chat-resize {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
}

.spec-chat-resize:hover {
  background: var(--accent);
}

