/* 思维导图容器样式 */
.mindmap-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    overflow: hidden;
    width: calc(100% - 400px);
}

#jsmind_container {
    flex: 1;
    position: relative;
    background: var(--bg-color);
    overflow: hidden;
    width: 100%;
    height: 100%;
    padding: 50px;
}

/* 缩放控制器 */
#zoom_controller {
    padding: 8px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#zoom_text {
    min-width: 60px;
    text-align: center;
}

/* 主题选择 */
#theme_select {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 0.9rem;
}

/* 节点指示器样式 */
.formula-indicator {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #9c27b0;
}

.has-note {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #ff9800;
    border-radius: 50%;
}

/* 关联线样式 */
.relation-line {
    stroke: #2196F3;
    stroke-width: 1.5px;
    stroke-dasharray: 5,3;
    fill: none;
}

/* 摘要样式 */
.node-summary {
    font-size: 12px;
    color: #777;
    font-style: italic;
    margin-top: 2px;
}

/* 备注提示框样式 */
.note-tooltip {
    position: absolute;
    z-index: 1000;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 14px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    max-width: 350px;
    max-height: 250px;
    overflow: auto;
    display: none;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    cursor: default;
    pointer-events: auto;
    user-select: text;
}

/* 提示框滚动条样式 */
.note-tooltip::-webkit-scrollbar {
    width: 8px;
}

.note-tooltip::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.note-tooltip::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.note-tooltip::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 确保节点样式增加 */
jmnode {
    position: relative;
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 10px 15px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    min-height: 30px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    
    /* 允许显示长文本的关键样式 */
    white-space: normal !important; /* 允许文本自动换行 */
    overflow: visible !important; /* 确保内容不会被截断 */
    text-overflow: clip !important; /* 禁用省略号 */
    word-wrap: break-word !important; /* 允许长单词自动换行 */
    max-width: 450px !important; /* 设置最大宽度限制 */
    min-width: 120px; /* 设置最小宽度 */
    width: auto !important; /* 自动适应内容宽度 */
    height: auto !important; /* 自动适应内容高度 */
    line-height: 1.5; /* 增加行高改善可读性 */
    text-align: center !important; /* 文本居中显示 */
}

jmnode:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

jmnode.selected {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* 根节点样式 */
jmnode.root {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    border: none;
}

jmnode.root:hover {
    background-color: var(--primary-dark);
}

jmnode.root.selected {
    box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

/* 连线样式 */
jmexpander {
    width: 12px;
    height: 12px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-color);
    box-shadow: var(--shadow-sm);
    position: absolute;
    transition: background-color var(--transition-fast);
}

jmexpander:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

/* 注释提示框 */
.note-tooltip {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
    max-width: 350px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    cursor: default;
    pointer-events: auto;
    user-select: text;
}

.note-tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* 自定义滚动条 */
.note-tooltip::-webkit-scrollbar {
    width: 6px;
}

.note-tooltip::-webkit-scrollbar-track {
    background: var(--hover-bg);
    border-radius: 3px;
}

.note-tooltip::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.note-tooltip::-webkit-scrollbar-thumb:hover {
    background-color: var(--light-text);
}

/* 节点菜单 */
.node-menu {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 100;
    min-width: 150px;
    overflow: hidden;
}

.node-menu-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    color: var(--text-color);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.node-menu-item:hover {
    background-color: var(--hover-bg);
}

.node-menu-item.delete {
    color: #ef4444;
}

.node-menu-item.delete:hover {
    background-color: #fee2e2;
}

/* 备注指示器样式 */
.note-indicator {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background-color: transparent;
    color: black;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    z-index: 100;
    transition: all var(--transition-fast);
    border: none;
}

.note-indicator:hover {
    transform: translateX(-50%) scale(1.2);
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: none;
}

/* 适应不同主题的文本颜色 - 统一为黑色 */
.theme-primary .note-indicator svg,
.theme-danger .note-indicator svg,
.theme-success .note-indicator svg,
.theme-warning .note-indicator svg,
.note-indicator svg {
    fill: black !important;
}

/* 调整具有备注的节点的样式 */
jmnode.has-note-mark {
    padding-bottom: 25px; /* 增加底部内边距 */
    min-height: 35px; /* 增加最小高度 */
}

/* 修复可能的jsMind默认样式 */
.jsmind-inner jmnode {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    text-align: center !important;
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #6366f1;
        --primary-dark: #4f46e5;
        --primary-light: #3730a3;
        --text-color: #f9fafb;
        --light-text: #d1d5db;
        --bg-color: #111827;
        --sidebar-bg: #1f2937;
        --border-color: #374151;
        --hover-bg: #1e293b;
        --input-bg: #1f2937;
        --shadow-color: rgba(0, 0, 0, 0.25);
    }
    
    jmnode {
        background-color: #1f2937;
    }
    
    .note-tooltip {
        background-color: #1f2937;
    }
}

.chat-hidden .mindmap-container {
    width: 100%;
}

.toolbar {
    display: flex;
    flex-wrap: wrap; /* 允许工具栏换行 */
    gap: 5px;
    padding: 8px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.toolbar-group {
    display: flex;
    align-items: center;
    margin-right: 15px;
    margin-bottom: 5px; /* 增加底部间距以便于分行 */
}

/* 英文模式下的按钮样式调整 */
html[lang="en"] .toolbar .btn {
    font-size: 0.85rem; /* 英文模式下缩小字体 */
    padding: 5px 8px; /* 调整内边距，使按钮更紧凑 */
}

/* 确保图标和文本对齐 */
.toolbar .btn i {
    margin-right: 4px;
    vertical-align: middle;
}

/* 增加工具栏高度，以容纳两行 */
.toolbar {
    min-height: 80px; /* 足够容纳两行按钮 */
}

/* 按钮样式细化 */
.toolbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 80px; /* 确保按钮有最小宽度 */
}

/* 工具栏行样式 */
.toolbar-row {
    display: flex;
    width: 100%;
    padding: 5px 0;
    flex-wrap: wrap;
}

.toolbar-row + .toolbar-row {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #eee;
}

/* 按钮内容区样式 */
.btn-content {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
}

/* 确保图标固定显示 */
.btn-content i.fas {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    margin-right: 5px !important;
    text-align: center !important;
    font-size: 14px !important; 
}

/* 按钮文本样式 */
.btn-text {
    display: inline-block !important;
    flex: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.azure-settings {
    display: none;
}

/* 导出问题反馈按钮样式 */
#export_feedback {
    position: relative;
}

#export_feedback i.fa-bug {
    color: #e91e63; /* 使用醒目的粉红色 */
}

#export_feedback:hover i.fa-bug {
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-5deg); }
    50% { transform: rotate(0); }
    75% { transform: rotate(5deg); }
}