/* ============================================
   FilePreviewPanel - 文件预览面板样式
   类名前缀: wk-file-preview
   ============================================ */

.wk-file-preview-panel {
  pointer-events: auto;
  /* 与 ThreadPanel 共享宽度变量，实现宽度一致 */
  width: var(--wk-width-thread-panel);
  min-width: 360px;
  height: 100%;
  background: var(--wk-bg-surface);
  border-left: 1px solid var(--wk-border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 绝对定位 + 滑入动画，与 ThreadPanel 保持一致 */
  position: absolute;
  z-index: 101;
  top: 0;
  right: 0;
  transition: margin-right 150ms ease-in-out 0s;
  margin-right: calc(0px - var(--wk-width-thread-panel));
  box-shadow: var(--wk-shadow-md);
}

/* 打开状态 - 支持 filepreview-open 或 threadpanel-open（子区频道使用后者） */
.wk-chat-content-right.wk-chat-filepreview-open .wk-file-preview-panel,
.wk-chat-content-right.wk-chat-threadpanel-open .wk-file-preview-panel {
  margin-right: 0;
}

/* Header */
.wk-file-preview-header {
  height: var(--wk-height-chat-conversation-header);
  min-height: var(--wk-height-chat-conversation-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--wk-sp-4);
  border-bottom: 1px solid var(--wk-border-default);
  background-color: var(--wk-bg-surface);
}

.wk-file-preview-title {
  flex: 1;
  font-size: var(--wk-text-size-md);
  font-weight: 500;
  color: var(--wk-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: var(--wk-sp-3);
}

/* Header actions */
.wk-file-preview-actions {
  display: flex;
  align-items: center;
  gap: var(--wk-sp-1);
}

.wk-file-preview-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--wk-text-secondary);
  border-radius: var(--wk-r-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.wk-file-preview-close:hover {
  background: var(--wk-color-danger-light);
  color: var(--wk-color-danger);
}

/* Content area */
.wk-file-preview-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wk-file-preview-content > * {
  flex: 1;
  min-height: 0;
}

/* Dark mode */
body[theme-mode="dark"] .wk-file-preview-panel {
  background: var(--wk-bg-surface);
}
