/*
 * Copyright 2025 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
.timeline-tree-view {
  display: flex;
  overflow: hidden;
}

.timeline-tree-view devtools-toolbar {
  background-color: var(--sys-color-cdt-base-container);
  border-bottom: 1px solid var(--sys-color-divider);
}

.timeline-tree-view .data-grid {
  flex: auto;
}

.timeline-tree-view .data-grid .data-container {
  overflow-y: scroll;
}

.timeline-tree-view .data-grid.data-grid-fits-viewport .corner {
  display: table-cell;
}

.timeline-tree-view .data-grid table.data {
  background: var(--sys-color-cdt-base-container);
}

.timeline-tree-view .data-grid .odd {
  background-color: var(--sys-color-surface1);
}

.timeline-tree-view .data-grid tr:hover td:not(.bottom-filler-td) {
  background-color: var(--sys-color-state-hover-on-subtle);
}

.timeline-tree-view .data-grid td.numeric-column {
  text-align: right;
  position: relative;
}

.timeline-tree-view .data-grid td.activity-column {
  padding-left: 0;

  &::before {
    mask-position: center;
    mask-repeat: no-repeat;
    width: var(--sys-size-9);
    height: 18px;
    margin: 0 calc(-1 * var(--sys-size-2)) 0 0;
    top: 0;
  }
}

.timeline-tree-view .data-grid div.background-bar-text {
  position: relative;
  z-index: 1;
}

.timeline-tree-view .data-grid span.percent-column {
  color: var(--sys-color-token-subtle);
  width: 45px;
  display: inline-block;
}

.timeline-tree-view .data-grid tr.selected span {
  color: inherit;
}

.timeline-tree-view .data-grid tr.selected {
  background-color: var(--sys-color-tonal-container);
}

.timeline-tree-view .data-grid .name-container {
  display: flex;
  align-items: center;
}

.timeline-tree-view .data-grid .name-container .activity-icon {
  width: 12px;
  height: 12px;
  border: 1px solid var(--divider-line);
  margin: 3px 0;
}

.timeline-tree-view .data-grid .name-container .activity-icon-container {
  margin-right: 3px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  overflow: hidden;
}

.timeline-tree-view .data-grid .name-container .activity-warning::after {
  content: "[deopt]";
  margin: 0 4px;
  line-height: 12px;
  font-size: 10px;
  color: var(--sys-color-state-disabled);
}

.timeline-tree-view .data-grid tr.selected .name-container .activity-warning::after {
  color: var(--sys-color-on-tonal-container);
}

.timeline-tree-view .data-grid .name-container .activity-link {
  flex: auto;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 5px;
}

.timeline-tree-view .data-grid .background-bar-container {
  position: absolute;
  /* Small gap on the left side so the first row (which has a 100% width bar, has a distinguishable bar */
  inset: 0 0 0 2px;
}

.timeline-tree-view .data-grid .background-bar {
  height: 18px;
  background-color: var(--sys-color-surface-yellow);
  border-bottom: 1px solid var(--sys-color-yellow-outline);
  position: absolute;
  right: 0;
}

.timeline-tree-view .data-grid .selected .background-bar {
  background-color: var(--app-color-selected-progress-bar);
  border-bottom: 1px solid var(--app-border-selected-progress-bar);
}

.timeline-tree-view .data-grid thead {
  height: 21px;
  /* so the header is always above any body rows that the user has scrolled past */
  z-index: 2;
}

@media (forced-colors: active) {
  .timeline-tree-view .data-grid .name-container .activity-icon {
    forced-color-adjust: none;
  }

  .timeline-tree-view .data-grid tr.selected span.percent-column,
  .timeline-tree-view .data-grid tr.selected div.background-bar-text span,
  .timeline-tree-view .data-grid tr.selected .name-container .activity-link .devtools-link .timeline-link {
    color: HighlightText;
  }

  .timeline-tree-view .data-grid .background-bar,
  .timeline-tree-view .data-grid tr:hover td:not(.bottom-filler-td) {
    background-color: transparent;
  }

  .timeline-tree-view .data-grid tr.selected .background-bar {
    background-color: transparent;
    border-bottom-color: HighlightText;
  }
}
