/* =============================================================================
 * SciTeX Shell — Viewer (file preview pane)
 * =============================================================================
 * Ported from scitex-cloud's workspace-viewer.css
 * Prefix: stx-shell-viewer
 * ============================================================================= */

.stx-shell-viewer {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--workspace-bg-secondary);
}

.stx-shell-viewer--empty {
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.stx-shell-viewer--empty i {
  font-size: 24px;
  opacity: 0.3;
}

/* --- Header --- */

.stx-shell-viewer__header {
  display: flex;
  align-items: center;
  height: 50px;
  min-height: 50px;
  padding: 0 12px;
  border-bottom: 1px solid var(--workspace-border-subtle);
  background: var(--workspace-bg-secondary);
  flex-shrink: 0;
  gap: 8px;
}

.stx-shell-viewer__filename {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stx-shell-viewer__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.stx-shell-viewer__close:hover {
  color: var(--text-primary);
  background: var(--workspace-bg-hover);
}

/* --- Content --- */

.stx-shell-viewer__content {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.stx-shell-viewer__loading,
.stx-shell-viewer__error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.stx-shell-viewer__error {
  color: var(--status-error);
}

/* --- Image viewer --- */

.stx-shell-viewer__image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--workspace-bg-primary);
}

.stx-shell-viewer__image-container img {
  transition: none;
}

/* --- Text viewer --- */

.stx-shell-viewer__text {
  margin: 0;
  padding: 12px 16px;
  font-family: "JetBrains Mono", Monaco, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--workspace-bg-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
  height: 100%;
}

.stx-shell-viewer__text code {
  font-family: inherit;
}

/* --- CSV Table (ported from CsvViewer.ts) --- */

.stx-shell-viewer__csv-container {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.stx-shell-viewer__csv-table {
  border-collapse: collapse;
  font-size: 12px;
  font-family: "JetBrains Mono", Monaco, Menlo, monospace;
  white-space: nowrap;
  width: 100%;
}

.stx-shell-viewer__csv-table th,
.stx-shell-viewer__csv-table td {
  padding: 4px 8px;
  border: 1px solid var(--workspace-border-subtle);
}

.stx-shell-viewer__csv-table th {
  background: var(--workspace-bg-elevated);
  font-weight: 600;
  color: var(--text-primary);
  position: sticky;
  top: 0;
}

.stx-shell-viewer__csv-table td {
  color: var(--text-secondary);
}

/* --- Audio viewer (ported from AudioViewer.ts) --- */

.stx-shell-viewer__audio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  padding: 20px;
}

.stx-shell-viewer__media-name {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  word-break: break-all;
}

.stx-shell-viewer__media-format {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Video viewer (ported from VideoViewer.ts) --- */

.stx-shell-viewer__video-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.stx-shell-viewer__media-toolbar {
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--workspace-border-subtle);
  flex-shrink: 0;
}

.stx-shell-viewer__video-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* --- Binary / unsupported --- */

.stx-shell-viewer__binary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.stx-shell-viewer__binary i {
  font-size: 32px;
  opacity: 0.3;
}
