/* =============================================
   pages/gantt.css — gantt chart page
   ============================================= */

#pageGantt {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#pageGantt .page-header {
  flex-shrink: 0;
  margin-bottom: 16px;
}

/* ---- Controls row ---- */

.gantt-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 14px;
}

.gantt-range-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gantt-range-btn:hover { background: var(--bg); color: var(--text); }
.gantt-range-btn.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: transparent;
}

.gantt-add-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gantt-add-btn:hover { opacity: 0.88; }
.gantt-add-btn svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ---- Chart layout ---- */

.gantt-chart {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Sticky header row containing labels + day columns */
.gantt-header {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.gantt-label-col {
  flex-shrink: 0;
  width: 200px;
  min-width: 0;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-xmuted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  background: var(--bg);
}

.gantt-timeline-header {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

.gantt-day-header {
  min-width: 0;
  text-align: center;
  font-size: clamp(10px, 0.75vw, 12px);
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 4px 7px;
  border-right: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}
.gantt-day-header:last-child { border-right: none; }
.gantt-week-header { flex: 1 0 0 !important; font-size: clamp(10px, 0.75vw, 12px); }
.gantt-week-current { color: var(--accent); font-weight: 700; background: var(--accent-light); }

/* ---- Body (scrollable rows) ---- */

.gantt-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background: linear-gradient(to right, #fafafa 200px, var(--surface) 200px);
}


.gantt-grid-overlay {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
  background: transparent;
}

.gantt-grid-overlay-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border-light);
}

.gantt-row {
  display: flex;
  align-items: center;
  min-height: 40px;
  transition: background 0.1s;
}
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover { background: var(--bg); }

/* Task name column */
.gantt-row-label {
  flex-shrink: 0;
  width: 200px;
  min-width: 0;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  background: #fafafa;
}

.gantt-row-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 0;
  min-width: 0;
}
.gantt-row-name.strikethrough { text-decoration: line-through; color: var(--text-muted); }

.gantt-row-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Timeline column */
.gantt-row-timeline {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
}

/* Day grid lines */
.gantt-row-timeline::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to right,
    transparent,
    transparent calc(var(--gantt-cell-w) - 1px),
    var(--border-light) calc(var(--gantt-cell-w) - 1px),
    var(--border-light) var(--gantt-cell-w)
  );
  pointer-events: none;
}

/* Today highlight stripe */
.gantt-today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: var(--gantt-cell-w);
  background: rgba(99, 102, 241, 0.06);
  pointer-events: none;
  z-index: 0;
}

/* Task bar */
.gantt-bar {
  position: absolute;
  height: 22px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  z-index: 3;
  min-width: 10px;
}
.gantt-bar:hover { opacity: 0.85; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* Single-day point marker */
.gantt-bar.single-day {
  width: 22px !important;
  min-width: 22px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  font-size: 0;
}
.gantt-bar.single-day::after {
  content: '';
  width: 8px; height: 8px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
}

/* ---- Quarter / Month view ---- */

/* Header: all cols equal width */
.gantt-quarter-header,
.gantt-month-header {
  flex: 1 1 0 !important;
  font-size: clamp(10px, 0.8vw, 12px);
}

/* Row: label + timeline */
.gantt-segment-row {
  display: flex;
  align-items: center;
}

/* Timeline: relative container; bar sits inside */
.gantt-fixed-timeline {
  flex: 1 1 0;
  min-width: 0;
  height: 40px;
  position: relative;
  background: transparent;
}

/* The single continuous bar */
.gantt-fixed-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  border-radius: 11px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  z-index: 3;
}
.gantt-fixed-bar:hover { opacity: 0.85; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }



/* ---- Dark mode ---- */

[data-theme="dark"] .gantt-chart { background: var(--surface); border-color: #2e2e3e; }
[data-theme="dark"] .gantt-header { background: var(--surface); border-color: #2e2e3e; }
[data-theme="dark"] .gantt-label-col { background: #16161f; }
[data-theme="dark"] .gantt-row { border-color: #252535; }
[data-theme="dark"] .gantt-row:hover { background: #16161f; }
[data-theme="dark"] .gantt-row-label { background: #141420; }
[data-theme="dark"] .gantt-body { background: linear-gradient(to right, #141420 200px, var(--surface) 200px); }
[data-theme="dark"] .gantt-range-btn { background: var(--surface); border-color: #2e2e3e; }
[data-theme="dark"] .gantt-range-btn:hover { background: #16161f; }
[data-theme="dark"] .gantt-today-line { background: rgba(99,102,241,0.08); }
