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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f5f7fa;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

header h1 {
    color: white;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 300;
}

/* 上传区域样式 */
.upload-section {
    margin-bottom: 30px;
}

.upload-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.upload-box {
    background-color: #fafafa;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
    transition: all 0.3s ease;
}

.upload-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.upload-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.drop-zone {
    position: relative;
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #ffffff;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.drop-zone:hover {
    background-color: #f8f9ff;
    border-color: #764ba2;
    border-style: solid;
}

.drop-zone.dragover {
    background-color: #eef1ff;
    border-color: #764ba2;
    transform: scale(1.01);
    border-style: solid;
}

.drop-zone-text {
    font-size: 16px;
    color: #7f8c8d;
    margin-bottom: 15px;
    font-weight: 500;
}

.preview-canvas {
    display: none;
    max-width: 100%;
    max-height: 350px;
    margin: 0 auto;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    background-color: white;
}

/* 删除按钮样式 */
.delete-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    z-index: 10;
}

.delete-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

/* 图片控制按钮样式 */
.image-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    flex-wrap: wrap;
    align-items: center;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: white;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid #e1e8ed;
}

.zoom-input {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.zoom-input:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 上传按钮样式 */
.upload-btn {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* 隐藏已上传图片后的上传按钮 */
.preview-canvas[style*="display: block"] ~ .upload-btn {
    display: none;
}

.preview-canvas[style*="display: block"] ~ .image-controls {
    opacity: 1;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rotate-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    font-weight: bold;
}

.rotate-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

/* 缩放按钮样式 */
.zoom-btn {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

.zoom-btn:hover {
    background: linear-gradient(135deg, #d35400 0%, #a04000 100%);
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
}

.preview-canvas[style*="display: block"] + .delete-btn {
    display: flex;
}

/* A4预览区域样式 */
.a4-section {
    margin-bottom: 30px;
}

.a4-container {
    background-color: #fafafa;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.a4-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.a4-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f2f5;
    padding: 30px;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: auto;
    min-height: 450px;
    border: 1px solid #e1e8ed;
}

.a4-canvas {
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.a4-canvas:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.preview-info {
    text-align: center;
    margin-top: 25px;
    color: #7f8c8d;
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
}

.preview-info p {
    margin: 8px 0;
    font-weight: 500;
    font-size: 14px;
}

/* 功能按钮区域样式 */
.function-section {
    margin-bottom: 30px;
}

.function-container {
    background-color: #fafafa;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e1e8ed;
}

.function-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.function-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-height: 60px;
}

.function-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.print-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.print-btn:hover {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.image-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.image-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
}

.pdf-btn {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.pdf-btn:hover {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
}

.same-size-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.same-size-btn:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.btn-icon {
    font-size: 24px;
}

/* 底部样式 */
footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    padding: 25px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .upload-container {
        grid-template-columns: 1fr;
    }
    
    .upload-box {
        width: 100%;
    }
    
    .function-buttons {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    
    .function-btn {
        width: 100%;
        max-width: none;
        justify-content: center;
    }
    
    .zoom-controls {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .image-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .a4-preview {
        padding: 10px;
        min-height: 300px;
    }
}

/* 打印样式 */
@media print {
    body {
        background-color: white;
    }
    
    .container > *:not(.a4-section) {
        display: none;
    }
    
    .a4-section {
        margin: 0;
        padding: 0;
    }
    
    .a4-container {
        box-shadow: none;
        padding: 0;
    }
    
    .a4-preview {
        padding: 0;
        background-color: white;
    }
    
    .a4-canvas {
        border: none;
        box-shadow: none;
        max-width: 100%;
        max-height: 100%;
    }
}