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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    color: #333;
}

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

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

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

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 20px;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #4caf50;
    background: #e8f5e8;
}

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

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    margin-bottom: 20px;
}

.upload-btn {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
    font-weight: 600;
}

.upload-btn:hover {
    background: #5a6fd8;
}

.file-info {
    font-size: 0.9rem;
    color: #999;
    margin-top: 15px;
}

/* File Info Section */
.file-info-section {
    margin-bottom: 30px;
}

.file-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9ff;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.file-meta h3 {
    color: #333;
    margin-bottom: 5px;
}

.file-meta p {
    color: #666;
    font-size: 0.9rem;
}

.clear-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.clear-btn:hover {
    background: #d32f2f;
}

/* Controls Section */
.controls-section {
    margin-bottom: 30px;
}

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

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

.control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.control-group select,
.control-group input[type="text"] {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.control-group input[type="range"] {
    margin-bottom: 5px;
}

.control-group span {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.convert-btn,
.download-all-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.convert-btn:hover,
.download-all-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.download-all-btn {
    background: #4caf50;
}

.download-all-btn:hover {
    background: #45a049;
}

/* Progress Section */
.progress-section {
    margin-bottom: 30px;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: #666;
    font-weight: 600;
}

/* Preview Section */
.preview-section {
    margin-bottom: 30px;
}

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

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.preview-item {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s ease;
}

.preview-item:hover {
    transform: translateY(-5px);
}

.preview-item canvas {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 10px;
}

.preview-item .page-info {
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.preview-item .download-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.preview-item .download-btn:hover {
    background: #45a049;
}

/* Error Section */
.error-section {
    margin-bottom: 30px;
}

.error-message {
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: #d32f2f;
}

.error-message i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 15px;
}

.loading-spinner p {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .main-content {
        padding: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 40px 15px;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .convert-btn,
    .download-all-btn {
        width: 100%;
        max-width: 300px;
    }

    .file-details {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .upload-area {
        padding: 30px 10px;
    }

    .preview-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.6;
    pointer-events: none;
}
