/* JSONL Renderer - JSONL 格式化/表格视图渲染器样式（虚拟滚动版） */

.wk-file-preview-jsonl-renderer {
  display: flex;
  flex-direction: column;
  background: var(--wk-bg-base);
  height: 100%;
  overflow: hidden;
}

/* Loading state */
.wk-file-preview-jsonl-renderer--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--wk-sp-3);
  color: var(--wk-text-secondary);
  font-size: var(--wk-text-size-md);
}

.wk-file-preview-jsonl-renderer__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--wk-border-subtle);
  border-top-color: var(--wk-brand-primary);
  border-radius: var(--wk-r-full);
  animation: wk-jsonl-renderer-spin 0.8s linear infinite;
}

@keyframes wk-jsonl-renderer-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error state */
.wk-file-preview-jsonl-renderer--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--wk-sp-3);
  color: var(--wk-color-danger);
  font-size: var(--wk-text-size-md);
}

.wk-file-preview-jsonl-renderer__retry {
  padding: var(--wk-sp-2) var(--wk-sp-4);
  border: 1px solid var(--wk-border-default);
  background: var(--wk-bg-base);
  color: var(--wk-text-primary);
  border-radius: var(--wk-r-sm);
  cursor: pointer;
  font-size: var(--wk-text-size-sm);
  transition: background-color 0.15s ease;
}

.wk-file-preview-jsonl-renderer__retry:hover {
  background: var(--wk-bg-hover);
}

/* Empty state */
.wk-file-preview-jsonl-renderer--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--wk-text-secondary);
  font-size: var(--wk-text-size-md);
}

/* Toolbar - 工具栏 */
.wk-file-preview-jsonl-renderer__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--wk-sp-2) var(--wk-sp-4);
  background: var(--wk-bg-elevated);
  border-bottom: 1px solid var(--wk-border-subtle);
  flex-shrink: 0;
  gap: var(--wk-sp-2);
}

.wk-file-preview-jsonl-renderer__info {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-2);
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-secondary);
}

.wk-file-preview-jsonl-renderer__badge {
  display: inline-flex;
  align-items: center;
  padding: var(--wk-sp-1) var(--wk-sp-2);
  background: var(--wk-brand-primary);
  color: var(--wk-color-white);
  font-size: var(--wk-text-size-xs);
  font-weight: 600;
  border-radius: var(--wk-r-xs);
  letter-spacing: 0.5px;
}

.wk-file-preview-jsonl-renderer__stats {
  color: var(--wk-text-tertiary);
}

.wk-file-preview-jsonl-renderer__view-switcher {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-1);
  padding: var(--wk-sp-1);
  background: var(--wk-bg-base);
  border: 1px solid var(--wk-border-subtle);
  border-radius: var(--wk-r-sm);
}

.wk-file-preview-jsonl-renderer__view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--wk-sp-1) var(--wk-sp-3);
  border: none;
  background: transparent;
  color: var(--wk-text-secondary);
  font-size: var(--wk-text-size-sm);
  border-radius: var(--wk-r-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  gap: var(--wk-sp-1);
}

.wk-file-preview-jsonl-renderer__view-btn:hover {
  background: var(--wk-bg-hover);
  color: var(--wk-text-primary);
}

.wk-file-preview-jsonl-renderer__view-btn--active {
  background: var(--wk-brand-primary);
  color: var(--wk-color-white);
}

.wk-file-preview-jsonl-renderer__view-btn--active:hover {
  background: var(--wk-brand-primary);
  color: var(--wk-color-white);
}

.wk-file-preview-jsonl-renderer__view-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wk-file-preview-jsonl-renderer__view-btn:disabled:hover {
  background: transparent;
  color: var(--wk-text-secondary);
}

.wk-file-preview-jsonl-renderer__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Content area - 表格主体 */
.wk-file-preview-jsonl-renderer__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* Virtual table (react-virtuoso) */
.wk-file-preview-jsonl-renderer__virtual-table {
  flex: 1;
  min-height: 0;
}

