/* ====================================================================
   Schedule Tab — P6-Style Construction Scheduler
   ==================================================================== */

/* Toolbar */
#sched-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--card-bg, #1a1a2e); border-bottom: 1px solid var(--border, #2a2a4a);
  flex-wrap: wrap; min-height: 44px;
}
#sched-toolbar .sched-toolbar-left,
#sched-toolbar .sched-toolbar-center,
#sched-toolbar .sched-toolbar-right {
  display: flex; align-items: center; gap: 6px;
}
#sched-toolbar .sched-toolbar-left { flex: 1; }
#sched-toolbar .sched-toolbar-right { margin-left: auto; }
.sched-select { max-width: 220px; font-size: 12px; padding: 4px 8px; }
.sched-select-sm { max-width: 160px; }
.sched-zoom-label { font-size: 11px; color: var(--text-muted, #888); margin-left: 8px; }
.sched-zoom-slider { width: 80px; accent-color: var(--accent, #ff6b35); }

/* Schedule tab — use absolute fill so it works regardless of parent layout */
#schedule {
  position: relative;
}
#schedule.tab-content.active {
  display: flex !important; flex-direction: column;
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* Split pane layout */
#sched-split {
  display: flex; flex: 1; overflow: hidden;
  min-height: 0;
}

/* Left: activity table */
#sched-table {
  width: 520px; min-width: 300px; max-width: 700px;
  display: flex; flex-direction: column;
  border-right: 2px solid var(--border, #2a2a4a);
  overflow: hidden; flex-shrink: 0;
}
#sched-table-header {
  display: flex; align-items: center;
  background: var(--card-bg, #1a1a2e);
  border-bottom: 2px solid var(--border, #2a2a4a);
  font-size: 11px; font-weight: 600; color: var(--text-muted, #aaa);
  text-transform: uppercase; letter-spacing: 0.5px;
  height: 48px; flex-shrink: 0;
}
.sched-th {
  padding: 0 6px; display: flex; align-items: center; height: 100%;
  border-right: 1px solid var(--border, #2a2a4a);
}
.sched-col-expand { width: 24px; flex-shrink: 0; }
.sched-col-id { width: 90px; flex-shrink: 0; }
.sched-col-name { flex: 1; min-width: 140px; }
.sched-col-dur { width: 40px; flex-shrink: 0; text-align: center; }
.sched-col-start { width: 80px; flex-shrink: 0; }
.sched-col-finish { width: 80px; flex-shrink: 0; }
.sched-col-float { width: 36px; flex-shrink: 0; text-align: center; }

#sched-table-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
}

/* Activity rows */
.sched-row {
  display: flex; align-items: center; height: 24px;
  border-bottom: 1px solid var(--border-light, rgba(255,255,255,0.05));
  font-size: 11px; cursor: pointer; transition: background 0.1s;
}
.sched-row:hover { background: rgba(255,255,255,0.04); }
.sched-row.selected { background: rgba(var(--accent-rgb, 255,107,53), 0.15); }
.sched-row.critical .sched-cell-name { color: #ff4444; }
.sched-row.wbs-row {
  font-weight: 600; background: rgba(255,255,255,0.03);
  font-size: 11px;
}
.sched-cell {
  padding: 0 6px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; height: 100%; display: flex; align-items: center;
  border-right: 1px solid var(--border-light, rgba(255,255,255,0.03));
}
.sched-cell-expand { width: 24px; flex-shrink: 0; cursor: pointer; justify-content: center; }
.sched-cell-expand svg { width: 10px; height: 10px; transition: transform 0.15s; }
.sched-cell-expand.collapsed svg { transform: rotate(-90deg); }
.sched-cell-id { width: 90px; flex-shrink: 0; color: var(--text-muted, #888); font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 10px; }
.sched-cell-name { flex: 1; min-width: 140px; }
.sched-cell-dur { width: 40px; flex-shrink: 0; justify-content: center; }
.sched-cell-start, .sched-cell-finish { width: 80px; flex-shrink: 0; font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 10px; }
.sched-cell-float { width: 36px; flex-shrink: 0; justify-content: center; font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 10px; }
.sched-cell-float.zero { color: #ff4444; font-weight: 600; }

.sched-indent { display: inline-block; width: 16px; flex-shrink: 0; }

/* Divider (resizable) */
#sched-divider {
  width: 4px; cursor: col-resize;
  background: var(--border, #2a2a4a);
  transition: background 0.15s;
  flex-shrink: 0;
}
#sched-divider:hover, #sched-divider.dragging {
  background: var(--accent, #ff6b35);
}

/* Right: Gantt chart */
#sched-gantt-wrap {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  overflow: hidden;
}
#sched-gantt-header {
  height: 48px; flex-shrink: 0; overflow: hidden;
  background: var(--card-bg, #1a1a2e);
  border-bottom: 2px solid var(--border, #2a2a4a);
  position: relative;
}
#sched-gantt-scroll {
  flex: 1; overflow: scroll; position: relative;
  min-height: 0;
}
#sched-gantt {
  display: block;
}

/* Status bar */
#sched-status-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px; font-size: 11px; color: var(--text-muted, #888);
  background: var(--card-bg, #1a1a2e);
  border-top: 1px solid var(--border, #2a2a4a);
  height: 28px; flex-shrink: 0;
}

/* Context menu */
.sched-context-menu {
  position: fixed; z-index: 9999;
  background: var(--card-bg, #1e1e3a); border: 1px solid var(--border, #2a2a4a);
  border-radius: 6px; padding: 4px 0; min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.sched-context-item {
  padding: 6px 14px; font-size: 12px; cursor: pointer;
  color: var(--text, #eee); transition: background 0.1s;
}
.sched-context-item:hover { background: rgba(255,255,255,0.08); }
.sched-context-sep { height: 1px; background: var(--border, #2a2a4a); margin: 4px 0; }

/* Modal dialogs */
.sched-modal-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
}
.sched-modal {
  background: var(--card-bg, #1e1e3a); border: 1px solid var(--border, #2a2a4a);
  border-radius: 8px; padding: 20px; min-width: 400px; max-width: 600px;
  max-height: 80vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.sched-modal h3 { margin: 0 0 16px; font-size: 16px; }
.sched-modal .field { margin-bottom: 12px; }
.sched-modal .field label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted, #aaa); margin-bottom: 4px; text-transform: uppercase; }
.sched-modal .field input, .sched-modal .field select {
  width: 100%; padding: 6px 10px; font-size: 13px;
  background: var(--input-bg, #12122a); border: 1px solid var(--border, #2a2a4a);
  border-radius: 4px; color: var(--text, #eee);
}
.sched-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
