/* Simple Node Workflow — SyncFrame glass style */

/* ── Fullscreen workflow modal (matches Episode Details) ── */
.wf-modal-overlay {
    background: rgba(238, 245, 255, 0.52);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.wf-modal-overlay .wf-popup-window {
    border: none !important;
    border-radius: 0 !important;
    background:
        radial-gradient(circle at 20% 15%, rgba(120, 160, 255, 0.24), transparent 35%),
        radial-gradient(circle at 55% 25%, rgba(80, 220, 235, 0.16), transparent 32%),
        radial-gradient(circle at 85% 80%, rgba(210, 235, 255, 0.36), transparent 38%),
        linear-gradient(135deg, #eef5ff 0%, #f7f8ff 45%, #eef8fb 100%) !important;
    box-shadow: none !important;
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.wf-modal-overlay .modal-glass-header {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.58);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.65);
}

.wf-modal-overlay #workflow-popup-toolbar .episode-pill-btn {
    font-size: 12px;
}

.wf-modal-overlay #workflow-popup-toolbar .wf-btn-dirty {
    box-shadow: 0 0 0 2px rgba(79, 124, 255, 0.35);
}

.wf-popup-window {
    box-shadow: 0 28px 80px rgba(50, 80, 110, 0.22);
}

.wf-popup-body {
    background: rgba(247, 250, 255, 0.35);
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem 0.75rem;
}

.wf-popup-body .wf-shell {
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.wf-popup-body .wf-body {
    flex: 1;
    min-height: 0;
    height: auto;
}

.wf-popup-body .wf-canvas-wrap {
    flex: 1;
    min-height: 0;
}

.wf-popup-body .wf-viewport {
    min-height: 0;
    height: 100%;
}

.wf-popup-body .wf-nodes-layer,
.wf-popup-body .wf-world {
    min-height: 0;
}

.wf-popup-body .wf-inspector {
    width: min(300px, 30vw);
}

.wf-shell--popup .wf-header {
    display: none;
}

.wf-header-actions--full {
    width: 100%;
    justify-content: flex-end;
}

.wf-shell {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.wf-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.wf-title {
    font-size: 15px;
    font-weight: 800;
    color: #111827;
    letter-spacing: -0.02em;
}

.wf-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 0.15rem;
}

.wf-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.wf-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(210, 225, 240, 0.65);
    background: rgba(255, 255, 255, 0.82);
    color: #243047;
    transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.wf-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 6px 18px rgba(50, 80, 110, 0.08);
}

.wf-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.wf-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wf-btn-primary {
    background: linear-gradient(135deg, rgba(79, 124, 255, 0.14), rgba(20, 184, 166, 0.12));
    border-color: rgba(79, 124, 255, 0.28);
    color: #1e3a8a;
}

.wf-btn-save.wf-btn-dirty {
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18);
}

.wf-btn-soft {
    background: rgba(255, 255, 255, 0.72);
}

.wf-btn-danger {
    color: #dc2626;
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(254, 242, 242, 0.85);
}

.wf-reset-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 210px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(210, 225, 240, 0.75);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(50, 80, 110, 0.14);
    padding: 0.35rem;
    z-index: 30;
}

.wf-reset-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.wf-reset-menu button:hover {
    background: rgba(79, 124, 255, 0.08);
}

.wf-body {
    display: flex;
    gap: 0.85rem;
    flex: 1;
    min-height: 0;
}

.wf-canvas-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    border-radius: 18px;
    border: 1px solid rgba(210, 225, 240, 0.55);
    background:
        radial-gradient(circle at 1px 1px, rgba(79, 124, 255, 0.12) 1px, transparent 0) 0 0 / 18px 18px,
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 250, 255, 0.78));
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.wf-canvas-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(210, 225, 240, 0.65);
    box-shadow: 0 8px 22px rgba(50, 80, 110, 0.08);
}

.wf-canvas-toolbar button {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #475569;
    font-size: 11px;
}