.wk-file-preview-jsonl-renderer__virtual-table table {
  border-collapse: collapse;
  table-layout: auto;
}

.wk-file-preview-jsonl-renderer__th {
  height: 40px;
  background: var(--wk-bg-elevated);
  font-size: var(--wk-text-size-xs);
  font-weight: 500;
  color: var(--wk-text-primary);
  padding: 0 var(--wk-sp-3);
  border-bottom: 1px solid var(--wk-border-subtle);
  text-align: left;
  white-space: nowrap;
  min-width: 100px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wk-file-preview-jsonl-renderer__td {
  height: 40px;
  background: var(--wk-bg-base);
  font-size: var(--wk-text-size-sm);
  color: var(--wk-text-primary);
  padding: 0 var(--wk-sp-3);
  border-bottom: 1px solid var(--wk-border-subtle);
  min-width: 100px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wk-file-preview-jsonl-renderer__virtual-table tr:hover .wk-file-preview-jsonl-renderer__td {
  background: var(--wk-bg-hover);
}

/* Footer - 底部信息栏 */
.wk-file-preview-jsonl-renderer__footer {
  display: flex;
  align-items: center;
  padding: var(--wk-sp-2) var(--wk-sp-4);
  background: var(--wk-bg-elevated);
  border-top: 1px solid var(--wk-border-subtle);
  flex-shrink: 0;
}

.wk-file-preview-jsonl-renderer__row-count {
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-secondary);
}

/* Code view - 代码视图 */
.wk-file-preview-jsonl-renderer__code-container {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

/* 代码高亮样式已移至 code-highlight.css */

/* Empty content state */
.wk-file-preview-jsonl-renderer__empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: var(--wk-sp-3);
  color: var(--wk-text-secondary);
  font-size: var(--wk-text-size-md);
}

.wk-file-preview-jsonl-renderer__switch-btn {
  padding: var(--wk-sp-2) var(--wk-sp-4);
  border: 1px solid var(--wk-border-default);
  background: var(--wk-bg-base);
  color: var(--wk-text-primary);
  border-radius: var(--wk-r-sm);
  cursor: pointer;
  font-size: var(--wk-text-size-sm);
  transition: background-color 0.15s ease;
}

.wk-file-preview-jsonl-renderer__switch-btn:hover {
  background: var(--wk-bg-hover);
}

/* 大文件提示条 */
.wk-file-preview-jsonl-renderer__plain-hint {
  padding: var(--wk-sp-2) var(--wk-sp-4);
  background: var(--wk-bg-elevated);
  border-bottom: 1px solid var(--wk-border-subtle);
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-tertiary);
}

/* 纯文本渲染 */
.wk-file-preview-jsonl-renderer__pre {
  margin: 0;
  padding: var(--wk-sp-4);
  background: var(--wk-bg-base);
  min-height: 100%;
  box-sizing: border-box;
  overflow: auto;
}

.wk-file-preview-jsonl-renderer__code {
  font-family: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--wk-text-primary);
  white-space: pre;
  display: block;
}

/* Too large state - 文件太大 */
.wk-file-preview-jsonl-renderer--too-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--wk-sp-4);
  color: var(--wk-text-secondary);
}

.wk-file-preview-jsonl-renderer__large-file-icon {
  width: 64px;
  height: 64px;
  color: var(--wk-text-tertiary);
}

.wk-file-preview-jsonl-renderer__large-file-icon svg {
  width: 100%;
  height: 100%;
}

.wk-file-preview-jsonl-renderer__large-file-text {
  font-size: var(--wk-text-size-md);
  color: var(--wk-text-secondary);
}

.wk-file-preview-jsonl-renderer__download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--wk-sp-2);
  padding: var(--wk-sp-2) var(--wk-sp-4);
  background: var(--wk-brand-primary);
  color: var(--wk-color-white);
  border: none;
  border-radius: var(--wk-r-sm);
  font-size: var(--wk-text-size-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.wk-file-preview-jsonl-renderer__download-btn:hover {
  background: var(--wk-brand-primary-hover);
}
