/* =================================================================
   VisualBase Workflow Designer — design language unified with the
   Login screen (Poppins, teal/navy palette, glass cards, layered
   shadows, animated accents).
   ================================================================= */

:root {
  /* Brand palette — pulled from VisualBase.Core.Security.SSO/Login */
  --vb-teal:        #00c4b4;
  --vb-teal-2:      #0ea5e9;
  --vb-teal-3:      #06b6d4;
  --vb-gold:        #d4af37;
  --vb-gold-2:      #f59e0b;
  --vb-navy-1:      #0b1220;
  --vb-navy-2:      #13294b;
  --vb-navy-3:      #0b3a6d;

  /* Surfaces */
  --vb-bg:          #F1F5FB;
  --vb-surface:     #FFFFFF;
  --vb-glass:       rgba(255, 255, 255, 0.92);
  --vb-border:      #E2E8F0;
  --vb-text:        #0F172A;
  --vb-muted:       #64748B;
  --vb-accent:      var(--vb-teal);
  --vb-accent-soft: #CCF7F2;

  /* Geometry */
  --vb-radius-sm:   10px;
  --vb-radius:      16px;
  --vb-radius-lg:   24px;

  /* Layered shadow presets (login-style) */
  --vb-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 10px rgba(15, 23, 42, .06);
  --vb-shadow:    0 4px 6px rgba(0, 0, 0, .07), 0 12px 24px rgba(0, 0, 0, .10), 0 24px 48px rgba(0, 0, 0, .10);
  --vb-shadow-lg: 0 10px 30px rgba(15, 23, 42, .14), 0 30px 60px rgba(15, 23, 42, .12);
  --vb-glow-teal: 0 0 0 4px color-mix(in srgb, var(--vb-teal) 18%, transparent 82%);

  --vb-font:    'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  --vb-font-ar: 'Tajawal', "Cairo", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--vb-bg); color: var(--vb-text); font-family: var(--vb-font); font-size: 14px; }
button { font-family: inherit; }

.vb-shell, .vb-designer { display: flex; flex-direction: column; height: 100vh; }
[dir="rtl"] .vb-shell, [dir="rtl"] .vb-designer { font-family: var(--vb-font-ar); }
.vb-lang { font-weight: 700; letter-spacing: 1px; min-width: 40px; text-align: center; text-decoration: none; }

/* ---------- Toolbar (light glass card on top) ---------- */
.vb-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: var(--vb-glass); border-bottom: 1px solid var(--vb-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--vb-shadow-sm); z-index: 10; flex: 0 0 auto;
}
.vb-toolbar-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.vb-brand {
  font-weight: 800; font-size: 16px; letter-spacing: .3px;
  background: linear-gradient(135deg, var(--vb-teal) 0%, var(--vb-teal-2) 50%, var(--vb-teal-3) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: vb-shimmer 4s linear infinite;
}
@keyframes vb-shimmer { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }
.vb-sep { color: var(--vb-muted); }
.vb-objname { font-weight: 700; font-size: 16px; }
.vb-objname-ar { color: var(--vb-muted); margin-inline-start: 4px; font-size: 14px; }
.vb-toolbar-actions { display: flex; gap: 10px; align-items: center; }

.vb-input {
  height: 36px; padding: 0 12px; border: 1.5px solid var(--vb-border); border-radius: var(--vb-radius-sm);
  background: #F8FAFC; color: var(--vb-text); outline: none; min-width: 240px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.vb-input:focus { border-color: var(--vb-teal); box-shadow: var(--vb-glow-teal); background: white; }
.vb-btn {
  height: 36px; padding: 0 16px; border: 1.5px solid var(--vb-border); border-radius: var(--vb-radius-sm);
  background: var(--vb-surface); cursor: pointer; font-weight: 600; font-size: 13px;
  transition: all .15s; color: var(--vb-text);
}
.vb-btn:hover { border-color: var(--vb-teal); color: var(--vb-teal); transform: translateY(-1px); box-shadow: var(--vb-shadow-sm); }
.vb-btn:disabled { opacity: .4; cursor: not-allowed; }
.vb-btn-ghost { border-color: transparent; color: var(--vb-teal); background: transparent; }
.vb-btn-ghost:hover:not(:disabled) { background: var(--vb-accent-soft); }
.vb-btn-ghost.vb-on { background: linear-gradient(135deg, var(--vb-teal) 0%, var(--vb-teal-2) 100%); color: white; border-color: transparent; }
/* Primary action — used for "Send Approval Request" in runtime mode. */
.vb-btn-primary {
  background: linear-gradient(135deg, var(--vb-teal) 0%, var(--vb-teal-2) 100%);
  color: white; border-color: transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.vb-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--vb-shadow-sm);
  color: white;
}
.vb-spin { display: inline-block; animation: vb-spin .8s linear infinite; font-size: 14px; }
@keyframes vb-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- Zoom group (browser-style − [100%] +) ---------- */
.vb-zoom {
  display: inline-flex; align-items: stretch; height: 36px;
  border: 1.5px solid var(--vb-border); border-radius: var(--vb-radius-sm);
  background: var(--vb-surface); overflow: hidden;
}
.vb-zoom-btn, .vb-zoom-level {
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  font-weight: 700; font-size: 14px; color: var(--vb-text);
  padding: 0 12px; min-width: 32px; transition: all .15s;
}
.vb-zoom-level {
  min-width: 56px; font-size: 12px; letter-spacing: .5px;
  border-left: 1px solid var(--vb-border); border-right: 1px solid var(--vb-border);
}
.vb-zoom-btn:hover:not(:disabled), .vb-zoom-level:hover { background: var(--vb-accent-soft); color: var(--vb-teal); }
.vb-zoom-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Combobox ---------- */
.vb-combobox { position: relative; width: 340px; }
.vb-combobox-input { width: 100%; padding-right: 32px; }
.vb-combo-toggle {
  position: absolute; right: 6px; top: 6px; height: 24px; width: 24px;
  border: 0; background: transparent; color: var(--vb-muted); cursor: pointer; border-radius: 6px;
}
.vb-combo-toggle:hover { background: var(--vb-bg); color: var(--vb-teal); }
.vb-combo-list {
  position: absolute; top: 40px; left: 0; right: 0; max-height: 380px; overflow: auto;
  background: var(--vb-surface); border: 1px solid var(--vb-border); border-radius: var(--vb-radius);
  box-shadow: var(--vb-shadow-lg); z-index: 50;
}
.vb-combo-empty { padding: 16px; color: var(--vb-muted); text-align: center; font-size: 13px; }
.vb-combo-error { color: #B91C1C; background: #FEF2F2; border-bottom: 1px solid #FECACA; word-break: break-word; }
.vb-combo-item {
  display: block; width: 100%; text-align: start; padding: 12px 14px;
  border: 0; background: transparent; border-bottom: 1px solid var(--vb-border); cursor: pointer;
  font-family: inherit;
}
.vb-combo-item:last-child { border-bottom: 0; }
.vb-combo-item:hover { background: linear-gradient(90deg, var(--vb-accent-soft) 0%, transparent 100%); }
.vb-combo-item.vb-active { background: linear-gradient(90deg, var(--vb-accent-soft) 0%, transparent 100%); }
.vb-combo-line1 { display: flex; gap: 8px; align-items: baseline; }
.vb-combo-name { font-weight: 700; font-size: 13px; }
.vb-combo-line2 { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.vb-pill { color: white; font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 10px; letter-spacing: .8px; text-transform: uppercase; }
.vb-meta-text { color: var(--vb-muted); font-size: 11px; }

/* ---------- Diagram canvas — dark BPMN-style with login-style "space" backdrop ---------- */
/* The dark sky lives on .vb-canvas (the viewport-bound parent) so the nebula and
   star particles stay fixed while the SVG scrolls. */
.vb-canvas {
  position: relative; flex: 1; min-height: 0; min-width: 0; overflow: hidden;
  background: linear-gradient(135deg, #0b1220 0%, #13294b 45%, #0b3a6d 100%);
}
/* Pulsing nebula glows — same recipe as login-left-section::before */
.vb-canvas::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(circle at 25% 35%, rgba(0, 196, 180, .22) 0%, transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(14, 165, 233, .18) 0%, transparent 50%),
    radial-gradient(circle at 60% 15%, rgba(212, 175, 55, .10) 0%, transparent 45%);
  animation: vb-pulse 6s ease-in-out infinite;
}
/* Floating star particles — three tri-color dot grids drifting on top of the nebula */
.vb-canvas::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .55) 1px, transparent 1px),
    radial-gradient(circle, rgba(0, 196, 180, .50) 1px, transparent 1px),
    radial-gradient(circle, rgba(212, 175, 55, .45) 1px, transparent 1px);
  background-size: 60px 60px, 90px 90px, 130px 130px;
  background-position: 0 0, 30px 50px, 70px 20px;
  animation: vb-particle-float 24s linear infinite;
  opacity: .55;
}
.vb-canvas-empty {
  position: relative; z-index: 1;
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .85);
}
.vb-empty-title { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.vb-empty-sub   { margin-top: 8px; font-size: 13px; opacity: .7; }

.vb-diagram-host {
  position: absolute; inset: 0; padding: 0; overflow: hidden;
  background: transparent; z-index: 1;
  display: flex; flex-direction: column;
}
/* Procedure strip: independent horizontal scroller pinned to the top.
   Drawing area: independent both-axis scroller below it.
   Strip background spans the FULL host width even when the inner SVG content
   is narrower, so the dark band always reads as a top "border". */
.vb-diagram-proc {
  flex: 0 0 auto; overflow-x: auto; overflow-y: hidden;
  background: rgba(255, 255, 255, .06);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.vb-diagram-flow { flex: 1 1 auto; min-height: 0; overflow: auto; }
.vb-diagram-svg { display: block; cursor: default; }

@keyframes vb-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .75; transform: scale(1.04); }
}
@keyframes vb-particle-float {
  0%   { background-position:   0 0,  30px  50px,  70px  20px; }
  100% { background-position: 60px 60px, 120px 140px, 200px 150px; }
}

