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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header > div:first-child {
    text-align: left;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 500px 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 450px 1fr;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.controls-panel,
.result-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    box-shadow: var(--shadow-md);
}

.controls-panel {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar */
.controls-panel::-webkit-scrollbar {
    width: 8px;
}

.controls-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.controls-panel::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Section */
.section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.section:last-child {
    border-bottom: none;
}

.section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
    border-width: 3px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.upload-placeholder svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-placeholder p {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.file-info {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.preview-image {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

/* Control Groups */
.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.label-text {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background: var(--primary-color);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::before {
    transform: translateX(24px);
    background: white;
}

/* Range Input */
input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.input-with-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.value-display {
    min-width: 65px;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
}

/* Text Inputs */
input[type="text"],
input[type="number"],
textarea,
.seed-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
.seed-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.number-input {
    max-width: 120px;
}

.seed-input-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: var(--bg-primary);
    transform: scale(1.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 10px;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-download {
    background: var(--success-color);
    color: white;
}

.btn-download:hover {
    background: #16a34a;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Container */
.result-container {
    min-height: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 40px;
    position: relative;
}

.empty-state {
    text-align: center;
}

.empty-state svg {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state p {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.empty-state span {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Loading State */
.loading-state {
    text-align: center;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.loading-state span {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Result Image */
.result-image {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.result-actions {
    width: 100%;
}

/* Image Comparison Slider */
.image-comparison-container {
    width: 100%;
    margin-bottom: 20px;
}

.comparison-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    user-select: none;
    display: inline-block;
}

.comparison-image {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    max-width: 100%;
}

.before-image {
    position: relative;
    z-index: 1;
    display: block;
}

.after-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
    z-index: 2;
}

.after-image {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    max-width: none;
}

.comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    cursor: ew-resize;
    z-index: 3;
    transform: translateX(-50%);
    transition: background 0.2s ease;
}

.comparison-slider:hover {
    background: var(--primary-hover);
}

.comparison-slider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 100%;
    cursor: ew-resize;
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.comparison-slider:hover .slider-button {
    background: var(--primary-hover);
    transform: translate(-50%, -50%) scale(1.1);
}

.slider-button svg {
    width: 16px;
    height: 16px;
    color: white;
}

.comparison-labels {
    position: absolute;
    top: 16px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 4;
    pointer-events: none;
}

.label-before,
.label-after {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.label-after {
    background: rgba(99, 102, 241, 0.9);
}

/* Processing Info */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.info-value {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.footer p {
    margin-bottom: 8px;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

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

.section {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        max-height: none;
    }
}

