:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent: #10b981;
    --accent-hover: #059669;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs */
.background-blob {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0) 70%);
    top: -200px;
    left: -200px;
    z-index: -1;
    filter: blur(80px);
    animation: move 20s infinite alternate;
}

.background-blob.second {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, rgba(56, 189, 248, 0) 70%);
    bottom: -200px;
    right: -200px;
    top: auto;
    left: auto;
    animation: move 25s infinite alternate-reverse;
}

@keyframes move {
    from { transform: translate(0, 0); }
    to { transform: translate(100px, 100px); }
}

.container {
    width: 95%;
    max-width: 1200px;
    margin: 20px auto;
    z-index: 10;
}

@media (min-width: 768px) {
    .container {
        width: 90%;
        margin: 40px auto;
    }
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

header h1 span {
    color: var(--primary);
}

header p {
    color: var(--text-muted);
}

.logo-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

.logo-link:hover {
    opacity: 0.8;
}

.header-nav {
    margin-top: 15px;
}

.nav-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
}

.nav-link:hover {
    text-decoration: underline;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.icon-box {
    width: 64px;
    height: 64px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    color: var(--primary);
}

.icon-box svg {
    width: 32px;
    height: 32px;
}

.upload-area h3 {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.upload-area p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 240px 1fr 340px;
    gap: 24px;
}

@media (max-width: 1000px) {
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .batch-sidebar {
        grid-row: 3;
        flex-direction: row;
        overflow-x: auto;
        max-height: 150px;
    }
    .batch-list {
        flex-direction: row;
    }
    .thumb-item {
        flex: 0 0 150px;
    }
}

@media (max-width: 600px) {
    .glass-card {
        padding: 20px;
    }
    header h1 {
        font-size: 1.8rem;
    }
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

.batch-sidebar {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 600px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#batch-count {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}

.batch-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.batch-list::-webkit-scrollbar {
    width: 4px;
}

.batch-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.thumb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.thumb-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.thumb-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.thumb-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.thumb-info {
    flex: 1;
    overflow: hidden;
}

.thumb-info p {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thumb-info span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.preview-section {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    min-height: 300px;
    border: 1px solid var(--glass-border);
}

.preview-container {
    width: 100%;
    height: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#image-preview {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

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

.estimate {
    display: block;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
}

/* Controls */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.filter-item {
    background: rgba(0, 0, 0, 0.02);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.filter-item span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.filter-input {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    appearance: none;
    outline: none;
    border-radius: 2px;
}

.filter-input::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

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

.input-field {
    flex: 1;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    transition: var(--transition);
}

.input-field span {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-right: 8px;
}

.input-field input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    padding: 12px 0;
    outline: none;
    font-size: 0.95rem;
}

.input-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.lock-btn {
    background: white;
    border: 1px solid var(--glass-border);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.lock-btn.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary);
}

.lock-btn svg { width: 20px; }

.format-chips {
    display: flex;
    gap: 8px;
}

.chip {
    flex: 1;
    background: white;
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Range Input */
#quality-input {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    appearance: none;
    outline: none;
}

#quality-input::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#quality-value {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}

.unit-select {
    background: white;
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    font-weight: 600;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Actions */
.actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.3);
}

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

.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.3);
}

.btn-accent:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-accent svg, .btn-primary svg { width: 20px; }

.btn-secondary.small {
    padding: 8px;
    font-size: 0.8rem;
    border-radius: 10px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 12px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-main);
}

.hidden { display: none !important; }

footer {
    text-align: center;
    margin-top: 40px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
