* {
  box-sizing: border-box;
}

body {
  font-family: "SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #111;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

header h1 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
}

.logo-icon {
  width: 20px;
  height: 20px;
  color: #4A90D9;
}

#searchBox {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 13px;
}

#searchBox:focus {
  outline: none;
  border-color: #999;
  background: #fff;
}

.wrap-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #555;
}

/* 隐藏原始 checkbox */
.wrap-toggle input {
  display: none;
}

/* 滑轨 */
.wrap-toggle label {
  width: 34px;
  height: 18px;
  background: #e0e0e0;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}

/* 滑块 */
.wrap-toggle label::after {
  content: "";
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.15s ease;
}

/* 打开状态 */
.wrap-toggle input:checked + label {
  background: #bbb;
}

.wrap-toggle input:checked + label::after {
  transform: translateX(16px);
}
#charcoalez-main {
  display: flex;
  height: calc(100vh - 96px);
}

#charcoalez-tree-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.tree-search {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.tree-search input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.tree-search input:focus {
  outline: none;
  border-color: #aaa;
}

#charcoalez-tree {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: #fff;
}

.project-item {
  margin-bottom: 4px;
}

.project-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f5f5f5;
  cursor: pointer;
  transition: background 0.15s;
  overflow: hidden;
  min-width: 0;
}

.project-title:hover {
  background: #e8e8e8;
}

.project-icon {
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-icon svg {
  width: 18px;
  height: 18px;
}

.project-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.download-btn:hover {
  opacity: 1;
  background: #ddd;
}

.download-btn svg {
  width: 14px;
  height: 14px;
}

ul {
  list-style: none;
  padding-left: 14px;
  margin: 4px 0;
}

.file,
.folder {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;

  font-size: 13px;
  padding: 3px 6px;
  border-radius: 4px;
}

.file-icon,
.folder-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon svg,
.folder-icon svg {
  width: 14px;
  height: 14px;
}

.file-label,
.folder-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}


.folder:hover,
.file:hover {
  background: #f2f2f2;
}


.tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #ccc;
  color: #555;
  margin-left: 6px;
}

/* Web */
.tag.html,
.tag.css,
.tag.js,
.tag.json {
    background:#ffe8d9;
    border-color:#f4b183
}

/* R */
.tag.r,
.tag.rmd,
.tag.qmd,
.tag.rproj,
.tag.quarto {
    background:#e0f2ef;
    border-color:#5cbdb2
}

/* Python */
.tag.py,
.tag.ipynb,
.tag.pyi,
.tag.pycfg {
    background:#e3e9f6;
    border-color:#8faadc
}

/* Other code */
.tag.lua,
.tag.ts,
.tag.jsx,
.tag.tsx,
.tag.c,
.tag.cpp,
.tag.h,
.tag.hpp,
.tag.java,
.tag.kt,
.tag.cs,
.tag.go,
.tag.rs,
.tag.php,
.tag.rb,
.tag.sql {
  background: #f2f2f2;
  border-color: #d5d5d5;
}

/* Shell / System */
.tag.shell,
.tag.sh,
.tag.bash,
.tag.cmd,
.tag.zsh,
.tag.ps1 {
    background:#e6f4ea;
    border-color:#7ac08b
}

/* Config */
.tag.yaml,
.tag.toml,
.tag.yml,
.tag.ini,
.tag.env,
.tag.cfg {
  background: #eee6f5;
  border-color: #d3c2e4;
}

/* Docs */
.tag.md,
.tag.txt,
.tag.docx,
.tag.xlsx,
.tag.pdf {
    background:#fcffee;
    border-color:#b0be46;
}

/*Values and data*/
.tag.csv,
.tag.tsv,
.tag.h5,
.tag.fst{ 
    background:#f5ede3; 
    border-color:#c9b39b
}

#charcoalez-splitter {
  width: 5px;
  background: #e0e0e0;
  flex-shrink: 0;
  cursor: col-resize;
  transition: background 0.15s;
}

#charcoalez-splitter:hover,
#charcoalez-splitter.dragging {
  background: #aaa;
}

#charcoalez-splitter.dragging {
  transition: none;
}

#charcoalez-code-wrapper {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  background: #0f1115;
}


#charcoalez-code {
  padding: 16px;
  margin: 0;
  background: #0f1115;
  font-size: 13px;
  line-height: 1.6;
  color: #c9d1d9;
  overflow: auto;
  white-space: pre;
  min-width: max-content;
}

/* 换行模式 */
#charcoalez-code.wrap {
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 100%;
}

footer {
  font-size: 11px;
  color: #999;
  padding: 6px 14px;
  border-top: 1px solid #eee;
  background: #fafafa;
}


.attribution {
  margin-left: 8px;
  opacity: 0.8;
}


/* 禁止页面文本选中（代码区除外） */
body,
header,
footer,
#charcoalez-tree,
#charcoalez-tree * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* 允许代码区文本选择与复制 */
#charcoalez-code,
#charcoalez-code * {
  user-select: text !important;
  -webkit-user-select: text !important;
  -ms-user-select: text !important;
}

/* ===== Custom tooltip (minimal, tool-like) ===== */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: fixed;

  background: #111;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;

  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;

  opacity: 0;
  pointer-events: none;

  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;

  z-index: 9999;
  
  left: var(--tt-x);
  top: var(--tt-y);

}

/* hover 显示 */
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(0);
}


