/* @startsimpli/ui - Gantt Chart Styles */

.gantt-wrapper {
  display: flex;
  flex-direction: column;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 8px;
  overflow: hidden;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  font-family: inherit;
}

/* Fullscreen mode */
.gantt-wrapper.gantt-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  border-radius: 0;
  border: none;
}

.gantt-wrapper.gantt-fullscreen .gantt-body-scroll {
  max-height: none;
}

/* Filter bar */
.gantt-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--muted, 210 40% 96%) / 0.5);
  flex-wrap: wrap;
}

.gantt-filter-search {
  height: 28px;
  padding: 0 0.5rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  font-size: 0.75rem;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  min-width: 140px;
  outline: none;
}

.gantt-filter-search:focus {
  border-color: hsl(var(--primary, 222 47% 11%) / 0.5);
}

.gantt-filter-search::placeholder {
  color: hsl(var(--muted-foreground, 215 16% 47%));
}

.gantt-filter-select {
  height: 28px;
  padding: 0 0.375rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  font-size: 0.7rem;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  cursor: pointer;
  outline: none;
}

.gantt-filter-date {
  height: 28px;
  padding: 0 0.375rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  font-size: 0.65rem;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  cursor: pointer;
  outline: none;
  max-width: 120px;
}

.gantt-filter-clear {
  height: 28px;
  padding: 0 0.5rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  font-size: 0.7rem;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--muted-foreground, 215 16% 47%));
  cursor: pointer;
  transition: all 0.15s;
}

.gantt-filter-clear:hover {
  background: hsl(var(--accent, 210 40% 96%));
  color: hsl(var(--foreground, 222 47% 11%));
}

.gantt-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.625rem;
  font-weight: 500;
  background: hsl(var(--primary, 222 47% 11%) / 0.1);
  color: hsl(var(--foreground, 222 47% 11%));
  white-space: nowrap;
}

.gantt-filter-pill button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  opacity: 0.6;
}

.gantt-filter-pill button:hover {
  opacity: 1;
}

.gantt-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  font-size: 0.875rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 8px;
}

.gantt-header-row {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--muted, 210 40% 96%));
}

.gantt-info-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  height: 52px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  border-right: 1px solid hsl(var(--border, 220 13% 91%));
}

.gantt-zoom-controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.gantt-zoom-controls button {
  width: 22px;
  height: 22px;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.gantt-zoom-controls button:hover:not(:disabled) {
  background: hsl(var(--accent, 210 40% 96%));
}

.gantt-zoom-controls button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gantt-zoom-slider {
  width: 60px;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: hsl(var(--border, 220 13% 91%));
}

.gantt-zoom-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: hsl(var(--primary, 222 47% 11%));
  cursor: pointer;
}

.gantt-timeline-header {
  flex: 1;
  overflow: hidden;
}

.gantt-month-header {
  display: flex;
  height: 26px;
  background: hsl(var(--muted, 210 40% 96%));
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  position: sticky;
  top: 0;
  z-index: 5;
}

.gantt-month {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: hsl(var(--foreground, 222 47% 11%));
  border-right: 1px solid hsl(var(--border, 220 13% 91%));
  text-transform: uppercase;
}

.gantt-day-header {
  display: flex;
  height: 26px;
  background: hsl(var(--muted, 210 40% 96%));
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  position: sticky;
  top: 26px;
  z-index: 5;
}

.gantt-day {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  border-right: 1px solid hsl(var(--border, 220 13% 91%) / 0.3);
}

.gantt-day.weekend {
  background: hsl(var(--muted, 210 40% 96%) / 0.5);
}

.gantt-day.today {
  background: hsl(var(--primary, 222 47% 11%) / 0.1);
  color: hsl(var(--primary, 222 47% 11%));
  font-weight: 600;
}

.gantt-week {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  border-right: 1px solid hsl(var(--border, 220 13% 91%) / 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.gantt-week.has-today {
  background: hsl(var(--primary, 222 47% 11%) / 0.1);
  color: hsl(var(--primary, 222 47% 11%));
  font-weight: 500;
}

.gantt-body-scroll {
  flex: 1;
  display: flex;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.gantt-info-column {
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--background, 0 0% 100%));
}

.gantt-info-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  height: 36px;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
}

.gantt-info-row:hover {
  background: hsl(var(--accent, 210 40% 96%) / 0.5);
}

.gantt-row-indent { flex-shrink: 0; }

.gantt-collapse-btn {
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  cursor: pointer;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 3px;
  transition: all 0.1s;
}

.gantt-collapse-btn:hover {
  background: hsl(var(--accent, 210 40% 96%));
  color: hsl(var(--foreground, 222 47% 11%));
}

