* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-panel: #ffffff;
    --bg-header: #fafafa;
    --bg-hover: #e8e8e8;
    --bg-tooltip: #333333;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #dddddd;
    --accent-color: #4a90d9;
    --accent-hover: #3a7bc8;
    --danger-color: #e74c3c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-panel: #252525;
    --bg-header: #2d2d2d;
    --bg-hover: #3a3a3a;
    --bg-tooltip: #4a4a4a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #444444;
    --accent-color: #5a9feb;
    --accent-hover: #4a8eda;
    --danger-color: #c0392b;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

/* 顶部导航栏 */
.header {
    display: none;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.header-left {
    flex: 1;
}

.app-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

/* 主体内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧模块区 */
.sidebar-left {
    width: 220px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.3s ease;
}

.sidebar-left.collapsed {
    width: 50px;
    overflow: visible;
}

.sidebar-left.collapsed .panel-header h2,
.sidebar-left.collapsed .project-toolbar,
.sidebar-left.collapsed .component-list,
.sidebar-left.collapsed .copyright-info {
    display: none;
}

/* 版权信息 */
.copyright-info {
    padding: 0px 15px 20px 15px;
    text-align: center;
    margin-top: auto;
}

.copyright-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 16px;
}

.beian-link {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 21px;
    text-decoration: none;
    display: block;
}

.beian-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.btn-toggle-sidebar:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-toggle-sidebar svg {
    width: 16px;
    height: 16px;
}

.sidebar-left.collapsed .panel-header {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100%;
    padding: 10px 0;
    gap: 15px;
}

.sidebar-left.collapsed .btn-toggle-sidebar {
    transform: rotate(180deg);
}

.collapsed-icon-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: visible;
    padding: 10px 0;
}

.collapsed-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.collapsed-icon-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.collapsed-icon-btn svg {
    width: 20px;
    height: 20px;
}

.collapsed-icon-btn span {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tooltip {
    position: relative;
}

.tooltip::after {
    display: none;
}

.tooltip:hover::after {
    display: none;
}

/* 浮动tooltip样式 */
.floating-tooltip {
    position: fixed;
    background-color: var(--bg-tooltip);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* 右侧参数设置区 */
.sidebar-right {
    width: 240px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* 面板头部 */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 组件列表 */
.component-list {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.component-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 12px;
    margin-bottom: 6px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
}

.component-item:hover {
    background-color: var(--bg-hover);
    border-color: #4d2fa0;
}

.component-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.component-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.component-item span {
    font-size: 13px;
    color: var(--text-primary);
}

/* 中间面板 */
.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

/* 画布区 */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 12px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.canvas-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 10px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: all 0.2s;
    display: inline-flex;        /* 添加 */
    align-items: center;         /* 添加 */
    gap: 6px;                    /* 添加（图标和文字间距） */
}

.action-btn:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.action-btn.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* 提示弹窗样式 */
.toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.toast-overlay.show {
    opacity: 1;
    visibility: visible;
}

.toast-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 360px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.toast-overlay.show .toast-modal {
    transform: scale(1) translateY(0);
}

.toast-content {
    padding: 24px;
    text-align: center;
}

.toast-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.toast-icon.info {
    color: #4080ff;
}

.toast-icon.error {
    color: #ff4d4f;
}

.toast-icon.success {
    color: #52c41a;
}

.toast-message {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    margin-bottom: 20px;
}

.toast-actions {
    display: flex;
    gap: 12px;
}

.toast-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.toast-btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
}

.toast-btn-primary:hover {
    background-color: #3370e7;
}

.toast-btn-secondary {
    background-color: #f5f5f5;
    color: #666;
}

.toast-btn-secondary:hover {
    background-color: #eee;
}

.canvas-area {
    flex: 1;
    position: relative;
    overflow: auto;
    background-color: var(--bg-primary);
}

/* 标尺样式 */
.ruler {
    position: absolute;
    background-color: #f0f0f0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

[data-theme="dark"] .ruler {
    background-color: #3a3a3a;
}

.ruler-horizontal {
    top: 0;
    left: 24px;
    right: 0;
    height: 24px;
    border-bottom: 1px solid #ccc;
}

[data-theme="dark"] .ruler-horizontal {
    border-bottom-color: #555;
}

.ruler-vertical {
    top: 24px;
    left: 0;
    bottom: 0;
    width: 24px;
    border-right: 1px solid #ccc;
}

[data-theme="dark"] .ruler-vertical {
    border-right-color: #555;
}

.ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background-color: #e0e0e0;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    z-index: 11;
}

[data-theme="dark"] .ruler-corner {
    background-color: #333;
    border-right-color: #555;
    border-bottom-color: #555;
}

.ruler-marks {
    position: absolute;
    width: 100%;
    height: 100%;
}

.ruler-mark {
    position: absolute;
    background-color: #999;
}

[data-theme="dark"] .ruler-mark {
    background-color: #888;
}

.ruler-mark-main {
    background-color: #666;
}

[data-theme="dark"] .ruler-mark-main {
    background-color: #aaa;
}

.ruler-label {
    position: absolute;
    font-size: 9px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: #666;
    white-space: nowrap;
    transform: translateY(-100%);
    margin-top: -2px;
}

[data-theme="dark"] .ruler-label {
    color: #aaa;
}

.canvas-grid {
  position: absolute;
  top: 24px;
  left: 24px;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 10px 10px;
  /* min-height: 400px; */
}

/* 禁止拖拽时的视觉提示 */
#canvas.canvas-drag-disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 禁止拖拽时显示提示文字覆盖层 */
#canvas.canvas-drag-disabled::before {
    content: '请先建立项目或选择已有的项目。';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.1);
    padding: 12px 24px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 1000;
}

