/* =================================================================
 * FEATURE-036-B: Workflow View Shell & CRUD
 * Panels, modal, stage pills, toast notifications
 * ================================================================= */

.workflow-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    overflow-y: auto;
    background: var(--content-bg, #ffffff);
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}

.workflow-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e1e2e;
}

.workflow-btn-create {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}
.workflow-btn-create:hover { background: #2563eb; }

/* --- Panels --- */
.workflow-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workflow-panel-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.workflow-panel {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.workflow-panel:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.workflow-panel-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    gap: 0.75rem;
}

.workflow-panel-chevron {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.workflow-panel.expanded .workflow-panel-chevron {
    transform: rotate(90deg);
}

.workflow-panel-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-panel-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: #64748b;
    flex-shrink: 0;
}

.workflow-feature-badge {
    background: #f1f5f9;
    color: #475569;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 500;
}

.workflow-stage-pill {
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}
.workflow-stage-pill.completed { background: #dcfce7; color: #166534; }
.workflow-stage-pill.active    { background: #dbeafe; color: #1e40af; }
.workflow-stage-pill.locked    { background: #f1f5f9; color: #64748b; }

.workflow-action-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    position: relative;
}
.workflow-action-btn:hover { color: #475569; background: #f1f5f9; }

.workflow-action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 140px;
    padding: 0.3rem 0;
    display: none;
}
.workflow-action-menu.open { display: block; }

.workflow-action-menu button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.85rem;
    background: none;
    border: none;
    font-size: 0.82rem;
    cursor: pointer;
    color: #dc2626;
}
.workflow-action-menu button:hover { background: #fef2f2; }

.workflow-panel-body {
    display: none;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: #475569;
}
.workflow-panel.expanded .workflow-panel-body { display: block; }

/* --- Empty state --- */
.workflow-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: #94a3b8;
    text-align: center;
}
.workflow-empty i { font-size: 2.5rem; margin-bottom: 0.75rem; }
.workflow-empty h5 { margin: 0 0 0.4rem; color: #64748b; font-size: 1rem; }
.workflow-empty p  { margin: 0; font-size: 0.85rem; }

/* --- Modal --- */
.workflow-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.workflow-modal {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.workflow-modal h3 { margin: 0 0 1rem; font-size: 1.1rem; color: #1e293b; }

.workflow-modal-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}
.workflow-modal-input:focus { border-color: #3b82f6; }

.workflow-modal-error {
    color: #dc2626;
    font-size: 0.78rem;
    margin-top: 0.35rem;
    min-height: 1.2em;
}

.workflow-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}
.workflow-modal-actions button {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #475569;
}
.workflow-modal-actions button:hover { background: #f8fafc; }
.workflow-modal-actions .btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.workflow-modal-actions .btn-primary:hover { background: #2563eb; }
.workflow-modal-actions .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.workflow-modal-actions .btn-danger { background: #dc2626; border-color: #dc2626; }
.workflow-modal-actions .btn-danger:hover { background: #b91c1c; }

/* --- Toast --- */
.workflow-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #fff;
    background: #1e293b;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1100;
    animation: wf-toast-in 0.3s ease;
}
.workflow-toast.error { background: #dc2626; }
@keyframes wf-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- Error banner --- */
.workflow-error-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #dc2626;
    font-size: 0.9rem;
}
.workflow-error-banner button {
    padding: 0.35rem 0.8rem;
    border: 1px solid #dc2626;
    border-radius: 6px;
    background: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 0.82rem;
}
.workflow-error-banner button:hover { background: #fef2f2; }

/* ═══════════════════════════════════════════
   FEATURE-036-C: Stage Ribbon & Action Execution
   ═══════════════════════════════════════════ */

/* Stage Ribbon */
.stage-ribbon { display: flex; align-items: center; padding: 14px 16px; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--border-color, #333); }
.stage-item { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 9999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.stage-item.completed { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.3); }
.stage-item.active { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; border: 1px solid transparent; box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.stage-item.pending { background: rgba(255,255,255,0.05); color: #94a3b8; border: 1px solid #334155; }
.stage-item.locked { background: rgba(255,255,255,0.02); color: #475569; border: 1px solid #1e293b; opacity: 0.5; }
.stage-check { width: 16px; height: 16px; border-radius: 50%; background: #22c55e; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; }
.stage-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.6); animation: pulse-dot 2s infinite; }
.stage-num { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #475569; display: flex; align-items: center; justify-content: center; font-size: 9px; }
.stage-arrow { color: #475569; font-size: 14px; padding: 0 6px; }

@keyframes pulse-dot { 0%,100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 1; transform: scale(1.3); } }

/* Actions Area */
.actions-area { padding: 14px 16px; border-bottom: 1px solid var(--border-color, #333); }
.action-group { margin-bottom: 12px; }
.action-group:last-child { margin-bottom: 0; }
.actions-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: #94a3b8; margin-bottom: 10px; }
.actions-label .actions-label-sub { font-weight: 400; text-transform: none; letter-spacing: normal; color: #64748b; margin-left: 4px; }
.actions-grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* Action Buttons */
.action-btn { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.2s; border: 1.5px solid; background: none; }
.action-btn .action-icon { font-size: 14px; flex-shrink: 0; }
.action-btn.done { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #22c55e; }
.action-btn.optional { background: rgba(255,255,255,0.05); border-color: #64748b; border-style: dashed; color: #94a3b8; }
.action-btn.optional:hover { border-color: #94a3b8; background: rgba(255,255,255,0.08); }
.action-btn.normal { background: rgba(255,255,255,0.05); border-color: #334155; color: #94a3b8; }
.action-btn.normal:hover { border-color: #64748b; background: rgba(255,255,255,0.08); }
.action-btn.suggested { background: rgba(245,158,11,0.2); border-color: #f59e0b; color: #f59e0b; animation: gentle-glow 3s ease-in-out infinite; }
.action-btn.suggested:hover { background: rgba(245,158,11,0.3); transform: translateY(-1px); }
.action-btn.locked { background: rgba(255,255,255,0.02); border-color: #1e293b; color: #475569; cursor: not-allowed; opacity: 0.5; }

@keyframes gentle-glow { 0%,100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px rgba(245,158,11,0.15); } }

/* Meta section below ribbon */
.workflow-panel-meta-section { padding: 10px 16px; border-top: 1px solid var(--border-color, #333); }
.workflow-panel-meta-section .workflow-panel-body-row { font-size: 12px; }

/* Error state */
.workflow-error { padding: 20px; text-align: center; color: #ef4444; }
.workflow-error button { margin-top: 8px; padding: 4px 12px; border-radius: 4px; border: 1px solid #ef4444; background: transparent; color: #ef4444; cursor: pointer; }

/* =================================================================
 * FEATURE-036-D: Feature Lanes & Dependencies
 * Feature selector, lanes, dependency badges, SVG arrows
 * ================================================================= */

/* Feature Selector */
.feature-selector-wrap { position: relative; margin: 12px 0; display: flex; gap: 8px; align-items: center; }
.feature-selector-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-primary, #e2e8f0); background: var(--card-bg, #1e293b); border: 1px solid var(--border-color, #334155); border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.feature-selector-btn:hover { border-color: #10b981; }
.feature-selector-dropdown { position: absolute; top: calc(100% + 6px); left: 0; width: 340px; background: var(--card-bg, #1e293b); border: 1px solid var(--border-color, #334155); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); z-index: 10; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: all 0.25s cubic-bezier(0.4,0,0.2,1); }
.feature-selector-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.feature-selector-header { padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted, #64748b); border-bottom: 1px solid var(--border-color, #334155); }
.feature-selector-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-color, #1e293b); transition: background 0.15s; }
.feature-selector-item:hover { background: rgba(255,255,255,0.05); }
.feature-selector-item.selected { background: rgba(16,185,129,0.1); }
.feature-selector-item:last-child { border-bottom: none; }
.feature-selector-icon { font-size: 18px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.feature-selector-info { flex: 1; min-width: 0; }
.feature-selector-name { font-size: 13px; font-weight: 600; color: var(--text-primary, #e2e8f0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feature-selector-stage { font-size: 11px; color: var(--text-muted, #64748b); }
.feature-selector-next { font-size: 10px; padding: 2px 6px; background: rgba(245,158,11,0.1); color: #f59e0b; border-radius: 4px; white-space: nowrap; }

/* Feature Lanes */
.lanes-container { display: flex; flex-direction: column; gap: 8px; position: relative; padding-left: 28px; }
.feature-lane { display: flex; align-items: stretch; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; cursor: pointer; transition: all 0.25s; }
.feature-lane:hover { border-color: #10b981; box-shadow: 0 2px 8px rgba(16,185,129,0.08); }
.feature-lane.highlighted { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.15); }
.lane-label { width: 180px; padding: 12px 16px; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.lane-feature-id { font-family: monospace; font-size: 10px; color: #10b981; }
.lane-feature-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.lane-stages { display: flex; align-items: center; padding: 10px 12px; gap: 4px; flex: 1; flex-wrap: wrap; }
.lane-stage { display: flex; gap: 5px; align-items: center; padding: 5px 10px; border-radius: 4px; font-size: 11px; white-space: nowrap; cursor: pointer; transition: background 0.15s; }
.lane-stage:hover { background: rgba(0,0,0,0.04); }
.lane-stage.done { background: rgba(16,185,129,0.1); color: #10b981; }
.lane-stage.active { background: rgba(16,185,129,0.15); color: #10b981; font-weight: 600; }
.lane-stage.pending { color: #64748b; }
.lane-arrow { color: #94a3b8; font-size: 14px; }

/* Dependency Tags & Badges */
.dep-tag { display: inline-flex; gap: 3px; padding: 2px 7px; font-size: 9px; font-weight: 600; border-radius: 4px; margin-top: 4px; transition: opacity 0.3s; }
.dep-tag.depends { background: rgba(251,191,36,0.1); color: #d97706; border: 1px solid rgba(251,191,36,0.3); }
.dep-tag.parallel { background: rgba(59,130,246,0.08); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }

/* Dependencies Toggle */
.dep-toggle { display: inline-flex; gap: 4px; align-items: center; padding: 2px 8px; font-size: 11px; cursor: pointer; border-radius: 4px; background: rgba(239,246,255,0.1); color: #3b82f6; border: 1px solid #3b82f6; transition: all 0.2s; }
.dep-toggle.active { background: #3b82f6; color: #fff; }
.dep-toggle-icon { font-size: 12px; }

/* Deps-hidden state */
.lanes-container.deps-hidden .dep-svg-overlay,
.lanes-container.deps-hidden .dep-tag { opacity: 0; pointer-events: none; transition: opacity 0.3s; }

/* SVG Dependency Arrows */
.dep-svg-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.dep-arrow-line { fill: none; stroke: #3b82f6; stroke-width: 1.8; stroke-dasharray: 5 3; opacity: 0.7; transition: opacity 0.3s; }
.dep-arrow-head { fill: #3b82f6; opacity: 0.7; transition: opacity 0.3s; }
.lanes-container:hover .dep-arrow-line,
.lanes-container:hover .dep-arrow-head { opacity: 1; }

/* =================================================================
 * FEATURE-036-E: Deliverables, Polling & Lifecycle
 * ================================================================= */

/* Deliverables Section */
.deliverables-area { padding: 16px 0; border-top: 1px solid var(--border-color); margin-top: 12px; }
.deliverables-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 4px 0; }
.deliverables-title { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.deliverables-count { font-size: 11px; padding: 1px 8px; background: rgba(59,130,246,0.15); color: #3b82f6; border-radius: 10px; }
.deliverables-toggle { font-size: 14px; color: var(--text-muted); transition: transform 0.2s; }
.deliverables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 10px; align-items: start; }
.deliverables-empty { color: var(--text-muted); font-size: 12px; padding: 12px 0; }
.deliverable-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; transition: all 0.2s; cursor: default; }
.deliverable-card.clickable { cursor: pointer; }
.deliverable-card:hover { border-color: var(--accent); }
.deliverable-card.missing { opacity: 0.6; }
.deliverable-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 16px; flex-shrink: 0; }
.deliverable-icon.ideas { background: rgba(168,85,247,0.15); }
.deliverable-icon.mockups { background: rgba(236,72,153,0.15); }
.deliverable-icon.requirements { background: rgba(59,130,246,0.15); }
.deliverable-icon.implementations { background: rgba(245,158,11,0.15); }
.deliverable-icon.quality { background: rgba(16,185,129,0.15); }
.deliverable-icon.folders { background: rgba(107,114,128,0.15); }
.deliverable-info { flex: 1; min-width: 0; }
.deliverable-name { font-size: 12px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deliverable-path { font-size: 10px; font-family: monospace; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deliverable-missing-badge { font-size: 10px; color: #ef4444; white-space: nowrap; }
.deliverable-preview-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1051; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; font-family: 'DM Sans', sans-serif; }
.deliverable-preview-backdrop.active { opacity: 1; visibility: visible; }
.deliverable-preview { background: #fff; border-radius: 12px; width: 90vw; height: 90vh; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow: hidden; transform: scale(0.95) translateY(10px); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.deliverable-preview-backdrop.active .deliverable-preview { transform: scale(1) translateY(0); }
.deliverable-preview .preview-header { padding: 14px 20px; font-size: 14px; font-weight: 600; color: #1e293b; border-bottom: 1px solid #e2e8f0; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; }
.deliverable-preview .preview-close { cursor: pointer; color: #94a3b8; font-size: 18px; line-height: 1; padding: 4px; border-radius: 4px; transition: all 0.15s; }
.deliverable-preview .preview-close:hover { color: #1e293b; background: #f1f5f9; }
.deliverable-preview .preview-content { padding: 20px; overflow-y: auto; flex: 1; font-size: 14px; color: #334155; line-height: 1.7; }
.deliverable-preview .preview-content pre { white-space: pre-wrap; word-wrap: break-word; font-size: 13px; background: #f8fafc; padding: 12px; border-radius: 6px; border: 1px solid #e2e8f0; }
.deliverable-preview .preview-content h1, .deliverable-preview .preview-content h2, .deliverable-preview .preview-content h3 { color: #0f172a; margin-top: 1em; }
.deliverable-preview .preview-content p { margin: 0.5em 0; }
.deliverable-preview .preview-content ul, .deliverable-preview .preview-content ol { padding-left: 1.5em; }
.deliverable-card.folder-type { background: var(--deliverable-folder-bg, rgba(99, 102, 241, 0.06)); cursor: pointer; }

/* Context Menu */
.wf-context-menu { position: fixed; z-index: 100; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); min-width: 160px; padding: 4px 0; }
.wf-context-menu-item { display: block; width: 100%; padding: 8px 14px; font-size: 12px; color: var(--text-primary); background: none; border: none; cursor: pointer; text-align: left; }
.wf-context-menu-item:hover { background: rgba(255,255,255,0.08); }