.wf-canvas-toolbar button:hover {
    background: rgba(79, 124, 255, 0.08);
    color: #1e40af;
}

.wf-zoom-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    min-width: 36px;
    text-align: center;
}

.wf-viewport {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    cursor: grab;
}

.wf-viewport:active {
    cursor: grabbing;
}

.wf-world {
    transform-origin: 0 0;
    position: relative;
    min-width: 1200px;
    min-height: 900px;
}

.wf-nodes-layer {
    position: relative;
    min-height: 900px;
    min-width: 1200px;
}

.wf-nodes-mount {
    position: relative;
    z-index: 2;
}

.wf-edges-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.wf-edges-svg .wf-edge-hit {
    pointer-events: stroke;
    cursor: pointer;
}

.wf-edge {
    fill: none;
    stroke: rgba(79, 124, 255, 0.38);
    stroke-width: 1.75;
    pointer-events: none;
}

.wf-edge-hit:hover + .wf-edge,
.wf-edge.is-hovered {
    stroke: rgba(239, 68, 68, 0.65);
}

.wf-temp-edge {
    pointer-events: none;
}

.wf-node {
    position: absolute;
    top: 0;
    left: 0;
    width: 196px;
    z-index: 2;
}

.wf-node.is-dragging {
    z-index: 20;
    will-change: transform;
}

.wf-node.is-dragging .wf-node-inner {
    box-shadow: 0 16px 40px rgba(50, 80, 110, 0.16);
    cursor: grabbing;
}

.wf-node.is-selected .wf-node-inner {
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.22), 0 14px 34px rgba(50, 80, 110, 0.12);
    border-color: rgba(79, 124, 255, 0.45);
}

.wf-node-inner {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(210, 225, 240, 0.7);
    border-radius: 14px;
    padding: 0.65rem 0.7rem 0.55rem;
    box-shadow: 0 10px 28px rgba(50, 80, 110, 0.08);
    cursor: grab;
}

.wf-node-inner:active {
    cursor: grabbing;
}

.wf-node-top {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.wf-node-color {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.wf-node-name {
    font-size: 12px;
    font-weight: 800;
    color: #111827;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wf-node-status {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
}

.wf-node-status--done {
    background: rgba(20, 184, 166, 0.12);
    color: #0f766e;
}

.wf-node-status--skipped {
    background: rgba(148, 163, 184, 0.16);
    color: #64748b;
}

.wf-node-desc {
    font-size: 10px;
    line-height: 1.45;
    color: #6b7280;
    min-height: 2.2em;
    margin-bottom: 0.45rem;
}

.wf-node-actions {
    display: flex;
    gap: 0.35rem;
}

.wf-node-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid rgba(210, 225, 240, 0.65);
    background: rgba(255, 255, 255, 0.85);
    color: #475569;
    font-size: 11px;
}

.wf-node-btn:hover:not(.is-disabled):not(:disabled) {
    background: rgba(79, 124, 255, 0.08);
    color: #1e40af;
}

.wf-node-btn.is-disabled,
.wf-node-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wf-handle {
    position: absolute;
    top: 50%;
    margin-top: -6px;
    width: 12px;
    height: 12px;
    padding: 0;
    border-radius: 999px;
    border: 2px solid rgba(79, 124, 255, 0.55);
    background: #fff;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(79, 124, 255, 0.18);
    box-sizing: border-box;
}

.wf-handle-in {
    left: -6px;
}

.wf-handle-out {
    right: -6px;
    cursor: crosshair;
}

.wf-handle-out:hover {
    background: rgba(79, 124, 255, 0.15);
    transform: scale(1.08);
}

.wf-inspector {
    width: 240px;
    flex-shrink: 0;
    flex-direction: column;
    border-radius: 18px;
    border: 1px solid rgba(210, 225, 240, 0.55);
    background: rgba(255, 255, 255, 0.82);
    padding: 0.85rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.wf-inspector-empty {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.5;
}

.wf-inspector-empty.hidden {
    display: none;
}

.wf-inspector-fields {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.wf-field-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.wf-field-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(210, 225, 240, 0.65);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.45rem 0.6rem;
    font-size: 12px;
    color: #243047;
}

.wf-field-input:focus {
    outline: none;
    border-color: rgba(79, 124, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.12);
}

.wf-field-textarea {
    resize: vertical;
    min-height: 64px;
}

.wf-inspector-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.wf-inspector-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.wf-inspector-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    max-height: 72vh;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(210, 225, 240, 0.75);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 48px rgba(50, 80, 110, 0.16);
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    transform: translateY(110%);
    transition: transform 220ms ease;
    overflow-y: auto;
}

.wf-inspector-drawer.is-open {
    transform: translateY(0);
}

.wf-inspector-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.75rem;
}