.gantt-collapse-spacer { width: 16px; flex-shrink: 0; }

.gantt-row-title {
  flex: 1;
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.gantt-row-title:hover {
  color: hsl(var(--primary, 222 47% 11%));
}

.gantt-category-badge {
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  color: white;
  flex-shrink: 0;
}

.gantt-status-badge {
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  background: hsl(var(--muted, 210 40% 96%));
  color: hsl(var(--muted-foreground, 215 16% 47%));
}

.gantt-status-completed, .gantt-status-closed { background: #dcfce7; color: #166534; }
.gantt-status-in_progress, .gantt-status-active, .gantt-status-on_track { background: #fef3c7; color: #92400e; }
.gantt-status-at_risk, .gantt-status-off_track { background: #fee2e2; color: #991b1b; }
.gantt-status-draft, .gantt-status-pending { background: #e0e7ff; color: #3730a3; }

.gantt-timeline-body { position: relative; }

.gantt-grid-line {
  position: absolute;
  top: 0;
  border-right: 1px solid hsl(var(--border, 220 13% 91%) / 0.2);
}

.gantt-grid-line.weekend { background: hsl(var(--muted, 210 40% 96%) / 0.3); }
.gantt-grid-line.today { background: hsl(var(--primary, 222 47% 11%) / 0.05); }

.gantt-row-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: hsl(var(--border, 220 13% 91%));
}

.gantt-deps-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }

.gantt-dep-line {
  stroke: hsl(var(--muted-foreground, 215 16% 47%));
  stroke-width: 1.5;
  fill: none;
  opacity: 0.4;
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: hsl(var(--primary, 222 47% 11%));
  z-index: 3;
}

.gantt-bar {
  position: absolute;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden;
  font-size: 0.625rem;
  font-weight: 500;
  color: white;
  transition: transform 0.1s, box-shadow 0.1s;
  z-index: 2;
  min-height: 16px;
  min-width: 16px;
}

.gantt-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

.gantt-bar.depth-0 { height: 22px; }
.gantt-bar.depth-1 { height: 20px; }
.gantt-bar.depth-2 { height: 18px; }
.gantt-bar.depth-3 { height: 16px; }

.gantt-bar-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px 0 0 4px;
  transition: width 0.2s ease;
}

.gantt-bar-progress.behind { background: rgba(239, 68, 68, 0.3); }
.gantt-bar-progress.ahead { background: rgba(34, 197, 94, 0.3); }

.gantt-bar-time-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.5);
  z-index: 1;
  pointer-events: none;
}

.gantt-bar-label {
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  z-index: 1;
}

.gantt-bar-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}

.gantt-bar-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 1px;
}

.gantt-bar-handle-left { left: 0; }
.gantt-bar-handle-left::after { left: 3px; }
.gantt-bar-handle-right { right: 0; }
.gantt-bar-handle-right::after { right: 3px; }

.gantt-bar:hover .gantt-bar-handle { opacity: 1; }

.gantt-bar.dragging {
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
  user-select: none;
  -webkit-user-select: none;
}

.gantt-bar.dragging .gantt-bar-handle { opacity: 1; }

.gantt-drag-tooltip {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: hsl(var(--popover, 0 0% 100%));
  color: hsl(var(--popover-foreground, 222 47% 11%));
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid hsl(var(--border, 220 13% 91%));
}

.gantt-legend {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid hsl(var(--border, 220 13% 91%));
  font-size: 0.7rem;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  flex-shrink: 0;
  flex-wrap: wrap;
  background: hsl(var(--muted, 210 40% 96%) / 0.5);
}

.gantt-legend-item { display: flex; align-items: center; gap: 0.375rem; }
.gantt-legend-color { width: 12px; height: 12px; border-radius: 2px; }

/* Focus outline for keyboard nav */
.gantt-wrapper:focus { outline: 2px solid hsl(var(--primary, 222 47% 11%) / 0.3); outline-offset: -2px; }

.gantt-row-focused {
  background: hsl(var(--primary, 222 47% 11%) / 0.08) !important;
  outline: 1px solid hsl(var(--primary, 222 47% 11%) / 0.3);
  outline-offset: -1px;
}

/* View switcher */
.gantt-view-switcher {
  display: flex;
  gap: 0;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--muted, 210 40% 96%) / 0.5);
  padding: 0 0.75rem;
}

.gantt-view-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.gantt-view-tab:hover {
  color: hsl(var(--foreground, 222 47% 11%));
}

.gantt-view-tab.active {
  color: hsl(var(--foreground, 222 47% 11%));
  border-bottom-color: hsl(var(--primary, 222 47% 11%));
  font-weight: 600;
}

