/**
 * GANTT Chart Styles
 * Comprehensive styling for the Gantt chart application
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 95%;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  overflow: hidden;
}

/* Header */
.header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 20px 32px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.header-title {
  text-align: left;
}

.header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.header p {
  opacity: 0.9;
  font-size: 16px;
}

/* Project Selector */
.project-selector {
  position: relative;
}

.project-selector-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  min-width: 280px;
}

.project-selector-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.project-selector-btn .project-icon {
  font-size: 24px;
}

.project-selector-btn .project-name {
  flex: 1;
  text-align: left;
}

.project-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  min-width: 350px;
  z-index: 1000;
  overflow: hidden;
}

.project-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #e2e8f0;
}

.project-menu-item:last-child {
  border-bottom: none;
}

.project-menu-item:hover {
  background: #f8fafc;
}

.project-menu-item .project-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.project-menu-item .project-info {
  flex: 1;
}

.project-menu-item .project-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.project-menu-item .project-desc {
  font-size: 13px;
  color: #64748b;
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.toolbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
  background: #4f46e5;
  color: white;
}

.btn-secondary {
  background: #e2e8f0;
  color: #475569;
}

.btn-success {
  background: #16a34a;
  color: white;
}

.btn-warning {
  background: #ea580c;
  color: white;
}

/* PDF Export Button - Custom styling */
.btn-secondary[onclick*="exportToPDF"] {
  background: #6366f1 !important;
  color: white !important;
}

.btn-secondary[onclick*="exportToPDF"]:hover {
  background: #4f46e5 !important;
}

/* View Options Dropdown */
.view-options-dropdown {
  position: relative;
  display: inline-block;
}

.view-options-btn {
  padding: 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: white;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.view-options-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.view-options-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 300px;
  padding: 12px 0;
}

.view-options-menu.show {
  display: block;
}

.view-options-section {
  padding: 8px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.view-options-section:last-child {
  border-bottom: none;
}

.view-options-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.view-option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.view-option-item:hover {
  background: #f8fafc;
}

.view-option-item input[type="radio"] {
  cursor: pointer;
}

.view-option-item label {
  cursor: pointer;
  flex: 1;
  font-size: 13px;
  color: #334155;
}

.view-option-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 8px 0;
}

/* Toggle switch */
.toggle-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.toggle-switch:hover {
  background: #f8fafc;
}

.toggle-switch-label {
  font-size: 13px;
  color: #334155;
  flex: 1;
}

.toggle-switch-control {
  position: relative;
  width: 42px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  transition: background 0.3s ease;
  cursor: pointer;
}