.wf-inspector-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
}

@media (max-width: 1023px) {
    .wf-body {
        flex-direction: column;
        min-height: 360px;
    }

    .wf-canvas-wrap {
        min-height: 360px;
    }

    .wf-viewport {
        min-height: 360px;
    }
}

html[data-theme="dark"] .wf-title,
html[data-theme="dark"] .wf-node-name,
html[data-theme="dark"] .wf-inspector-drawer-head {
    color: #f3f4f6;
}

html[data-theme="dark"] .wf-canvas-wrap,
html[data-theme="dark"] .wf-inspector,
html[data-theme="dark"] .wf-node-inner,
html[data-theme="dark"] .wf-btn,
html[data-theme="dark"] .wf-inspector-drawer {
    background: rgba(26, 29, 38, 0.92);
    border-color: rgba(55, 65, 81, 0.75);
}

html[data-theme="dark"] .wf-subtitle,
html[data-theme="dark"] .wf-node-desc,
html[data-theme="dark"] .wf-inspector-empty {
    color: #9ca3af;
}

html[data-theme="dark"] .wf-field-input {
    background: rgba(15, 17, 23, 0.75);
    color: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.85);
}

/* Rich inline node content */
.wf-node--rich {
    width: 300px;
}

.wf-node--rich .wf-node-inner {
    cursor: default;
    padding: 0.55rem 0.65rem 0.5rem;
}

.wf-node--rich .wf-node-top {
    cursor: grab;
    margin-bottom: 0.45rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(210, 225, 240, 0.55);
}

.wf-node--rich .wf-node-top:active {
    cursor: grabbing;
}

.wf-rich-body {
    font-size: 11px;
}

.wf-rich-textarea,
.wf-rich-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(210, 225, 240, 0.75);
    background: rgba(255, 255, 255, 0.92);
    padding: 0.45rem 0.55rem;
    font-size: 11px;
    line-height: 1.45;
    color: #1f2937;
    resize: vertical;
}

.wf-rich-textarea:focus,
.wf-rich-input:focus {
    outline: none;
    border-color: rgba(79, 124, 255, 0.45);
    box-shadow: 0 0 0 2px rgba(79, 124, 255, 0.12);
}

.wf-rich-field {
    display: block;
    margin-top: 0.45rem;
}

.wf-rich-label {
    display: block;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.wf-rich-video {
    width: 100%;
    max-height: 160px;
    border-radius: 10px;
    background: #0f172a;
    display: block;
}

.wf-rich-video-iframe {
    width: 100%;
    height: 160px;
    border: 0;
    border-radius: 10px;
    background: #0f172a;
}

.wf-rich-cover-wrap {
    border-radius: 10px;
    overflow: hidden;
    background: rgba(241, 245, 249, 0.85);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wf-rich-cover-img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    display: block;
}

.wf-rich-empty {
    color: #94a3b8;
    font-size: 10px;
    text-align: center;
    padding: 0.75rem 0.5rem;
}

.wf-rich-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
}

.wf-rich-check {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 10px;
    font-weight: 600;
    color: #475569;
}

