/* Filter navigation controls */
.filter-nav-controls {
    margin-top: 18px;
    padding: 12px 0 0 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 44px; /* Fixed height across all state combinations */
    width: 100%;
}

.filter-nav-label {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    padding: 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.filter-nav-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

#reapply-filter-btn,
#clear-filter-btn-2 {
    min-width: 0;
    flex: 1 1 0;
    padding: 7px 10px;
    font-size: 0.82rem;
}

#clear-filter-btn-2 {
    color: var(--danger);
    border-color: var(--danger);
}

#clear-filter-btn-2:hover {
    background: rgba(255, 122, 144, 0.08);
    color: #fff;
}

.icon-btn[disabled] {
    opacity: 0.45;
    pointer-events: none;
}

/* ============================================================
   editor.css — Circuit Burn Filters (Editor Architecture)
   ============================================================ */

/* ── Design tokens ── */
:root {
    --bg: #090b11;
    --surface: rgba(13, 17, 28, 0.96);
    --surface-2: rgba(18, 23, 38, 0.92);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(77, 252, 255, 0.28);
    --text: #f0f4ff;
    --muted: #8593b0;
    --accent: #4dfcff;
    --accent-b: #ff7b72;
    --accent-c: #ffc66d;
    --danger: #ff7a90;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 9px;
    --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    --transition: 160ms cubic-bezier(.4, 0, .2, 1);
    --header-h: 56px;
    --left-w: 260px;
    --right-w: 256px;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 18% 8%, rgba(77, 252, 255, 0.13) 0%, transparent 32%),
        radial-gradient(circle at 84% 6%, rgba(255, 123, 114, 0.11) 0%, transparent 28%),
        linear-gradient(180deg, #090b11, #06070d);
    color: var(--text);
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    /* editor fills viewport */
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input,
select {
    font: inherit;
}

.hidden {
    display: none !important;
}

/* ── Header ── */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: rgba(6, 8, 16, 0.97);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-b));
    box-shadow: 0 0 14px rgba(77, 252, 255, 0.7);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-count-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(77, 252, 255, 0.1);
    border: 1px solid rgba(77, 252, 255, 0.18);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ── Editor shell: 3-column grid ── */
.editor-shell {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
    overflow: hidden;
}

/* ─────────────────────────────────────────
   LEFT SIDEBAR
───────────────────────────────────────── */
.editor-left {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    overflow-x: hidden;
}

/* custom scrollbar */
.editor-left::-webkit-scrollbar {
    width: 4px;
}

.editor-left::-webkit-scrollbar-track {
    background: transparent;
}

.editor-left::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* ── Upload panel ── */
.upload-panel {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.panel-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.icon-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

/* Dropzone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    min-height: 110px;
    border-radius: var(--radius-md);
    border: 1.5px dashed rgba(255, 255, 255, 0.14);
    background: radial-gradient(circle at 50% 0%, rgba(77, 252, 255, 0.08), transparent 60%);
    cursor: pointer;
    padding: 14px 10px;
    transition: border-color var(--transition), transform var(--transition);
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: rgba(77, 252, 255, 0.5);
    transform: translateY(-1px);
}

.dropzone-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    opacity: 0.7;
}

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

.dropzone span {
    font-size: 0.76rem;
    color: var(--muted);
}

.dropzone-hint {
    font-size: 0.68rem !important;
    color: rgba(139, 151, 175, 0.7) !important;
    margin-top: 2px;
}

/* File info row */
.file-info-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-thumb-wrap {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.file-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-meta {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 2px;
}

.file-name {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-dims {
    font-size: 0.68rem;
    color: var(--muted);
}

/* Upload progress */
.upload-progress-wrap {
    margin-top: 8px;
    display: grid;
    gap: 5px;
}

.upload-progress-bar {
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-b));
    width: 0%;
    transition: width 200ms ease;
}

.upload-progress-label {
    font-size: 0.72rem;
    color: var(--muted);
}

/* Inline alert */
.inline-alert {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    line-height: 1.4;
}

.inline-alert.error {
    background: rgba(255, 122, 144, 0.1);
    border: 1px solid rgba(255, 122, 144, 0.25);
    color: #ffd3db;
}

/* ── Filter search ── */
.filter-search-panel {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.filter-search-input {
    width: 100%;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.83rem;
    outline: none;
    transition: border-color var(--transition);
}

.filter-search-input:focus {
    border-color: rgba(77, 252, 255, 0.35);
}

.filter-search-input::placeholder {
    color: var(--muted);
}

/* ── Filter list ── */
.filter-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px 0;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    background: transparent;
    text-align: left;
    transition: background var(--transition), border-color var(--transition);
    cursor: pointer;
    width: 100%;
}

.filter-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.filter-item.is-active {
    background: rgba(77, 252, 255, 0.08);
    border-left: 2px solid var(--accent);
}

.filter-item.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.filter-item.is-hidden {
    display: none;
}

.filter-item-thumb {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    overflow: hidden;
    background: linear-gradient(135deg,
            rgba(77, 252, 255, 0.2),
            rgba(255, 123, 114, 0.2),
            rgba(255, 198, 109, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.filter-item-initials {
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: -0.04em;
}

.filter-item-info {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 1px;
}

.filter-item-name {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-item-cat {
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.04em;
}

.filter-item-badge {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transition: background var(--transition);
}

.filter-item.is-active .filter-item-badge {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}

/* ─────────────────────────────────────────
   CENTER: PREVIEW CANVAS
───────────────────────────────────────── */
.editor-center {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(135deg, rgba(77, 252, 255, 0.03) 0%, transparent 50%),
        rgba(6, 7, 12, 0.6);
    overflow: hidden;
}

/* Empty state */
.canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    padding: 24px;
    animation: fadeIn 300ms ease;
}

.canvas-empty-icon {
    font-size: 2.8rem;
    opacity: 0.5;
}

.canvas-empty h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.3rem;
    color: var(--text);
}

.canvas-empty p {
    color: var(--muted);
    font-size: 0.88rem;
    max-width: 240px;
    line-height: 1.5;
}

/* Canvas wrap + image */
.canvas-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.canvas-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
    transition: opacity 200ms ease;
}

.canvas-img.is-fading {
    opacity: 0;
}

/* Loading overlay */
.canvas-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(6, 7, 12, 0.72);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-md);
    z-index: 10;
}

