:root{
    --editor-font-size: 14px;
    --sidebar-width: 220px;
}
:root {
    --p: 0.62 0.25 250;  /* #1970fc 的近似值 */
    --pc: 1 0 0;

    /* ===== Site design tokens (blue) ===== */
    --primary-color: #1970fc;
    --primary-hover: #155ee6;
    --primary-active: #0f4fca;
    --primary-soft: rgba(25, 112, 252, 0.12);

    /* 页面底色更柔和（淡蓝灰），面板保持白色 */
    --bg: #f6f8fc;
    --bg-muted: #eef3fb;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;

    --text: #0f172a;
    --text-muted: #475569;
    --text-subtle: #64748b;
    --border: #e2e8f0;

    --radius-sm: 6px;
    --radius-md: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.10);

    --focus-ring: 0 0 0 3px rgba(25, 112, 252, 0.18);

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "PingFang SC",
        "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
        "Courier New", monospace;
}

[data-theme="dark"] {
    --p: 0.65 0.25 250;  /* 暗色主题稍微亮一点 */
    --pc: 1 0 0;

    --primary-color: #5aa2ff;
    --primary-hover: #7bb6ff;
    --primary-active: #2f8cff;
    --primary-soft: rgba(90, 162, 255, 0.16);

    --bg: #0b1220;
    --bg-muted: #0e1730;
    --surface: #0f172a;
    --surface-muted: #111c33;

    --text: #e5e7eb;
    --text-muted: #cbd5e1;
    --text-subtle: #94a3b8;
    --border: rgba(148, 163, 184, 0.22);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.45);

    --focus-ring: 0 0 0 3px rgba(90, 162, 255, 0.22);
}

/* ===== Base layer: typography / links / focus ===== */
html, body {
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--bg);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Page surfaces (make overall look less white) ===== */
body.bg-base-100 {
    background: var(--bg) !important;
}

#centerPanel,
#leftPanel {
    background: var(--bg) !important;
}

/* Panels should read as “cards” on top of page bg */
.editor-panel,
.output-panel,
#jsonEditor {
    background: var(--surface) !important;
}

/* Toolbars: slightly tinted, not pure gray/white */
.toolbar {
    background-color: rgba(25, 112, 252, 0.05) !important;
    border-color: rgba(148, 163, 184, 0.55) !important;
}
[data-theme="dark"] .toolbar {
    background-color: rgba(90, 162, 255, 0.08) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
}

/* Small separators used for grouping buttons */
.ui-sep {
    width: 1px;
    height: 1.25rem;
    background: rgba(148, 163, 184, 0.65);
    margin: 0 0.35rem;
}
[data-theme="dark"] .ui-sep {
    background: rgba(148, 163, 184, 0.28);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}
a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

:where(button, [role="button"], input, select, textarea, a):focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ===== Reusable components (opt-in via class) ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.card-muted {
    background: var(--surface-muted);
    border-color: var(--border);
}

/* Base button style - 覆盖 daisyUI 的默认按钮，让所有 .btn 更统一、偏淡蓝 */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    min-height: 2.25rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    border-width: 1px;
    border-style: solid;
    border-color: rgba(148, 163, 184, 0.8);
    background-color: var(--surface);
    color: var(--text);
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.1s ease;
}
.btn:hover {
    background-color: var(--primary-soft);
    border-color: rgba(37, 99, 235, 0.8);
    color: var(--primary-hover);
}
.btn:active {
    transform: translateY(0.5px);
    box-shadow: none;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.25rem;
    padding: 0 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary {
    background-color: rgba(25, 112, 252, 0.10);
    border-color: rgba(25, 112, 252, 0.65);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background-color: rgba(25, 112, 252, 0.16);
    border-color: var(--primary-color);
    color: var(--primary-hover);
}
.btn-primary:active {
    background-color: rgba(25, 112, 252, 0.22);
    border-color: var(--primary-active);
}
.btn-primary:disabled,
.btn-primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--surface-muted);
    border-color: rgba(148, 163, 184, 0.9);
    color: var(--text);
}
.btn-secondary:hover {
    background-color: rgba(25, 112, 252, 0.08);
    border-color: rgba(37, 99, 235, 0.7);
    color: var(--primary-hover);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text);
}
.btn-ghost:hover {
    background: var(--primary-soft);
    color: var(--primary-hover);
}

