/**
 * Terminal Output Component Styles
 *
 * Styles for step output display with ANSI color rendering.
 * Supports light and dark terminal themes.
 *
 * Requirements covered:
 * - 6.5: Support both light and dark terminal color themes
 */

/* ==========================================================================
   Step Output Container
   ========================================================================== */

.step-output {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 0.5rem;
  overflow: hidden;
}

.step-output__container {
  padding: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.step-output__line {
  margin: 0;
  padding: 0.125rem 0;
}

.step-output__line pre {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Output line stream types */
.output-line {
  margin: 0;
  padding: 0.125rem 0;
}

.output-line pre {
  margin: 0;
  font-family: inherit;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.output-line.stderr {
  opacity: 0.9;
}

/* ==========================================================================
   Light Theme (Default)
   ========================================================================== */

.theme-light {
  background-color: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.theme-light .step-output__container {
  background-color: #f9fafb;
}

.theme-light .output-line.stderr {
  color: #dc2626;
}

/* Light theme ANSI color overrides for better contrast */
.theme-light .ansi-black-fg { color: #1f2937; }
.theme-light .ansi-red-fg { color: #dc2626; }
.theme-light .ansi-green-fg { color: #16a34a; }
.theme-light .ansi-yellow-fg { color: #ca8a04; }
.theme-light .ansi-blue-fg { color: #2563eb; }
.theme-light .ansi-magenta-fg { color: #9333ea; }
.theme-light .ansi-cyan-fg { color: #0891b2; }
.theme-light .ansi-white-fg { color: #6b7280; }

/* Light theme bright/bold colors */
.theme-light .ansi-bright-black-fg { color: #374151; }
.theme-light .ansi-bright-red-fg { color: #ef4444; }
.theme-light .ansi-bright-green-fg { color: #22c55e; }
.theme-light .ansi-bright-yellow-fg { color: #eab308; }
.theme-light .ansi-bright-blue-fg { color: #3b82f6; }
.theme-light .ansi-bright-magenta-fg { color: #a855f7; }
.theme-light .ansi-bright-cyan-fg { color: #06b6d4; }
.theme-light .ansi-bright-white-fg { color: #9ca3af; }

/* Light theme background colors */
.theme-light .ansi-black-bg { background-color: #1f2937; }
.theme-light .ansi-red-bg { background-color: #fee2e2; }
.theme-light .ansi-green-bg { background-color: #dcfce7; }
.theme-light .ansi-yellow-bg { background-color: #fef9c3; }
.theme-light .ansi-blue-bg { background-color: #dbeafe; }
.theme-light .ansi-magenta-bg { background-color: #f3e8ff; }
.theme-light .ansi-cyan-bg { background-color: #cffafe; }
.theme-light .ansi-white-bg { background-color: #f3f4f6; }

/* ==========================================================================
   Dark Theme
   ========================================================================== */

.theme-dark {
  background-color: #0d1117;
  color: #00ff41;
  border: 1px solid #21262d;
}

.theme-dark .step-output__container {
  background-color: #0d1117;
}

.theme-dark .output-line.stderr {
  color: #ff6b6b;
}

/* Dark theme ANSI colors - Matrix-inspired green terminal */
.theme-dark .ansi-black-fg { color: #161b22; }
.theme-dark .ansi-red-fg { color: #ff6b6b; }
.theme-dark .ansi-green-fg { color: #00ff41; }
.theme-dark .ansi-yellow-fg { color: #ffeb3b; }
.theme-dark .ansi-blue-fg { color: #58a6ff; }
.theme-dark .ansi-magenta-fg { color: #bc8cff; }
.theme-dark .ansi-cyan-fg { color: #39c5cf; }
.theme-dark .ansi-white-fg { color: #c9d1d9; }

/* Dark theme bright/bold colors */
.theme-dark .ansi-bright-black-fg { color: #484f58; }
.theme-dark .ansi-bright-red-fg { color: #ffa7a7; }
.theme-dark .ansi-bright-green-fg { color: #7fff7f; }
.theme-dark .ansi-bright-yellow-fg { color: #fff176; }
.theme-dark .ansi-bright-blue-fg { color: #79c0ff; }
.theme-dark .ansi-bright-magenta-fg { color: #d2a8ff; }
.theme-dark .ansi-bright-cyan-fg { color: #56d4dd; }
.theme-dark .ansi-bright-white-fg { color: #f0f6fc; }

/* Dark theme background colors */
.theme-dark .ansi-black-bg { background-color: #010409; }
.theme-dark .ansi-red-bg { background-color: #490202; }
.theme-dark .ansi-green-bg { background-color: #003d00; }
.theme-dark .ansi-yellow-bg { background-color: #3d3d00; }
.theme-dark .ansi-blue-bg { background-color: #0d1d31; }
.theme-dark .ansi-magenta-bg { background-color: #2a0d3d; }
.theme-dark .ansi-cyan-bg { background-color: #0d2d31; }
.theme-dark .ansi-white-bg { background-color: #21262d; }

/* ==========================================================================
   Agent Output Header
   ========================================================================== */

.step-output__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid;
}

.step-output__agent-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-output__agent-icon {
  flex-shrink: 0;
}

.step-output__agent-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.step-output__output-badge {
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Light theme header */
.theme-light .step-output__header {
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}

.theme-light .step-output__agent-label {
  color: #374151;
}

.theme-light .step-output__output-badge {
  background-color: #e5e7eb;
  color: #6b7280;
}

/* Dark theme header */
.theme-dark .step-output__header {
  background-color: #161b22;
  border-color: #21262d;
}

.theme-dark .step-output__agent-label {
  color: #00ff41;
}

.theme-dark .step-output__output-badge {
  background-color: #21262d;
  color: #00ff41;
}

/* ==========================================================================
   Theme Toggle Button
   ========================================================================== */

.step-output__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-light .step-output__toolbar {
  border-color: #e5e7eb;
  background-color: #f3f4f6;
}

.theme-dark .step-output__toolbar {
  border-color: #3c3c3c;
  background-color: #252526;
}

.step-output__theme-toggle {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.theme-light .step-output__theme-toggle {
  background-color: #e5e7eb;
  color: #374151;
  border: 1px solid #d1d5db;
}

.theme-light .step-output__theme-toggle:hover {
  background-color: #d1d5db;
}

.theme-dark .step-output__theme-toggle {
  background-color: #3c3c3c;
  color: #d4d4d4;
  border: 1px solid #4b4b4b;
}

.theme-dark .step-output__theme-toggle:hover {
  background-color: #4b4b4b;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.step-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
}

.step-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-completed {
  background-color: #dcfce7;
  color: #166534;
}

.status-failed {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-timeout {
  background-color: #fef3c7;
  color: #92400e;
}

.status-unknown {
  background-color: #f3f4f6;
  color: #374151;
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */

.step-output__container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.theme-light .step-output__container::-webkit-scrollbar-track {
  background: #f3f4f6;
}

.theme-light .step-output__container::-webkit-scrollbar-thumb {
  background-color: #d1d5db;
  border-radius: 4px;
}

.theme-light .step-output__container::-webkit-scrollbar-thumb:hover {
  background-color: #9ca3af;
}

.theme-dark .step-output__container::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.theme-dark .step-output__container::-webkit-scrollbar-thumb {
  background-color: #4b4b4b;
  border-radius: 4px;
}

.theme-dark .step-output__container::-webkit-scrollbar-thumb:hover {
  background-color: #6b7280;
}
