/* 合并后的样式文件 */

/* 全局样式变量 */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #22c55e;
    --success-hover: #16a34a;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --border-radius: 0.375rem;
}

/* 移除Quill编辑器默认样式 */
.ql-toolbar.ql-snow {
    border-color: var(--border-color) !important;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    background-color: #f9fafb;
}

.ql-container.ql-snow {
    border-color: var(--border-color) !important;
    border-top: none !important;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    background-color: white;
}

/* Quill编辑器样式调整 */
.ql-editor {
    min-height: 200px;
    max-height: calc(100% - 42px);
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Consolas', 'DejaVu Sans Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background-color: white;
}

/* 输入框样式 */
#userInput {
    font-size: 14px;
    transition: all 0.3s ease;
}

#userInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* 按钮统一样式 */
button {
    transition: all 0.2s ease;
}

/* Mermaid语法高亮 */
.ql-syntax-keyword {
    color: #569cd6;
    font-weight: bold;
}

.ql-syntax-arrow {
    color: #d4d4d4;
    font-weight: bold;
}

.ql-syntax-label {
    color: #9cdcfe;
}

.ql-syntax-bracket {
    color: #ffd700;
}

.ql-syntax-comment {
    color: #6a9955;
    font-style: italic;
}

/* 标题项样式 */
.title-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 0.25rem;
    border: 1px solid transparent;
}

.title-item:hover {
    background-color: #f3f4f6;
    border-color: #e5e7eb;
}

.title-item.active {
    background-color: #e5edff;
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

.title-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 删除按钮 */
.delete-btn {
    opacity: 0;
    transition: opacity 0.2s;
}

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

/* 禁用状态 */
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mermaid图表容器 */
.mermaid {
    text-align: center;
    padding: 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 预览区域 */
#preview {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 0;
}

#preview svg {
    max-width: 100%;
    height: auto;
    background-color: white;
    border: none;
}

/* 版本列表项样式 */
.version-item {
    position: relative;
}