/* Board view */
.gantt-board {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow-x: auto;
  flex: 1;
  min-height: 200px;
}

.gantt-board-column {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  background: hsl(var(--muted, 210 40% 96%) / 0.5);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.gantt-board-column.gantt-board-drag-over {
  background: hsl(var(--primary, 222 47% 11%) / 0.08);
  outline: 2px dashed hsl(var(--primary, 222 47% 11%) / 0.3);
}

.gantt-board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%) / 0.5);
}

.gantt-board-count {
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  background: hsl(var(--background, 0 0% 100%));
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
}

.gantt-board-cards {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  overflow-y: auto;
}

.gantt-board-card {
  padding: 0.5rem 0.625rem;
  background: hsl(var(--background, 0 0% 100%));
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  transition: box-shadow 0.15s;
}

.gantt-board-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gantt-board-card[draggable='true'] { cursor: grab; }
.gantt-board-card[draggable='true']:active { cursor: grabbing; }

.gantt-board-card-title {
  flex: 1 1 100%;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--foreground, 222 47% 11%));
}

.gantt-board-card-date {
  font-size: 0.625rem;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  margin-left: auto;
}

/* List view */
.gantt-list {
  flex: 1;
  overflow-y: auto;
}

.gantt-list-header {
  display: flex;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  background: hsl(var(--muted, 210 40% 96%));
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  position: sticky;
  top: 0;
  z-index: 1;
}

.gantt-list-row {
  display: flex;
  padding: 0.375rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
  cursor: pointer;
  align-items: center;
  transition: background 0.1s;
}

.gantt-list-row:hover {
  background: hsl(var(--accent, 210 40% 96%) / 0.5);
}

.gantt-list-col-title { flex: 3; font-size: 0.75rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-list-col-status { flex: 1; min-width: 80px; }
.gantt-list-col-category { flex: 1; min-width: 70px; }
.gantt-list-col-dates { flex: 1.5; font-size: 0.7rem; color: hsl(var(--muted-foreground, 215 16% 47%)); min-width: 120px; }
.gantt-list-col-progress { flex: 1; display: flex; align-items: center; gap: 0.375rem; font-size: 0.7rem; color: hsl(var(--muted-foreground, 215 16% 47%)); min-width: 100px; }

.gantt-list-progress-bar {
  flex: 1;
  height: 4px;
  background: hsl(var(--border, 220 13% 91%));
  border-radius: 2px;
  overflow: hidden;
}

.gantt-list-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.2s;
}

/* Detail modal */
.gantt-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gantt-detail-modal {
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  border-radius: 8px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  border: 1px solid hsl(var(--border, 220 13% 91%));
}

.gantt-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid hsl(var(--border, 220 13% 91%));
}

.gantt-detail-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-detail-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground, 215 16% 47%));
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.gantt-detail-close:hover {
  background: hsl(var(--accent, 210 40% 96%));
  color: hsl(var(--foreground, 222 47% 11%));
}

.gantt-detail-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gantt-detail-row {
  display: flex;
  gap: 0.75rem;
}

.gantt-detail-row > .gantt-detail-field { flex: 1; }

.gantt-detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gantt-detail-field label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground, 215 16% 47%));
}

.gantt-detail-field p {
  margin: 0;
  font-size: 0.8rem;
  color: hsl(var(--foreground, 222 47% 11%));
  line-height: 1.4;
}

.gantt-detail-select,
.gantt-detail-input {
  height: 32px;
  padding: 0 0.5rem;
  border: 1px solid hsl(var(--border, 220 13% 91%));
  border-radius: 4px;
  font-size: 0.8rem;
  background: hsl(var(--background, 0 0% 100%));
  color: hsl(var(--foreground, 222 47% 11%));
  outline: none;
}

.gantt-detail-select:focus,
.gantt-detail-input:focus {
  border-color: hsl(var(--primary, 222 47% 11%) / 0.5);
}

.gantt-detail-slider {
  width: 100%;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  background: hsl(var(--border, 220 13% 91%));
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.gantt-detail-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: hsl(var(--primary, 222 47% 11%));
  cursor: pointer;
}

@media (max-width: 768px) {
  .gantt-info-header { width: 220px !important; padding: 0.5rem 0.5rem; }
  .gantt-info-column { width: 220px !important; }
  .gantt-info-row { min-height: 44px; padding: 0 0.5rem; }
  .gantt-row-title { font-size: 0.8rem; }
  .gantt-category-badge { display: none; }
  .gantt-legend { gap: 0.75rem; padding: 0.5rem; }
}

@media (max-width: 480px) {
  .gantt-info-header { width: 160px !important; }
  .gantt-info-column { width: 160px !important; }
  .gantt-status-badge { display: none; }
}
