* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 24px;
    color: #333;
}

/* 海报预览区域 */
.poster-preview {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.poster-content {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 海报模板图片 */
.poster-template {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* 海报文字样式 */
.poster-text {
    position: absolute;
    font-size: 20px;
    font-weight: bold;
    color: #333;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.4;
    z-index: 2;
    cursor: move;
    padding: 10px;
    user-select: none;
    text-shadow: none;
}

/* 文字样式选项 */
.text-style-options {
    margin: 10px 0;
}

.text-style-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
}

.text-style-select:hover {
    border-color: #1890ff;
}

.text-style-select:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 二维码容器 */
.qrcode-container {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    overflow: hidden;
    z-index: 2;
    cursor: move;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 可拖拽元素样式 */
.draggable {
    touch-action: pan-x pan-y;
    cursor: move;
}

#qrcodeContainer {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.draggable:hover {
    border-color: #1890ff;
    box-shadow: 0 0 10px rgba(24, 144, 255, 0.3);
}

.draggable:active {
    cursor: grabbing;
    border-color: #1890ff;
    box-shadow: 0 0 15px rgba(24, 144, 255, 0.5);
}

.draggable.dragging {
    opacity: 0.8;
    z-index: 100;
}

/* 调整大小手柄 - 优化大小和可见性 */
.resize-handle {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background-color: #1890ff;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.resize-handle:hover {
    transform: scale(1.2);
    background-color: #40a9ff;
}

/* 调整大小时的样式 */
.resizeable:active .resize-handle {
    cursor: nwse-resize;
    transform: scale(1.3);
}

/* 拖拽时的样式 */
.dragging {
    opacity: 0.8;
    z-index: 1000;
}

/* 二维码图片 */
#qrcodeImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 上传占位符 */
.upload-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
    color: #999;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-placeholder:hover {
    background-color: #f0f0f0;
    color: #666;
}

/* 编辑器面板 */
.editor-panel {
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
}

.editor-section {
    margin-bottom: 25px;
}

.editor-section:last-child {
    margin-bottom: 0;
}

.editor-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #555;
}

.editor-section input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.editor-section input[type="text"]:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 按钮样式 */
button {
    display: inline-block;
    padding: 12px 24px;
    margin-right: 10px;
    margin-bottom: 10px;
    background-color: #1890ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #40a9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(24, 144, 255, 0.2);
}

button:disabled {
    background-color: #d9d9d9;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 文件名显示 */
.file-name {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* 二维码列表 */
.qrcode-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fafafa;
}

.qrcode-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    overflow: hidden;
}

.qrcode-item.active {
    border-color: #1890ff;
    box-shadow: 0 0 5px rgba(24, 144, 255, 0.5);
}

.qrcode-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qrcode-item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    padding: 2px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qrcode-item-remove {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(255, 0, 0, 0.8);
    color: #fff;
    font-size: 14px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 0 0 0 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.modal-content .close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.modal-content .close:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

/* 裁剪容器 */
.crop-container {
    position: relative;
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
    overflow: hidden;
}

.crop-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#cropArea {
    position: absolute;
    border: 2px dashed #1890ff;
    background-color: rgba(24, 144, 255, 0.1);
    cursor: move;
}

#cropArea::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: linear-gradient(45deg, rgba(255,255,255,0.3) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.3) 75%, rgba(255,255,255,0.3)),
                      linear-gradient(45deg, rgba(255,255,255,0.3) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.3) 75%, rgba(255,255,255,0.3));
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

/* 裁剪区域大小文本 */
.crop-size-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    user-select: none;
}

/* 裁剪调整大小手柄 */
.crop-resize-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background-color: #1890ff;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 10;
}

.crop-slider-container {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.crop-slider-container label {
    font-weight: bold;
    color: #555;
    min-width: 80px;
}

.crop-slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.crop-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1890ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.crop-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: #40a9ff;
    transform: scale(1.2);
}

.crop-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1890ff;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.crop-slider-container input[type="range"]::-moz-range-thumb:hover {
    background: #40a9ff;
    transform: scale(1.2);
}

.crop-slider-container #cropSizeValue {
    min-width: 50px;
    text-align: right;
    font-weight: bold;
    color: #1890ff;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#cancelCropBtn {
    background-color: #f0f0f0;
    color: #333;
}

#confirmCropBtn {
    background-color: #1890ff;
    color: #fff;
}

/* 预览图区域 */
.preview-section {
    margin-top: 30px;
    text-align: center;
}

.preview-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.final-preview {
    max-width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 适配手机端 */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .poster-preview {
        padding: 15px;
    }
    
    .poster-content {
        padding: 30px 15px;
    }
    
    .poster-text {
        font-size: 18px;
        margin-bottom: 30px;
    }
    
    .qrcode-container {
        width: 180px;
        height: 180px;
    }
    
    .editor-panel {
        padding: 15px;
    }
    
    button {
        width: 100%;
        margin-right: 0;
    }
}

/* 钉钉环境适配 */
@media all and (display-mode: standalone) {
    .container {
        padding-top: 0;
    }
}