/* =============================================================================
 * AI Panel: layout — console panel column in Workspace
 * Ported from scitex-cloud global-ai-chat/01-panel-layout.css
 * =============================================================================
 * The console panel in Workspace.tsx uses .stx-workspace__console-panel for
 * sizing/resizing, and .stx-shell-ai-* for inner DOM matching scitex-cloud.
 * ============================================================================= */

/* Body of the panel: flex column filling available height */
.stx-shell-ai-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-secondary, var(--workspace-bg-secondary));
  padding: 0 !important;
}

/* Panel header — matches scitex-cloud stx-shell-ai-panel-header */
.stx-shell-ai-panel-header {
  display: flex;
  align-items: center;
  cursor: default;
  user-select: none;
  border-bottom: 1px solid var(--border-default, var(--workspace-border-subtle));
  background: var(--bg-tertiary, var(--workspace-bg-tertiary));
  min-height: 50px;
  padding: 0 4px;
  flex-shrink: 0;
}

.stx-shell-ai-panel-header:hover {
  background: var(--workspace-bg-hover, rgba(139, 148, 158, 0.08));
  border-bottom-color: var(--stx-app-accent, #059669);
}

/* Panel actions container */
.stx-shell-ai-panel-actions {
  display: flex;
  gap: 0.25rem;
}

/* Action buttons in header */
.stx-shell-ai-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #8b949e);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  transition:
    color 0.15s,
    background 0.15s;
}

.stx-shell-ai-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
}

.stx-shell-ai-action-btn.active {
  color: #5a9a7e;
}

/* Model badge — inline in settings panel or input area */
.stx-shell-ai-model-badge {
  font-size: 0.6rem;
  font-family: monospace;
  font-weight: 400;
  color: var(--text-dimmed, #484f58);
  display: inline;
  margin-left: 0.25rem;
}

.stx-shell-ai-model-badge:empty {
  display: none;
}

/* Context chip in panel header */
.stx-shell-ai-context-chip {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, #8b949e);
  font-family: monospace;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Config popover (gear settings dropdown) */
.stx-shell-ai-config-popover {
  position: absolute;
  bottom: 100%;
  right: 0;
  min-width: 240px;
  background: var(--bg-secondary, #161b22);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 6px;
  padding: 0.5rem;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.ai-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.stx-shell-ai-settings-label {
  font-size: 0.75rem;
  color: var(--text-muted, #8b949e);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ai-settings-select,
.ai-settings-input {
  font-size: 0.75rem;
  padding: 0.2rem 0.375rem;
  border: 1px solid var(--border-default, #30363d);
  border-radius: 4px;
  background: var(--bg-tertiary, #0d1117);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.ai-settings-section {
  padding: 0.375rem 0;
  border-top: 1px solid var(--border-default, #30363d);
  margin-top: 0.375rem;
}

.ai-settings-section:first-child {
  border-top: none;
  margin-top: 0;
}

.ai-settings-links {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-default, #30363d);
  margin-top: 0.375rem;
}

.ai-settings-links a {
  font-size: 0.7rem;
  color: var(--color-accent-fg, #58a6ff);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ai-settings-links a:hover {
  text-decoration: underline;
}

/* View switching */
.stx-shell-ai-view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.stx-shell-ai-view.active {
  display: flex;
}
