/* MyExplorer 窗口样式 */
.win {
    position: absolute; min-width: 480px; min-height: 320px;
    background: #fff; border-radius: 6px; overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,.4);
    display: flex; flex-direction: column;
    border: 1px solid #c5cfdd;
}
.win.maximized { border-radius: 0; }
/* 窗口缩放手柄 */
.win-resize { position: absolute; z-index: 5; }
.win-resize.n, .win-resize.s { left: 6px; right: 6px; height: 5px; cursor: ns-resize; }
.win-resize.e, .win-resize.w { top: 6px; bottom: 6px; width: 5px; cursor: ew-resize; }
.win-resize.n { top: 0; }
.win-resize.s { bottom: 0; }
.win-resize.e { right: 0; }
.win-resize.w { left: 0; }
.win-resize.ne, .win-resize.nw { width: 9px; height: 9px; top: 0; cursor: nesw-resize; }
.win-resize.se, .win-resize.sw { width: 9px; height: 9px; bottom: 0; cursor: nwse-resize; }
.win-resize.ne { right: 0; }
.win-resize.nw { left: 0; }
.win-resize.se { right: 0; }
.win-resize.sw { left: 0; }
.win-resize:hover { background: rgba(47,123,230,.5); }
.win.maximized .win-resize { display: none; }
.win-titlebar {
    height: 38px; background: linear-gradient(180deg,#f7f9fc,#e7edf5);
    display: flex; align-items: center; padding: 0 8px;
    border-bottom: 1px solid #d4dce8; cursor: default;
}
.win-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: bold; color: #2c3e57; font-size: 13px; overflow: hidden; }
.win-title .fi { width: 22px; height: 22px; line-height: 22px; font-size: 13px; }
.win-title .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-controls { display: flex; gap: 2px; }
.win-ctrl {
    width: 30px; height: 26px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; cursor: pointer; color: #5a6b82; font-size: 14px;
}
.win-ctrl:hover { background: rgba(0,0,0,.08); }
.win-ctrl.close:hover { background: #e81123; color: #fff; }
.win-body { flex: 1; min-height: 0; min-width: 0; display: flex; overflow: hidden; position: relative; }

/* 窗口内布局 */
.explorer { display: flex; width: 100%; }
.ex-sidebar {
    width: 220px; background: #f3f6fb; border-right: 1px solid #e2e8f1;
    display: flex; flex-direction: column; overflow: hidden;
}
.ex-sidebar .side-head { padding: 8px 12px; font-weight: bold; color: #46566f; border-bottom: 1px solid #e2e8f1; }
.ex-tree { flex: 1; overflow: auto; padding: 4px 0; }
.tree-node { display: flex; align-items: center; padding: 5px 10px; cursor: pointer; color: #3d4d66; font-size: 12px; }
.tree-node:hover { background: #e6eef8; }
.tree-node.active { background: #d4e4fa; color: #1d4f9e; }
.tree-node .tw { width: 16px; text-align: center; color: #8a97ab; }
.tree-node .nm { margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-children { margin-left: 14px; }

.ex-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ex-toolbar {
    height: 38px; display: flex; align-items: center; gap: 2px;
    padding: 0 6px; border-bottom: 1px solid #e2e8f1; background: #fafcff; flex-wrap: wrap;
}
.ex-tool {
    padding: 5px 9px; border-radius: 4px; cursor: pointer; color: #44546c;
    display: flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap;
}
.ex-tool:hover { background: #e6eef8; }
.ex-tool.disabled { color: #b9c2d0; cursor: default; }
.ex-tool.disabled:hover { background: none; }
.ex-tool .ic { font-size: 14px; }
.ex-sep { width: 1px; height: 20px; background: #dde4ee; margin: 0 4px; }

.ex-address {
    height: 34px; display: flex; align-items: center; gap: 6px;
    padding: 0 8px; border-bottom: 1px solid #eef2f7; background: #fff;
}
.ex-nav-btn { width: 26px; height: 24px; border: 1px solid #d4dce8; border-radius: 3px; cursor: pointer; text-align: center; line-height: 22px; color: #5a6b82; }
.ex-nav-btn:hover { background: #eef3f9; }
.ex-breadcrumb { flex: 1; display: flex; align-items: center; gap: 2px; overflow: hidden; font-size: 12px; }
.ex-crumb { padding: 3px 8px; border-radius: 3px; cursor: pointer; color: #2c6fd6; white-space: nowrap; }
.ex-crumb:hover { background: #e6eef8; }
.ex-crumb.sep { color: #aab4c4; cursor: default; }
.ex-search { width: 160px; height: 24px; border: 1px solid #d4dce8; border-radius: 12px; padding: 0 10px; outline: none; font-size: 12px; }

.ex-content { flex: 1; overflow: auto; position: relative; background: #fff; }
.ex-content.loading::after {
    content: "加载中..."; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; color: #8a97ab;
    background: rgba(255,255,255,.6);
}

/* 图标视图 / 列表视图样式统一由 explorer.css 提供，此处不再重复定义，
   避免 window.css 后加载时覆盖 explorer.css 中的文件名换行/省略规则 */

/* 分栏视图 */
.view-split { display: flex; width: 100%; height: 100%; }
.view-split .pane { flex: 1; overflow: auto; border-right: 1px solid #eef2f7; }
.view-split .item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; }
.view-split .item:hover { background: #eef4fc; }
.view-split .item.selected { background: #d4e4fa; }

.ex-empty { padding: 40px; text-align: center; color: #aab4c4; }

/* 状态栏 */
.ex-statusbar { height: 26px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-top: 1px solid #e2e8f1; background: #fafcff; font-size: 11px; color: #6b7892; }

/* 窗口底部操作栏(保存/另存为等) */
.win-foot {
    border-top: 1px solid #e2e8f1; background: #fafcff; padding: 8px 12px;
    display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}

/* 文本编辑器(窗口内) */
.editor-body { display: flex; flex-direction: column; width: 100%; height: 100%; background: #1e2227; }
.editor-body.ed-light { background: #fff; }
.editor-toolbar {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px;
    background: #2a2f37; border-bottom: 1px solid #1a1d22; flex: 0 0 auto;
}
.editor-toolbar .editor-name { color: #e6ebf2; font-size: 13px; font-weight: 600; }
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar .et-lang-label { color: #93a0b4; font-size: 12px; }
.editor-toolbar .editor-lang {
    background: #1e2227; color: #d7dee8; border: 1px solid #3a414c;
    border-radius: 5px; padding: 4px 6px; font-size: 12px; outline: none;
}
.editor-toolbar .btn { padding: 5px 12px; font-size: 12px; }

/* 编辑器菜单栏(对齐 KodExplorer) */
.editor-menubar {
    display: flex; align-items: stretch; background: #252a32; border-bottom: 1px solid #16191e;
    flex: 0 0 auto; user-select: none;
}
.editor-menubar .em-item {
    position: relative; padding: 7px 13px; color: #c7d0dc; font-size: 13px; cursor: pointer;
    border-right: 1px solid transparent;
}
.editor-menubar .em-item:hover { background: #313845; color: #fff; }
.editor-menubar .em-drop {
    display: none; position: absolute; top: 100%; left: 0; min-width: 168px; z-index: 50;
    background: #2a2f37; border: 1px solid #16191e; border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 22px rgba(0,0,0,.4); padding: 4px 0;
}
.editor-menubar .em-option {
    padding: 7px 16px; color: #c7d0dc; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.editor-menubar .em-option:hover { background: #3a4452; color: #fff; }

/* 编辑器工具栏按钮 */
.editor-toolbar .et-btn {
    padding: 5px 10px; font-size: 12px; color: #d7dee8; background: #313845; border: 1px solid #3d4654;
    border-radius: 5px; cursor: pointer; line-height: 1; white-space: nowrap;
}
.editor-toolbar .et-btn:hover { background: #3c4756; color: #fff; }
.editor-toolbar .et-btn.primary { background: #2f7be6; border-color: #2f7be6; color: #fff; }
.editor-toolbar .et-btn.primary:hover { background: #3a87ef; }
.editor-toolbar .et-sep { width: 1px; height: 18px; background: #3d4654; margin: 0 3px; }

/* 编辑器编辑区 */
.editor-main { display: flex; flex: 1; min-height: 0; width: 100%; overflow: hidden; }
.editor-ace { flex: 1; min-height: 0; min-width: 0; position: relative; overflow: hidden; }
.editor-ace .ace_editor { width: 100%; height: 100%; font-size: 14px; }

/* Markdown 预览（分栏） */
.editor-preview { display: none; }
.editor-body.md-split .editor-main > .editor-ace { flex: 0 0 50%; }
.editor-body.md-split .editor-preview {
    display: block; flex: 1; min-width: 0; overflow: auto;
    border-left: 1px solid #d6dae1; background: #fff;
}
.editor-body.ed-dark.md-split .editor-preview { background: #1e2227; border-left-color: #16191e; }
.md-body { padding: 16px 22px; color: #24292f; font: 14px/1.7 -apple-system,"Segoe UI","Microsoft YaHei",sans-serif; }
.editor-body.ed-dark .md-body { color: #d7dee8; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
    margin: 18px 0 10px; font-weight: 600; line-height: 1.3;
}
.md-body h1 { font-size: 26px; border-bottom: 1px solid #e3e6ea; padding-bottom: 8px; }
.md-body h2 { font-size: 21px; border-bottom: 1px solid #e3e6ea; padding-bottom: 6px; }
.md-body h3 { font-size: 17px; }
.editor-body.ed-dark .md-body h1, .editor-body.ed-dark .md-body h2 { border-bottom-color: #30363d; }
.md-body p { margin: 10px 0; }
.md-body ul, .md-body ol { margin: 10px 0; padding-left: 26px; }
.md-body li { margin: 4px 0; }
.md-body a { color: #2f7be6; text-decoration: none; }
.md-body a:hover { text-decoration: underline; }
.md-body code {
    background: #f0f2f5; border-radius: 4px; padding: 2px 6px;
    font: 13px/1.5 Consolas,Menlo,monospace; color: #c7254e;
}
.editor-body.ed-dark .md-body code { background: #2a2f37; color: #f6c453; }
.md-body pre {
    background: #f6f8fa; border: 1px solid #e3e6ea; border-radius: 6px;
    padding: 12px 14px; overflow: auto; margin: 12px 0;
}
.md-body pre code { background: none; padding: 0; color: #24292f; }
.editor-body.ed-dark .md-body pre { background: #161a1f; border-color: #30363d; }
.editor-body.ed-dark .md-body pre code { color: #d7dee8; }
.md-body blockquote {
    margin: 12px 0; padding: 6px 14px; color: #6a737d;
    border-left: 4px solid #d0d7de; background: #f8f9fb;
}
.editor-body.ed-dark .md-body blockquote { color: #8a97a8; border-left-color: #3d4654; background: #22262c; }
.md-body hr { border: none; border-top: 1px solid #e3e6ea; margin: 18px 0; }
.editor-body.ed-dark .md-body hr { border-top-color: #30363d; }
.md-body img { max-width: 100%; border-radius: 4px; }
.md-body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.md-body table th, .md-body table td { border: 1px solid #d0d7de; padding: 8px 12px; }
.md-body table th { background: #f6f8fa; font-weight: 600; }
.editor-body.ed-dark .md-body table th,
.editor-body.ed-dark .md-body table td { border-color: #30363d; }
.editor-body.ed-dark .md-body table th { background: #161a1f; }

/* ============ 文件操作任务窗（仿宝塔） ============ */
.util-taskwin {
    position: fixed; right: 24px; bottom: 24px; z-index: 9999;
    width: 460px; max-width: 92vw; max-height: 70vh;
    background: #fff; border-radius: 8px; overflow: hidden;
    box-shadow: 0 12px 48px rgba(0,0,0,.45);
    display: flex; flex-direction: column; font-size: 13px; color: #24292f;
}
.util-taskwin-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: linear-gradient(180deg,#f7f9fc,#e7edf5);
    color: #2c3e57; font-weight: bold; font-size: 13px;
    border-bottom: 1px solid #d4dce8; cursor: move; user-select: none;
}
.util-taskwin-x { cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.util-taskwin-sum { padding: 8px 14px; background: #f6f8fa; border-bottom: 1px solid #e1e4e8; }
.util-taskwin-sum .ok { color: #1a7f37; }
.util-taskwin-sum .bad { color: #cf222e; }
.util-taskwin-note { margin-top: 4px; font-size: 12px; color: #57606a; }
.util-taskwin-list { flex: 1; overflow-y: auto; padding: 6px 0; min-height: 80px; max-height: 46vh; }
.util-taskwin-row {
    display: flex; align-items: baseline; gap: 8px; padding: 4px 14px;
    border-bottom: 1px solid #f0f0f0; line-height: 1.4;
}
.util-taskwin-row[data-status="fail"] { background: #fff5f5; }
.util-taskwin-row[data-status="ok"] { color: #57606a; }
.util-taskwin-st { flex: 0 0 18px; text-align: center; }
.util-taskwin-lb { flex: 1 1 auto; word-break: break-all; }
.util-taskwin-msg { flex: 0 0 auto; max-width: 50%; color: #cf222e; font-size: 12px; word-break: break-all; text-align: right; }
.util-taskwin-retry {
    margin-left: 6px; color: #2f7be6; cursor: pointer; font-size: 12px;
    border: 1px solid #b9d2f7; border-radius: 3px; padding: 0 4px; display: inline-block; line-height: 16px;
}
.util-taskwin-retry:hover { background: #e8f1fe; color: #1d4f9e; }
.util-taskwin-foot { display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid #e1e4e8; background: #f6f8fa; }
.util-taskwin-btn {
    padding: 5px 12px; border: 1px solid #d0d7de; border-radius: 5px;
    background: #fff; cursor: pointer; font-size: 12px; color: #24292f;
}
.util-taskwin-btn:hover { background: #f3f4f6; }
.util-taskwin-btn:disabled { opacity: .5; cursor: default; }

/* 编辑器状态栏 */
.editor-statusbar {
    display: flex; align-items: center; gap: 16px; padding: 0 14px; height: 26px; flex: 0 0 auto;
    background: #252a32; border-top: 1px solid #16191e; color: #8a97a8; font-size: 12px;
}
.editor-statusbar .st-item { color: #8a97a8; }
.editor-statusbar .spacer { flex: 1; }
.editor-statusbar .st-state.dirty { color: #f6c453; }
.editor-statusbar .st-state.saving { color: #4f9bff; }
.win-body .editor-area {
    flex: 1; width: 100% !important; height: auto !important; min-height: 120px;
    border: none; outline: none; resize: none; padding: 12px 14px;
    font: 13px/1.6 "Consolas","Menlo","Courier New",monospace; color: #2c3e57;
    box-sizing: border-box; background: #1e2227; color: #d7dee8;
}

/* 媒体播放器 (DPlayer) */
.dp-layout { display: flex; flex-direction: row; }
.dp-box {
    flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
    background: #000; padding: 6px; overflow: hidden;
}
.dp-box .dplayer { width: 100%; max-width: 100%; border-radius: 6px; overflow: hidden; }
.player-list {
    flex: 0 0 240px; width: 240px; height: 100%; overflow-y: auto; background: #11151c;
    border-left: 1px solid #232a34; padding: 4px 0;
}
.player-list .pl-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 14px;
    color: #aeb9c7; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-list .pl-item:hover { background: #1a2029; color: #e6ebf2; }
.player-list .pl-item.active { background: #243447; color: #fff; }
.player-list .pl-item .pl-ic { color: #4f9bff; width: 14px; text-align: center; }
.player-list .pl-item .pl-name { overflow: hidden; text-overflow: ellipsis; }

/* 新建文件对话框 */
.nf-dialog { padding: 4px 2px; }
.nf-dialog .nf-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nf-dialog .nf-row label { color: #4a5670; font-size: 13px; }
.nf-dialog .nf-type {
    background: #fff; color: #2c3e57; border: 1px solid #cdd6e3;
    border-radius: 5px; padding: 6px 8px; font-size: 13px; outline: none;
}
.nf-dialog .nf-name { flex: 1; min-width: 160px; }

/* 媒体/图片预览(窗口内) */
.preview-body { flex: 1; min-height: 0; min-width: 0; width: 100%; display: flex; align-items: center; justify-content: center; background: #11151c; color: #c9d3e0; overflow: hidden; }
.preview-body .prev-img, .preview-body img.preview-media, .preview-body video.preview-media { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.preview-body audio.preview-media { width: 90%; max-width: 420px; height: auto; }
.preview-body .prev-err { color: #ff9b9b; font-size: 13px; padding: 20px; text-align: center; }

/* 空媒体播放器(拖入) */
.player-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; transition: box-shadow .15s; cursor: default; }
.player-hint { color: #8fa0b6; font-size: 14px; line-height: 1.9; text-align: center; user-select: none; }
.player-link { color: #4f9bff; text-decoration: underline; cursor: pointer; }

/* ===== 编辑器亮色主题覆盖（须置于文件末尾以覆盖默认暗色） ===== */
.editor-body.ed-light .editor-menubar { background: #f3f4f6; border-bottom-color: #d6dae1; }
.editor-body.ed-light .editor-menubar .em-item { color: #3a4453; }
.editor-body.ed-light .editor-menubar .em-item:hover,
.editor-body.ed-light .editor-menubar .em-item.on { background: #e3e6ea; color: #111; }
.editor-body.ed-light .editor-menubar .em-drop { background: #fff; border-color: #d6dae1; box-shadow: 0 8px 22px rgba(0,0,0,.14); }
.editor-body.ed-light .editor-menubar .em-option { color: #3a4453; }
.editor-body.ed-light .editor-menubar .em-option:hover { background: #eef1f5; color: #111; }
.editor-body.ed-light .editor-toolbar { background: #fafbfc; border-bottom-color: #d6dae1; }
.editor-body.ed-light .editor-toolbar .et-btn { background: #fff; border-color: #d6dae1; color: #3a4453; }
.editor-body.ed-light .editor-toolbar .et-btn:hover { background: #eef1f5; color: #111; }
.editor-body.ed-light .editor-toolbar .et-sep { background: #d6dae1; }
.editor-body.ed-light .editor-statusbar { background: #f3f4f6; border-top-color: #d6dae1; color: #6a737d; }
.editor-body.ed-light .editor-statusbar .st-item { color: #6a737d; }
.editor-body.ed-light .editor-statusbar .st-state.dirty { color: #e0863a; }
.editor-body.ed-light .editor-statusbar .st-state.saved { color: #2e9e5b; }