.canvas-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid rgba(77, 252, 255, 0.2);
    border-top-color: var(--accent);
    animation: spin 0.7s linear infinite;
}

.canvas-loading-label {
    font-size: 0.82rem;
    color: var(--muted);
}

/* Active filter bar */
.active-filter-bar {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(8, 10, 18, 0.88);
    border: 1px solid rgba(77, 252, 255, 0.22);
    backdrop-filter: blur(10px);
    white-space: nowrap;
    animation: slideUp 200ms ease;
}

.active-filter-label {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

/* ─────────────────────────────────────────
   RIGHT SIDEBAR
───────────────────────────────────────── */
.editor-right {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    overflow-x: hidden;
}

.editor-right::-webkit-scrollbar {
    width: 4px;
}

.editor-right::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.right-panel {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

/* Settings panel — currently empty, collapsed */
.settings-panel:empty,
.settings-panel {
    display: none;
}

.settings-hint {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Export panel */
.export-info {
    margin-bottom: 10px;
}

.export-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Buttons */
.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform var(--transition), opacity var(--transition), background var(--transition);
    width: 100%;
    cursor: pointer;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-c));
    color: #060c12;
    border: none;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--muted);
}

.ghost-button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.7);
    animation: spin 0.7s linear infinite;
}

.btn-label+.btn-spinner {
    margin-left: 6px;
}

/* Export filename preview */
.export-filename {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    font-size: 0.68rem;
    color: var(--muted);
    word-break: break-all;
    line-height: 1.4;
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 10px);
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

.toast {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: rgba(10, 12, 22, 0.96);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 0.82rem;
    max-width: 280px;
    animation: slideIn 180ms ease;
}

.toast.success {
    border-color: rgba(73, 215, 157, 0.3);
}

.toast.error {
    border-color: rgba(255, 122, 144, 0.3);
}

.profiling-panel {
    margin-top: 16px;
}

.profiling-copy {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.profiling-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

.profiling-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
}

.profiling-field-wide {
    grid-column: 1 / -1;
}

.profiling-field input,
.profiling-field select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 12px;
}

.profiling-toggles,
.profiling-actions,
.profiling-status {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.profiling-toggles {
    font-size: 12px;
}

.profiling-status {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.4;
}

/* ── Animations ── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ── Responsive: tablet ── */
@media (max-width: 900px) {
    :root {
        --left-w: 220px;
        --right-w: 210px;
    }
}

/* ── Responsive: mobile ── */
@media (max-width: 640px) {
    body {
        overflow: auto;
    }

    .editor-shell {
        position: static;
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .editor-left {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow: visible;
    }

    .filter-list {
        max-height: 220px;
        overflow-y: auto;
    }

    .editor-center {
        min-height: 320px;
        border-bottom: 1px solid var(--border);
    }

    .canvas-wrap {
        padding: 10px;
    }

    .editor-right {
        border-left: none;
    }

    .active-filter-bar {
        bottom: 8px;
    }
}