/* RA-H Terminal Theme Design System */

:root {
  /* Core Backgrounds - Ultra minimal dark */
  --bg-primary: #0a0a0a;      /* Main app background */
  --bg-secondary: #0f0f0f;     /* Panel backgrounds */
  --bg-surface: #151515;      /* Elevated surfaces */
  --bg-hover: #1a1a1a;        /* Hover states */
  
  /* Borders & Dividers - Subtle definition */
  --border-subtle: #1f1f1f;    /* Very subtle borders */
  --border-default: #2a2a2a;   /* Default borders */
  --border-strong: #353535;    /* Strong emphasis borders */
  
  /* Text Hierarchy - High contrast */
  --text-primary: #e5e5e5;     /* Primary text */
  --text-secondary: #a8a8a8;   /* Secondary text */
  --text-muted: #6b6b6b;       /* Muted/disabled text */
  --text-subtle: #4a4a4a;      /* Very subtle text */
  
  /* Terminal Accent Colors - Distinctive but minimal */
  --accent-blue: #5c9aff;      /* Primary actions / User messages */
  --accent-green: #52d97a;     /* Success / Assistant messages */
  --accent-yellow: #ffcc66;    /* Warning / Tool usage */
  --accent-red: #ff6b6b;       /* Error states */
  --accent-purple: #b794f6;    /* Thinking / Processing */
  --accent-cyan: #69d2e7;      /* Special highlights */
  
  /* Message Status Indicators */
  --dot-user: #5c9aff;         /* User message indicator */
  --dot-assistant: #52d97a;    /* Assistant indicator */
  --dot-tool: #ffcc66;         /* Tool usage indicator */
  --dot-thinking: #b794f6;     /* Thinking indicator */
  --dot-system: #69d2e7;       /* System messages */
  
  /* Semantic Colors */
  --color-success: #52d97a;
  --color-warning: #ffcc66;
  --color-error: #ff6b6b;
  --color-info: #5c9aff;
  
  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', ui-monospace, Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 13px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  
  /* Animations */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Terminal Styles */
.terminal-container {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: 1.6;
  letter-spacing: 0.025em;
  font-feature-settings: 'liga' 1, 'calt' 1;
}

/* Message Display Styles */
.message-container {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) 0;
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.message-indicator {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.message-indicator.user {
  background: var(--dot-user);
}

.message-indicator.assistant {
  background: var(--dot-assistant);
}

.message-indicator.tool {
  background: var(--dot-tool);
}

.message-indicator.thinking {
  background: var(--dot-thinking);
  animation: pulse 1.5s infinite;
}

.message-indicator.system {
  background: var(--dot-system);
}

@keyframes pulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-text {
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.message-timestamp {
  display: inline-block;
  margin-top: var(--spacing-xs);
  color: var(--text-subtle);
  font-size: var(--font-size-xs);
}

/* Terminal Input Styles */
.terminal-input-container {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-default);
}

.prompt-symbol {
  color: var(--text-muted);
  font-size: var(--font-size-md);
  line-height: 1.5;
  padding-top: 2px;
  user-select: none;
}

.terminal-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.terminal-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  padding: var(--spacing-sm) var(--spacing-md);
  resize: none;
  outline: none;
  transition: all var(--transition-fast);
  border-radius: 2px;
  min-height: 32px;
  line-height: 1.5;
}

.terminal-input:focus {
  border-color: var(--accent-blue);
  background: var(--bg-primary);
  box-shadow: 0 0 0 1px rgba(92, 154, 255, 0.1);
}

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

.terminal-input::placeholder {
  color: var(--text-subtle);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.input-hints {
  display: flex;
  gap: var(--spacing-md);
  color: var(--text-subtle);
  font-size: var(--font-size-xs);
  user-select: none;
}

.input-hint {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.key-hint {
  padding: 2px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  font-size: 10px;
}

/* Tool Indicator Styles */
.tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.tool-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-default);
  border-top-color: var(--dot-tool);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.tool-name {
  color: var(--dot-tool);
  font-weight: 500;
}

.tool-status {
  color: var(--text-muted);
}

.tool-complete {
  color: var(--color-success);
}

.tool-error {
  color: var(--color-error);
}

/* ASCII Banner Styles */
.ascii-banner {
  padding: var(--spacing-xl);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  line-height: 1.2;
  white-space: pre;
  font-family: var(--font-mono);
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.ascii-banner-title {
  color: var(--text-secondary);
}

.ascii-banner-stats {
  color: var(--text-subtle);
}

/* Helper Tab Styles */
.helper-tab {
  position: relative;
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
  white-space: nowrap;
}

.helper-tab:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.helper-tab.active {
  background: var(--bg-primary);
  border-bottom-color: var(--accent-blue);
  color: var(--text-primary);
}

/* Scrollbar Styles */
.terminal-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.terminal-scrollbar::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.terminal-scrollbar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.terminal-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* Loading States */
.loading-dots {
  display: inline-flex;
  gap: 2px;
}

.loading-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: loadingPulse 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes loadingPulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Focus States for Accessibility */
.terminal-focusable:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Utility Classes */
.terminal-text-muted {
  color: var(--text-muted);
}

.terminal-text-subtle {
  color: var(--text-subtle);
}

.terminal-text-error {
  color: var(--color-error);
}

.terminal-text-success {
  color: var(--color-success);
}

.terminal-bg-surface {
  background: var(--bg-surface);
}

.terminal-border-default {
  border-color: var(--border-default);
}