/* Canvas自由布局编辑器样式 */
.editor-wrap { max-width: 1200px; margin: 0 auto; padding: 20px; }
.editor-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.editor-header label { font-size: 14px; color: #555; }
.editor-header input[type="number"] { width: 80px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.editor-header .unit { font-size: 13px; color: #999; }

#editor-container { position: relative; margin: 0 auto; background: #f0f0f0; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 10px rgba(0,0,0,.05); max-height: 1000px; }
#editor-canvas { border: 2px solid red; display: block; margin: 0 auto; cursor: crosshair; touch-action: none; }

/* 工具栏 */
.editor-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-btn { padding: 8px 18px; border: 1px solid #ddd; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; transition: all .2s; }
.toolbar-btn:hover { border-color: #FE4F70; color: #FE4F70; }
.toolbar-btn.primary { background: linear-gradient(135deg, #FE4F70, #FFA387); color: #fff; border: none; }
.toolbar-btn.primary:hover { opacity: .9; }

/* 属性面板 */
.paint-props { padding: 16px; background: #fafafa; border-radius: 8px; margin-top: 16px; display: none; }
.paint-props.show { display: block; }
.paint-props h4 { margin: 0 0 12px; font-size: 15px; color: #333; }
.prop-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.prop-row label { width: 60px; font-size: 13px; color: #666; text-align: right; }
.prop-row input { width: 80px; padding: 5px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; }
.prop-row .unit { font-size: 12px; color: #999; }


/* 距离标注提示 */
.dim-tooltip { position: absolute; background: rgba(255,255,255,.95); padding: 2px 8px; border-radius: 4px; font-size: 11px; color: #FF4444; pointer-events: none; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.1); z-index: 10; }

/* 添加画弹窗 */
.add-paint-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); z-index: 9999; display: none; align-items: center; justify-content: center; }
.add-paint-modal.show { display: flex; }
.add-paint-dialog { background: #fff; border-radius: 12px; padding: 24px; width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.add-paint-dialog h3 { margin: 0 0 16px; font-size: 18px; color: #333; }
.add-paint-dialog .form-row { margin-bottom: 12px; }
.add-paint-dialog .form-row label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.add-paint-dialog .form-row input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; box-sizing: border-box; }
.add-paint-dialog .btn-row { display: flex; gap: 10px; margin-top: 16px; }
.add-paint-dialog .btn-row button { flex: 1; padding: 10px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
.add-paint-dialog .btn-cancel { background: #f0f0f0; color: #666; }
.add-paint-dialog .btn-confirm { background: linear-gradient(135deg, #FE4F70, #FFA387); color: #fff; }

@media (max-width: 768px) {
    .editor-wrap { padding: 12px; }
    .editor-header { flex-direction: column; align-items: flex-start; }
}

/* ★ 全屏编辑模式 — 自定义CSS class方案，不依赖浏览器原生Fullscreen API */
#editor-workspace.combo-fullscreen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
    border-radius: 0; background: #f5f5f5;
    overflow-y: auto; overflow-x: hidden; z-index: 99990; margin: 0; padding: 20px; box-sizing: border-box;
}
#editor-workspace.combo-fullscreen #editor-container {
    max-height: none;
    overflow: visible;
}
#editor-workspace.combo-fullscreen #editor-canvas {
    display: block;
    border: 2px solid red;
}
/* ★ 全屏模式下的添加画框弹窗：提高z-index确保在全屏之上 */
#editor-workspace.combo-fullscreen ~ .add-paint-modal,
#editor-workspace.combo-fullscreen ~ .modal-overlay,
.add-paint-modal.show,
.modal-overlay.show {
    z-index: 99999 !important;
}
/* ★ 全屏模式下的 Toast */
#editor-workspace.combo-fullscreen ~ .admin-toast,
#editor-workspace.combo-fullscreen ~ .combo-toast {
    z-index: 99999 !important;
}
/* ★ 全屏模式下的灯箱 */
#editor-workspace.combo-fullscreen ~ .combo-lightbox {
    z-index: 99998 !important;
}
/* 退出全屏按钮 */
.combo-exit-fullscreen {
    position: fixed; top: 16px; right: 16px; z-index: 99999;
    padding: 10px 20px; background: linear-gradient(135deg, #FE4F70, #FFA387); color: #fff;
    border: none; border-radius: 8px; font-size: 14px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
/* ★ 移动端全屏适配 */
@media (max-width: 768px) {
    #editor-workspace.combo-fullscreen {
        padding: 10px;
    }
    #editor-workspace.combo-fullscreen .editor-top-bar,
    #editor-workspace.combo-fullscreen .combo-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }
}


/* 预设模板卡片 */
.preset-tpl-card { width:160px; border:2px solid #e5e7eb; border-radius:10px; overflow:hidden; cursor:pointer; transition:all .2s; background:#fff; }
.preset-tpl-card:hover { border-color:#8B5CF6; box-shadow:0 4px 12px rgba(139,92,246,0.2); transform:translateY(-2px); }
.preset-tpl-card.selected { border-color:#8B5CF6; box-shadow:0 0 0 3px rgba(139,92,246,0.2); }
.preset-tpl-card .tpl-preview { width:100%; height:120px; background:#f9fafb; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.preset-tpl-card .tpl-preview img { max-width:100%; max-height:100%; object-fit:contain; }
.preset-tpl-card .tpl-preview .tpl-placeholder { font-size:32px; color:#d0d5dd; }
.preset-tpl-card .tpl-info { padding:8px 10px; }
.preset-tpl-card .tpl-name { font-size:13px; font-weight:600; color:#374151; margin-bottom:2px; }
.preset-tpl-card .tpl-count { font-size:11px; color:#9ca3af; }
/* ★ v3.0 背景图层 */
#editor-container { position: relative; }
.bg-layer-hint { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 4px; font-size: 11px; pointer-events: none; z-index: 5; }

/* ★ v3.0 背景图状态栏 */
.bg-status-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #f8f9fa; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 12px; font-size: 13px; flex-wrap: wrap; }
.bg-status-label { color: #6b7280; font-weight: 500; white-space: nowrap; }
.bg-status-text { color: #999; }
.bg-preview-thumb { width: 40px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid #e5e7eb; }
.bg-remove-btn { padding: 4px 10px; border: 1px solid #fca5a5; border-radius: 4px; background: #fff; color: #ef4444; font-size: 12px; cursor: pointer; transition: all .2s; }
.bg-remove-btn:hover { background: #fef2f2; border-color: #ef4444; }
.bg-hint-text { color: #9ca3af; font-size: 11px; margin-left: auto; }
@media (max-width: 768px) {
    .bg-hint-text { display: none; }
    .bg-status-bar { gap: 6px; padding: 8px 10px; }
}
