* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f0f2f5;
    padding: 20px;
    transition: all 0.3s ease;
    overflow-x: hidden; /* 防止横向滚动 */
    max-width: 100%; /* 确保不会超出屏幕 */
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow-x: hidden; /* 防止横向滚动 */
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 35px;
    position: relative;
    padding-bottom: 20px;
    border-bottom: 1px solid #eaeaea;
}

.header-logo img {
    margin-right: 20px;
    transition: transform 0.3s ease;
}

.header-logo img:hover {
    transform: scale(1.05);
}

h1 {
    text-align: center;
    color: #1a73e8;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

h2 {
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e8eef7;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
}

.editor-container {
    display: flex;
    flex-wrap: wrap; /* 允许在较小屏幕上换行 */
    gap: 30px;
    margin-top: 20px;
    width: 100%;
}

.form-container {
    flex: 1 1 400px; /* 更灵活的布局，最小宽度400px */
    max-height: none !important;
    overflow-y: visible !important;
    padding: 25px;
    background-color: #f9fafc;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}

.pdf-container {
    flex: 1 1 400px; /* 更灵活的布局，最小宽度400px */
    display: flex;
    flex-direction: column;
    padding: 25px;
    background-color: #f9fafc;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}

.pdf-viewer {
    border: 1px solid #e0e0e0;
    min-height: 500px; /* 使用固定的最小高度而不是视口比例 */
    max-height: 70vh; /* 设置最大高度为视口的70% */
    background-color: #f9f9f9;
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0), 
                      linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px; /* 棋盘背景，看起来更专业 */
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
    position: relative;
    width: 100%; /* 确保宽度不会超出父容器 */
    border-radius: 4px;
}

.pdf-canvas {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 100%; /* 确保canvas不超出容器宽度 */
    height: auto !important; /* 覆盖可能的内联样式 */
}

.message-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    max-width: 80%;
    text-align: center;
    color: #333;
    font-size: 16px;
    line-height: 1.5;
    z-index: 50;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.pdf-controls button {
    padding: 8px 15px;
}

#pageInfo {
    font-size: 14px;
}

#zoomLevel {
    width: 80px;
}

.form-group {
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.form-group:hover {
    transform: translateY(-2px);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 15px;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e1e5eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.01);
}

input:focus, select:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    outline: none;
}

input[type="file"] {
    padding: 10px;
    background-color: #f5f7fa;
    border: 2px dashed #d9e2ec;
    cursor: pointer;
}

.photo-preview {
    width: 160px;
    height: 200px;
    border: 2px dashed #d9e2ec;
    margin-top: 10px;
    background-color: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.03);
}

.photo-preview:hover {
    border-color: #1a73e8;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transform: translateY(-3px);
}

.photo-preview img {
    max-width: 100%;
    max-height: 100%;
    transition: all 0.3s ease;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: space-between;
}

button {
    padding: 12px 24px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(26, 115, 232, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background-color: #1557b0;
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(26, 115, 232, 0.25);
}

button:active {
    transform: translateY(1px);
}

.canvas-container {
    margin: 0 auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-message {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.editable-field {
    cursor: pointer;
    border: 1px dashed transparent;
    padding: 2px 4px;
    transition: all 0.3s;
    font-size: 12px;
    color: #333;
    background-color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.editable-field:hover {
    border-color: #1a73e8;
    background-color: rgba(26, 115, 232, 0.1);
    z-index: 15 !important;
}

.active-field {
    border: 2px solid #1a73e8;
    background-color: rgba(26, 115, 232, 0.1);
    z-index: 20 !important;
}

.photo-field {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.photo-field:hover {
    background-color: rgba(26, 115, 232, 0.2);
}

.photo-field img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 992px) {
    .editor-container {
        flex-direction: column;
    }
    
    .form-container, .pdf-container {
        flex: 1 1 100%;
        max-height: none;
        margin-bottom: 20px;
    }
    
    .pdf-viewer {
        min-height: 400px;
        max-height: 60vh;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: center;
    }
    
    .container {
        padding: 20px 15px;
    }
}

@media (max-width: 768px) {
    .header-logo {
        flex-direction: column;
    }
    
    .header-logo img {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .pdf-controls {
        flex-wrap: wrap;
    }
    
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px 10px;
        border-radius: 8px;
    }
    
    .form-container, .pdf-container {
        padding: 15px;
        border-radius: 8px;
    }
    
    .pdf-viewer {
        min-height: 300px;
        padding: 15px 10px;
        background-size: 15px 15px; /* 减小背景图案大小 */
    }
    
    /* 优化水印在移动设备上的显示 */
    .watermark {
        font-size: min(30px, 5vw) !important; /* 在移动设备上强制更小的水印 */
        opacity: 0.15 !important;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .site-stats {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    /* 缩小内边距，节省空间 */
    h2 {
        margin-bottom: 15px;
        padding-bottom: 8px;
        font-size: 20px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
}

/* 隐藏静态字段 */
.static-field {
    display: none;
}

/* 水印样式 */
.watermark {
    position: absolute;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: min(50px, 4vw); /* 使用视窗相对单位，但限制最大值为50px */
    color: rgba(139, 0, 0, 0.2); /* 降低不透明度 */
    font-weight: bold;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
    opacity: 0.8;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1); /* 添加微弱阴影 */
    /* 使用滤镜增强对比度 */
    filter: contrast(0.8);
}

/* 联系方式样式 */
.contact {
    position: absolute;
    bottom: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #666;
    margin: 0;
}

.telegram-icon {
    width: 16px;
    height: 16px;
}

/* 页脚样式 */
.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    text-align: center;
    color: #666;
    font-size: 14px;
    width: 100%;
    overflow: hidden; /* 防止内容溢出 */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.site-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-icon {
    color: #1a73e8;
}

.stat-number {
    font-weight: 600;
}

.friendly-links {
    margin-top: 15px;
}

.friendly-links a {
    color: #1a73e8;
    text-decoration: none;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.friendly-links a:hover {
    color: #1557b0;
    text-decoration: underline;
} 