* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.main-content {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.config-panel {
    flex: 0 0 350px;
    background: #f5f6f7;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e8ecef;
    /* 移除高度限制，让内容自然展开 */
    /* max-height: calc(100vh - 200px); */
    /* overflow-y: auto; */
}

.config-section {
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #3498db;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(44, 62, 80, 0.03);
}

.config-section:hover {
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.12);
    background: #f0f7ff;
}

.config-section:last-child {
    margin-bottom: 0;
}

.more-config-section {
    border: 1px solid #3498db;
    border-radius: 6px;
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(44, 62, 80, 0.03);
    transition: all 0.2s;
}

.more-config-section:hover {
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.12);
}

.more-config-section .config-section {
    background: transparent;
    border: none;
    padding: 12px 15px;
    margin-bottom: 0;
}

.more-config-section .config-section:hover {
    box-shadow: none;
    border-color: transparent;
}

.more-config-header {
    padding: 12px 15px;
    background: #f0f2f5;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border-bottom: 1px solid #e8ecef;
}

.more-config-header:hover {
    background: #e3f2fd;
    border-bottom-color: #3498db;
}

.more-toggle-icon {
    font-size: 11px;
    color: #3498db;
    transition: all 0.3s;
    font-weight: bold;
}

.more-config-header:hover .more-toggle-icon {
    color: #2c3e50;
    transform: scale(1.1);
}

.more-config-content {
    padding: 12px 15px;
    border-top: 1px solid #e8ecef;
    background: #fafbfc;
}

.more-config-content .config-section {
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
    padding-bottom: 10px;
}

.more-config-content .config-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.more-config-content .config-section h3 {
    font-size: 14px;
    border-bottom: 1px solid #e8e8e8;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.config-section h3 {
    font-size: 15px;
    margin-bottom: 10px;
    margin-top: 0;
    color: #2c3e50;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
    background: linear-gradient(90deg, transparent 0%, rgba(52, 152, 219, 0.05) 100%);
    padding-left: 4px;
    margin-left: -4px;
    padding-right: 4px;
    margin-right: -4px;
}

.form-control {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
    background: #ffffff;
}

.form-control:hover {
    border-color: #3498db;
    background: #f8fbff;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
    background: #ffffff;
}

.preview-panel {
    flex: 1;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.preview-header h3 {
    font-size: 15px;
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
}

.pdf-preview:focus {
    outline: none;
}

.pdf-preview {
    min-height: 500px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    background: #fafafa;
    margin-bottom: 12px;
    overflow-y: auto;
    flex: 1;
}

.pdf-preview canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.stamp-preview-overlay {
    border: none;
    background: transparent;
    border-radius: 4px;
    pointer-events: auto;
    transition: all 0.2s;
}

.stamp-preview-overlay:hover {
    border: none;
    background: transparent;
    box-shadow: none;
}

.stamp-delete-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 1001;
}

.stamp-delete-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.preview-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.stamp-preview {
    text-align: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 6px;
}

.stamp-preview h4 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
}

.stamp-preview canvas {
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-upload {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-upload:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
}

/* 美化上一页/下一页按钮 */
.btn-page {
    background: #3498db;
    color: white;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(52, 152, 219, 0.3);
}

.btn-page:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

.btn-page:disabled {
    background: #bdc3c7;
    opacity: 0.6;
    cursor: not-allowed;
}

.page-info {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    padding: 0 8px;
    min-width: 120px;
    text-align: center;
}

/* 按钮组：让开始签章和下载PDF按钮并排显示，各占约一半宽度 */
.button-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.button-group .btn {
    flex: 1;
}

/* 印章选择组：分组和印章选择并排显示，节省空间 */
.stamp-select-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.stamp-select-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    background: transparent;
}

.stamp-select-item:hover {
    background: rgba(52, 152, 219, 0.04);
    transform: translateY(-1px);
}

.progress-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    margin-bottom: 15px;
}

.progress-section h3 {
    font-size: 15px;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 28px;
    background: #ecf0f1;
    border-radius: 14px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.file-list {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.file-list h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 15px;
    font-weight: 600;
}

.file-list ul {
    list-style: none;
}

.file-list li {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.file-list li:hover {
    background: #f8f9fa;
}

.file-list li:last-child {
    border-bottom: none;
}

/* 美化文件选择按钮 */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 8px;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-input-label {
    display: block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.25);
    font-size: 14px;
    font-weight: 500;
}

.file-input-label:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.file-input-wrapper input[type="file"]:focus + .file-input-label {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.stamp-preview-image {
    margin-top: 8px;
    text-align: center;
}

.stamp-preview-image img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 5px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    object-fit: contain;
    transition: all 0.2s;
    cursor: pointer;
}

.stamp-preview-image img:hover {
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
    transform: scale(1.02);
}

/* 印章设置网格布局 - 一行2个，响应式 */
.stamp-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.stamp-setting-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    background: transparent;
}

.stamp-setting-item:hover {
    background: rgba(52, 152, 219, 0.04);
    transform: translateY(-1px);
}

.setting-label {
    font-size: 12px;
    color: #495057;
    font-weight: 500;
    transition: color 0.2s;
}

.stamp-setting-item:hover .setting-label,
.stamp-select-item:hover .setting-label {
    color: #2c3e50;
}

.setting-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 14px;
}

/* select样式 - 保持简洁，与普通input一致 */
select.form-control,
select.setting-input {
    cursor: pointer;
}

/* 响应式：空间不够时改为单列 */
@media (max-width: 400px) {
    .stamp-settings-grid {
        grid-template-columns: 1fr;
    }
    .stamp-select-group {
        grid-template-columns: 1fr;
    }
}

label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #3498db;
    transition: all 0.2s;
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
    filter: brightness(1.1);
}

/* 输出设置区域美化 */
.output-settings {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e8ecef;
    background: #f5f7fa;
    padding: 12px;
    margin-left: -12px;
    margin-right: -12px;
    margin-bottom: -12px;
    border-radius: 0 0 6px 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label:hover {
    color: #2c3e50;
}

.checkbox-text {
    flex-shrink: 0;
    min-width: 80px;
    font-size: 14px;
    user-select: none;
    display: inline-block;
}

.pdf-password-input {
    flex: 1;
    max-width: 200px;
    margin-left: 8px;
    padding: 6px 10px;
    font-size: 13px;
    transition: all 0.3s ease;
    opacity: 0;
    width: 0;
    min-width: 0;
    overflow: hidden;
    border: 1px solid transparent;
    visibility: hidden;
}

.pdf-password-input.show {
    opacity: 1;
    width: auto;
    min-width: 150px;
    border-color: #d1d5db;
    visibility: visible;
}

.pdf-password-input:hover {
    border-color: #3498db;
    background: #f8fbff;
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .config-panel {
        flex: 1;
        max-height: none;
    }
}

