/* ═══════════════════════════════════════════════════════
   EVENTFLOW — wbs.css
   Work Breakdown Structure styles
   ═══════════════════════════════════════════════════════ */

/* ── Summary bar ───────────────────────────────────────── */
.wbs-summary-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.wbs-stat {
  flex: 1;
  min-width: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wbs-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.wbs-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Tree container ────────────────────────────────────── */
.wbs-tree-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.wbs-tree-header {
  background: linear-gradient(135deg, var(--az-bg), var(--surface));
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}
.wbs-root-node {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wbs-root-icon {
  font-size: 28px;
  width: 44px;
  text-align: center;
}
.wbs-root-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.wbs-root-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.wbs-add-btn {
  margin-left: auto;
}

/* ── Tree body ─────────────────────────────────────────── */
.wbs-tree-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wbs-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

/* ── Node card ─────────────────────────────────────────── */
.wbs-node {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wbs-depth-0 > .wbs-node-card { border-left: 3px solid var(--node-color, var(--azure)); }
.wbs-depth-1 > .wbs-node-card { border-left: 3px solid var(--node-color, var(--emerald)); margin-left: 28px; }
.wbs-depth-2 > .wbs-node-card { border-left: 3px solid var(--node-color, var(--violet)); margin-left: 56px; }
.wbs-depth-3 > .wbs-node-card { border-left: 3px solid var(--node-color, var(--amber)); margin-left: 84px; }

.wbs-node-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow 0.15s, background 0.15s;
}
.wbs-node-card:hover {
  background: var(--surface);
  box-shadow: var(--sh);
}
.wbs-node-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.wbs-node-code {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-family: 'DM Mono', monospace;
}
.wbs-node-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wbs-node-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.wbs-meta-item {
  font-size: 11px;
  color: var(--muted);
}
.wbs-team-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.wbs-node-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.wbs-node-stats {
  display: flex;
  gap: 12px;
  align-items: center;
}
.wbs-mini-stat {
  text-align: center;
  min-width: 36px;
}
.wbs-mini-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.wbs-mini-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}
.wbs-progress-bar {
  width: 80px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.wbs-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.wbs-node-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.wbs-node-card:hover .wbs-node-actions { opacity: 1; }

/* ── Action buttons ────────────────────────────────────── */
.wbs-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--slate);
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.wbs-action-btn:hover { background: var(--bg); border-color: var(--border2); }
.wbs-action-danger:hover { background: var(--ru-bg); border-color: var(--ruby); color: var(--ruby); }

/* ── Task list under node ──────────────────────────────── */
.wbs-task-list {
  margin-left: 44px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wbs-depth-1 .wbs-task-list { margin-left: 72px; }
.wbs-depth-2 .wbs-task-list { margin-left: 100px; }
.wbs-depth-3 .wbs-task-list { margin-left: 128px; }

.wbs-task-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.wbs-task-status { font-size: 13px; flex-shrink: 0; }
.wbs-task-name { flex: 1; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbs-task-team { font-size: 11px; font-weight: 500; white-space: nowrap; }
.wbs-task-priority { font-size: 10px; flex-shrink: 0; }
.wbs-task-due { font-size: 11px; color: var(--muted); font-family: monospace; white-space: nowrap; }
.wbs-assign-pill-btn { font-size: 11px; padding: 2px 8px; margin-left: auto; }

/* ── Children connector ────────────────────────────────── */
.wbs-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Unassigned bucket ─────────────────────────────────── */
.wbs-unassigned-bucket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.wbs-unassigned-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.15s;
}
.wbs-unassigned-header:hover { background: var(--bg); }
.wbs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.wbs-badge-amber { background: var(--am-bg); color: var(--amber); }

/* ── WBS Node Modal ────────────────────────────────────── */
#wbs-modal, #wbs-assign-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11,15,26,.45);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.wbs-modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}
.wbs-modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wbs-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.wbs-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.wbs-modal-parent-label {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.wbs-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Assign modal ──────────────────────────────────────── */
.wbs-assign-modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.wbs-assign-body-scroll {
  overflow-y: auto;
  padding: 16px 20px;
  flex: 1;
}
.wbs-assign-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin: 12px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.wbs-assign-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}
.wbs-assign-row:hover { background: var(--bg); }
.wbs-assign-row input[type="checkbox"] { cursor: pointer; }
.wbs-assign-task-name { flex: 1; color: var(--ink); font-weight: 500; }
.wbs-assign-status { font-size: 11px; color: var(--muted); }
.wbs-assign-status.done { color: var(--emerald); }
.wbs-assign-meta { font-size: 11px; }
.wbs-assigned { background: var(--em-bg); }
.wbs-assign-other { opacity: 0.65; }

/* ── BCC Roll-up table ─────────────────────────────────── */
.wbs-bcc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.wbs-bcc-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.wbs-bcc-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.wbs-bcc-table tr:last-child td { border-bottom: none; }
.wbs-table-code {
  font-size: 10px;
  font-weight: 700;
  background: var(--az-bg);
  color: var(--azure);
  padding: 2px 6px;
  border-radius: 10px;
  margin-right: 6px;
  font-family: monospace;
}
.wbs-progress-inline {
  display: inline-block;
  vertical-align: middle;
  width: 60px;
  margin-right: 6px;
}

/* ── Gantt WBS filter ──────────────────────────────────── */
#gantt-wbs-filter {
  height: 30px;
  font-size: 12px;
  min-width: 170px;
  max-width: 220px;
}

/* ── Dark mode ─────────────────────────────────────────── */
[data-theme="dark"] .wbs-node-card { background: var(--ink3); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .wbs-node-card:hover { background: var(--ink2); }
[data-theme="dark"] .wbs-task-pill { background: var(--ink2); border-color: rgba(255,255,255,.08); }
[data-theme="dark"] .wbs-unassigned-bucket,
[data-theme="dark"] .wbs-tree-container,
[data-theme="dark"] .wbs-stat,
[data-theme="dark"] .wbs-modal-box,
[data-theme="dark"] .wbs-assign-modal-box { background: var(--ink2); border-color: rgba(255,255,255,.1); }
[data-theme="dark"] .wbs-tree-header { background: linear-gradient(135deg, var(--ink3), var(--ink2)); }
[data-theme="dark"] .wbs-assign-row:hover { background: var(--ink3); }
[data-theme="dark"] .wbs-assigned { background: rgba(16,160,106,.12); }

/* ── Kanban / Gantt toolbar filter selects ─────────────────────────────────
   wbs.css loads last, but use !important to beat mobile-enhancements.css
   @media rules that re-apply width:100% at narrow breakpoints.               */
#task-search-bar .form-select,
#task-search-bar select,
select#task-filter-team,
select#task-filter-priority,
select#task-filter-status,
select#task-filter-wbs {
  width: auto !important;
  padding: 0 36px 0 10px !important;
  height: 34px !important;
  line-height: 34px !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
}

select#task-filter-team     { min-width: 130px; max-width: 180px; }
select#task-filter-priority { min-width: 110px; max-width: 150px; }
select#task-filter-status   { min-width: 120px; max-width: 160px; }
select#task-filter-wbs      { min-width: 140px; max-width: 210px; }

/* Gantt controls bar selects */
.gantt-controls .form-select,
.gantt-controls select,
select#gantt-wbs-filter {
  width: auto !important;
  padding: 0 36px 0 10px !important;
  height: 30px !important;
  line-height: 30px !important;
  box-sizing: border-box !important;
  flex-shrink: 0;
}
select#gantt-wbs-filter { min-width: 150px; max-width: 220px; }

/* WBS task-row assignment select — compact inline context */
.wbs-task-assign-select,
.form-select[style*="height:28px"],
.form-select[style*="height: 28px"] {
  padding: 3px 32px 3px 8px !important;
  height: 28px !important;
  line-height: 22px !important;
  font-size: 11px !important;
}

/* Workload team filter toolbar */
#p3-wl-team-filter {
  padding: 6px 36px 6px 10px !important;
  height: 34px !important;
}
