* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.alert {
    padding: 15px 20px;
    margin: 0;
    border: none;
}

.alert.error {
    background: #fee;
    color: #c53030;
    border-left: 4px solid #c53030;
}

.alert.success {
    background: #f0fff4;
    color: #2d5016;
    border-left: 4px solid #38a169;
}

.download-btn {
    display: inline-block;
    background: #38a169;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 10px;
    font-weight: 600;
    transition: background 0.3s;
}

.download-btn:hover {
    background: #2f855a;
}

.upload-form {
    padding: 40px;
}

.file-input-wrapper {
    position: relative;
    margin-bottom: 30px;
}

#images {
    opacity: 0;
    position: absolute;
    z-index: -1;
}

.file-input-label {
    display: block;
    padding: 40px 20px;
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f7fafc;
}

.file-input-label:hover {
    border-color: #4facfe;
    background: #ebf8ff;
    transform: translateY(-2px);
}

.upload-icon {
    display: block;
    font-size: 3rem;
    margin-bottom: 10px;
}

.upload-text {
    display: block;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.file-info {
    display: block;
    font-size: 0.95rem;
    color: #718096;
}

/* Image Previews */
.image-previews {
    display: none;
    margin-bottom: 30px;
}

.image-previews h4 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.preview-item:hover {
    transform: translateY(-2px);
}

.preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.preview-placeholder {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 2rem;
}

.preview-placeholder.invalid {
    background: #fed7d7;
    color: #c53030;
}

.preview-info {
    text-align: center;
    width: 100%;
}

.preview-name {
    font-size: 0.75rem;
    color: #2d3748;
    font-weight: 500;
    margin-bottom: 2px;
    word-break: break-word;
    line-height: 1.2;
}

.preview-size {
    font-size: 0.7rem;
    color: #718096;
}

.preview-error {
    font-size: 0.7rem;
    color: #c53030;
    margin-top: 2px;
}

.convert-btn {
    width: 100%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 18px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.3);
}

.convert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Section */
.progress-section {
    margin-top: 25px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    font-weight: 600;
    color: #2d3748;
    z-index: 1;
}

.progress-message {
    text-align: center;
    color: #4a5568;
    font-size: 0.9rem;
    margin: 0;
}

/* Result Section */
.result-section {
    margin-top: 25px;
}

.success-message {
    padding: 25px;
    background: #f0fff4;
    color: #2d5016;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #9ae6b4;
}

.success-message h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.success-message p {
    margin-bottom: 15px;
    font-size: 1rem;
}

.download-btn {
    display: inline-block;
    background: #38a169;
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.download-btn:hover {
    background: #2f855a;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
    border-top: 1px solid #e2e8f0;
}

.feature {
    padding: 30px 20px;
    text-align: center;
    border-right: 1px solid #e2e8f0;
}

.feature:last-child {
    border-right: none;
}

.feature h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #2d3748;
}

.feature p {
    font-size: 0.9rem;
    color: #718096;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .upload-form {
        padding: 20px;
    }
    
    .file-input-label {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .upload-text {
        font-size: 1.1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .preview-image, .preview-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .feature {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .feature:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .upload-form {
        padding: 15px;
    }
    
    .file-input-label {
        padding: 20px 10px;
    }
}