/* CodeRenderer - 代码渲染器样式 */

.wk-file-preview-code-renderer {
  height: 100%;
  overflow: auto;
  background: var(--wk-bg-base);
}

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

.wk-file-preview-code-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;
}

/* 大文件提示条 */
.wk-file-preview-code-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);
}

/* Loading state */
.wk-file-preview-code-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-code-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-code-renderer-spin 0.8s linear infinite;
}

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

/* Error state */
.wk-file-preview-code-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-code-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 0.15s;
}

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

/* Too large state - 文件太大 */
.wk-file-preview-code-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-code-renderer__large-file-icon {
  width: 64px;
  height: 64px;
  color: var(--wk-text-tertiary);
}

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

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

.wk-file-preview-code-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-code-renderer__download-btn:hover {
  background: var(--wk-brand-primary-hover);
}

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