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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 50px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    position: relative;
}

h1 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2.8em;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #64748b;
    margin-bottom: 40px;
    font-size: 1.2em;
    text-align: center;
    font-weight: 400;
    line-height: 1.5;
}

.alert {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.alert h3 {
    color: #b45309;
    margin-bottom: 10px;
}

.alert p {
    color: #78350f;
    line-height: 1.6;
}

.upload-section {
    border: 3px dashed #cbd5e1;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
}

.upload-section:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.upload-section.dragover {
    border-color: #667eea;
    background: #eef2ff;
    transform: scale(1.02);
}

input[type="file"] {
    display: none;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: transform 0.2s;
    display: inline-block;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.controls {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 35px;
    margin-bottom: 40px;
    display: none;
    border: 1px solid #e2e8f0;
}

.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 35px;
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    color: #475569;
    font-weight: 600;
    font-size: 15px;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.value-display {
    color: #667eea;
    font-size: 16px;
    font-weight: 700;
}

.preview-section {
    display: none;
}

.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 50px;
    padding: 0 20px;
}

.comparison-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
}

.comparison-item h3 {
    margin-bottom: 20px;
    color: #1e293b;
    font-size: 18px;
}

.canvas-wrapper {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    display: inline-block;
    margin-bottom: 15px;
}

canvas {
    display: block;
    image-rendering: pixelated;
}

.size-label {
    color: #64748b;
    font-size: 14px;
    margin-top: 10px;
}

.output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
    margin: 30px 0;
    padding: 0 10px;
}

.output-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: transform 0.2s;
}

.output-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.output-item h4 {
    margin-bottom: 15px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
}

.download-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s;
    margin-top: 10px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 30px;
    padding: 20px 0;
}

.download-all {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 36px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.download-all:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.generate-html {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 18px 36px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.2);
}

.generate-html:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
}

.stats {
    background: #eef2ff;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: left;
}

.stats p {
    color: #4338ca;
    font-size: 13px;
    margin: 5px 0;
}

/* New Phase 2 Features Styles */
.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
    opacity: 1 !important;
}

.batch-info {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    .control-row {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .comparison {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 0;
    }
    
    .output-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .container {
        padding: 25px;
        margin: 10px;
    }
    
    .upload-section {
        padding: 40px 25px;
    }
    
    h1 {
        font-size: 2.2em;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .download-all, .generate-html {
        width: 100%;
        max-width: 300px;
    }
}

/* Loading states */
.processing {
    opacity: 0.7;
    pointer-events: none;
}

/* Notification animations */
#notification {
    animation: notificationSlide 0.3s ease-out;
}

@keyframes notificationSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Enhanced upload section */
.upload-section {
    position: relative;
    overflow: hidden;
}

.upload-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.upload-section:hover::before {
    opacity: 1;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}