/**
 * @fileoverview Styles cho BIM 4D/5D View - Compact với viewer
 * Tham khảo MS Project
 */

.bim-4d5d-view {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

.bim-view-header-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: white;
  border-bottom: 1px solid var(--border-color);
  min-height: 36px;
}

.bim-title-compact {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 0;
}

.bim-view-tabs-compact {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.bim-tab-compact {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.bim-tab-compact:hover {
  color: var(--text-color);
}

.bim-tab-compact.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.bim-view-center-viewer { background-color: var(--bg-secondary); }
.gantt-bar.gantt-completed { background: var(--color-success); }
.gantt-bar.gantt-in-progress { background: var(--color-primary); }
.gantt-bar.gantt-not-started { background: var(--gray-400); }
.gantt-bar.gantt-delayed { background: var(--color-danger); }
.task-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.progress-fill { background: var(--color-primary); }
.cost-variance.positive, .summary-value.positive { color: var(--color-danger); }
.cost-variance.negative, .summary-value.negative { color: var(--color-success); }
.cost-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.cost-bar-planned { background: var(--color-primary); opacity: 0.3; }
.cost-bar-actual { background: var(--color-primary); }

.bim-view-body-split {
  display: grid;
  grid-template-columns: 300px 1fr 400px;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

/* File Explorer bên trái - luôn hiển thị */
.bim-view-left-file-explorer {
  display: flex;
  flex-direction: column;
  background: white;
  border-right: 1px solid var(--border-color);
  overflow: hidden;
}

.bim-view-header-compact, .bim-view-left-file-explorer .panel-header { background: var(--gray-50); }
.bim-view-left-file-explorer .panel-header, .gantt-chart { background: var(--gray-50); }
.empty-state, .cost-quantity, .empty-state p { color: var(--gray-500); }
.cost-item-actions { border-top: 1px solid var(--gray-200); }

.bim-view-left-file-explorer .panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* Viewer ở giữa */
.bim-view-center-viewer { background-color: var(--gray-100); }
.gantt-chart { background: var(--gray-50); }
.gantt-bar.gantt-completed { background: var(--color-success); }
.gantt-bar.gantt-in-progress { background: var(--color-primary); }
.gantt-bar.gantt-not-started { background: var(--gray-400); }
.gantt-bar.gantt-delayed { background: var(--color-danger); }
.task-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.progress-fill { background: var(--color-primary); }
.cost-variance.positive, .summary-value.positive { color: var(--color-danger); }
.cost-variance.negative, .summary-value.negative { color: var(--color-success); }
.cost-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.task-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.progress-fill { background: var(--color-primary); }
.empty-state { color: var(--gray-500); }
.empty-state p { color: var(--gray-500); }

.bim-view-center-viewer #viewer-container {
  position: absolute;
  inset: 0;
}

.bim-view-center-viewer #viewer-toolbar-container {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
}

/* BIM Panel bên phải - thay thế Properties */
.bim-view-right-panel {
  display: flex;
  flex-direction: column;
  background: white;
  border-left: 1px solid var(--border-color);
  overflow: hidden;
}

.bim-tab-content {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 8px;
}

.bim-tab-content.active {
  display: block;
}

/* Timeline Panel - Compact */
.timeline-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.timeline-panel-header h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 0;
}

.gantt-container {
  height: 150px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px;
  background: white;
  margin-bottom: 8px;
}

.gantt-chart {
  position: relative;
  height: 100%;
  background: var(--gray-50);
}

.gantt-bar { color: white; }
.task-item, .cost-item { background: var(--bg-surface); border-color: var(--border-color); }
.empty-state { color: var(--gray-500); }

.gantt-bar:hover {
  opacity: 0.8;
}

.gantt-bar.gantt-completed { background: var(--color-success); }
.gantt-bar.gantt-in-progress { background: var(--color-primary); }
.gantt-bar.gantt-not-started { background: var(--gray-400); }
.gantt-bar.gantt-delayed { background: var(--color-danger); }
.task-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.progress-fill { background: var(--color-primary); }
.cost-variance.positive { color: var(--color-danger); }
.cost-variance.negative { color: var(--color-success); }
.summary-value.positive { color: var(--color-danger); }
.summary-value.negative { color: var(--color-success); }

.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: var(--font-size-base);
}

.task-item:hover {
  background: var(--bg-hover);
}

.task-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.progress-fill { background: var(--color-primary); }
.cost-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.task-name {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.task-actions {
  display: flex;
  gap: 2px;
}

.btn-icon-compact {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.btn-icon-compact:hover {
  color: var(--text-color);
  background: var(--bg-hover);
  border-radius: 3px;
}

.task-dates {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.task-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s;
}

.progress-text {
  font-size: var(--font-size-xs);
  font-weight: 500;
  min-width: 35px;
}

.task-cost {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--font-size-xs);
}

.cost-planned,
.cost-actual {
  display: flex;
  justify-content: space-between;
}

.cost-variance {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: var(--font-size-xs);
}

.cost-variance.positive { color: var(--color-danger); }
.cost-variance.negative { color: var(--color-success); }
.summary-value.positive { color: var(--color-danger); }
.summary-value.negative { color: var(--color-success); }
.empty-state { color: var(--gray-500); }
.empty-state p { color: var(--gray-500); }

/* Cost Panel - Compact */
.cost-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-panel-header h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 0;
}

.cost-summary {
  display: flex;
  gap: 16px;
  padding: 8px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: var(--font-size-base);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.summary-value {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.summary-value.positive { color: var(--color-danger); }
.summary-value.negative { color: var(--color-success); }

.cost-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cost-item {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  font-size: var(--font-size-base);
}

.cost-item:hover {
  background: var(--bg-hover);
}

.cost-item.active { border-color: var(--color-primary); background: var(--color-primary-bg); }
.empty-state { color: var(--gray-500); }
.empty-state p { color: var(--gray-500); }

.cost-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cost-category {
  font-weight: 600;
  font-size: var(--font-size-base);
}

.cost-percentage {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.cost-bar-container {
  margin-bottom: 4px;
}

.cost-bar {
  position: relative;
  height: 18px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.cost-bar-planned {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-primary-light);
  opacity: 0.3;
}

.cost-bar-actual {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-primary);
}

.cost-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--font-size-xs);
}

.cost-details .label {
  color: var(--text-secondary);
}

.cost-details .value {
  font-weight: 500;
}

/* Compact buttons */
.btn-sm {
  padding: 4px 8px;
  font-size: var(--font-size-base);
  min-height: 28px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--gray-600);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-state p {
  margin: 0;
  color: var(--gray-500);
}

.timeline-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.cost-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.cost-panel-header h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: 0;
}

.cost-item-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--gray-200);
}

.cost-quantity {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
}