/* Top tabs under main logo */
.navbar2 .link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0 0.9rem;
    margin-right: 0.25rem;
    border-radius: 999px;
    color: var(--text-muted);
    background-color: transparent;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.navbar2 .link:hover {
    color: var(--primary-hover);
    background-color: rgba(25, 112, 252, 0.08);
    border-color: rgba(148, 163, 184, 0.5);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.navbar2 .link-primary {
    color: var(--primary-color);
    background-color: rgba(25, 112, 252, 0.12);
    border-color: rgba(25, 112, 252, 0.7);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(25, 112, 252, 0.18);
}

/* Size variants (to coexist with daisyUI .btn-xs / .btn-sm) */
.btn-primary.btn-xs,
.btn-secondary.btn-xs,
.btn-ghost.btn-xs {
    height: 1.5rem;
    padding: 0 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.35rem;
}
.btn-primary.btn-sm,
.btn-secondary.btn-sm,
.btn-ghost.btn-sm {
    height: 1.9rem;
    padding: 0 0.7rem;
    font-size: 0.8125rem;
}

.form-control {
    width: 100%;
    height: 2.25rem;
    padding: 0 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:hover { border-color: rgba(148, 163, 184, 0.55); }
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

/* ===========================================
 * 全局滚动条样式重定义
 * 类似 Monica 的滚动条设计
 * =========================================== */

/* Webkit 浏览器 (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;  /* 垂直滚动条宽度 */
    height: 8px; /* 水平滚动条高度 */
}

::-webkit-scrollbar-track {
    background: transparent; /* 滚动条轨道背景 */
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15); /* 滚动条颜色 */
    border-radius: 4px;
    transition: all 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25); /* 悬停时颜色 */
}

::-webkit-scrollbar-thumb:active {
    background: rgba(0, 0, 0, 0.35); /* 拖拽时颜色 */
}

/* 滚动条角落 */
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ===========================================
 * 深色主题下的滚动条样式
 * =========================================== */

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.4);
}

/* ===========================================
 * Firefox 浏览器滚动条样式
 * =========================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

[data-theme="dark"] * {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}




body {
    overflow-x: hidden; /* 完全禁用滚动 */
}

.search-dropdown {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}

/* 缩小导航栏高度 */
.navbar {
    min-height: 3rem;
    height: 3rem;
    /* 加深边框 */
    border-bottom: 1px solid #ccc;
    font-family: PingFang SC;
}

.navbar .btn2 {
    height: 2rem;
    min-height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
}

.navbar .btn3 {
    height: 3rem;
    width: 3rem;
}

.navbar .input {
    height: 2rem;
    min-height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.875rem;
}

.navbar .menu li > * {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.navbar .dropdown-content {
    margin-top: 0.75rem;
}

/* 调整背景色和边框 */
.navbar.bg-base-200 {
    background-color: #f1f5f9;
}


#centerPanel .bg-base-200 {
    background-color: #f8fafc;
}

/* 深色主题适配 */
[data-theme="dark"] .navbar.bg-base-200 {
    background-color: #1e293b;
}

[data-theme="dark"] #leftPanel .bg-base-200,
[data-theme="dark"] #centerPanel .bg-base-200 {
    background-color: #1e293b;
}



/* 深色主题适配 */
[data-theme="dark"] .navbar2 {
    border-bottom: 1px solid #434968;
}



[data-theme="dark"] #leftPanel {
    border-right: 1px solid #434968;
}



/* 左侧边栏宽度控制 */
#leftPanel {
    width: var(--sidebar-width) !important;
    /*transition: width 0.3s ease;*/
    /*overflow: hidden;*/
}