[data-theme="dark"] .canvas-grid {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
}

/* 画布组件样式 */
.dragged-component {
    position: absolute;
    padding: 0px;
    color: white;
    border-radius: 0px;
    cursor: move;
    user-select: none;
    text-align: center;
}

.dragged-component.selected {
    outline: 2px solid #ff6b35;
    outline-offset: -1px;
}

/* 代码区 */
.code-container {
    height: 270px;
    margin: 0 12px 12px;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: height 0.3s ease;
}

.code-container.collapsed {
    height: 56px;
}

.code-container.collapsed .code-area {
    display: none;
}

.code-container.expanded {
    height: 620px;
}

.code-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.code-area {
    flex: 1;
    overflow: auto;
    padding: 12px;
    background-color: #1e1e1e;
}

.code-area pre {
    margin: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #d4d4d4;
}

.code-area code {
    white-space: pre-wrap;
    word-break: break-all;
}

/* 代码行样式 */
.code-line {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #d4d4d4;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 1px 4px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

/* 代码行高亮样式 */
.code-line.highlighted {
    background-color: rgba(37, 65, 170, 0.5);
    border-left: 3px solid #5d73c5;
    animation: codeHighlight 0.1s ease;
}

@keyframes codeHighlight {
    0% {
        background-color: rgba(37, 65, 170, 0.3);
    }
    100% {
        background-color: rgba(37, 65, 170, 0.5);
    }
}

/* 代码中参数值高亮样式（橘黄色） */
.code-value {
    color: #ff8c00;
    font-weight: 500;
}

/* 参数设置表单 */
.settings-form {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-content {
    display: none;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);  
    margin-top: 16px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row-3 {
    display: flex;
    gap: 8px;
}

.form-row-3 .form-group {
    flex: 1;
    min-width: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.form-group.half {
    flex: 1;
}

.form-group label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    padding: 6px 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-primary);
    transition: border-color 0.2s;
    width:100%
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-input[readonly] {
    background-color: var(--bg-hover);
    cursor: not-allowed;
}

.color-picker {
    padding: 2px;
    height: 30px;
}

.range-input {
    padding: 0;
}

.file-input {
    padding: 4px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
}

.upload-preview {
    margin-top: 6px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

/* 窗口类型组件样式 */
.dialog-base {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

.dialog-bg-image {
    pointer-events: auto;
    cursor: pointer;
}

.dialog-base img {
    max-width: 100%;
    max-height: 100%;
}

/* 关闭按钮预览样式 */
.close-btn-preview {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    z-index: 1;
}

/* 文本组件样式 */
.text-component {
    user-select: none;
    white-space: nowrap;
}

/* 按钮组件样式 */
.button-component {
    z-index: 11 !important;
}

.input-component {
    z-index: 12 !important;
}

.input-component input::placeholder {
    color: var(--placeholder-color);
    opacity: 1;
}

.apply-btn {
    margin-top: 8px;
    padding: 10px;
    background-color: var(--accent-color);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.apply-btn:hover {
    background-color: var(--accent-hover);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 参数设置区标题右侧图标按钮 */
.header-icon-btn {
    width: 26px;
    height: 26px;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    padding: 0;
}

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

.header-icon-btn svg {
    width: 16.8px;
    height: 16.8px;
}

/* 设置弹窗 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-panel);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.theme-option:hover {
    background-color: var(--bg-hover);
}

.theme-option input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.theme-option span {
    font-size: 14px;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: var(--bg-hover);
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar-left, .sidebar-right {
        width: 180px;
    }
}

/* 颜色选择器样式 */
.color-picker-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
}

.color-value-input {
    flex: 1;
    background-color: var(--bg-secondary);
    cursor: default;
}

.color-picker-block {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.15s;
}

.color-picker-block:hover {
    transform: scale(1.1);
}

/* 颜色选择弹窗样式 */
.color-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.color-modal-overlay.show {
    display: flex;
}

.color-modal {
    background: #222;
    border-radius: 8px;
    padding: 15px;
    max-width: 90%;
    width: auto;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.color-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.color-modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

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

.color-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.color-modal-grid {
    display: grid;
    grid-template-columns: repeat(15, 18px);
    gap: 1px;
}

.color-modal-block {
    width: 18px;
    height: 18px;
    font-size: 8px;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 删除确认弹窗样式 */
.delete-confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.delete-confirm-overlay.show {
    display: flex;
}

.delete-confirm-modal {
    background-color: var(--bg-panel);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.delete-confirm-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.delete-confirm-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.delete-confirm-body {
    padding: 20px;
}

.delete-confirm-body p {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.delete-warning {
    color: #e74c3c !important;
    font-weight: 600;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.delete-confirm-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* 全屏模式样式 */
.fullscreen-mode .main-content {
    padding: 0;
}

.fullscreen-mode .center-panel {
    margin: 0;
    height: 100vh;
}

.fullscreen-mode .canvas-container {
    height: 100%;
    margin: 0;
    border-radius: 0;
}

.fullscreen-mode .code-container {
    flex-direction: column;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    margin: 0;
    border-radius: 0;
}

.fullscreen-mode .canvas-area {
    height: calc(100vh - 52px);
}

.fullscreen-mode.code-collapsed .canvas-area {
    height: 100vh;
}

#fullscreenBtn {
    min-width: 60px;
}

/* 删除按钮样式 */
.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 撤销/重做按钮样式 */
.undo-redo-container {
    position: relative;
    display: inline-block;
}

.undo-redo-buttons {
    display: flex;
    gap: 4px;
}

.btn-undo-redo {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-panel);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    padding: 0;
}

.btn-undo-redo:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.btn-undo-redo:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-undo-redo svg {
    width: 16px;
    height: 16px;
}

.btn-history svg {
    width: 12px;
    height: 12px;
}

/* 撤销历史下拉菜单 */
.undo-history-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.undo-history-dropdown.show {
    display: block;
}

.undo-history-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.undo-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.undo-history-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.15s;
}

.undo-history-item:hover {
    background: var(--bg-hover);
}

.undo-history-item.current {
    background: var(--bg-secondary);
    color: var(--accent-color);
}

.undo-history-item .item-index {
    width: 20px;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.undo-history-item.current .item-index {
    background: var(--accent-color);
    color: white;
}

/* 脚本变量库样式 */
.variable-library-btn {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white !important;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
}

.variable-library-btn:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.variable-library-panel {
    position: fixed;
    top: 100px;
    left: 100px;
    width: 350px;
    max-height: 600px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    cursor: default;
    color: var(--text-primary);
}

.variable-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
    cursor: move;
}

.variable-library-header span {
    font-weight: bold;
    font-size: 14px;
    user-select: none;
}

.variable-library-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 4px;
    line-height: 1;
}

.variable-library-close:hover {
    color: var(--text-primary);
}

/* 搜索和筛选区域 */
.variable-library-filter {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.variable-library-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.variable-tag {
    padding: 4px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.variable-tag:hover {
    border-color: var(--accent-color);
}

.variable-tag.active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    border-color:linear-gradient(135deg, #4f46e5, #7c3aed);
}

.variable-library-search {
    display: flex;
    gap: 8px;
}

.variable-search-input {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.variable-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.variable-search-btn {
    display: none; /* 隐藏搜索按钮，改为实时搜索 */
    padding: 6px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.variable-search-btn:hover {
    background: #3d8b3f;
}

.variable-library-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.variable-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.variable-item {
    display: flex;
    align-items: center;
    padding: 4px 0;
}

.variable-name {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.variable-name:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.variable-name::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 11px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    font-family: var(--font-family);
}

.variable-name:hover::after {
    opacity: 1;
}

.variable-desc {
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 搜索关键字高亮 */
.highlight-keyword {
    background: #ffff00;
    color: #e74c3c;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* 变量库遮罩层 */
.variable-library-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10000;
}


.undo-history-item .item-desc {
    flex: 1;
}

.undo-history-item .item-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.undo-history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.action-btn:disabled:hover {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

#deleteBtn:not(:disabled):hover {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

/* 文本内容+颜色组合样式 */
.text-content-with-color {
    display: flex;
    gap: 8px;
    align-items: center;
}

.text-content-with-color .form-input {
    flex: 1;
    min-width: 40px;
}

.text-content-with-color .color-value-input {
    width: 40px;
    flex: none;
}

/* 富文本编辑器样式 */
.rich-text-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.rich-text-segment {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rich-text-segment .rich-text-input {
    flex: 1;
    min-width: 100px;
}

.rich-text-segment .color-value-input {
    width: 40px;
}

.add-segment-btn {
    align-self: flex-start;
    background-color: #27ae60;
    color: white;
    border-color: #27ae60;
}

.add-segment-btn:hover {
    background-color: #219a52;
    border-color: #219a52;
    color: white;
}

.remove-segment-btn {
    padding: 6px 6px;
    background-color: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.remove-segment-btn:hover {
    background-color: #c0392b;
    border-color: #c0392b;
    color: white;
}

/* 十字线样式 */
.crosshair {
    position: absolute;
    pointer-events: none;
    z-index: 1000; /* 确保十字线在所有组件之上 */
    display: none; /* 默认隐藏 */
}

.crosshair.show {
    display: block;
}

.crosshair-horizontal {
    left: 0;
    width: 100%;
    height: 1px;
    background-color: rgba(74, 144, 217, 0.6);
}

.crosshair-vertical {
    top: 0;
    height: 100%;
    width: 1px;
    background-color: rgba(74, 144, 217, 0.6);
}

/* 固定状态样式 - 更明显的颜色 */
.crosshair.fixed {
    height: 2px;
    width: 2px;
    background-color: rgba(231, 76, 60, 0.8);
}

.crosshair-horizontal.fixed {
    height: 2px;
    width: 100%;
}

.crosshair-vertical.fixed {
    width: 2px;
    height: 100%;
}

/* 深色模式十字线颜色 */
[data-theme="dark"] .crosshair-horizontal {
    background-color: rgba(90, 159, 235, 0.7);
}

[data-theme="dark"] .crosshair-vertical {
    background-color: rgba(90, 159, 235, 0.7);
}

/* 深色模式固定状态 */
[data-theme="dark"] .crosshair.fixed {
    background-color: rgba(255, 107, 107, 0.9);
}

/* 自定义右键菜单 */
.context-menu {
    position: fixed;
    display: none;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 4px 0;
    min-width: 150px;
    z-index: 1000;
    font-size: 14px;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.context-menu-item .ctx-icon {
    margin-right: 8px;
    font-size: 16px;
}

.context-menu-item.context-menu-danger {
    color: var(--color-danger, #e74c3c);
}

.context-menu-item.context-menu-danger:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

/* 深色模式右键菜单 */
[data-theme="dark"] .context-menu {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

/* 标题容器 */
.panel-title-container {
    display: flex;
    align-items: center;
}

/* 帮助按钮样式 */
.help-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0px;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.help-btn svg {
    width: 20px;
    height: 20px;
}

/* 帮助弹窗样式 */
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.help-modal.show {
    display: flex;
}

.help-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.help-modal-content {
    position: relative;
    background-color: var(--bg-panel);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 680px;
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-header);
}

.help-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.help-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.help-modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.help-modal-close svg {
    width: 18px;
    height: 18px;
}

.help-modal-body {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 480px;
}

.help-image {
    width: 650px;
    height: 450px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}