:root {
    --bg-deep: #0a0c10;
    --bg-surface: #111418;
    --bg-elevated: #1a1d23;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --border: #30363d55;
    --input-bg: rgba(0, 0, 0, 0.2);
}

:root.light-theme-active,
body.light-theme {
    --bg-deep: #f6f8fa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --border: #d0d7de;
    --input-bg: #f6f8fa;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar {
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 148, 158, 0.35) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(139, 148, 158, 0.35); border-radius: 9999px; }

.sidebar-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

.sidebar-item:hover {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

.active-sidebar {
    background-color: #f9731610;
    color: var(--accent);
    border-right: 2px solid var(--accent);
}

.btn-primary {
    background-color: var(--accent);
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-loader {
    border: 2px solid var(--text-secondary);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dropzone {
    border: 2px dashed var(--border);
    transition: all 0.3s;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background-color: rgba(249, 115, 22, 0.05);
}

.preview-container {
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    border-radius: 12px;
    overflow: hidden;
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.tool-input {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.tool-input:focus {
    outline: none;
    border-color: var(--accent);
}

#toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#toast.show { transform: translateX(-50%) translateY(0); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-header {
    cursor: pointer;
    user-select: none;
}

.accordion-header.active i.fa-chevron-right { transform: rotate(90deg); }

.header-icon-btn {
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.header-icon-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-elevated);
    border-color: var(--border);
}

.dropdown-content {
    display: none;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.dropdown-content.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.progress-bar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 9999px;
    overflow: hidden;
    height: 6px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fbbf24, #f97316);
    transition: width 0.3s ease;
}

.savings-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-download-bright {
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
    color: #000;
    text-decoration: none;
}

.quality-slider {
    accent-color: var(--accent);
}