/* 左侧边栏字体大小 */
#leftPanel .project-name-input {
    font-size: 12px !important;
    height: 1.8rem !important;
    min-height: 1.8rem !important;
    padding: 0 0.5rem !important;
    width: 120px;
}

/* 左侧边栏按钮字体 */
#leftPanel .btn {
    font-size: 12px !important;
}

/* 宽度切换按钮样式 */
.sidebar-toggle-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 10;
    font-size: 10px !important;
    padding: 2px 4px !important;
    min-height: 1.2rem !important;
    height: 1.2rem !important;
}

#centerPanel button.gap-0{
    gap: 3px;
}

.editor-panel {
    width: 40%;
}

.output-panel {

}

.CodeMirror {
    height: 100% !important;
    font-family: 'Consolas', 'Monaco', '微软雅黑', 'Courier New', monospace;
    font-size: var(--editor-font-size);
}

.CodeMirror pre {
    word-break: break-all !important;
}

#jsonTreeView{
    contain: layout style paint; /* CSS Containment */
    overflow-y: auto;
    height: 100%;
}


/* 可编辑树形结构样式 */
.json-tree {
    font-family: 'Consolas', 'Monaco', '微软雅黑', 'Courier New', monospace;
    font-size: var(--editor-font-size);
    line-height: 1.6;
}

.json-item {
    margin: 0;
    padding: 0 0;
    border-radius: 3px;

}

.json-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.json-item .delete-item-btn{
    opacity: 0;
    font-weight: normal;
}

.json-item:hover > .delete-item-btn {
    opacity: 1;
    background-color: #fff3cd;
}


/* 减少重绘 */
.json-editable:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.json-editable {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 0 10px;
    font-family: 'Consolas', 'Monaco', '微软雅黑', 'Courier New', monospace;
    font-size: var(--editor-font-size);
    min-width: 20px;
    display: inline-block;
    /*transition: all 0.2s;*/
    cursor: text;
    word-break: break-all;
}

.json-editable:hover {
    border-color: #d1d5db;
    background-color: rgba(255, 255, 255, 0.8);
}

.json-editable:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.json-editable[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    font-style: italic;
}

/* 特定类型样式 */
.json-string-editable {
    color: #059669;
}

.json-number-editable {
    color: #dc2626;
}

.json-boolean-editable {
    color: #7c3aed;
}

.json-null-editable {
    color: #6b7280;
}

.json-key-editable {
    color: #1d4ed8;
    font-weight: bold;
    margin-right: 4px;
    min-width: 30px;
    outline: none;
    white-space: nowrap;
}

.json-key-editable:focus {
    background-color: #eff6ff;
    border-color: #3b82f6;
    border-radius: 3px;
}

.json-key-editable:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    font-style: italic;
    font-weight: normal;
}

.json-key-wrapper {
    display: inline-flex;
    align-items: center;
}

.json-index {
    color: #6b7280;
    font-weight: bold;
    margin-right: 8px;
    min-width: 20px;
    display: inline-block;
}

.json-bracket {
    color: #374151;
    font-weight: bold;
    margin-right: 4px;
}

.json-expandable {
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.json-expanded::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%236b7280' d='M2 4l6 6 6-6H2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.json-collapsed::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%236b7280' d='M4 2l6 6-6 6V2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}


.json-content {
    margin-left: 12px;
}

.add-item-btn {
    color: #059669;
    font-weight: bold;
}

.delete-item-btn {
    color: #dc2626;
    opacity: 0.6;
}

.delete-item-btn:hover {
    opacity: 1;
}