/* ---------- Nodes (main flow) ---------- */
/* No transform on hover — caused jitter when nodes were tightly packed. Glow only. */
.vb-node { cursor: pointer; }
.vb-node .vb-tile-bg { transition: stroke-width .15s ease, filter .15s ease; }
.vb-node:hover .vb-tile-bg { stroke-width: 3; filter: drop-shadow(0 0 14px rgba(0, 196, 180, .65)); }
.vb-selected .vb-tile-bg { stroke-width: 3.2; filter: drop-shadow(0 0 16px rgba(0, 196, 180, .70)); }

/* ---------- Procedure strip ---------- */
.vb-proc-strip-bg { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .12); stroke-width: 1; }
.vb-proc-row > text,
.vb-proc-row > line,
.vb-proc-row > circle { pointer-events: none; }
.vb-proc-node { cursor: pointer; transition: transform .12s; }
.vb-seq-clickable { cursor: pointer; }
.vb-seq-clickable .vb-tile-bg { transition: filter .15s ease, stroke-width .15s ease; }
.vb-seq-clickable:hover .vb-tile-bg { filter: drop-shadow(0 0 10px rgba(0, 196, 180, .55)); stroke-width: 2.8; }
.vb-proc-node rect, .vb-proc-node text { pointer-events: auto; }
.vb-proc-node .vb-hit { pointer-events: all; cursor: pointer; }
.vb-proc-node rect:first-of-type { transition: filter .15s ease, stroke-width .15s ease; }
.vb-proc-node:hover rect:first-of-type { filter: drop-shadow(0 0 10px rgba(0, 196, 180, .55)); stroke-width: 2.2; }
.vb-proc-current rect:first-of-type { stroke-width: 2.5; }

