/* ============================================================
   TASKFLOW — Gantt Chart Styles
   ============================================================ */

/* ---- Section container ---- */
#ganttSection {
  display: none;
}

/* ---- Toolbar ---- */
.gantt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 16px;
  flex-wrap: wrap;
}

.gantt-toolbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gantt-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.gantt-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Zoom buttons ---- */
.gantt-zoom-group {
  display: flex;
  gap: 2px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 2px;
}

.gantt-zoom-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-body);
}
.gantt-zoom-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.gantt-zoom-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ---- Nav buttons ---- */
.gantt-nav-btn {
  width: 32px; height: 32px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}
.gantt-nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ---- Chart container ---- */
.gantt-outer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

#ganttChartArea {
  overflow: hidden;
  position: relative;
  min-height: 300px;
}

/* ---- Layout ---- */
.gantt-layout {
  display: flex;
  width: 100%;
  position: relative;
}

/* ---- Sidebar ---- */
.gantt-sidebar {
  flex-shrink: 0;
  background: var(--bg-card);
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.gantt-sidebar-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
  background: var(--bg-700);
}

.gantt-sidebar-rows { overflow-y: hidden; flex: 1; }

.gantt-sidebar-row {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.82rem;
}
.gantt-sidebar-row:hover { background: var(--bg-hover); }

/* ---- Scroll wrap ---- */
.gantt-scroll-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  width: 100%;
}

.gantt-scroll-wrap > div {
  min-width: max-content;
}
.gantt-scroll-wrap::-webkit-scrollbar { height: 6px; }
.gantt-scroll-wrap::-webkit-scrollbar-track { background: transparent; }
.gantt-scroll-wrap::-webkit-scrollbar-thumb { background: var(--bg-600); border-radius: 3px; }

/* ---- Task bar ---- */
.gantt-bar {
  position: absolute;
  border-radius: 6px;
  cursor: grab;
  overflow: hidden;
  transition: box-shadow 0.2s, opacity 0.2s;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  user-select: none;
}
.gantt-bar:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important; }
.gantt-bar:active { cursor: grabbing; }

.gantt-resize-handle {
  position: absolute;
  right: 0; top: 0;
  width: 8px; height: 100%;
  cursor: ew-resize;
  z-index: 5;
  border-radius: 0 6px 6px 0;
  background: rgba(255,255,255,0.2);
  opacity: 0;
  transition: opacity 0.2s;
}
.gantt-bar:hover .gantt-resize-handle { opacity: 1; }

/* ---- Empty state ---- */
.gantt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}
.gantt-empty-icon {
  font-size: 3rem;
  opacity: 0.3;
  margin-bottom: 8px;
}
.gantt-empty h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.gantt-empty p {
  font-size: 0.875rem;
  max-width: 300px;
}

/* ---- Stats strip ---- */
.gantt-stats-strip {
  display: flex;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-700);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.gantt-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}
.gantt-stat-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.gantt-stat-label { color: var(--text-muted); }
.gantt-stat-value { font-weight: 700; color: var(--text-primary); }

/* ---- Legend ---- */
.gantt-legend {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-700);
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.gantt-legend-bar {
  width: 20px; height: 8px;
  border-radius: 4px;
}
.gantt-legend-dep-line {
  width: 20px; height: 2px;
  background: rgba(108,99,255,0.6);
  position: relative;
}
.gantt-legend-dep-line::after {
  content: '▶';
  position: absolute;
  right: -6px;
  top: -5px;
  font-size: 8px;
  color: rgba(108,99,255,0.6);
}

/* ---- Light mode overrides ---- */
body.light-mode .gantt-sidebar { background: #fff; }
body.light-mode .gantt-sidebar-header { background: #f7f9ff; }
body.light-mode .gantt-sidebar-row:hover { background: #f0f2f8; }
body.light-mode .gantt-outer { background: #fff; border-color: rgba(0,0,0,0.08); }
body.light-mode .gantt-toolbar { background: rgba(240,242,248,0.9); }
body.light-mode .gantt-stats-strip { background: #f7f9ff; }
body.light-mode .gantt-legend { background: #f7f9ff; }
body.light-mode .gantt-zoom-group { background: #f0f2f8; border-color: rgba(0,0,0,0.08); }
body.light-mode .gantt-zoom-btn.active { background: var(--accent); }
body.light-mode .gantt-nav-btn { background: #f0f2f8; border-color: rgba(0,0,0,0.08); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .gantt-toolbar { flex-wrap: wrap; }
  .gantt-sidebar { width: 180px !important; }
}
@media (max-width: 640px) {
  .gantt-sidebar { display: none; }
  .gantt-zoom-group { display: none; }
}