.toggle-switch-control::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input[type="checkbox"] {
  display: none;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch-control {
  background: #4f46e5;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch-control::after {
  transform: translateX(18px);
}

/* GANTT Container */
.gantt-container {
  display: flex;
  flex-direction: column;
  height: 1040px;
  overflow: hidden;
}

/* Gantt header row - sticky */
.gantt-header-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 20;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.task-list-header-wrapper {
  width: 720px;
  flex-shrink: 0;
  background: #f8fafc;
  border-right: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.timeline-header-wrapper {
  flex: 1;
  overflow: hidden;
  background: white;
  position: relative;
}

.timeline-header {
  position: absolute;
  top: 0;
  left: 0;
  width: fit-content;
  will-change: transform;
}

.timeline-level1,
.timeline-level2,
.timeline-level3 {
  display: flex;
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  border-bottom: 1px solid #e2e8f0;
}

.timeline-level1 {
  background: #e5e7eb !important;
}

.timeline-level1 > * {
  background: #e5e7eb !important;
}

.timeline-level2 {
  background: #f3f4f6 !important;
}

.timeline-level2 > * {
  background: #f3f4f6 !important;
}

.timeline-level3 {
  background: #fafafa !important;
  border-bottom: 2px solid #e2e8f0;
}

.timeline-level3 > * {
  background: #fafafa !important;
}

/* Gantt content wrapper */
.gantt-content {
  display: flex;
  flex: 1;
  overflow-y: hidden;
  overflow-x: hidden;
  min-height: 0;
}

/* Task List (venstre side) */
.task-list {
  width: 720px;
  background: #f8fafc;
  border-right: 2px solid #e2e8f0;
  flex-shrink: 0;
  overflow-y: scroll;
  overflow-x: visible;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  pointer-events: none; /* Disable direct interaction */
}

.task-list::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.task-list * {
  pointer-events: auto; /* Re-enable for children (buttons, etc) */
}

.task-list-header-level1,
.task-list-header-level2,
.task-list-header-level3 {
  padding: 8px 16px;
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  border-bottom: 1px solid #e2e8f0;
}

.task-list-header-level1 {
  background: #e5e7eb;
  font-weight: 600;
  font-size: 14px;
}

.task-list-header-level1 i {
  margin-right: 8px;
}

.task-list-header-level2 {
  background: white;
  gap: 16px;
  font-size: 12px;
}

.task-list-header-level3 {
  background: #fafafa;
  border-bottom: 2px solid #e2e8f0;
}

.task-list-header-level3 label:first-child {
  margin-left: 12px;
}

.status-filter {
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.status-filter:hover {
  background: #f1f5f9;
}

.status-filter[data-status="in-progress"] {
  color: #3b82f6;
}

.status-filter[data-status="future"] {
  color: #ec4899;
}

.status-filter[data-status="completed"] {
  color: #22c55e;
}

.task-list-description {
  padding: 8px 16px;
  background: white;
  border-bottom: 2px solid #e2e8f0;
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  font-size: 13px;
  color: #64748b;
  font-style: italic;
}

.timeline-subheader {
  padding: 8px 16px;
  background: white;
  border-bottom: 2px solid #e2e8f0;
  height: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  font-size: 13px;
  color: #64748b;
  font-style: italic;
  position: relative;
  z-index: 1;
}

.task-item {
  padding: 16px 16px 8px 16px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  box-sizing: border-box;
  overflow: visible;
}

.task-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.task-item:hover {
  background: #e2e8f0;
}

.task-item.selected {
  background: #dbeafe;
  border-left: 4px solid #3b82f6;
}

.task-item.level-0 {
  background: #e2e8f0;
  font-weight: 600;
  border-left: 4px solid #4f46e5;
}

.task-item.level-1 {
  padding-left: 30px;
  border-left: 2px solid #e2e8f0;
  background: #f1f5f9;
}

.task-item.level-2 {
  padding-left: 44px;
  border-left: 1px solid #f1f5f9;
  font-size: 14px;
  background: #f8fafc;
}

.task-item.level-3 {
  padding-left: 56px;
  border-left: 1px solid #f8fafc;
  font-size: 13px;
  background: white;
}

.task-item.level-4 {
  padding-left: 68px;
  border-left: 1px solid #f8fafc;
  font-size: 13px;
}

.task-item.level-5 {
  padding-left: 80px;
  border-left: 1px solid #f8fafc;
  font-size: 13px;
}

.task-item.level-6 {
  padding-left: 92px;
  border-left: 1px solid #f8fafc;
  font-size: 12px;
}

.task-item.level-7 {
  padding-left: 104px;
  border-left: 1px solid #f8fafc;
  font-size: 11px;
}

.task-item.level-8 {
  padding-left: 132px;
  border-left: 1px solid #f8fafc;
  font-size: 11px;
}

.task-item.level-9 {
  padding-left: 144px;
  border-left: 1px solid #f8fafc;
  font-size: 10px;
}

.task-item.level-10 {
  padding-left: 156px;
  border-left: 1px solid #f8fafc;
  font-size: 10px;
}

.task-item.collapsed .subtasks {
  display: none;
}

.expand-toggle {
  width: 16px;
  height: 16px;
  margin-right: 0px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-size: 10px;
  color: #64748b;
  transition: all 0.2s ease;
}

.expand-toggle:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.expand-toggle.expanded {
  transform: rotate(0deg);
}

/* Milestone double-tag container */
.milestone-double-tag {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.milestone-double-tag .hierarchy-tag {
  min-width: 40px;
  padding: 2px 8px;
  font-size: 9px;
}

/* Hierarchy tags - replaces old task-status circles */
.hierarchy-tag {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  text-align: center;
  min-width: 40px;
}

/* Dynamic styling based on hierarchy level position */
/* Level 0 (first in hierarchy) - thick border */
.hierarchy-tag.level-0:not(.tag-FASE):not(.tag-WBS):not(.tag-MIL):not(.tag-LEV) {
  border: 3px solid rgba(0, 0, 0, 0.2);
  padding: 2px 7px;
}

/* Level 1 (second in hierarchy) - thin border */
.hierarchy-tag.level-1:not(.tag-FASE):not(.tag-WBS):not(.tag-MIL):not(.tag-LEV) {
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Level 2+ (third and beyond) - no border, just filled */
/* Already handled by default .hierarchy-tag style */

/* FASE always gets stripes regardless of level */
.hierarchy-tag.tag-FASE.status-not-started { 
  background: #9ca3af repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.2) 5px, rgba(255, 255, 255, 0.2) 7px);
}
.hierarchy-tag.tag-FASE.status-in-progress { 
  background: #3b82f6 repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.2) 5px, rgba(255, 255, 255, 0.2) 7px);
}
.hierarchy-tag.tag-FASE.status-completed { 
  background: #16a34a repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.2) 5px, rgba(255, 255, 255, 0.2) 7px);
}
.hierarchy-tag.tag-FASE.status-delayed { 
  background: #ef4444 repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.2) 5px, rgba(255, 255, 255, 0.2) 7px);
}

/* WBS always gets outline style regardless of level */
.hierarchy-tag.tag-WBS {
  background: transparent !important;
  border: 1.5px solid;
  font-weight: 600;
}

/* AKT gets same outline style as WBS */
.hierarchy-tag.tag-AKT {
  background: transparent !important;
  border: 1.5px solid;
  font-weight: 600;
}

/* Status colors for hierarchy tags (filled) */
.hierarchy-tag.status-not-started { background: #9ca3af; }
.hierarchy-tag.status-in-progress { background: #3b82f6; }
.hierarchy-tag.status-completed { background: #16a34a; }
.hierarchy-tag.status-delayed { background: #ef4444; }

/* Red border for tasks that are behind schedule but not past deadline */
.hierarchy-tag.overdue-in-progress {
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444;
}

/* WBS outline colors based on status */
.hierarchy-tag.tag-WBS.status-not-started { 
  border-color: #9ca3af; 
  color: #9ca3af;
}
.hierarchy-tag.tag-WBS.status-in-progress { 
  border-color: #3b82f6; 
  color: #3b82f6;
}
.hierarchy-tag.tag-WBS.status-completed { 
  border-color: #16a34a; 
  color: #16a34a;
}
.hierarchy-tag.tag-WBS.status-delayed { 
  border-color: #ef4444; 
  color: #ef4444;
}

/* AKT outline colors based on status (same as WBS) */
.hierarchy-tag.tag-AKT.status-not-started { 
  border-color: #9ca3af; 
  color: #9ca3af;
}
.hierarchy-tag.tag-AKT.status-in-progress { 
  border-color: #3b82f6; 
  color: #3b82f6;
}
.hierarchy-tag.tag-AKT.status-completed { 
  border-color: #16a34a; 
  color: #16a34a;
}
.hierarchy-tag.tag-AKT.status-delayed { 
  border-color: #ef4444; 
  color: #ef4444;
}

/* Old task-status styles (deprecated - keeping for backwards compatibility) */
.task-status {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: none; /* Hidden - replaced by hierarchy tags */
}

/* Diamond shape for milestones */
.task-status.milestone {
  width: 16px;
  height: 16px;
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  display: none; /* Hidden - replaced by hierarchy tags */
}

.status-not-started { background: #9ca3af; }
.status-in-progress { background: #3b82f6; }
.status-completed { background: #16a34a; }
.status-delayed { background: #ef4444; }

.task-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 24px;
}

.task-details {
  flex: 1;
  min-width: 0;
  margin-right: 32px;
}

.task-name {
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.task-dates {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.2s ease;
}

.task-dates:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.task-owner {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  margin-bottom: 8px;
}

.task-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dependency-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  color: #64748b;
  transition: all 0.2s ease;
  position: relative;
}

.dependency-icon:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: scale(1.15);
}

.dependency-icon.has-dependencies {
  color: #3b82f6;
  font-weight: bold;
}

.dependency-icon.has-dependencies:hover {
  color: #2563eb;
}

.dependency-icon.affected-by {
  color: #9ca3af; /* Gray when no dependencies */
}

.dependency-icon.affected-by.has-dependencies {
  color: #9333ea; /* Purple when has dependencies */
  font-weight: bold;
}

.dependency-icon.affected-by.has-dependencies:hover {
  color: #7e22ce;
}

.dependency-count {
  position: absolute;
  top: -6px;
  background: #3b82f6;
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dependency-count.left {
  right: 18px;
}

.dependency-count.right {
  right: -6px;
}

.dependency-count.purple {
  background: #9333ea;
}

/* QA flag count badge */
.qa-flag-count {
  position: absolute;
  top: -6px;
  right: -6px;
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  pointer-events: none; /* Allow hover events to pass through to the flag icon */
}

/* Dependency icon hover effect only */
.dependency-icon {
  position: relative;
}

.dependency-icon:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: scale(1.15);
}

.percent-input {
  width: 45px;
  padding: 2px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
}

.percent-input:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.percent-label {
  font-size: 10px;
  color: #64748b;
}

.milestone-completion {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  width: 60px;
  margin-right: 0;
}

.milestone-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #16a34a; /* Green when checked */
}

.wbs-number {
  min-width: 60px;
  padding: 2px 12px 2px 8px;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-align: right;
  margin-right: 4px;
}

/* Timeline (høyre side) */
.timeline {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
}

.timeline-header {
  background: white;
  border-bottom: 2px solid #e2e8f0;
  min-width: 4200px; /* ~105 weeks * 40px (2 years) */
  width: 4200px;
}

#gantt-rows {
  position: relative;
  min-width: 4200px; /* Match header width */
  width: 4200px;
}

.gantt-row-overlay.hover {
  background: #f8fafc !important;
}

.gantt-row {
  position: relative;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  border-bottom: 1px solid #e2e8f0;
  box-sizing: border-box;
}

.gantt-row:hover {
  background: #f8fafc;
}

.timeline-months {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  height: 36px;
  min-height: 36px;
}

.timeline-weeks {
  display: flex;
  background: white;
  height: 36px;
  min-height: 36px;
}

.timeline-weeks-numbers {
  display: flex;
  align-items: center;
  height: 28px;
  min-height: 28px;
  box-sizing: border-box;
  overflow: hidden;
  background: #ffffff;
  border-bottom: 1px solid #e6eef8;
}

.week-number-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 6px;
  box-sizing: border-box;
  border-left: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: 12px;
  color: #374151;
  background: transparent;
}

.month-header {
  padding: 8px 12px;
  font-weight: 600;
  color: #475569;
  border-right: 1px solid #cbd5e1;
  min-width: 100px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  box-sizing: border-box;
  font-size: 13px;
  background: transparent;
}

.week-header {
  padding: 6px 4px;
  font-size: 10px;
  color: #64748b;
  border-right: 1px solid #e2e8f0;
  min-width: 30px;
  text-align: center;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 36px;
  box-sizing: border-box;
  background: transparent;
}

.week-header.today {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

.week-date {
  font-weight: 500;
  color: #374151;
}

.week-number {
  opacity: 0.7;
  font-size: 9px;
}

/* GANTT Bars */
.gantt-row {
  position: relative;
  min-height: 56px;
  border-bottom: 1px solid #e2e8f0;
  box-sizing: border-box;
  overflow: visible;
}

.gantt-row.level-0 {
  background: #e2e8f0;
}

.gantt-row:hover {
  background: #f8fafc;
}

/* Week columns background */
.week-column {
  position: absolute;
  top: 0;
  height: 100%;
  width: 40px;
  border-right: 1px solid #f1f5f9;
  pointer-events: none;
}

.week-column:nth-child(even) {
  background: #fafafa;
}

/* More subtle week stripes in parent rows */
.gantt-row.level-0 .week-column:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

.week-column.current-week {
  background: #fef3c7 !important;
  border-left: 2px solid #fbbf24;
  border-right: 2px solid #fbbf24;
}

/* Weekend columns (for detailed "alle dager" view) */
.week-column.weekend {
  background: #f1f5f9 !important;
}

.week-header.weekend {
  background: #e2e8f0;
  font-weight: 600;
}

/* Row separators */
.row-separator {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #e2e8f0;
  z-index: 1;
}

/* Task bars */
.task-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 500;
  color: white;
  cursor: move;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
  z-index: 2;
}

/* Export mode - force proper vertical alignment for html2canvas */
.gantt-container.export-mode .task-bar:not(.milestone):not(.deliverable) {
  display: block !important;
  align-items: unset !important;
}

.gantt-container.export-mode .task-bar.hierarchy-level-0:not(.milestone):not(.deliverable) {
  padding-top: 7.5px !important;
  padding-bottom: 7.5px !important;
  line-height: 13px !important;
  font-size: 13px !important;
}

.gantt-container.export-mode .task-bar.hierarchy-level-1:not(.milestone):not(.deliverable) {
  padding-top: 7px !important;
  padding-bottom: 7px !important;
  line-height: 12px !important;
  font-size: 12px !important;
}

.gantt-container.export-mode .task-bar.hierarchy-level-2:not(.milestone):not(.deliverable) {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  line-height: 12px !important;
  font-size: 12px !important;
}

.gantt-container.export-mode .task-bar:not(.milestone):not(.deliverable):not(.hierarchy-level-0):not(.hierarchy-level-1):not(.hierarchy-level-2) {
  padding-top: 4.5px !important;
  padding-bottom: 4.5px !important;
  line-height: 11px !important;
  font-size: 11px !important;
}

.gantt-container.export-mode .task-bar-text {
  display: inline-block !important;
  vertical-align: top !important;
  line-height: inherit !important;
}

.task-bar-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  min-width: 0;
}

.task-bar:hover {
  transform: translateY(-50%) translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  z-index: 15;
}


.task-bar.dragging {
  z-index: 20;
  transform: scale(1.02);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.task-bar.not-started { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.task-bar.in-progress { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.task-bar.completed { background: linear-gradient(135deg, #16a34a, #15803d); }
.task-bar.delayed { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* Critical path highlighting */
.task-bar.critical-path-highlight {
  border: 2.0px solid #000000 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.task-bar.milestone.critical-path-highlight,
.task-bar.deliverable.critical-path-highlight {
  filter: drop-shadow(0 0 2.0px #000000) drop-shadow(0 1px 3px rgba(0,0,0,0.3)) !important;
}

.task-bar.parent {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 3px solid rgba(0, 0, 0, 0.2);
  height: 24px;
  font-weight: 600;
  position: relative;
}

/* Milestone styling - star shape */
.task-bar.milestone {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  background: transparent !important;
  border: none;
  cursor: pointer;
  position: relative;
  margin-left: -18px; /* Center on date */
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.task-bar.milestone.completed {
  background: #16a34a !important;
  filter: drop-shadow(0 2px 4px rgba(22, 163, 74, 0.5));
}

.task-bar.milestone.not-started {
  background: #9ca3af !important;
  filter: drop-shadow(0 2px 4px rgba(156, 163, 175, 0.5));
}

.task-bar.milestone.in-progress {
  background: #3b82f6 !important;
  filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.5));
}

.task-bar.milestone.delayed {
  background: #ef4444 !important;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.5));
}

/* Note: Milestones should not use .critical styling - they follow status colors only */

.task-bar.milestone .task-bar-text {
  display: none; /* Hide text inside diamond */
}

.milestone-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9;
}

.milestone-label.completed {
  color: #16a34a;
}

.milestone-label.in-progress {
  color: #3b82f6;
}

.milestone-label.not-started {
  color: #6b7280;
}

.milestone-label.delayed {
  color: #dc2626;
}

.task-bar.milestone:hover::after {
  content: attr(data-name);
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
}

/* Deliverable styling - hexagon shape */
.task-bar.deliverable {
  width: 36px !important;
  height: 32px !important;
  min-width: 36px !important;
  background: transparent !important;
  border: none;
  cursor: pointer;
  position: relative;
  margin-left: -18px; /* Center on date */
  clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
}

.task-bar.deliverable.completed {
  background: #16a34a !important;
  filter: drop-shadow(0 2px 4px rgba(22, 163, 74, 0.5));
}

.task-bar.deliverable.not-started {
  background: #9ca3af !important;
  filter: drop-shadow(0 2px 4px rgba(156, 163, 175, 0.5));
}

.task-bar.deliverable.in-progress {
  background: #3b82f6 !important;
  filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.5));
}

.task-bar.deliverable.delayed {
  background: #dc2626 !important;
  filter: drop-shadow(0 2px 4px rgba(220, 38, 38, 0.5));
}

.task-bar.deliverable .task-bar-text {
  display: none; /* Hide text inside hexagon */
}

.deliverable-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9;
}

.deliverable-label.completed {
  color: #16a34a;
}

.deliverable-label.in-progress {
  color: #3b82f6;
}

.deliverable-label.not-started {
  color: #9ca3af;
}

.deliverable-label.delayed {
  color: #dc2626;
}

.task-bar.deliverable:hover::after {
  content: attr(data-name);
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
}

.task-bar.has-children {
  position: relative;
  cursor: default;
}

.task-bar.has-children::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  z-index: 5;
}

/* Expand toggle outside task bar */
.gantt-row .expand-toggle-gantt {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 9px;
  color: #64748b;
  background: #f1f5f9;
  transition: all 0.2s ease;
  z-index: 10;
  border: 1px solid #cbd5e1;
}

.gantt-row .expand-toggle-gantt:hover {
  background: #e2e8f0;
  color: #1e293b;
  transform: translateY(-50%) scale(1.15);
  border-color: #94a3b8;
}

.gantt-row .expand-toggle-gantt.expanded {
  transform: translateY(-50%) rotate(0deg);
}

.gantt-row .expand-toggle-gantt.expanded:hover {
  transform: translateY(-50%) rotate(0deg) scale(1.15);
}

.task-bar.has-children::after {
  content: 'Styres av underoppgaver';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 100;
}

.task-bar.has-children:hover::after {
  opacity: 1;
}

.task-bar.level-1 {
  height: 20px;
  opacity: 0.9;
}

.task-bar.level-2 {
  height: 16px;
  opacity: 0.8;
  font-size: 11px;
}

/* Resize handles */
.resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: ew-resize;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}

.resize-handle.left {
  left: 0;
  border-left: 2px solid rgba(255,255,255,0.8);
}

.resize-handle.right {
  right: 0;
  border-right: 2px solid rgba(255,255,255,0.8);
}

.task-bar:hover .resize-handle {
  opacity: 1;
}

.resize-handle:hover {
  background: rgba(255,255,255,0.5);
}

/* Dependency arrows */
.dependency-arrow {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

/* Shake animation for non-draggable tasks */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* Stats */
.stats {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* Custom checkbox colors */
.task-list-header-level3 input[type="checkbox"]:checked {
  accent-color: white;
  outline: 1px solid #94a3b8;
}

/* Filter panel */
.filter-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.filter-content {
  background: white;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.filter-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  align-items: end;
}

.filter-field {
  flex: 1;
}

.filter-field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: #374151;
}

.filter-field select,
.filter-field input {
  width: 100%;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

/* Filter checkbox hover effects */
.filter-panel label:has(input[type="checkbox"]):hover {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

.filter-panel label:has(input[type="checkbox"]:checked) {
  background-color: #eff6ff !important;
  border-color: #3b82f6 !important;
}

.filter-panel input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-panel select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* PDF Export Dialog Styling */
#pdf-export-dialog input[type="radio"] {
  display: none;
}

#pdf-export-dialog input[type="radio"]:checked + div {
  border-color: #4f46e5 !important;
  background: #eef2ff !important;
}

#pdf-export-dialog input[type="radio"]:checked + div i {
  color: #4f46e5 !important;
}

#pdf-export-dialog input[type="radio"] + div:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .gantt-container {
    flex-direction: column;
    height: auto;
  }
  
  .task-list {
    width: 100%;
    max-height: 200px;
  }
  
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .toolbar-left,
  .toolbar-right {
    justify-content: center;
  }
}

/* Date tooltip styling - pen tooltip for datoer */
.task-dates[data-breakdown] {
  position: relative;
}

.task-dates[data-breakdown]::after {
  content: attr(data-breakdown);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  font-size: 11px;
  line-height: 1.5;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  white-space: pre-line;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  transform: translateY(-4px);
  z-index: 10000;
  pointer-events: none;
  min-width: 200px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 400;
}

.task-dates[data-breakdown]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Liten pil oppover */
.task-dates[data-breakdown]::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 100%;
  margin-top: 2px;
  border: 6px solid transparent;
  border-bottom-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 10001;
  pointer-events: none;
}

.task-dates[data-breakdown]:hover::before {
  opacity: 1;
  visibility: visible;
}
