/* =============================================================================
 * SciTeX Shell — Chat (ported from scitex-cloud llm_app)
 * =============================================================================
 * Prefix: stx-shell-chat
 * All colors reference theme.css tokens. No hardcoded values.
 * ============================================================================= */

.stx-shell-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.stx-shell-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 36px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--workspace-border-subtle);
  background: var(--workspace-bg-secondary);
  flex-shrink: 0;
}

.stx-shell-chat__clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
}

.stx-shell-chat__clear:hover {
  color: var(--status-error);
  background: var(--workspace-bg-hover);
}

/* --- Messages --- */

.stx-shell-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stx-shell-chat__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.stx-shell-chat__empty i {
  font-size: 32px;
  opacity: 0.3;
}

.stx-shell-chat__message {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.stx-shell-chat__message--user {
  background: var(--stx-app-accent, var(--app-accent-color));
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.stx-shell-chat__message--assistant {
  background: var(--workspace-bg-elevated);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.stx-shell-chat__message-content {
  white-space: pre-wrap;
}

/* --- Input --- */

.stx-shell-chat__input-area {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--workspace-border-subtle);
  background: var(--workspace-bg-secondary);
  flex-shrink: 0;
}

.stx-shell-chat__input {
  flex: 1;
  background: var(--workspace-bg-primary);
  border: 1px solid var(--workspace-border-default);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 150ms;
}

.stx-shell-chat__input::placeholder {
  color: var(--text-muted);
}

.stx-shell-chat__input:focus {
  border-color: var(--stx-app-accent, var(--app-accent-color));
}

.stx-shell-chat__send {
  background: var(--stx-app-accent, var(--app-accent-color));
  border: none;
  border-radius: 6px;
  color: #ffffff;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: opacity 150ms;
}

.stx-shell-chat__send:hover {
  opacity: 0.85;
}

.stx-shell-chat__send:disabled {
  opacity: 0.4;
  cursor: default;
}
