/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    overflow: hidden;
}

/* SVG编辑器主容器 */
.svg-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
}

/* 头部样式 */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #2c3e50;
    color: white;
    border-bottom: 1px solid #34495e;
    min-height: 48px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.editor-header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    opacity: 0.9;
}

#file-status {
    color: #e74c3c;
    font-weight: bold;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* 编辑器主体 */
.editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏样式 */
.left-sidebar,
.right-sidebar {
    background: #ecf0f1;
    border-right: 1px solid #bdc3c7;
    overflow-y: auto;
    flex-shrink: 0;
}

.left-sidebar {
    width: 240px;
    border-right: 1px solid #bdc3c7;
}

.right-sidebar {
    width: 280px;
    border-left: 1px solid #bdc3c7;
}

/* 画布区域 */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    min-height: 40px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-controls .btn {
    min-width: 32px;
    height: 28px;
    padding: 4px 8px;
    font-size: 12px;
}

#zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.canvas-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #666;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f8f9fa;
    background-image: 
        linear-gradient(rgba(0,0,0,.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,.1) 1px, transparent 1px);
    background-size: 20px 20px;
}

.canvas-wrapper {
    position: relative;
    transform-origin: 0 0;
    display: block;
    box-sizing: border-box;
}

#svg-canvas {
    /* 移除背景，让网格透过 */
}

/* 底部状态栏 */
.editor-footer {
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px;
    font-size: 12px;
    color: #666;
    min-height: 24px;
}

.status-right {
    display: flex;
    gap: 16px;
}

/* 通用按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    min-height: 32px;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 按钮变体 */
.btn-primary {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
    border-color: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    border-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
    border-color: #7f8c8d;
}

.btn-help {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: bold;
}

.btn-help:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 选中状态样式 - 移除红色样式，仅依赖选择框 */
.selected {
    /* 不添加任何视觉样式，选中状态通过选择框显示 */
}

/* 选择框和控制点样式 */
.selection-box {
    pointer-events: none;
    z-index: 1000;
}

.resize-handle {
    pointer-events: all;
    transition: fill 0.1s ease;
    z-index: 1001;
}

.resize-handle:hover {
    fill: #1976D2 !important;
}

.connection-point {
    pointer-events: all;
    transition: fill 0.1s ease;
    opacity: 0.8;
    z-index: 1001;
}

.connection-point:hover {
    fill: #388E3C !important;
    opacity: 1;
}

/* 临时连接点样式 */
.temp-connection-point {
    pointer-events: all;
    transition: fill 0.1s ease, r 0.1s ease;
    opacity: 0.9;
    z-index: 1001;
}

.temp-connection-point:hover {
    fill: #FF5722 !important;
    r: 6 !important;
    opacity: 1;
}

/* 连接线样式 */
.connection-line {
    pointer-events: all;
    transition: stroke-width 0.1s ease;
    z-index: 500;
}

.connection-line:hover {
    stroke-width: 3 !important;
}

/* 连接模式时的光标样式 */
.connecting-mode {
    cursor: crosshair !important;
}

.connecting-mode * {
    cursor: crosshair !important;
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.modal-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #666;
}

.modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.modal-content {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
}

/* 帮助对话框样式 */
.help-dialog {
    width: 600px;
}

.help-content section {
    margin-bottom: 20px;
}

.help-content h4 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.help-content ul {
    list-style: none;
    padding: 0;
}

.help-content li {
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.4;
}

.help-content kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1;
    color: #555;
    background: #f7f7f7;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: monospace;
    margin-right: 8px;
    min-width: 20px;
    text-align: center;
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    max-width: 320px;
}

.notification.error {
    background: #e74c3c;
}

.notification.success {
    background: #27ae60;
}

.notification.warning {
    background: #f39c12;
}

.notification.info {
    background: #3498db;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 200px;
    }
    
    .right-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .editor-body {
        flex-direction: column;
    }
    
    .left-sidebar,
    .right-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-left: none;
        border-right: none;
        border-top: 1px solid #bdc3c7;
        border-bottom: 1px solid #bdc3c7;
    }
    
    .canvas-area {
        order: -1;
    }
    
    .canvas-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .canvas-info {
        flex-wrap: wrap;
    }
}

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

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

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

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

/* 增强的帮助对话框样式 */
.help-dialog {
    width: 800px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.help-dialog .modal-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.help-nav {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    margin: -16px -16px 16px -16px;
    padding: 0;
}

.help-nav-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.help-nav-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.help-nav-btn.active {
    color: #2196F3;
    background: #fff;
    border-bottom-color: #2196F3;
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.help-section {
    display: none;
}

.help-section.active {
    display: block;
}

.help-content section {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
}

.help-content h4 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-content li {
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #495057;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.help-content li:before {
    content: "▸";
    color: #2196F3;
    font-weight: bold;
    margin-top: 2px;
    flex-shrink: 0;
}

.help-content kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1;
    color: #495057;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 0 4px;
    font-weight: 600;
}

.help-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.help-dialog .modal-footer {
    justify-content: space-between;
    margin: 16px -16px -16px -16px;
}

.help-version {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .help-dialog {
        width: 95vw;
        height: 90vh;
    }
    
    .help-nav {
        flex-wrap: wrap;
    }
    
    .help-nav-btn {
        flex: 1 1 50%;
        font-size: 13px;
        padding: 10px 8px;
    }
    
    .help-content section {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .help-content h4 {
        font-size: 14px;
    }
    
    .help-content li {
        font-size: 13px;
    }
    
    .help-dialog .modal-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}