* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.editor-wrapper {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.edit-panel, .preview-panel {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.edit-panel {
    flex: 1;
    min-width: 350px;
}

.preview-panel {
    flex: 1;
    min-width: 400px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

h3.section-title {
    color: #667eea;
    font-size: 14px;
    margin: 20px 0 15px 0;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #444;
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group select.form-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #fff;
}

.form-group select.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 35px;
}

.form-group input[type="text"]:focus {
    border-color: #667eea;
    outline: none;
}

.form-group input[type="color"] {
    width: 100%;
    height: 45px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    padding: 5px;
}

.form-group input[type="range"].slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    margin: 10px 0;
}

.form-group input[type="range"].slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.form-group input[type="range"].slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.form-group small {
    display: block;
    color: #888;
    font-size: 12px;
    margin-top: 5px;
}

.checkbox-group {
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-label span {
    font-size: 14px;
    color: #555;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 25px;
}

.btn {
    flex: 1;
    min-width: 100px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(56, 239, 125, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.preview-container {
    text-align: center;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
    overflow: auto;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    display: block;
}

/* 拖动控制层 */
.drag-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.drag-item {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.drag-label {
    background: rgba(102, 126, 234, 0.9);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: ns-resize;
    pointer-events: auto;
    font-size: 13px;
    font-weight: bold;
    user-select: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transition: all 0.15s;
}

.drag-label:hover {
    background: rgba(118, 75, 162, 1);
    transform: scale(1.05);
}

.drag-label:active, .drag-label.dragging {
    background: rgba(56, 239, 125, 0.95);
    transform: scale(1.1);
    cursor: grabbing;
}

/* 二维码特殊样式 */
.drag-qrcode {
    border: 3px dashed rgba(102, 126, 234, 0.6);
    background: rgba(102, 126, 234, 0.08);
    pointer-events: auto;
    box-sizing: border-box;
}

.drag-qrcode .drag-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.drag-qrcode .drag-label:active, 
.drag-qrcode .drag-label.dragging {
    transform: translate(-50%, -50%) scale(1.1);
}

.resize-corner {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 24px;
    height: 24px;
    background: #667eea;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    pointer-events: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.15s;
}

.resize-corner:hover {
    background: #764ba2;
    transform: scale(1.2);
}

.resize-corner:active, .resize-corner.dragging {
    background: #38ef7d;
    transform: scale(1.3);
}

.drag-tip {
    margin-top: 15px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

h2 small {
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .editor-wrapper {
        flex-direction: column;
    }
    
    .edit-panel, .preview-panel {
        min-width: 100%;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

/* 文件上传美化 */
input[type="file"] {
    background: #f8f9fa;
}

input[type="file"]::-webkit-file-upload-button {
    padding: 8px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 10px;
}

input[type="file"]::-webkit-file-upload-button:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 提示信息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    z-index: 1001;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
