/* Excel Renderer - Excel/CSV 表格渲染器样式（虚拟滚动版） */

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

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

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

/* Error state */
.wk-file-preview-excel-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-excel-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-excel-renderer__retry:hover {
  background: var(--wk-bg-hover);
}

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

/* Content area - 表格主体 */
.wk-file-preview-excel-renderer__content {
  flex: 1;
  overflow: hidden; /* TableVirtuoso 自带滚动容器，避免嵌套滚动 */
  min-height: 0;
}

/* Virtual table (react-virtuoso) */
.wk-file-preview-excel-renderer__virtual-table {
  height: 100%;
}

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

.wk-file-preview-excel-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-excel-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-excel-renderer__virtual-table tr:hover .wk-file-preview-excel-renderer__td {
  background: var(--wk-bg-hover);
}

/* Footer - 底部信息栏 */
.wk-file-preview-excel-renderer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  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-excel-renderer__row-count {
  font-size: var(--wk-text-size-xs);
  color: var(--wk-text-secondary);
}

/* Tabs - 工作表切换器 */
.wk-file-preview-excel-renderer__tabs {
  display: flex;
  gap: var(--wk-sp-1);
  overflow-x: auto;
}

.wk-file-preview-excel-renderer__tab {
  padding: var(--wk-sp-1) var(--wk-sp-3);
  border: none;
  background: transparent;
  color: var(--wk-text-secondary);
  font-size: var(--wk-text-size-xs);
  border-radius: var(--wk-r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

.wk-file-preview-excel-renderer__tab--active {
  background: var(--wk-brand-primary);
  color: var(--wk-color-white);
}
