/* Modern CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --secondary-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Base Styles */
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;
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.dropzone {
    background: var(--card-background);
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.dropzone:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.dropzone.drag-over {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    transform: scale(1.02);
}

.dropzone-content {
    z-index: 1;
    position: relative;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.upload-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dropzone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
    left: 0;
}

/* Error Message */
.error-message {
    background: var(--error-color);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

/* Preview Section */
.preview-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    animation: slideIn 0.3s ease;
}

.preview-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    object-fit: contain;
}

.image-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.process-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.process-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.process-btn:active {
    transform: translateY(0);
}

/* Processing */
.processing {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.processing p {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.processing-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Result Section */
.result-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

.result-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.image-container {
    text-align: center;
}

.image-container h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.comparison-image {
    width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    object-fit: contain;
    border: 2px solid var(--border-color);
}

.download-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-btn {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.new-image-btn {
    background: var(--text-secondary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.new-image-btn:hover {
    background: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .dropzone {
        padding: 2rem 1rem;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .download-section {
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn, .new-image-btn {
        width: 100%;
        max-width: 300px;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .preview-section, .processing, .result-section {
        padding: 1rem;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .upload-text {
        font-size: 1rem;
    }
}
