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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

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

header {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 500px;
    margin: 0 auto;
}

.upload-area {
    background: white;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 2px dashed #ddd;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-content svg {
    margin-bottom: 20px;
    color: #667eea;
}

.upload-content p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.small {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 20px;
}

.btn {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.btn.secondary {
    background: linear-gradient(90deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn.secondary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    min-height: 100px;
}

.image-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    height: 150px;
    background: #f8f9fa;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.mini-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.results {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.stat-item h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-item p {
    color: #888;
    font-size: 0.9rem;
}

.comparison-container {
    margin-bottom: 30px;
}

.panel.slider {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.panel.slider h3 {
    margin-bottom: 20px;
    font-weight: 600;
    color: #667eea;
}

/* Comparison Slider */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.comparison-item {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    cursor: ew-resize;
}

.comparison-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.comparison-item img:last-child {
    clip-path: inset(0 0 0 50%);
}

.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: #667eea;
    z-index: 10;
    transform: translateX(-50%);
    cursor: ew-resize;
}

.slider-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 100%;
    background: white;
    transform: translateX(-50%) translateY(-50%);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    transform: translateX(-50%) translateY(-50%);
    cursor: ew-resize;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.slider-button:hover {
    transform: translateX(-50%) translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.slider-button:active {
    transform: translateX(-50%) translateY(-50%) scale(0.95);
}

/* Thumbnail Grid */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.thumbnail-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.thumbnail-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.thumbnail-item.active {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.thumbnail-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.thumbnail-item .thumbnail-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 10px;
    text-align: center;
}

@media (max-width: 768px) {
    .comparison-item {
        height: 300px;
    }

    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .thumbnail-item img {
        height: 100px;
    }
}

.actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Loading Overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-content {
    text-align: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-content p {
    color: #667eea;
    font-weight: 600;
    margin: 0;
}

/* Image info overlay */
.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 12px;
    text-align: center;
    border-radius: 0 0 8px 8px;
}

@media (max-width: 768px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(3, 1fr);
    }

    header h1 {
        font-size: 2rem;
    }
}