* {
    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;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    background: white;
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #667eea;
    margin: 0 auto 20px;
}

.upload-content p {
    color: #333;
    font-size: 1.1rem;
    margin: 5px 0;
}

.upload-hint {
    color: #666;
    font-size: 0.9rem;
}

.controls-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.control-group input[type="number"],
.control-group input[type="range"],
.control-group select,
.control-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.control-group input[type="number"]:focus,
.control-group select:focus,
.control-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.control-group input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    padding: 0;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#qualityValue {
    display: inline-block;
    margin-left: 10px;
    font-weight: 600;
    color: #667eea;
}

.process-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.process-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.process-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.preview-section {
    margin-bottom: 30px;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.preview-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.preview-box h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.preview-box img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    max-height: 400px;
    object-fit: contain;
}

.remove-btn,
.download-btn {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.remove-btn {
    background: #ff4757;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.remove-btn:hover {
    background: #ff3838;
    transform: translateY(-2px);
}

.download-btn {
    background: #2ed573;
    color: white;
}

.download-btn:hover {
    background: #26d367;
    transform: translateY(-2px);
}

.error-message {
    background: #ff4757;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 40px 15px;
    }

    .controls-section {
        padding: 20px;
    }

    .preview-container {
        grid-template-columns: 1fr;
    }
}

