* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== 顶部工具栏 ========== */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 60px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: #409eff;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
}

/* ========== 主编辑区域 ========== */
.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== 左侧组件面板 ========== */
.components-panel {
    width: 260px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
}

.components-panel .el-tabs {
    height: 100%;
    border: none;
}

.components-panel .el-tabs__content {
    height: calc(100% - 55px);
    overflow-y: auto;
}

.component-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 15px;
}

.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: #f5f7fa;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.3s;
    gap: 8px;
}

.component-item:hover {
    background: #ecf5ff;
    border-color: #409eff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.2);
}

.component-item:active {
    cursor: grabbing;
}

.component-item span {
    font-size: 12px;
    color: #606266;
}

.template-list {
    padding: 15px;
}

.template-item {
    padding: 15px;
    margin-bottom: 10px;
    background: #f5f7fa;
    border: 1px solid #e4e7ed;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.template-item:hover {
    background: #ecf5ff;
    border-color: #409eff;
}

.template-name {
    font-size: 14px;
    font-weight: 600;
    color: #303133;
    margin-bottom: 5px;
}

.template-desc {
    font-size: 12px;
    color: #909399;
}

/* ========== 中间画布区域 ========== */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    position: relative;
    overflow: hidden;
}

.canvas-controls {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: #606266;
}

.canvas-wrapper {
    overflow: auto;
    max-width: 100%;
    max-height: 100%;
    padding: 40px;
}

.canvas {
    width: 375px;
    height: 667px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    transform-origin: center center;
    transition: box-shadow 0.3s;
}

.canvas:hover {
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

/* 画布元素 */
.canvas-element {
    position: absolute;
    cursor: move;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.canvas-element:hover {
    border-color: #409eff;
}

.canvas-element.selected {
    border-color: #409eff;
    z-index: 10;
}

.element-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
}

.element-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #909399;
    background: #f5f7fa;
    width: 100%;
    height: 100%;
}

.form-placeholder {
    color: #909399;
    background: #f5f7fa;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 调整大小控制点 */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #409eff;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 20;
}

.resize-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.resize-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

.delete-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f56c6c;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: #f74a4a;
    transform: scale(1.1);
}

/* 页面导航 */
.pages-nav {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 8px;
    background: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.page-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dcdfe6;
    cursor: pointer;
    transition: all 0.3s;
}

.page-dot.active {
    background: #409eff;
    transform: scale(1.2);
}

/* ========== 右侧属性面板 ========== */
.properties-panel {
    width: 320px;
    background: #fff;
    border-left: 1px solid #e8e8e8;
    overflow-y: auto;
}

.panel-title {
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #303133;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

.properties-form {
    padding: 20px;
}

.properties-form .el-form-item {
    margin-bottom: 15px;
}

.properties-form .el-form-item__label {
    font-weight: 500;
    color: #606266;
}

.upload-btn {
    margin-top: 10px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100% - 60px);
}

/* ========== 滚动条样式 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .components-panel {
        width: 220px;
    }
    
    .properties-panel {
        width: 280px;
    }
}
