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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: none;
}

.section.active {
    display: block;
}

h1, h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

h1 {
    font-size: 2.5em;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 上传区域 */
.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background-color: #f0f4ff;
}

#pdfFile {
    display: none;
}

.upload-label {
    cursor: pointer;
    display: block;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.upload-label p {
    font-size: 1.2em;
    color: #666;
}

/* PDF查看器 */
.pdf-viewer {
    position: relative;
    margin-bottom: 30px;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: auto;
    max-height: 600px;
}

#pdfCanvas {
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

#field-markers {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.page-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 10px 0 20px;
}

.page-controls button {
    padding: 6px 12px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.page-controls button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.field-marker {
    position: absolute;
    border: 2px solid;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: all;
    cursor: move;
}

.field-marker.name { border-color: #e74c3c; color: #e74c3c; }
.field-marker.date { border-color: #3498db; color: #3498db; }
.field-marker.idCard { border-color: #f39c12; color: #f39c12; }
.field-marker.address { border-color: #27ae60; color: #27ae60; }
.field-marker.creatorSign { border-color: #9b59b6; color: #9b59b6; }
.field-marker.signerSign { border-color: #e67e22; color: #e67e22; }

/* 字段配置 */
.field-config h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.field-list {
    display: grid;
    gap: 15px;
    margin-bottom: 30px;
}

.field-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    gap: 15px;
}

.field-item.required {
    border-left: 4px solid #e74c3c;
}

.field-item.optional {
    border-left: 4px solid #95a5a6;
}

.field-item label {
    flex: 1;
    font-weight: 500;
}

.add-field {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-field:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.add-field.active {
    background: #48bb78;
}

.field-status {
    font-size: 0.9em;
    color: #666;
}

.field-status.set {
    color: #48bb78;
    font-weight: 500;
}

/* 签名画布 */
.signature-area {
    text-align: center;
    margin-bottom: 30px;
}

#creatorSignCanvas, #signerSignCanvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: crosshair;
}

.sign-actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.sign-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#clearCreatorSign, #clearSignerSign {
    background: #e74c3c;
    color: white;
}

#clearCreatorSign:hover, #clearSignerSign:hover {
    background: #c0392b;
}

#saveCreatorSign, #completeSign {
    background: #27ae60;
    color: white;
}

#saveCreatorSign:hover, #completeSign:hover {
    background: #229954;
}

/* 动作按钮 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.action-buttons button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

#prevStep, #prevStep2 {
    background: #95a5a6;
    color: white;
}

#prevStep:hover, #prevStep2:hover {
    background: #7f8c8d;
}

#nextStep, #generateLink {
    background: #667eea;
    color: white;
}

#nextStep:hover, #generateLink:hover {
    background: #5a67d8;
}

#nextStep:disabled, #generateLink:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

#startNew {
    background: #27ae60;
    color: white;
}

#startNew:hover {
    background: #229954;
}

/* 分享部分 */
.share-info {
    text-align: center;
}

.share-info p {
    margin-bottom: 15px;
    font-size: 1.1em;
}

.share-link-container {
    display: flex;
    margin: 20px 0;
    gap: 10px;
}

#shareLink {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
}

#copyLink {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

#copyLink:hover {
    background: #5a67d8;
}

.note {
    color: #666;
    font-style: italic;
}

/* 签署者表单 */
.signer-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group.optional label::after {
    content: " (可选)";
    color: #999;
    font-weight: normal;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #app {
        padding: 10px;
    }
    
    .section {
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .share-link-container {
        flex-direction: column;
    }
    
    .field-item {
        flex-direction: column;
        text-align: center;
    }
    
    .pdf-viewer {
        max-height: 400px;
    }
}
