/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(to right, #4b6cb7, #182848);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* 上传区域 */
.upload-section, .recent-documents {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.upload-section h2, .recent-documents h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4b6cb7;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-input-custom {
    background: white;
    border: 2px dashed #4b6cb7;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    z-index: 1;
    position: relative;
}

.file-input-custom:hover {
    background: #f0f4ff;
    border-color: #182848;
}

.file-input-custom i {
    font-size: 2rem;
    color: #4b6cb7;
    margin-bottom: 10px;
    display: block;
}

.file-input-custom span {
    color: #4b6cb7;
    font-weight: 600;
}

.form-group small {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(to right, #4b6cb7, #182848);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(75, 108, 183, 0.4);
}

.btn-secondary {
    background: #ecf0f1;
    color: #34495e;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-sign {
    background: #27ae60;
    color: white;
}

.btn-download {
    background: #2980b9;
    color: white;
}

/* 文档列表 */
.documents-list {
    max-height: 400px;
    overflow-y: auto;
}

.document-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #4b6cb7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.document-item:hover {
    transform: translateX(5px);
}

.document-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #2c3e50;
}

.document-info p {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.uploaded {
    background: #f39c12;
    color: white;
}

.status.signed {
    background: #27ae60;
    color: white;
}

.no-documents {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

/* 签名页面样式 */
.signature-container {
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 992px) {
    .signature-container {
        grid-template-columns: 1fr 1fr;
    }
}

.contract-preview, .signature-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
}

.contract-preview h3, .signature-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4b6cb7;
}

.preview-image {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 签名画布 */
.canvas-container {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    background: white;
    height: 200px;
    margin-bottom: 20px;
    overflow: hidden;
}

#signatureCanvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.signature-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.signature-form .form-group {
    margin-bottom: 15px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

input[type="range"] {
    width: calc(100% - 50px);
    vertical-align: middle;
}

#sizeValue {
    display: inline-block;
    width: 40px;
    text-align: center;
    font-weight: 600;
}

/* 下载页面样式 */
.download-container {
    padding: 30px;
}

.success-message, .error-message {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 30px;
}

.success-icon {
    font-size: 4rem;
    color: #27ae60;
    margin-bottom: 20px;
}

.error-icon {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 20px;
}

.signed-preview {
    margin-bottom: 30px;
}

.signed-preview .preview-image {
    height: 400px;
}

.document-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.document-details h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.document-details ul {
    list-style: none;
}

.document-details li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.document-details li:last-child {
    border-bottom: none;
}

.download-actions {
    text-align: center;
    margin-bottom: 30px;
}

.btn-download-large {
    background: linear-gradient(to right, #27ae60, #219653);
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.share-options {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.share-link {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.share-link input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-share {
    background: #3498db;
    color: white;
}

.btn-share.whatsapp {
    background: #25D366;
}

.action-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* 页脚样式 */
footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 30px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .main-content, .signature-container {
        grid-template-columns: 1fr;
    }
    
    .share-link {
        flex-direction: column;
    }
    
    .document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}