/* file_preview.css — 共享文件/产物预览渲染器（artifact 面板 + VFS 浏览器）
 *
 * fp-* 类由 file_preview.js 产出，两个入口共用同一套样式：
 *  - artifact_panel.js：Agent 产出的 file_list 大卡片网格
 *  - vfs_browser.js：文件详情面板的 code/image 预览
 */

/* ══════ 空态 ══════ */
.fp-empty {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; color: var(--text3); font-size: 13px;
}

/* ══════ 文件大卡片网格（file_list 大屏展示） ══════ */
.fp-card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; padding: 4px 0;
}
.fp-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg2);
  text-decoration: none; color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  min-height: 0;
}
.fp-card:hover {
  background: var(--bg3); border-color: var(--accent);
  transform: translateY(-1px);
}
.fp-card-head {
  display: flex; align-items: center; gap: 10px;
}
.fp-card-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: var(--bg3);
  border-radius: 8px;
}
.fp-card-info { flex: 1; min-width: 0; }
.fp-card-name {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fp-card-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.fp-card-preview {
  margin: 0; padding: 8px 10px;
  background: var(--bg3); border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.5; color: var(--text2);
  max-height: 88px; overflow: hidden;
  white-space: pre; text-overflow: ellipsis;
}

/* ══════ 代码 / 文本 ══════ */
.fp-code {
  margin: 0; padding: 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.6; color: var(--text);
  overflow: auto; max-height: 100%;
  white-space: pre; tab-size: 4;
}

/* ══════ HTML iframe 沙箱 ══════ */
.fp-html-preview {
  width: 100%; height: 100%; min-height: 400px;
  border: 1px solid var(--border); border-radius: 8px;
  background: white;
}

/* ══════ Markdown ══════ */
.fp-markdown {
  font-size: 14px; line-height: 1.7; color: var(--text);
  overflow-wrap: break-word;
}
.fp-markdown h1, .fp-markdown h2, .fp-markdown h3 { margin: 16px 0 8px; }
.fp-markdown p { margin: 8px 0; }
.fp-markdown pre {
  background: var(--bg3); padding: 10px; border-radius: 6px;
  overflow-x: auto; font-size: 12px;
}
.fp-markdown code { font-family: ui-monospace, Menlo, monospace; }
.fp-markdown table { border-collapse: collapse; margin: 8px 0; }
.fp-markdown th, .fp-markdown td { border: 1px solid var(--border); padding: 4px 8px; }

/* ══════ 图片（含 VFS 详情内嵌） ══════ */
.fp-image {
  max-width: 100%; max-height: 420px;
  border-radius: 8px; border: 1px solid var(--border);
  display: block; cursor: zoom-in; object-fit: contain;
}

/* ══════ lightbox（共享放大层） ══════ */
.fp-lightbox {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 10001;
  display: none; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.fp-lightbox.open { display: flex; }
.fp-lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; }

/* VFS 浏览器详情面板内嵌时限制预览高度（attrs 面板在下方，不挤掉） */
.fb-det-section .fp-code { max-height: 320px; }