/* ---------- Strip toggle pill ---------- */
.vb-strip-toggle { cursor: pointer; }
.vb-strip-toggle, .vb-strip-toggle * { pointer-events: auto; }
.vb-strip-toggle:hover rect { filter: brightness(1.15); }

/* ---------- Floating panel (stage details) ---------- */
.vb-float {
  position: absolute; background: var(--vb-glass);
  border: 1px solid var(--vb-border); border-radius: var(--vb-radius);
  box-shadow: var(--vb-shadow-lg); z-index: 30; max-height: calc(100vh - 140px);
  display: flex; flex-direction: column; overflow: hidden;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.vb-float-collapsed { max-height: 48px; }
.vb-float-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; color: white; cursor: default; user-select: none;
}
.vb-float-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.vb-float-name { font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.vb-float-sub { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-float-actions { display: flex; gap: 4px; }
.vb-float-btn {
  width: 26px; height: 26px; border: 0; background: rgba(255,255,255,.18); color: white;
  border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1;
}
.vb-float-btn:hover { background: rgba(255,255,255,.32); }
.vb-float-body { padding: 14px 16px; overflow: auto; flex: 1; }

/* ---------- Detail content ---------- */
.vb-detail-head { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.vb-tag { background: var(--vb-bg); padding: 5px 12px; border-radius: 8px; font-size: 12px; color: var(--vb-muted); font-weight: 500; }
.vb-tag-warn { background: #FEF3C7; color: #92400E; }
.vb-tag-info { background: #E0F2FE; color: #0369A1; }

/* ---------- Validations toolbar button + grouped panel ---------- */
.vb-validations-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.vb-val-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #0EA5E9; color: white; font-size: 11px; font-weight: 800; line-height: 1;
}
.vb-valgroup { margin-bottom: 10px; border: 1px solid var(--vb-border); border-radius: 10px; overflow: hidden; }
.vb-valgroup-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.04); border: 0; padding: 10px 12px;
  cursor: pointer; color: inherit; font: inherit; text-align: start;
}
.vb-valgroup-head:hover { background: rgba(14,165,233,.08); }
.vb-valgroup-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--vbg-color, #0EA5E9); flex: 0 0 auto; }
.vb-valgroup-title { font-weight: 700; font-size: 13px; flex: 1; }
.vb-valgroup-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 8px; border-radius: 11px;
  background: var(--vbg-color, #0EA5E9); color: white; font-size: 11px; font-weight: 800;
}
.vb-valgroup-caret { font-size: 12px; color: var(--vb-muted); }
.vb-valgroup-empty { padding: 10px 14px; font-size: 12px; color: var(--vb-muted); font-style: italic; }
.vb-valgroup-table { table-layout: fixed; }
.vb-valgroup-table td:nth-child(3) { word-break: break-word; }
.vb-val-code { display: inline-block; max-width: 100%; }
.vb-row-muted { opacity: .55; }
.vb-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.vb-table th, .vb-table td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--vb-border); }
.vb-table th { font-weight: 700; color: var(--vb-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .8px; }
.vb-table code { background: var(--vb-bg); padding: 2px 6px; border-radius: 4px; font-size: 11px; color: #6D28D9; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.vb-muted { color: var(--vb-muted); font-style: italic; }

#blazor-error-ui { background: #fff5f5; color: #8b0000; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Runtime mode (page opened with ?guid=…) ---------- */
/* Requester pill — sits next to the approval-type pill in the toolbar; the icon
   carries the visual cue (👤) so the label can stay the actual user name. */
.vb-pill-requester {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #E2E8F0;
  display: inline-flex; align-items: center; gap: 6px;
  text-transform: none; letter-spacing: .2px;
  padding: 3px 10px 3px 8px;
}
.vb-pill-requester .vb-pill-ico { font-size: 11px; font-style: normal; line-height: 1; }
/* Toast pills shown next to the title after Send Approval — ok=teal, warn=amber.
   Click dismisses (the @onclick handler clears _sendToast). */
.vb-pill-ok   { background: linear-gradient(135deg, #10B981 0%, #059669 100%); color: white;
                display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
                text-transform: none; letter-spacing: .2px; }
.vb-pill-warn { background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%); color: white;
                display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
                text-transform: none; letter-spacing: .2px; }
.vb-pill-ok .vb-pill-ico, .vb-pill-warn .vb-pill-ico { font-style: normal; }

/* Current-user stage card — a soft amber halo + animated dashed ring so the
   reader's eye lands on it the moment the diagram renders. The vbFocusCurrentStage
   helper scrolls it into view; this CSS makes it obvious why we scrolled there. */
.vb-seq.vb-current-user .vb-tile-bg {
  filter: drop-shadow(0 0 14px rgba(245, 158, 11, .80));
  stroke-dasharray: 6 4;
  animation: vb-current-pulse 1.6s ease-in-out infinite;
}
@keyframes vb-current-pulse {
  0%, 100% { stroke-width: 2.6; }
  50%      { stroke-width: 4.0; }
}
