/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

.accordion {
  background-color: var(--theme-sidebar-background);
  width: 100%;
  list-style-type: none;
  padding: 0;
  margin-top: 0;
}

.accordion ._header {
  --dbg-accordion-twisty-color: var(--theme-icon-dimmed-color);
  background-color: var(--theme-accordion-header-background);
  border-bottom: 1px solid var(--theme-splitter-color);
  display: flex;
  column-gap: 8px;
  font-size: 12px;
  line-height: calc(16 / 12);
  padding: 4px 6px;
  width: 100%;
  align-items: center;
  margin: 0;
  font-weight: normal;
  cursor: default;
  user-select: none;
}

.accordion ._header:hover {
  background-color: var(--theme-accordion-header-hover-background);

  :root[forced-colors-active] & {
    --dbg-accordion-twisty-color: var(--theme-accordion-header-hover-color);
  }
}

.accordion ._header .header-label {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--theme-accordion-header-color);
  background: transparent;
  padding: 0;

  /* align expand arrow and button text */
  display: flex;
  align-items: center;
  gap: 4px;

  &:hover {
    background: transparent;
    color: var(--theme-accordion-header-hover-color);
  }

  /* The expand arrow needs to be displayed inside the button to be accessible */
  &::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    background-image: url(chrome://devtools/content/debugger/images/arrow.svg);
    background-repeat: no-repeat;
    background-size: contain;
    -moz-context-properties: fill;
    fill: var(--dbg-accordion-twisty-color);
    rotate: -90deg;
    transition: rotate 180ms var(--animation-curve);
  }
  &:dir(rtl)::before {
    rotate: 90deg;
  }

  &[aria-expanded="true"]::before {
    /* icon should always point to the bottom (default) when expanded,
    regardless of the text direction */
    rotate: 0deg !important;
  }
}

.accordion ._header .header-buttons {
  display: flex;
  margin-inline-start: auto;
}

.accordion ._header .header-buttons button {
  color: var(--theme-body-color);
  border: none;
  background: none;
  padding: 0;
  margin: 0 2px;
  width: 16px;
  height: 16px;
}

.accordion ._header .header-buttons button .dbg-img {
  display: block;
}

.accordion ._content {
  border-bottom: 1px solid var(--theme-splitter-color);
  font-size: var(--theme-body-font-size);
}

.accordion div:last-child ._content {
  border-bottom: none;
}
