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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 20px;
}

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

header p {
    color: rgba(255,255,255,0.8);
    font-size: 1.1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.tool-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.tool-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.tool-card h3 {
    color: #333;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.tool-card p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tool-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tool-header {
    background: white;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.tool-header h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.tool-header p {
    color: #666;
}

.upload-area {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
}

.drop-zone {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: border-color 0.3s, background 0.3s;
    cursor: pointer;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: #667eea;
    background: #f8f9ff;
}

.drop-zone .upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.drop-zone p {
    color: #666;
    margin-bottom: 10px;
}

.drop-zone small {
    color: #999;
}

#fileInput {
    display: none;
}

.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.file-item .file-info {
    flex: 1;
}

.file-item .file-name {
    font-weight: 500;
    color: #333;
}

.file-item .file-pages {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 500;
}

.file-item .file-size {
    font-size: 0.85rem;
    color: #999;
}

.file-item .remove-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.file-item .remove-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.5);
}

.options {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
}

.options h3 {
    color: #333;
    margin-bottom: 20px;
}

.option-group {
    margin-bottom: 20px;
}

.option-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.option-group select,
.option-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.option-group select:focus,
.option-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

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

.btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.progress-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.3s;
}

.result-container {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    display: none;
}

.result-container.success {
    display: block;
}

.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.result-icon {
    width: 50px;
    height: 50px;
    background: #2ed573;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-right: 20px;
}

.result-header h3 {
    color: #333;
    font-size: 1.3rem;
}

.result-files {
    margin-bottom: 20px;
}

.result-file {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.result-file .file-info {
    flex: 1;
}

.result-file .file-name {
    font-weight: 500;
    color: #333;
}

.result-file .file-size {
    font-size: 0.85rem;
    color: #999;
}

.download-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.4);
    font-weight: 500;
    transition: background 0.3s;
}

.download-btn:hover {
    background: #5a6fd6;
}

.error-message {
    background: #ffebee;
    border-left: 4px solid #ff4757;
    padding: 15px;
    border-radius: 0 8px 8px 0;
    color: #c62828;
    margin-bottom: 20px;
    display: none;
}

.back-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 30px;
}

.back-link:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

footer a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .tool-card {
        padding: 20px;
    }
    
    .tool-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .drop-zone {
        padding: 25px;
    }
}
