/* PDF Merger Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Upload Section */
.upload-section {
    padding: 40px;
}

.upload-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.upload-area {
    border: 3px dashed #4facfe;
    border-radius: 15px;
    padding: 60px 40px;
    text-align: center;
    background: #f8fafb;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-area:hover {
    border-color: #00f2fe;
    background: #f0f8ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #00c851;
    background: #e8f5e8;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #4facfe;
}

.upload-text h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.upload-text p {
    color: #7f8c8d;
    font-size: 1rem;
}

.browse-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.browse-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.file-info {
    text-align: center;
    margin-top: 15px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* File List Section */
.file-list-section {
    padding: 0 40px 40px;
}

.file-list-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.file-list {
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    background: white;
    max-height: 400px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f4;
    transition: background 0.2s ease;
    cursor: grab;
    user-select: none;
}

.file-item:last-child {
    border-bottom: none;
}

.file-item:hover {
    background: #f8f9fa;
}

.file-item.dragging {
    opacity: 0.5;
    background: #e3f2fd;
}

.file-drag-handle {
    color: #95a5a6;
    margin-right: 15px;
    cursor: grab;
    font-size: 1.2rem;
}

.file-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    color: #e74c3c;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.file-meta {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.file-actions {
    display: flex;
    gap: 10px;
}

.file-remove {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s ease;
}

.file-remove:hover {
    background: #c0392b;
}

.list-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

/* Options Section */
.options-section {
    padding: 0 40px 40px;
}

.options-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

.option-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.option-group select {
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.2s ease;
}

.option-group select:focus {
    outline: none;
    border-color: #4facfe;
}

.merge-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Preview Section */
.preview-section {
    padding: 40px;
    background: #f8f9fa;
}

.preview-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-info {
    font-weight: 600;
    color: #2c3e50;
}

.preview-nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: #4facfe;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.nav-btn:hover {
    background: #3498db;
}

.nav-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.preview-container {
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

#previewCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
}

.preview-actions {
    text-align: center;
}

/* Processing Section */
.processing-section {
    padding: 60px 40px;
    background: #f8f9fa;
    text-align: center;
}

.processing-content {
    max-width: 400px;
    margin: 0 auto;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #e1e8ed;
    border-top: 6px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#processingTitle {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

#processingDescription {
    color: #7f8c8d;
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e8ed;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 600;
    color: #4facfe;
}

/* Results Section */
.results-section {
    padding: 60px 40px;
    background: #f8f9fa;
    text-align: center;
}

.results-content {
    max-width: 500px;
    margin: 0 auto;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.results-content h3 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: #27ae60;
}

.file-details {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-item .label {
    font-weight: 600;
    color: #2c3e50;
}

.detail-item .value {
    color: #4facfe;
    font-weight: 600;
}

.download-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.additional-actions {
    display: flex;
    justify-content: center;
}

/* Error Section */
.error-section {
    padding: 60px 40px;
    background: #f8f9fa;
    text-align: center;
}

.error-content {
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.error-content h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #e74c3c;
}

.error-content p {
    color: #7f8c8d;
    margin-bottom: 30px;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.download-icon {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .upload-section,
    .file-list-section,
    .options-section,
    .preview-section,
    .processing-section,
    .results-section,
    .error-section {
        padding: 30px 20px;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .download-actions,
    .error-actions,
    .merge-controls,
    .list-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .preview-controls {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .file-item {
        padding: 12px 15px;
    }
    
    .file-name {
        font-size: 0.9rem;
    }
    
    .file-meta {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .upload-text h3 {
        font-size: 1.2rem;
    }
}
