/* ═══════════════════════════════════════════════════════════════
   Workflow Diagram Styles
   ═══════════════════════════════════════════════════════════════ */

/* Container */
.workflow-diagram-wrapper {
    width: 100%;
    height: 800px;
    position: relative;
    background-color: #f8f9fb;
    background-image:
        radial-gradient(circle, #d5d9e0 1px, transparent 1px);
    background-size: 24px 24px;
    border-radius: 0 0 0.5rem 0.5rem;
    overflow: hidden;
}

/* ── Step Node ────────────────────────────────────────────── */
.wf-step-node {
    background: #fff;
    border: 2px solid #4a90d9;
    border-radius: 10px;
    min-width: 230px;
    max-width: 280px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}

.wf-step-node:hover {
    box-shadow: 0 4px 18px rgba(74, 144, 217, 0.25);
}

.wf-step-node--selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Header */
.wf-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: #fff;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.wf-step-order-badge {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.wf-step-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

/* Body */
.wf-step-body {
    padding: 10px 12px;
}

.wf-step-info-row {
    display: flex;
    align-items: center;
    color: #555;
    margin-bottom: 4px;
    font-size: 12px;
}

/* Action Buttons (appear on hover) */
.wf-step-actions,
.wf-condition-header-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.wf-step-node:hover .wf-step-actions,
.wf-condition-node:hover .wf-condition-header-actions {
    opacity: 1;
}

.wf-node-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: inherit;
    padding: 0;
    font-size: 11px;
    transition: background 0.15s;
}

.wf-node-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.wf-node-btn--delete:hover {
    background: rgba(220, 53, 69, 0.85) !important;
    color: #fff !important;
}

/* ── Condition Node ───────────────────────────────────────── */
.wf-condition-node {
    background: #fff;
    border: 2px solid #d97706;
    border-radius: 10px;
    min-width: 200px;
    max-width: 260px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    transition: box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}

.wf-condition-node:hover {
    box-shadow: 0 4px 18px rgba(217, 119, 6, 0.25);
}

.wf-condition-node--selected {
    border-color: #b45309;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.18);
}

.wf-condition-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.wf-condition-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.wf-condition-body {
    padding: 10px 12px;
}

.wf-condition-outputs {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.wf-label-true {
    color: #16a34a;
    font-weight: 600;
    font-size: 12px;
}

.wf-label-false {
    color: #dc2626;
    font-weight: 600;
    font-size: 12px;
}

/* ── Port Overrides (small dots on node edges) ────────────── */
.diagram-port {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #94a3b8;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s, transform 0.15s;
}

.diagram-port:hover {
    background: #3b82f6;
    transform: scale(1.3);
}

/* ── Link / Arrow Overrides ───────────────────────────────── */

/* Z.Blazor.Diagrams v3 uses these selectors for SVG links */
.diagram-link path,
.blazor-diagram-link path,
svg path[class*="link"],
svg g[class*="link"] path {
    stroke: #64748b;
    stroke-width: 2;
    fill: none;
}

/* Hover / selected state */
.diagram-link.selected path,
.blazor-diagram-link.selected path {
    stroke: #3b82f6;
    stroke-width: 2.5;
}

/* Arrow marker (SVG <marker> fill inherits stroke color) */
svg marker path,
svg defs marker path {
    fill: #64748b;
    stroke: none;
}

/* Fallback: force any SVG path inside the diagram wrapper to be visible */
.workflow-diagram-wrapper svg path {
    stroke: #64748b;
    stroke-width: 2;
    fill: none;
}

.workflow-diagram-wrapper svg path[fill]:not([fill="none"]) {
    fill: #64748b;
    stroke: none;
}

/* ── Toolbar Helpers ──────────────────────────────────────── */
.wf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Branch Link Colors ───────────────────────────────────── */
.wf-branch-true path {
    stroke: #16a34a !important;
}

.wf-branch-false path {
    stroke: #dc2626 !important;
}

/* ── Condition Node: expression display ──────────────────── */
.wf-condition-expressions {
    border-top: 1px solid rgba(217, 119, 6, 0.2);
    padding-top: 6px;
}

.wf-expr-row {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.wf-expr-field {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.wf-expr-op {
    color: #6b7280;
    font-weight: 500;
}

.wf-expr-val {
    background: #f0fdf4;
    color: #166534;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.wf-expr-logic {
    font-size: 10px;
    font-weight: 700;
    color: #7c3aed;
    letter-spacing: 0.05em;
    margin: 1px 0;
}

/* ── Condition Node: branch outputs ─────────────────────── */
.wf-condition-outputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wf-branch-output {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 6px;
    border-radius: 5px;
    font-size: 11px;
}

.wf-branch-output--true {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.wf-branch-output--false {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.wf-branch-target {
    color: #6b7280;
    font-style: italic;
    font-size: 11px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Expression Builder ──────────────────────────────────── */
.wf-expr-builder {
    max-height: 320px;
    overflow-y: auto;
}

.wf-expr-row-builder {
    background: #fff !important;
}



/*  Link Labels (Evet / Hay\u0131r)  */
.diagram-link-label text,
.diagram-link text {
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 4px;
    fill: #374151;
}
