/* ============================================================
   imagic Web App — Workflow & Editor Styles
   ============================================================ */

/* --- Workflow Layout ---------------------------------------- */
.wf-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* --- Sidebar ------------------------------------------------ */
.wf-sidebar {
    background: #1a1a1a;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

.wf-logo {
    display: block;
    text-align: center;
    color: #ff9800;
    font-size: 18px;
    font-weight: 800;
    padding: 18px 0 14px;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.wf-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.wf-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    color: #888;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.wf-step:hover { background: #222; color: #ddd; }
.wf-step.active {
    border-left-color: #ff9800;
    color: #ff9800;
    font-weight: 700;
    background: #1e1e1e;
}
.wf-step.done {
    border-left-color: #4caf50;
    color: #4caf50;
}
.wf-step-dot { font-size: 12px; min-width: 14px; text-align: center; }
.wf-step-label { white-space: nowrap; }

.wf-sidebar-spacer { flex: 1; }

.wf-sidebar-progress {
    height: 5px;
    background: #222;
    border-radius: 3px;
    margin: 0 14px 4px;
    overflow: hidden;
}
.wf-sidebar-progress-bar {
    height: 100%;
    background: #ff9800;
    border-radius: 3px;
    transition: width 0.3s;
}
.wf-sidebar-status {
    text-align: center;
    font-size: 10px;
    color: #888;
    padding: 0 8px 10px;
}

.wf-sidebar-meta {
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #333;
}
.wf-sidebar-meta .usage-counter {
    font-size: 0.8rem;
    padding: 8px 10px;
    background: #222;
    border-radius: 4px;
    border: 1px solid #333;
    color: #999;
    text-align: center;
}
.wf-sidebar-meta .usage-counter strong { color: #ff9800; }
.wf-upgrade-btn {
    background: #ff9800; color: #111; font-weight: 700; border: none;
    border-radius: 4px; padding: 8px; font-size: 11px; cursor: pointer;
    font-family: inherit;
}
.wf-upgrade-btn:hover { background: #ffa726; }
.wf-manage-btn {
    background: #2a2a2a; color: #ddd; border: 1px solid #333;
    border-radius: 4px; padding: 7px; font-size: 11px; cursor: pointer;
    font-family: inherit;
}
.wf-pro-badge {
    display: inline-block; text-align: center;
    background: rgba(76, 175, 80, 0.15); color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3); border-radius: 4px;
    padding: 5px; font-size: 11px; font-weight: 700;
}

/* --- Main Content ------------------------------------------- */
.wf-main {
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.wf-page {
    display: none;
    flex: 1;
    min-height: 0;
}
.wf-page.active {
    display: flex;
    flex-direction: column;
}

.wf-page-inner { padding: 40px; }
.wf-page-centered { max-width: 700px; }

.wf-title { font-size: 22px; font-weight: 800; color: #ddd; margin: 0 0 4px; }
.wf-subtitle { color: #888; font-size: 13px; margin: 0 0 24px; line-height: 1.5; }

.wf-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #333;
    background: #181818;
    flex-shrink: 0;
}
.wf-page-header .wf-title { font-size: 16px; margin: 0; }
.wf-page-actions { display: flex; align-items: center; gap: 10px; }

.wf-btn-primary {
    background: #ff9800; color: #111; font-weight: 700; border: none;
    border-radius: 4px; padding: 8px 18px; font-size: 12px; cursor: pointer;
    font-family: inherit;
}
.wf-btn-primary:hover { background: #ffa726; }
.wf-btn-primary:disabled { background: #555; color: #999; cursor: default; }

.wf-btn-secondary {
    background: #2a2a2a; color: #ddd; border: 1px solid #333;
    border-radius: 4px; padding: 7px 14px; font-size: 12px; cursor: pointer;
    font-family: inherit;
}
.wf-btn-secondary:hover { background: #333; }

.wf-select {
    background: #2a2a2a; color: #ddd; border: 1px solid #333;
    border-radius: 4px; padding: 7px 10px; font-size: 12px; cursor: pointer;
    font-family: inherit;
}

.wf-checkbox {
    display: flex; align-items: center; gap: 8px;
    color: #ff9800; font-size: 12px; cursor: pointer; margin: 12px 0;
}
.wf-checkbox input { accent-color: #ff9800; }

.wf-import-status,
.wf-analyse-status,
.wf-review-status,
.wf-export-status {
    color: #888; font-size: 12px; padding: 8px 20px;
}

/* --- Library / Review Grid ---------------------------------- */
.wf-library-grid,
.wf-review-grid,
.wf-export-grid {
    display: grid;
    gap: 12px;
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.wf-library-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-content: start; }
.wf-review-grid  { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-content: start; }
.wf-export-grid  { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-content: start; }

.wf-lib-card,
.wf-rev-card,
.wf-exp-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.wf-lib-card:hover,
.wf-rev-card:hover,
.wf-exp-card:hover {
    border-color: rgba(124, 92, 252, 0.4);
    transform: translateY(-2px);
}

.wf-lib-card img,
.wf-rev-card img,
.wf-exp-card img {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.wf-card-info {
    padding: 8px 10px;
    font-size: 0.8rem;
}
.wf-card-name {
    font-weight: 600; color: #ddd;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wf-card-score {
    font-size: 0.75rem; color: #888; margin-top: 2px;
}

/* Review card keep/trash */
.wf-rev-actions {
    display: flex; gap: 6px; padding: 6px 10px 10px;
}
.wf-rev-actions button {
    flex: 1; border: none; border-radius: 4px; padding: 6px; font-size: 10px;
    font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.wf-btn-keep { background: #2e7d32; color: #fff; }
.wf-btn-keep:hover { background: #388e3c; }
.wf-btn-keep.active { box-shadow: 0 0 0 2px #4caf50; }
.wf-btn-trash { background: #c62828; color: #fff; }
.wf-btn-trash:hover { background: #d32f2f; }
.wf-btn-trash.active { box-shadow: 0 0 0 2px #f44336; }

.wf-rev-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.7rem; font-weight: 700; margin-top: 4px;
}
.wf-rev-badge.keep { background: rgba(46,125,50,0.25); color: #4caf50; }
.wf-rev-badge.trash { background: rgba(198,40,40,0.25); color: #f44336; }
.wf-rev-badge.review { background: rgba(255,152,0,0.25); color: #ff9800; }

/* --- Editor Layout ------------------------------------------ */
.ed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 42px;
    padding: 0 12px;
    background: #181818;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.ed-toolbar-left,
.ed-toolbar-center,
.ed-toolbar-right { display: flex; align-items: center; gap: 8px; }

.ed-title { font-size: 13px; font-weight: 600; color: #ddd; margin: 0 8px; }

.ed-tool-btn {
    background: #2a2a2a; color: #ddd; border: 1px solid #333;
    border-radius: 4px; padding: 5px 10px; font-size: 11px;
    cursor: pointer; font-family: inherit; white-space: nowrap;
}
.ed-tool-btn:hover { background: #333; }
.ed-tool-btn.active { border-color: #ff9800; color: #ff9800; }

.ed-layout {
    display: grid;
    grid-template-columns: 250px 1fr 280px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left panel */
.ed-left-panel {
    background: #1a1a1a;
    border-right: 1px solid #333;
    padding: 12px;
    overflow-y: auto;
}
.ed-section-title {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: #888; margin-bottom: 8px;
}

#ed-histogram {
    width: 100%;
    height: 100px;
    background: #111;
    border-radius: 4px;
    border: 1px solid #333;
}

.ed-info {
    font-size: 11px; color: #aaa; line-height: 1.6;
    white-space: pre-line;
}

.ed-zoom-slider {
    width: 100%;
    accent-color: #ff9800;
    margin: 6px 0 2px;
}
.ed-zoom-label {
    font-size: 10px; color: #888; text-align: center;
}

/* Center canvas */
.ed-canvas-wrap {
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}
.ed-canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.ed-no-photo {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #666; font-size: 14px; text-align: center; gap: 12px;
}

/* Right panel — slider sections */
.ed-right-panel {
    background: #1a1a1a;
    border-left: 1px solid #333;
    overflow-y: auto;
    padding: 0;
}

.ed-section {
    border-bottom: 1px solid #2a2a2a;
}
.ed-section-header {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 10px 14px; border: none; background: transparent;
    color: #aaa; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    cursor: pointer; font-family: inherit; text-align: left;
}
.ed-section-header:hover { color: #ddd; background: #222; }
.ed-chevron { font-size: 10px; }

.ed-section-body {
    padding: 4px 14px 12px;
}

/* Slider rows */
.ed-slider-row {
    display: grid;
    grid-template-columns: 90px 1fr 32px;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}
.ed-slider-row label {
    font-size: 11px; color: #999; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.ed-slider-row input[type="range"] {
    width: 100%;
    accent-color: #ff9800;
    height: 4px;
}
.ed-slider-val {
    font-size: 10px; color: #888; text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Grade grid in editor */
.ed-grade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.ed-grade-btn {
    background: #222; border: 2px solid transparent; border-radius: 4px;
    padding: 0; cursor: pointer; overflow: hidden; font-family: inherit;
    transition: border-color 0.15s;
}
.ed-grade-btn:hover { border-color: #555; }
.ed-grade-btn.selected { border-color: #ff9800; }
.ed-grade-btn canvas {
    width: 100%; height: 50px; display: block;
}
.ed-grade-btn .ed-grade-name {
    font-size: 8px; color: #888; text-align: center;
    padding: 2px 0 3px; background: #222;
}

/* AI tool buttons */
.ed-ai-btn {
    display: block; width: 100%; background: #2a2a2a; color: #ddd;
    border: 1px solid #333; border-radius: 4px; padding: 7px;
    font-size: 11px; cursor: pointer; margin-bottom: 5px;
    font-family: inherit; text-align: left;
}
.ed-ai-btn:hover { background: #ff9800; color: #111; }

/* Filmstrip */
.ed-filmstrip {
    height: 80px;
    background: #141414;
    border-top: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    overflow-x: auto;
    flex-shrink: 0;
}
.ed-film-thumb {
    width: 60px; height: 60px; min-width: 60px;
    border-radius: 4px; border: 2px solid transparent;
    object-fit: cover; cursor: pointer;
    transition: border-color 0.15s;
}
.ed-film-thumb:hover { border-color: #555; }
.ed-film-thumb.active { border-color: #ff9800; }

/* Duplicate results */
#duplicate-results {
    padding: 16px 20px;
}
.dup-group {
    background: #1e1e1e; border: 1px solid #333; border-radius: 8px;
    padding: 16px; margin-bottom: 12px;
}
.dup-group h3 { font-size: 14px; margin: 0 0 12px; color: #ddd; }
.dup-group-images {
    display: flex; gap: 12px; flex-wrap: wrap;
}
.dup-group-images img {
    width: 120px; height: 120px; object-fit: cover; border-radius: 6px;
    border: 1px solid #333;
}

/* Before/After overlay */
.ed-before-label {
    position: absolute; top: 12px; left: 12px;
    background: rgba(0,0,0,0.7); color: #ff9800;
    padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 700;
    pointer-events: none; z-index: 5;
}

/* Crop overlay */
.ed-crop-overlay {
    position: absolute;
    border: 2px dashed #ff9800;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 4;
}

/* --- Responsive --------------------------------------------- */
@media (max-width: 1100px) {
    .ed-layout { grid-template-columns: 1fr 260px; }
    .ed-left-panel { display: none; }
}
@media (max-width: 800px) {
    .wf-layout { grid-template-columns: 1fr; }
    .wf-sidebar {
        flex-direction: row; overflow-x: auto;
        border-right: none; border-bottom: 1px solid #333;
    }
    .wf-steps { flex-direction: row; }
    .wf-step { padding: 10px 12px; border-left: none; border-bottom: 3px solid transparent; }
    .wf-step.active { border-left-color: transparent; border-bottom-color: #ff9800; }
    .wf-step.done { border-left-color: transparent; border-bottom-color: #4caf50; }
    .wf-sidebar-spacer, .wf-sidebar-progress, .wf-sidebar-status, .wf-sidebar-meta { display: none; }
    .ed-layout { grid-template-columns: 1fr; }
    .ed-left-panel, .ed-right-panel { display: none; }
}
