/* output.scrapeable.com — Isolated output viewer for chat mode */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: #fff;
  color: #333;
}

/* ---- Content area ---- */

#output-content-area {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

/* ---- Placeholder ---- */

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 60px 20px;
  text-align: center;
  color: #999;
}

.placeholder-icon {
  font-size: 36px;
  color: #ccc;
  margin-bottom: 12px;
  display: block;
}

.placeholder-text {
  font-size: 13px;
  line-height: 1.4;
}

/* ---- Batch container ---- */

.output-batch {
  animation: batchIn 0.2s ease;
}

@keyframes batchIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Code toggle (collapsed by default) ---- */

.batch-code {
  margin-bottom: 6px;
}

.batch-code summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-radius: 4px;
}

.batch-code summary::-webkit-details-marker {
  display: none;
}

.batch-code summary:hover {
  background: #f3f4f6;
  color: #374151;
}

.batch-code summary .code-chevron {
  font-size: 8px;
  transition: transform 0.15s ease;
}

.batch-code[open] summary .code-chevron {
  transform: rotate(90deg);
}

.batch-code summary .code-label {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-weight: 600;
  font-size: 11px;
}

.batch-code summary .code-duration {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 400;
}

.batch-code summary .code-copy-btn {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  color: #6b7280;
  transition: all 0.1s ease;
}

.batch-code summary .code-copy-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.batch-code summary .code-copy-btn.copied {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.batch-code pre {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: #1f2937;
  color: #e5e7eb;
  border-radius: 4px;
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Output section (always visible) ---- */

.batch-output {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---- Text output (stdout / stderr) ---- */

.batch-output pre {
  margin: 0;
  padding: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

/* ---- Error ---- */

.batch-error {
  padding: 8px 10px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #991b1b;
}

/* ---- Plots (match viewer.scrapeable.com) ---- */

.batch-output img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

/* ---- Widget iframes (match viewer.scrapeable.com) ---- */

.batch-output iframe {
  display: block;
  width: 100%;
  height: 550px;
  border: none;
  background: #fff;
  border-radius: 4px;
}

/* ---- Data views ---- */

.batch-output .data-view h4 {
  font-weight: 500;
  margin-bottom: 4px;
  color: #6b7280;
  font-size: 11px;
}

.batch-output .data-view pre {
  padding: 8px 10px;
  background: #f5f7f9;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
}

/* ---- Standalone output items (non-batch) ---- */

.output-item {
  animation: batchIn 0.2s ease;
}

.output-item pre {
  margin: 0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

.output-item.error pre,
.output-item.error div {
  padding: 8px 10px;
  background: #fef2f2;
  border-left: 3px solid #dc2626;
  border-radius: 4px;
  color: #991b1b;
}

.output-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.output-item iframe {
  display: block;
  width: 100%;
  height: 550px;
  border: none;
  background: #fff;
  border-radius: 4px;
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