.version-item:hover {
    background-color: #f3f4f6;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 比较视图样式 */
.diff-view {
    display: flex;
    width: 100%;
    gap: 16px;
}

.diff-left, .diff-right {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
}

.diff-title {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

/* 对话提示 */
.prompt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #e5edff;
    color: var(--primary-color);
    font-size: 12px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .diff-view {
        flex-direction: column;
    }
    
    .diff-left, .diff-right {
        width: 100%;
    }
}

/* 元素高亮样式 */
/* 预览区元素高亮 - 使用紫蓝渐变的精致效果 */

/* 流程图高亮 */
.mermaid .node.highlighted > rect,
.mermaid .node.highlighted > polygon,
.mermaid .node.highlighted > circle,
.mermaid .node.highlighted > ellipse,
.mermaid .highlighted > rect,
.mermaid .highlighted > polygon,
.mermaid .highlighted > circle,
.mermaid .highlighted > ellipse {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 时序图高亮 */
.mermaid .actor.highlighted > rect,
.mermaid .actor.highlighted > line,
.mermaid .activation.highlighted > rect,
.mermaid .note.highlighted > rect,
.mermaid .note.highlighted > polygon,
.mermaid .messageText.highlighted,
.mermaid .labelText.highlighted,
.mermaid .noteText.highlighted {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 类图高亮 */
.mermaid .classGroup.highlighted > rect,
.mermaid .class.highlighted > rect,
.mermaid .relation.highlighted > path,
.mermaid .relation.highlighted > line {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 状态图高亮 */
.mermaid .state.highlighted > rect,
.mermaid .state.highlighted > circle,
.mermaid .stateGroup.highlighted > rect,
.mermaid .transition.highlighted > path {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 甘特图高亮 */
.mermaid .task.highlighted > rect,
.mermaid .section.highlighted > rect,
.mermaid .taskText.highlighted {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 饼图高亮 */
.mermaid .pieSlice.highlighted > path,
.mermaid .slice.highlighted > path {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    transition: all 0.3s ease;
}

/* 为SVG创建渐变定义 */
.mermaid svg:first-child {
    position: relative;
}

/* 编辑器行高亮 - 使用更柔和的紫色调 */
.ql-editor .line-highlight {
    background: linear-gradient(to right, 
        rgba(139, 92, 246, 0.08), 
        rgba(59, 130, 246, 0.08));
    border-left: 2px solid;
    border-image: linear-gradient(to bottom, #8b5cf6, #3b82f6) 1;
    margin-left: -2px;
    padding-left: 2px;
    transition: all 0.3s ease;
    opacity: 1;
}

/* 高亮淡入动画 */
.ql-editor .line-highlight.fade-in {
    opacity: 0;
    background: transparent;
    border-left-color: transparent;
}

.ql-editor .line-highlight.fade-in.active {
    opacity: 1;
    background: linear-gradient(to right, 
        rgba(139, 92, 246, 0.08), 
        rgba(59, 130, 246, 0.08));
    border-left: 2px solid;
    border-image: linear-gradient(to bottom, #8b5cf6, #3b82f6) 1;
    transition: all 0.3s ease;
}

/* 高亮淡出动画 - 修复版本，只改变透明度而不改变背景和边框样式 */
.ql-editor .line-highlight.fade-out {
    background: transparent !important;
    border-left: none !important;
    border-image: none !important;
    opacity: 1;
    transition: all 0.3s ease;
}

/* 预览区高亮淡入动画 - 流程图 */
.mermaid .highlighted.fade-in > rect,
.mermaid .highlighted.fade-in > polygon,
.mermaid .highlighted.fade-in > circle,
.mermaid .highlighted.fade-in > ellipse {
    stroke: transparent !important;
    filter: none !important;
    opacity: 0;
}

.mermaid .highlighted.fade-in.active > rect,
.mermaid .highlighted.fade-in.active > polygon,
.mermaid .highlighted.fade-in.active > circle,
.mermaid .highlighted.fade-in.active > ellipse {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    opacity: 1;
    transition: all 0.3s ease;
}

/* 预览区高亮淡入动画 - 时序图 */
.mermaid .actor.highlighted.fade-in > rect,
.mermaid .actor.highlighted.fade-in > line,
.mermaid .activation.highlighted.fade-in > rect,
.mermaid .note.highlighted.fade-in > rect,
.mermaid .note.highlighted.fade-in > polygon {
    stroke: transparent !important;
    filter: none !important;
    opacity: 0;
}

.mermaid .actor.highlighted.fade-in.active > rect,
.mermaid .actor.highlighted.fade-in.active > line,
.mermaid .activation.highlighted.fade-in.active > rect,
.mermaid .note.highlighted.fade-in.active > rect,
.mermaid .note.highlighted.fade-in.active > polygon {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 2px !important;
    filter: drop-shadow(0 0 3px rgba(139, 92, 246, 0.3));
    opacity: 1;
    transition: all 0.3s ease;
}

/* 预览区高亮淡出动画 - 修复版本 */
.mermaid .highlighted.fade-out > rect,
.mermaid .highlighted.fade-out > polygon,
.mermaid .highlighted.fade-out > circle,
.mermaid .highlighted.fade-out > ellipse,
.mermaid .highlighted.fade-out > line,
.mermaid .highlighted.fade-out > path {
    stroke: inherit !important;
    stroke-width: inherit !important;
    opacity: 1;
    transition: all 0.3s ease;
}

/* 连接线高亮 - 使用渐变效果 */
.mermaid .edgePath.highlighted path {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 1.5px !important;
    opacity: 0.8;
    transition: all 0.3s ease;
}

/* 连接线淡入动画 */
.mermaid .edgePath.highlighted.fade-in path {
    stroke: transparent !important;
    opacity: 0;
}

.mermaid .edgePath.highlighted.fade-in.active path {
    stroke: url(#highlight-gradient) !important;
    stroke-width: 1.5px !important;
    opacity: 0.8;
    transition: all 0.3s ease;
}

/* 连接线淡出动画 - 修复版本 */
.mermaid .edgePath.highlighted.fade-out path {
    stroke: inherit !important;
    stroke-width: inherit !important;
    opacity: 1;
    transition: all 0.3s ease;
}

/* 悬停效果增强 - 支持所有图表类型 */
.mermaid .node:hover,
.mermaid .actor:hover,
.mermaid .classGroup:hover,
.mermaid .class:hover,
.mermaid .state:hover,
.mermaid .task:hover,
.mermaid .pieSlice:hover,
.mermaid .slice:hover {
    cursor: pointer;
    filter: brightness(1.05);
}

/* 高亮时的动画效果 */
@keyframes highlight-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.9; }
    100% { opacity: 0.6; }
}

.mermaid .node.highlighted::after,
.mermaid .actor.highlighted::after,
.mermaid .classGroup.highlighted::after,
.mermaid .class.highlighted::after,
.mermaid .state.highlighted::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: inherit;
    background: linear-gradient(45deg, 
        rgba(139, 92, 246, 0.2), 
        rgba(59, 130, 246, 0.2));
    animation: highlight-pulse 2s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

/* AI编辑按钮样式 */
.ai-edit-button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid transparent;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    color: #8b5cf6;
    pointer-events: auto;
}

.ai-edit-button:hover {
    transform: scale(1.1);
    border: 2px solid #8b5cf6;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.ai-edit-button svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* AI编辑输入框样式 */
.ai-edit-input {
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1001;
    font-size: 14px;
}

.ai-edit-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.ai-edit-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.ai-edit-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: none;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.ai-edit-textarea:focus {
    outline: none;
}

.ai-edit-actions {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #e9ecef;
}

.ai-edit-actions button {
    padding: 6px 16px;
    border-radius: 4px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-edit-cancel {
    background: #e9ecef;
    color: #495057;
}

.ai-edit-cancel:hover {
    background: #dee2e6;
}

.ai-edit-submit {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
}

.ai-edit-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

/* 错误Toast样式 */
#toast.error-toast {
    background-color: #fee2e2;
    color: #b91c1c;
    border-left: 4px solid #dc2626;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.1), 0 2px 4px -1px rgba(220, 38, 38, 0.06);
    font-weight: 500;
} 