/* pathways.css — Replenishment Pathways workbench styles */

/* nav button styles handled by nav rail */

/* Panel */
#pathways-panel {
  position: fixed; top: 0; left: 52px; right: 0; bottom: 0;
  background: var(--panel-bg, #1A2832);
  border-left: 1px solid var(--panel-border, #2E4050);
  display: flex; flex-direction: column; z-index: 70;
}

/* Header */
.pw-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 48px; flex-shrink: 0;
  background: var(--panel-bg, #1A2832);
  border-bottom: 1px solid var(--panel-border, #2E4050);
}
.pw-header-icon {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; background: rgba(255,134,122,.12);
  border-radius: 6px; color: var(--coral, #FF867A); flex-shrink: 0;
}
.pw-header h2 { font-size: 13px; font-weight: 700; color: rgba(232,236,240,0.8); margin: 0; flex: 1; }
.pw-close-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-secondary, #7E97A8);
  cursor: pointer; border-radius: 8px; font-size: 15px;
}
.pw-close-btn:hover { background: rgba(255,255,255,.06); color: rgba(232,236,240,0.8); }

/* Body layout */
.pw-body { display: flex; flex: 1; overflow: hidden; position: relative; }

/* ── Sidebar ── */
.pw-sidebar {
  width: 260px; flex-shrink: 0; display: flex; flex-direction: column;
  overflow: hidden; border-right: 1px solid var(--panel-border, #2E4050);
  background: var(--panel-bg, #1A2832); transition: width .2s ease;
}
.pw-sidebar.hidden { width: 0; opacity: 0; pointer-events: none; border-right: none; }

/* Group select row at top of sidebar */
.pw-sb-group-row {
  padding: 8px 10px 6px; border-bottom: 1px solid var(--panel-border, #2E4050); flex-shrink: 0;
}
.pw-sel {
  width: 100%; background: var(--bg-surface, #1E2A33); border: 1px solid var(--panel-border, #2E4050);
  color: rgba(232,236,240,0.8); font-family: var(--font-primary, 'Avenir', sans-serif);
  font-size: 11px; padding: 5px 8px; border-radius: 6px; outline: none; cursor: pointer;
  box-sizing: border-box;
}
.pw-sel option { background: var(--panel-bg, #1A2832); }
.pw-sel:focus  { border-color: var(--coral, #FF867A); }

/* Pool section (takes remaining space) */
.pw-sb-pool { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.pw-pool-hd {
  display: flex; align-items: center; padding: 5px 10px;
  border-bottom: 1px solid var(--panel-border, #2E4050); flex-shrink: 0;
}
.pw-pool-hd-label {
  font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-secondary, #7E97A8); flex: 1;
}
.pw-pool-count { font-size: 9px; color: var(--grey-600, #515961); }
.pw-pool-body { flex: 1; overflow-y: auto; }

/* Buckets section — fills 50% of sidebar */
.pw-buckets { flex: 1; display: flex; flex-direction: column; border-top: 1px solid var(--panel-border, #2E4050); min-height: 0; overflow: hidden; }
.pw-buckets-hd {
  display: flex; align-items: center; padding: 5px 10px;
  user-select: none; background: rgba(255,255,255,.02); cursor: default;
}
.pw-buckets-hd-label {
  font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-secondary, #7E97A8); flex: 1;
}
.pw-buckets-hd-counts { font-size: 9px; color: var(--grey-600, #515961); margin-right: 6px; }
.pw-buckets-body { flex: 1; display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }

/* Sidebar sections — flexible, each grows/shrinks to content, all scroll together */
.pw-sb-section { display: flex; flex-direction: column; border-top: 1px solid var(--panel-border, #2E4050); }
.pw-sb-section-hd {
  display: flex; align-items: center; padding: 4px 10px;
  cursor: default; user-select: none; flex-shrink: 0; position: sticky; top: 0; z-index: 1;
  background: var(--panel-bg, #1A2832);
}
.pw-sb-section-hd:hover { background: rgba(255,255,255,.02); }
.pw-sb-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-secondary, #7E97A8); flex: 1;
}
.pw-sb-section-lbl-export { color: var(--coral, #FF867A); }
.pw-sb-section-lbl-both   { color: var(--success, #3DBB7D); }
.pw-sb-section-lbl-import { color: var(--blue-light, #4A9BF0); }
.pw-sb-toggle {
  background: none; border: none; color: var(--grey-600, #515961);
  cursor: pointer; font-size: 10px; padding: 0; line-height: 1;
  transition: transform .2s;
}
.pw-sb-toggle.collapsed { transform: rotate(-90deg); }
/* Section body: auto-size to content, no individual scroll */
.pw-sb-section-body { overflow: visible; }
.pw-sb-section-body.collapsed { display: none; }

/* Asset pool items */
.pw-pool-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  cursor: grab; transition: background .1s; user-select: none;
  border-bottom: 1px solid rgba(46,64,80,.4);
}
.pw-pool-item:hover { background: rgba(255,255,255,.04); }
.pw-pool-item.pw-dragging { opacity: .35; }
/* Name + op-code sit together inside a flex-1 wrapper — truncate as a unit */
.pw-asset-label { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 5px; overflow: hidden; }
.pw-asset-name  { font-size: 11px; font-weight: 500; color: rgba(232,236,240,0.8); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pw-op-code     { font-size: 11px; font-weight: 500; color: rgba(232,236,240,0.8); flex-shrink: 0; white-space: nowrap; }

/* Bucket sections in sidebar */
.pw-bucket-drop {
  padding: 4px 8px 6px; min-height: 44px;
  transition: background .15s; box-sizing: border-box;
}
.pw-bucket-drop.dov { background: rgba(255,255,255,.04); }
.pw-bucket-chip {
  display: flex; align-items: center; gap: 5px; padding: 3px 6px;
  border: 1px solid var(--panel-border, #2E4050); border-radius: 6px;
  background: var(--panel-bg-raised, #212F3A); margin-bottom: 3px;
  cursor: pointer; transition: border-color .12s; font-size: 10px;
}
.pw-bucket-chip:hover { border-color: rgba(229,73,58,.4); }
.pw-bucket-chip:hover .pw-chip-rm { opacity: 1; }
/* pw-chip-name: same spec as pw-asset-name so all labels are visually consistent */
.pw-chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(232,236,240,0.8); font-size: 11px; font-weight: 500; }
.pw-bucket-chip .pw-op-inline { font-size: 11px; font-weight: 500; color: rgba(232,236,240,0.8); }
.pw-chip-rm { font-size: 8px; color: var(--grey-600, #515961); opacity: 0; transition: opacity .12s; flex-shrink: 0; }
.pw-bucket-hint { font-size: 10px; color: var(--grey-700, #3A4148); padding: 3px 2px; display: block; }

/* Sidebar collapse handle — sits on the divider between sidebar and content */
.pw-sidebar-handle {
  position: absolute;
  left: 260px;
  top: 50%;
  transform: translateY(-50%) translateX(-50%);
  width: 16px;
  height: 40px;
  background: var(--panel-bg-raised, #212F3A);
  border: 1px solid var(--panel-border, #2E4050);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #7E97A8);
  z-index: 10;
  transition: background .15s, color .15s;
}
.pw-sidebar-handle:hover {
  background: var(--coral-10, rgba(255,134,122,0.1));
  color: var(--coral, #FF867A);
}

/* Content area */
.pw-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Toolbar */
.pw-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 44px; flex-shrink: 0;
  background: var(--panel-bg, #1A2832); border-bottom: 1px solid var(--panel-border, #2E4050);
}
.pw-toolbar-lbl {
  font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--grey-600, #515961); white-space: nowrap; flex-shrink: 0;
}
/* Product filter — popout button (see .pw-filter-btn below) */
.pw-count { font-size: 11px; color: var(--text-secondary, #7E97A8); flex: 1; padding-left: 4px; }
/* Product filter popout button */
.pw-filter-btn {
  display: flex; align-items: center; gap: 5px; padding: 4px 9px;
  background: var(--bg-surface, #1E2A33); border: 1px solid var(--panel-border, #2E4050);
  border-radius: 6px; color: var(--text-secondary, #7E97A8);
  font-family: var(--font-primary, 'Avenir', sans-serif);
  font-size: 11px; cursor: pointer; transition: all .12s; white-space: nowrap; flex-shrink: 0;
}
.pw-filter-btn:hover { border-color: var(--grey-500, #6B747D); color: rgba(232,236,240,0.8); }
.pw-filter-btn.active { border-color: var(--coral, #FF867A); color: var(--coral, #FF867A); background: rgba(255,134,122,.1); }
.pw-filter-btn.product-active { border-color: var(--coral, #FF867A); color: var(--coral, #FF867A); background: rgba(255,134,122,.1); }
.pw-filter-caret { font-size: 8px; opacity: .5; }
/* Filter popout panel */
.pw-filter-popout {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 120;
  background: var(--panel-bg-raised, #212F3A); border: 1px solid var(--panel-border, #2E4050);
  border-radius: 8px; padding: 10px; min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); display: none;
}
.pw-filter-popout.open { display: block; }
.pw-filter-popout-title {
  font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-secondary, #7E97A8); margin-bottom: 8px;
}
.pw-filter-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pw-fpill {
  padding: 3px 8px; border-radius: 20px; border: 1px solid var(--panel-border, #2E4050);
  background: none; color: var(--text-secondary, #7E97A8);
  font-family: var(--font-primary, 'Avenir', sans-serif); font-size: 10px;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.pw-fpill:hover { border-color: var(--grey-500, #6B747D); color: rgba(232,236,240,0.8); }
.pw-fpill.active { border-color: var(--coral, #FF867A); color: var(--coral, #FF867A); background: rgba(255,134,122,.1); }
.pw-analyze-btn {
  padding: 5px 13px; border-radius: 7px; border: none;
  background: var(--coral, #FF867A); color: #fff;
  font-family: var(--font-primary, 'Avenir', sans-serif);
  font-size: 11px; font-weight: 700; cursor: pointer; transition: background .15s;
  white-space: nowrap; flex-shrink: 0;
}
.pw-analyze-btn:hover { background: #f06b5e; }

/* Merged pane */
.pw-merged-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; min-height: 0; }
/* ── Step-by-step empty state ── */
.pw-steps {
  display: flex; flex-direction: column; gap: 0;
  max-width: 360px; width: 100%;
}
.pw-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: var(--panel-bg-raised, #212F3A);
  border: 1px solid var(--panel-border, #2E4050);
  border-radius: var(--r-md, 6px);
}
.pw-step-cta { border-color: rgba(255,134,122,0.4); background: rgba(255,134,122,0.07); }
.pw-step-num {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%;
  background: rgba(74,155,240,0.18);
  color: var(--blue-muted, #80BFFF);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.pw-step-num.cta {
  background: rgba(255,134,122,0.2);
  color: var(--coral, #FF867A);
  font-size: 14px;
}
.pw-step-title {
  font-size: 12px; font-weight: 700;
  color: var(--text-primary, #E8ECF0);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.pw-step-desc { font-size: 11px; color: var(--text-secondary, #7E97A8); line-height: 1.6; }
.pw-step-optional {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-secondary, #7E97A8);
}
.pw-step-tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
}
.pw-step-tag.export { background: rgba(255,134,122,0.15); color: var(--coral, #FF867A); }
.pw-step-tag.import { background: rgba(74,155,240,0.15);  color: var(--blue-muted, #80BFFF); }
.pw-step-tag.both   { background: rgba(61,187,125,0.15);  color: var(--success, #3DBB7D); }
.pw-step-arrow {
  text-align: center; color: var(--text-secondary, #7E97A8);
  font-size: 14px; line-height: 1; padding: 2px 0;
  padding-left: 11px;
}

/* pw-content needs relative so handle can position off sidebar */
.pw-content { position: relative; flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.pw-empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; flex: 1; gap: 10px; color: var(--text-secondary, #7E97A8);
}
.pw-empty-state p     { font-size: 13px; }
.pw-empty-state small { font-size: 11px; opacity: .6; }

/* Results split */
#pw-results { display: flex; flex-direction: row; flex: 1; min-height: 0; overflow: hidden; }

/* Left column: mini-map fills full height (tube map deferred) */
.pw-left-col {
  flex: 0 0 45%; display: flex; flex-direction: column;
  overflow: hidden; border-right: 1px solid var(--panel-border, #2E4050);
}
.pw-map-pane {
  flex: 1; position: relative; overflow: hidden;
}
/* pw-map-hd removed */
#pw-mini-map { position: absolute; inset: 0; }
/* Tube map pane — hidden until reimplemented */
.pw-tube-pane {
  display: none;
}
.pw-tube-hd {
  position: absolute; top: 0; left: 0; right: 0; z-index: 1;
  padding: 5px 10px; font-size: 9px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: var(--grey-600, #515961);
  background: linear-gradient(to bottom, rgba(26,40,50,.9), transparent);
  pointer-events: none;
}
#pw-tube-div {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden;
}

/* Right column: paths list */
.pw-paths-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.pw-paths-col-hd {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-bottom: 1px solid var(--panel-border, #2E4050); flex-shrink: 0; flex-wrap: wrap;
}
.pw-paths-col-title {
  font-size: 9px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
  color: var(--text-secondary, #7E97A8); margin-right: 2px;
}
/* View toggle: Origin / Destination */

/* Origin / Destination segmented switch */
.pw-view-switch {
  display: flex; align-items: stretch;
  border: 1px solid var(--panel-border, #2E4050); border-radius: 6px;
  overflow: hidden; flex-shrink: 0;
}
.pw-vs-opt {
  padding: 3px 11px; background: none; border: none;
  border-right: 1px solid var(--panel-border, #2E4050);
  color: var(--text-secondary, #7E97A8); cursor: pointer;
  font-family: var(--font-primary, 'Avenir', sans-serif);
  font-size: 9px; font-weight: 700; letter-spacing: .3px;
  transition: background .1s, color .1s; white-space: nowrap;
}
.pw-vs-opt:last-child { border-right: none; }
.pw-vs-opt:hover:not(.active) { background: rgba(255,255,255,.05); color: rgba(232,236,240,0.8); }
.pw-vs-opt.active          { background: rgba(255,134,122,.12); color: var(--coral, #FF867A); }
.pw-vs-opt.active-dest     { background: rgba(74,155,240,.12);  color: var(--blue-light, #4A9BF0); }

/* Modality filter pills in header */
.pw-mod-pills { display: flex; gap: 2px; flex-wrap: wrap; }
.pw-mpill {
  padding: 2px 7px; border-radius: 20px; border: 1px solid var(--panel-border, #2E4050);
  background: none; font-family: var(--font-primary, 'Avenir', sans-serif);
  font-size: 9px; cursor: pointer; transition: all .12s; white-space: nowrap;
  color: var(--text-secondary, #7E97A8);
}
.pw-mpill:hover { color: rgba(232,236,240,0.8); border-color: var(--grey-500); }
.pw-mpill[data-mod="pipeline"].active { border-color: #80BFFF; color: #80BFFF; background: rgba(128,191,255,.1); }
.pw-mpill[data-mod="rail"].active     { border-color: #4ECDC4; color: #4ECDC4; background: rgba(78,205,196,.1); }
.pw-mpill[data-mod="truck"].active    { border-color: #C9915A; color: #C9915A; background: rgba(201,145,90,.1); }
.pw-mpill[data-mod="barge"].active    { border-color: #4A9BF0; color: #4A9BF0; background: rgba(74,155,240,.1); }
.pw-mpill[data-mod="vessel"].active   { border-color: #4A9BF0; color: #4A9BF0; background: rgba(74,155,240,.1); }
.pw-mpill[data-mod=""].active         { border-color: var(--coral,#FF867A); color: var(--coral,#FF867A); background: rgba(255,134,122,.08); }
.pw-paths-scroll { flex: 1; overflow-y: auto; padding: 0 0 8px; min-height: 0; }

/* Path rows — merged-cell grid: 1fr [200px connector] 1fr
   Origin view:  anchor(col1,spans N rows) | conn(col2) | other(col3)
   Dest view:    other(col1) | conn(col2) | anchor(col3,spans N rows)
   Both asset columns are always equal (1fr each); connector is independent. */
.pw-path-group {
  display: grid;
  grid-template-columns: 1fr 200px 1fr;
  border-top: 1px solid var(--panel-border, #2E4050);
  margin-top: 3px;
}
.pw-path-group:first-child { margin-top: 0; border-top: none; }

/* Anchor cell — spans all rows in the group, vertically centred */
.pw-path-anchor {
  display: flex; align-items: center; padding: 12px 12px 12px 10px;
  border-left: 3px solid var(--ac, #7E97A8);
  border-right: 1px solid rgba(46,64,80,.4);
}
.pw-path-anchor.anchor-r {
  border-left: 1px solid rgba(46,64,80,.4);
  border-right: 3px solid var(--ac, #7E97A8);
  justify-content: flex-start;
}
.pw-anchor-inner { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.pw-anchor-name  {
  font-size: 11px; font-weight: 700; color: rgba(232,236,240,0.8);
  line-height: 1.4; word-break: break-word; flex: 1; min-width: 0;
}

/* Connector cell — col 2, one per row */
.pw-path-conn {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  padding: 5px 8px; min-height: 42px;
  border-bottom: 1px solid rgba(46,64,80,.25);
}
.pw-path-conn:last-of-type { border-bottom: none; }
.pw-path-conn svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pw-conn-labels {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  align-items: center; background: var(--panel-bg, #1A2832);
  padding: 2px 5px; max-width: 188px;
}
.pw-conn-mod-lbl  { font-size: 8px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }
.pw-conn-route-lbl {
  font-size: 7.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 186px; text-align: center;
}
.pw-conn-transit-lbl {
  font-size: 7px; font-weight: 600; white-space: nowrap; text-align: center; letter-spacing: .2px;
}

/* Other asset cell — col 1 or col 3, one per row */
.pw-path-other {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 10px 12px; min-width: 0; cursor: pointer;
  border-bottom: 1px solid rgba(46,64,80,.25);
  transition: background .1s;
}
.pw-path-other:hover { background: rgba(255,255,255,.03); }
.pw-path-other:last-of-type { border-bottom: none; }
.pw-path-other-name {
  font-size: 11px; font-weight: 600; color: rgba(232,236,240,0.8);
  line-height: 1.4; word-break: break-word; flex: 1; min-width: 0;
}
/* type-badge top-aligns with first line of wrapped name */
.pw-path-anchor .type-badge,
.pw-path-other  .type-badge { align-self: flex-start; margin-top: 2px; flex-shrink: 0; }

/* Tooltip */
.pw-status-bar {
  display: none; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  padding: 5px 14px; border-radius: 8px; font-size: 11px;
  z-index: 5; pointer-events: none; white-space: nowrap;
  background: rgba(26,40,50,.92); border: 1px solid rgba(245,166,35,.6); color: #F5A623; backdrop-filter: blur(4px);
}
#pw-tooltip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--panel-bg-raised, #212F3A); border: 1px solid var(--panel-border, #2E4050);
  border-radius: 8px; padding: 9px 12px; font-size: 11px; max-width: 220px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); opacity: 0; transition: opacity .1s;
}