/* 深色主题适配 */
[data-theme="dark"] .json-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .json-editable:hover {
    border-color: #6b7280;
    background-color: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .json-editable:focus {
    background-color: #1f2937;
    border-color: #60a5fa;
}

[data-theme="dark"] .json-bracket {
    color: #d1d5db;
}

[data-theme="dark"] .editor-panel {
    border-right-color: #434968;
    border-bottom-color: #434968;
}

[data-theme="dark"] .output-panel {
    border-bottom-color: #434968;
}

/* 深色主题适配 - 使用相同的颜色 */
[data-theme="dark"] .json-string-editable {
    color: #c3e88d;
}

[data-theme="dark"] .json-number-editable {
    color: #f78c6c;
}

[data-theme="dark"] .json-boolean-editable {
    color: #c792ea;
}

[data-theme="dark"] .json-null-editable {
    color: #546e7a;
}

[data-theme="dark"] .json-key-editable {
    color: #82b1ff;
}

[data-theme="dark"] .json-bracket {
    color: #89ddff;
}

[data-theme="dark"] .json-index {
    color: #ffcb6b;
}


.avatar-online {
    position: relative;
}

.avatar-online::after {
    content: '';
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 0.3rem;
    height: 0.3rem;
    background: #10b981; /* 绿色 */
    border-radius: 50%;
}

.avatar-offline {
    position: relative;
}

.avatar-offline::after {
    content: '';
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 0.3rem;
    height: 0.3rem;
    background: #666; /* 绿色 */
    border-radius: 50%;
}


.json-content .btn-xs{
    height: 1rem;
    min-height: 1rem;
}

.drag-over {
    position: relative;
    border: 2px dashed #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.drag-over::after {
    content: attr(data-drag-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 123, 255, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
    border-radius: inherit;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.drag-over:not([data-drag-text])::after {
    content: "松开鼠标上传文件";
}

.drop-zone {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}



.CodeMirror-foldmarker{color:#00f;text-shadow:#b9f 1px 1px 2px,#b9f -1px -1px 2px,#b9f 1px -1px 2px,#b9f -1px 1px 2px;font-family:arial;line-height:.3;cursor:pointer}.CodeMirror-foldgutter{width:.7em}.CodeMirror-foldgutter-folded,.CodeMirror-foldgutter-open{cursor:pointer}.CodeMirror-foldgutter-open:after{content:"\25BE"}.CodeMirror-foldgutter-folded:after{content:"\25B8"}



.CodeMirror-foldgutter-open:after {
    color: #272727;
    font-size: 14px;
    font-family: monospace;
    font-weight: bold;
}

/* 一级菜单项样式 */
.menu-horizontal > li > div {
    color: #374151;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 16px;
    margin: 0 2px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
}

.menu-horizontal > li > div:hover {
    background: #3B82F6;
    color: white;
    border-color: #2563EB;
}

/* 二级菜单面板样式 */
.dropdown-content {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
}

/* 二级菜单项样式 */
.dropdown-content li a {
    color: #4B5563;
    font-weight: 500;
    border-radius: 6px;
    padding: 4px 12px;
    margin: 1px 0;
    display: block;
}

.dropdown-content li a:hover {
    background: #3B82F6;
    color: white;
}

/* 二级菜单项中的红色高亮样式 - 改为与普通菜单项一致 */
.dropdown-content li a.text-red-600 {
    color: #4B5563;
    font-weight: 500;
    border-left: none;
    padding-left: 12px;
}

.dropdown-content li a.text-red-600:hover {
    background: #3B82F6;
    color: white;
    border-left: none;
}

/* 深色主题适配 */
[data-theme="dark"] .menu-horizontal > li > div {
    color: #E5E7EB;
    background: #1F2937;
    border-color: #374151;
}

[data-theme="dark"] .menu-horizontal > li > div:hover {
    background: #3B82F6;
    color: white;
    border-color: #2563EB;
}

[data-theme="dark"] .dropdown-content {
    background: #1F2937;
    border-color: #374151;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dropdown-content li a {
    color: #E5E7EB;
}

[data-theme="dark"] .dropdown-content li a:hover {
    background: #3B82F6;
    color: white;
}

[data-theme="dark"] .dropdown-content li a.text-red-600 {
    color: #E5E7EB;
}