.wf-rich-meta {
    font-size: 10px;
    color: #64748b;
    margin: 0 0 0.35rem;
}

.wf-node-desc--solo {
    margin-bottom: 0;
    min-height: auto;
}

html[data-theme="dark"] .wf-mod-text {
    color: #d1d5db;
}

html[data-theme="dark"] .wf-modal-overlay {
    background: rgba(10, 12, 18, 0.72);
}

html[data-theme="dark"] .wf-modal-overlay .wf-popup-window {
    background:
        radial-gradient(circle at 20% 15%, rgba(60, 90, 180, 0.2), transparent 35%),
        linear-gradient(135deg, #0f1117 0%, #151a24 100%) !important;
}

html[data-theme="dark"] .wf-modal-overlay .modal-glass-header {
    background: rgba(20, 24, 32, 0.85);
    border-bottom-color: rgba(55, 65, 81, 0.5);
}

html[data-theme="dark"] .wf-popup-body {
    background: rgba(15, 17, 23, 0.45);
}

html[data-theme="dark"] .wf-rich-textarea,
html[data-theme="dark"] .wf-rich-input {
    background: rgba(15, 17, 23, 0.75);
    color: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.85);
}

html[data-theme="dark"] .wf-rich-cover-wrap {
    background: rgba(15, 17, 23, 0.55);
}

.wf-video-lazy {
    min-height: 120px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
}

.wf-video-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(79, 124, 255, 0.28);
    background: rgba(255, 255, 255, 0.92);
    font-size: 11px;
    font-weight: 700;
    color: #1d4ed8;
    cursor: pointer;
}

.wf-video-play-btn:hover {
    background: rgba(79, 124, 255, 0.1);
}

.wf-rich-view-text {
    font-size: 11px;
    line-height: 1.55;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
}

.wf-rich-empty-inline {
    color: #94a3b8;
    font-style: italic;
}

.wf-rich-edit-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(210, 225, 240, 0.75);
    background: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    font-weight: 700;
    color: #1d4ed8;
    cursor: pointer;
}

.wf-rich-edit-btn:hover {
    background: rgba(79, 124, 255, 0.08);
}

.wf-rich-body.is-editing .wf-rich-edit-btn {
    color: #0f766e;
    border-color: rgba(20, 184, 166, 0.35);
}

/* Modification stage — open feedback issues */
.wf-rich-body--modification {
    max-height: 280px;
    overflow-y: auto;
}

.wf-mod-issue-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.25rem;
}

.wf-mod-issue {
    padding: 0.4rem 0.55rem;
    border-radius: 10px;
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.wf-mod-issue.is-done {
    border-left-color: #14b8a6;
    background: rgba(20, 184, 166, 0.06);
    opacity: 0.75;
}

.wf-mod-time {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    font-family: ui-monospace, monospace;
    color: #b45309;
    margin-bottom: 0.15rem;
}

.wf-mod-text {
    font-size: 11px;
    line-height: 1.45;
    color: #374151;
    margin: 0;
    word-break: break-word;
}

.wf-mod-more {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 0.35rem;
}

.wf-rich-video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.wf-rich-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(79, 124, 255, 0.25);
    background: rgba(79, 124, 255, 0.06);
    font-size: 10px;
    font-weight: 700;
    color: #1d4ed8;
    cursor: pointer;
}

.wf-rich-link-btn:hover {
    background: rgba(79, 124, 255, 0.12);
}

.wf-rich-tags {
    margin-top: 0.35rem;
    font-size: 10px;
    color: #64748b;
}

.wf-node--rich .wf-node-inner {
    min-height: 0;
}

html[data-theme="dark"] .wf-rich-view-text {
    color: #e5e7eb;
}

html[data-theme="dark"] .wf-rich-edit-btn,
html[data-theme="dark"] .wf-rich-link-btn {
    background: rgba(15, 17, 23, 0.75);
    border-color: rgba(55, 65, 81, 0.85);
    color: #93c5fd;
}
