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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #e9ecef;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: #ffffff;
    padding: 0;
    padding-top: 0;
    padding-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 主布局：左右边栏 */
.main-layout {
    display: flex;
    width: 100%;
    flex: 1;
    min-height: 0;
    gap: 0;
    overflow: hidden;
    padding: 20px 40px;
}

/* 左边栏：信息设置 */
.sidebar-left {
    width: 380px;
    min-width: 300px;
    max-width: 50%;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    overflow-x: hidden;
    resize: horizontal;
}

.sidebar-left::-webkit-scrollbar {
    width: 8px;
}

.sidebar-left::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-left::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 拖动分隔条 */
.resizer {
    width: 4px;
    background: #dee2e6;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s;
}

.resizer:hover {
    background: #0d6efd;
}

.resizer::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transform: translateX(-50%);
}

.resizer:hover::before {
    background: #0d6efd;
}

/* 右边栏：上传和预览 */
.sidebar-right {
    flex: 1;
    min-width: 400px;
    background: #ffffff;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-right::-webkit-scrollbar {
    width: 8px;
}

.sidebar-right::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-right::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.sidebar-right::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 边栏内容 */
.sidebar-content {
    padding: 15px;
    height: 100%;
}

/* 顶部导航栏样式 */
.header {
    background: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 15px 0;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    z-index: 100;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 40px;
    text-align: center;
}

h1 {
    color: #495057;
    margin: 0;
    text-align: center;
    font-size: 1.5em;
    font-weight: 600;
    padding: 0;
    border: none;
}

h2 {
    color: #495057;
    margin: 0 0 15px 0;
    font-size: 1.3em;
    font-weight: 600;
}

/* 右边栏的 h2 保持原样 */
.sidebar-right h2 {
    margin: 0 0 20px 0;
    font-size: 1.6em;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.upload-area {
    border: 2px dashed #6c757d;
    border-radius: 8px;
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #ffffff;
}

.upload-area:hover {
    border-color: #0d6efd;
    background: #f0f7ff;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.1);
}

.upload-placeholder {
    color: #6c757d;
}

.upload-placeholder:hover {
    color: #0d6efd;
}

.upload-placeholder svg {
    margin-bottom: 10px;
}

.upload-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    display: none;
}

.upload-status.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
    display: block;
}

.upload-status.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    display: block;
}

/* 预览区域 */
.preview-section {
    margin-bottom: 0;
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 15px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.page-range {
    margin-left: auto;
    color: #6c757d;
    font-weight: 500;
}

.pdf-preview {
    margin-top: 20px;
}

.pdf-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 25px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

/* 占位符提示全宽显示 */
.pdf-placeholder {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    background: #ffffff;
    border-radius: 8px;
    border: 2px dashed #ced4da;
    cursor: pointer;
    transition: all 0.3s;
}

.pdf-placeholder:hover {
    border-color: #0d6efd;
    background: #f8f9ff;
    color: #0d6efd;
}

.pdf-placeholder:hover svg {
    opacity: 0.7;
    color: #0d6efd;
}

.pdf-placeholder:hover p {
    color: #0d6efd;
}

.pdf-placeholder svg {
    margin: 0 auto 20px;
    display: block;
    opacity: 0.4;
    color: #6c757d;
    transition: all 0.3s;
}

.pdf-placeholder p {
    font-size: 16px;
    margin: 0;
    font-weight: 500;
    color: #6c757d;
    transition: color 0.3s;
}

.pdf-thumbnail {
    background: #ffffff;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.pdf-thumbnail:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
    transform: translateY(-2px);
}

.pdf-thumbnail iframe,
.pdf-thumbnail object,
.pdf-thumbnail embed {
    width: 100%;
    height: 280px;
    border: none;
    border-radius: 3px;
}

.pdf-thumbnail object {
    display: block;
}

.pdf-thumbnail canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    /* 提高图像渲染质量 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: auto;
}

.pdf-thumbnail .page-number {
    margin-top: 10px;
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

/* 信息设置区域 */
.watermark-section {
    margin-top: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.watermark-section h2 {
    margin: 0 0 15px 0;
    font-size: 1.3em;
    color: #495057;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.watermark-group {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.watermark-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.watermark-group-title {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.remove-group-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    font-weight: 500;
}

.remove-group-btn:hover {
    background: #bb2d3b;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.25);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #495057;
    font-weight: 500;
    font-size: 13px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: #ffffff;
    color: #495057;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
    background: #ffffff;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: #0d6efd;
    color: white;
}

.btn-primary:hover {
    background: #0a58ca;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: #198754;
    color: white;
}

.btn-success:hover {
    background: #157347;
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.3);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:not(.btn-primary):not(.btn-success) {
    background: #6c757d;
    color: white;
}

.btn:not(.btn-primary):not(.btn-success):hover {
    background: #5c636a;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
    transform: translateY(-1px);
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.action-buttons .btn {
    flex: 1;
    max-width: 200px;
}

#addWatermarkGroup {
    width: 100%;
    margin-bottom: 15px;
}

/* 页脚样式 */
.footer {
    background: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 15px 0;
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.footer-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 40px;
    text-align: center;
}

.footer-content p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
}

.footer-content a {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-content a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.footer-separator {
    margin: 0 8px;
    color: #adb5bd;
}

/* 统一导航栏和页脚的样式 */
.header,
.footer {
    background: #ffffff;
    border-color: #dee2e6;
    padding: 15px 0;
}

.header-content,
.footer-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 40px;
    text-align: center;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 30px;
    }
    
    h2 {
        font-size: 1.4em;
    }
    
    .main-layout {
        flex-direction: column;
        flex: 1;
        min-height: 0;
        padding: 10px 20px;
    }
    
    .container {
        height: 100vh;
        overflow: hidden;
    }
    
    .sidebar-left {
        width: 100% !important;
        min-width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        resize: none;
    }
    
    .resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
        background: #dee2e6;
    }
    
    .sidebar-right {
        width: 100%;
        min-width: 100%;
    }
    
    .upload-section,
    .preview-section,
    .watermark-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .preview-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .page-range {
        margin-left: 0;
        margin-top: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    .header-content,
    .footer-content {
        padding: 0 20px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .footer-content p {
        font-size: 12px;
    }
    
    .container {
        padding: 10px 20px;
        padding-bottom: 70px;
        padding-top: 0;
    }
}

