:root {
    --bg-color: #0F0F1A;
    --surface-color: #1a1a24;
    --surface-hover: #252533;
    --border-color: #2c2c3d;
    --text-primary: #DFE6E9;
    --text-minor: #636E72;
    --accent-color: #6C5CE7;
    --accent-hover: #5a4bcf;
    --radius: 10px;
    --font: 'Inter', system-ui, sans-serif;
    --transition: all 0.2s ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.text-minor {
    color: var(--text-minor);
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}

/* Base Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-header {
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 340px;
    min-width: 340px;
    background-color: var(--surface-color);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    padding: 1.5rem;
}

/* UI Elements */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--font);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

/* Sidebar Elements */
.sidebar-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-minor);
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
}

input[type="text"],
input[type="file"],
select {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus,
select:focus {
    border-color: var(--accent-color);
}

input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid var(--border-color);
    width: 100%;
    height: 38px;
    border-radius: var(--radius);
    padding: 0;
    cursor: pointer;
    background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background-color: var(--bg-color);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent-color);
    background-color: rgba(108, 92, 231, 0.05);
}

.file-list {
    margin-top: 1rem;
    max-height: 150px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--bg-color);
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.file-remove {
    cursor: pointer;
    color: var(--text-minor);
    padding: 0.2rem;
}

.file-remove:hover {
    color: #ff7675;
}

/* Workspace Area */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.preview-header h2 {
    font-size: 1.1rem;
    font-weight: 500;
}

.preview-controls {
    display: flex;
    align-items: center;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-minor);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: white;
}

/* Preview Container */
.preview-container {
    flex: 1;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background-image: linear-gradient(45deg, var(--bg-color) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bg-color) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bg-color) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bg-color) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Compare Slider */
.compare-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.compare-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.compare-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-overlay canvas {
    /* To align exactly with the img, we need to match dimensions via JS or CSS */
    position: absolute;
}

.compare-slider-handle {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: white;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
}

.compare-slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: white;
    color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    gap: 2px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 15, 26, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    width: 400px;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    transition: width 0.2s ease;
}