* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
}

/* 语言切换按钮 */
.language-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.language-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 50px;
    color: white;
    animation: fadeInUp 1s ease-out;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;
}

/* 使用指南样式 */
.usage-guide {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 1s ease-out 0.2s both;
}

.usage-guide h3 {
    color: #667eea;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.usage-guide h3::before {
    content: "📖";
    font-size: 1.2rem;
}

.usage-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.usage-step {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 15px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: transform 0.3s ease;
}

.usage-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.usage-step h4 {
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-step p {
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

main {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 1s ease-out 0.4s both;
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 20px;
    padding: 50px 30px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.02), rgba(118, 75, 162, 0.02));
    overflow: hidden;
    animation: fadeInUp 1s ease-out 0.6s both;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.upload-area:hover::before {
    left: 100%;
}

.upload-area:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2);
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12), rgba(118, 75, 162, 0.12));
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
}

.upload-area.has-file {
    border-color: #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(139, 195, 74, 0.05));
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.8;
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.upload-content {
    pointer-events: none;
    position: relative;
    z-index: 2;
}

.upload-content p {
    color: #555;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 1rem;
    color: #888;
    font-style: italic;
    margin-top: 10px;
}

.upload-hint {
    font-size: 0.9rem !important;
    color: #888 !important;
    margin-top: 10px;
}

.file-details {
    display: flex;
    gap: 15px;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.file-name {
    font-weight: 500;
    color: #333;
}

.remove-btn {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: #ff3742;
}

.preview-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.preview-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.preview-info {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    text-align: center;
}

.preview-description {
    margin: 0;
    color: #555;
    font-size: 1rem;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.page-preview {
    text-align: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: white;
}

.page-preview canvas {
    border: 1px solid #ddd;
    border-radius: 5px;
    max-width: 100%;
    height: auto;
}

.page-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.merge-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.merge-pairs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.merge-pair {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.merge-pair-pages {
    display: flex;
    gap: 5px;
    align-items: center;
}

.merge-pair-page {
    width: 40px;
    height: 50px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #666;
}

.merge-arrow {
    color: #667eea;
    font-weight: bold;
}

.preview-item {
    text-align: center;
}

.preview-item h4 {
    margin-bottom: 15px;
    color: #555;
}

.preview-item canvas {
    border: 1px solid #ddd;
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.layout-info {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
}

.merge-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.merge-options h3 {
    margin-bottom: 20px;
    color: #333;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.option-group label:hover {
    background: rgba(102, 126, 234, 0.05);
}

.option-group input[type="radio"],
.option-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.option-group h4 {
    margin: 15px 0 10px 0;
    color: #333;
    font-size: 16px;
}

.scale-controls {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.scale-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.scale-controls input[type="range"] {
    flex: 1;
    margin: 0 10px;
}

#scaleValue {
    min-width: 50px;
    font-weight: bold;
    color: #007bff;
}

.merge-btn {
    width: 100%;
    padding: 18px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    animation: fadeInUp 1s ease-out 0.8s both;
    overflow: hidden;
}

.merge-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.merge-btn:hover::before {
    left: 100%;
}

.merge-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.merge-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.merge-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    text-align: center;
}

.result-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.result-preview {
    margin-bottom: 20px;
}

.result-preview canvas {
    border: 1px solid #ddd;
    border-radius: 10px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.download-btn {
    padding: 12px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    z-index: 1000;
}

.progress-fill {
    height: 100%;
    background: #4CAF50;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 1001;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .upload-section,
    .preview-container {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

/* 错误提示样式 */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #c62828;
}

.success-message {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid #2e7d32;
}
