:root {
    --primary: #6366f1;
    --secondary: #4f46e5;
    --accent: #ef4444;
    --background: #f8fafc;
    --text: #1e293b;
    --border: #e2e8f0;
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.header {
    padding: 1.5rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary);
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-box {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.upload-box.dragover {
    background: rgba(99, 102, 241, 0.05) !important;
    border-color: var(--primary) !important;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.preview-box {
    display: none;
    margin-top: 2rem;
}

.preview-box.visible {
    display: block;
}

#imagePreview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.image-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.controls {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.control-group {
    margin-bottom: 1.5rem;
}

.custom-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: white;
}

.slider {
    width: 100%;
    height: 0.5rem;
    background: #e2e8f0;
    border-radius: 0.25rem;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.optimize-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.3s ease;
}

.optimize-btn:hover {
    background: var(--secondary);
}

.optimize-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.result-section {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.result-card {
    text-align: center;
}

.comparison {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

.download-btn {
    background: var(--accent);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    transition: background 0.3s ease;
}

.download-btn:hover {
    background: #dc2626;
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .upload-box {
        padding: 2rem;
    }
    
    .comparison {
        flex-direction: column;
        gap: 1rem;
    }
}