/* vfs_browser.css — VS Code 模式：树形导航 + tab 大屏预览 */

/* ══════ 整体布局 ══════ */
#fbWrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ══════ 左侧：树形导航 ══════ */
.fb-sidebar {
  width: 220px;
  min-width: 160px;
  max-width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border, #e0e0e0);
  background: var(--bg2, #fafafa);
  overflow: hidden;
}

.fb-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0;
}
.fb-tree::-webkit-scrollbar { width: 3px; }
.fb-tree::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.fb-tree-dir,
.fb-tree-file {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 26px;
}
.fb-tree-dir:hover,
.fb-tree-file:hover { background: var(--bg3, #f0f0f0); }

.fb-tree-dir.selected,
.fb-tree-file.selected {
  background: var(--accent-glow, #e8f0fe);
  color: var(--accent, #1a73e8);
}

.fb-tree-arrow {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3, #999);
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.fb-tree-dir.expanded .fb-tree-arrow { transform: rotate(0deg); }
.fb-tree-dir:not(.expanded) .fb-tree-arrow { transform: rotate(0deg); }

.fb-tree-icon { flex-shrink: 0; font-size: 13px; }
.fb-tree-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text, #333);
}
.fb-tree-file.selected .fb-tree-name { color: var(--accent, #1a73e8); }

.fb-tree-loading {
  padding: 4px 8px 4px 22px;
  font-size: 11px; color: var(--text3, #999);
  font-style: italic;
}

/* ══════ 拖拽调宽条 ══════ */
.fb-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.fb-resize-handle:hover,
.fb-resize-handle.dragging {
  background: var(--accent, #1a73e8);
  opacity: 0.5;
}

/* ══════ 右侧：大屏预览区 ══════ */
.fb-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg, #fff);
}

.fb-main-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text3, #ccc);
}
.fb-main-empty svg { opacity: 0.3; }
.fb-main-empty p { font-size: 14px; margin: 0; }

/* ══════ Tab 栏 ══════ */
.fb-main-tabs {
  display: flex;
  align-items: center;
  height: 36px;
  border-bottom: 1px solid var(--border, #eee);
  background: var(--bg2, #fafafa);
  overflow-x: auto;
  flex-shrink: 0;
}
.fb-main-tabs::-webkit-scrollbar { height: 0; }

.fb-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 12px;
  height: 100%;
  font-size: 12px;
  color: var(--text2, #666);
  cursor: pointer;
  border-right: 1px solid var(--border, #eee);
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  max-width: 180px;
}
.fb-tab:hover { background: var(--bg3, #f0f0f0); }
.fb-tab.active {
  background: var(--bg, #fff);
  color: var(--text, #333);
  font-weight: 600;
  border-bottom: 2px solid var(--accent, #1a73e8);
}
.fb-tab-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 120px;
}
.fb-tab-close {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: none; border-radius: 4px;
  background: transparent;
  color: var(--text3, #999);
  font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0; flex-shrink: 0;
}
.fb-tab-close:hover { background: var(--bg3, #ddd); color: var(--text, #333); }

/* ══════ 属性栏 + 切换按钮 ══════ */
.fb-main-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border, #eee);
  flex-shrink: 0;
  min-height: 36px;
}
.fb-main-meta {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; gap: 8px;
  overflow: hidden;
}
.fb-main-info { font-size: 11px; color: var(--text3, #999); white-space: nowrap; }
.fb-main-path {
  font-size: 12px; color: var(--text2, #666);
  font-family: ui-monospace, Menlo, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 预览/源码切换 */
.fb-mode-toggle { display: flex; gap: 2px; flex-shrink: 0; }
.fb-mode-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--text3, #999);
  cursor: pointer; padding: 0;
}
.fb-mode-btn:hover { background: var(--bg3, #f0f0f0); color: var(--text, #333); }
.fb-mode-btn.active { background: var(--accent-glow, #e8f0fe); color: var(--accent, #1a73e8); }

/* ══════ 内容区 ══════ */
.fb-main-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.fb-main-body .fp-code {
  border-radius: 0; border: none; min-height: 100%;
  padding: 14px 16px;
}
.fb-main-body .fp-html-preview {
  min-height: 100%; border: none; border-radius: 0;
}
.fb-main-iframe {
  width: 100%; height: 100%; min-height: 400px;
  border: none; background: white; display: block;
}

/* HTML 预览缩放容器 */
.fb-scale-wrap {
  overflow: hidden;
  margin: 0 auto;
}

/* 图片预览 */
.fb-image-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 240px; padding: 16px;
}
.fb-image-wrap .fp-image {
  max-width: 100%; max-height: 100%;
  object-fit: contain; cursor: zoom-in;
}
.fb-img-error {
  color: var(--text3, #999); font-size: 13px; padding: 48px 16px;
}

/* ══════ attrs 可折叠 ══════ */
.fb-attrs {
  border-top: 1px solid var(--border, #eee);
  flex-shrink: 0;
  max-height: 180px;
  overflow-y: auto;
}
.fb-attrs summary {
  cursor: pointer; padding: 5px 14px;
  font-size: 11px; color: var(--text3, #999); font-weight: 500;
  user-select: none;
}
.fb-attrs summary:hover { color: var(--text, #333); }
.fb-attrs[open] summary { border-bottom: 1px solid var(--border, #eee); }
.fb-attrs-pre {
  margin: 0; padding: 6px 14px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10px; line-height: 1.5;
  color: var(--text2, #666);
  white-space: pre-wrap; word-break: break-all;
}

/* ══════ 响应式 ══════ */
@media (max-width: 900px) {
  .fb-sidebar { width: 180px; }
}
