/*
 * Copyright 2016 The Chromium Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

.tree-outline {
  padding-left: 0;
}

.tree-outline > ol {
  padding-bottom: 5px;
  border-bottom: solid 1px var(--sys-color-divider);
}

.tree-outline > .parent {
  user-select: none;
  font-weight: bold;
  color: var(--sys-color-on-surface);
  margin-top: -1px;
  display: flex;
  align-items: center;
  height: var(--sys-size-13);
}

.tree-outline li {
  padding-left: 5px;
  line-height: 20px;
}

.tree-outline li:not(.parent) {
  margin-left: 10px;
  display: block;

  &:has(.payload-name) {
    margin: var(--sys-size-3) 0;
    display: grid;
    grid-template-columns: min-content 1fr;
    gap: var(--sys-size-6);
  }
}

.tree-outline li:not(.parent)::before {
  display: none;
}

.tree-outline li.expanded .payload-count {
  display: none;
}

.tree-outline li .payload-toggle {
  display: none;
}

.tree-outline li.expanded .payload-toggle {
  display: inline;
  margin-left: 30px;
  font-weight: normal;
}

.tree-outline li.expanded .payload-toggle:focus-visible {
  border: 2px solid var(--sys-color-state-focus-ring);
  border-radius: 5px;
}

.tree-outline li .header-toggle:hover {
  color: var(--sys-color-token-subtle);
}

.tree-outline .payload-name {
  color: var(--sys-color-on-surface-subtle);
  font: var(--sys-typescale-body5-medium);
  white-space: pre-wrap;
  align-self: start;
  min-width: 150px;
  line-height: 18px;
}

.tree-outline .payload-value {
  display: inline;
  white-space: pre-wrap;
  word-break: break-all;
  font: var(--sys-typescale-body4-regular);
  line-height: 18px;
}

.tree-outline .empty-request-payload {
  color: var(--sys-color-state-disabled);
}

.request-payload-show-more-button {
  margin: 0 4px;
}

@media (forced-colors: active) {
  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li.selected:focus {
    background: Highlight;
  }

  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li::before {
    background-color: ButtonText;
  }

  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li.selected.parent::before {
    background-color: HighlightText;
  }

  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li.selected *,
  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li.selected.parent,
  :host-context(.request-payload-tree) ol.tree-outline:not(.hide-selection-when-blurred) li.selected.parent span {
    color: HighlightText;
  }
}

.payload-decode-error {
  color: var(--sys-color-error);
}
