/* 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/>. */

.sources-panel {
  background-color: var(--theme-sidebar-background);
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  position: relative;

  & * {
    user-select: none;
  }

  /* Tabs header */
  & .tabs-navigation {
    height: var(--editor-header-height) !important;

    & .tabs-menu {
      /* override margin set by the Tabs component */
      margin: 0 !important;
    }

    & .tab {
      flex: 1;
      overflow: hidden;
      display: inline-flex;
      align-items: center;
    }

    & [role="tab"] {
      padding: 4px 8px;
      flex: 1;
    }
  }
}



/***********************/
/* Souces Panel layout */
/***********************/

.sources-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.sources-list .debugger-settings-menu-button {
  position: absolute;
  top: 0;

  inset-inline-end: 1px;
  /* The negative margin is set in order to collapse the inline-end border with
     the border of its container. */
  margin-inline-end: -1px;
  html[dir="rtl"] & {
    /* In RTL mode, there is a slightly different offset, so even if we use
       inline-end, we have to set slightly different values. */
    inset-inline-end: -1px;
    margin-inline-end: 0;
  }

  z-index: 5;

  background: var(--theme-toolbar-background);
  min-width: unset;
  width: 25px;
  height: 25px;
  border: 1px solid var(--theme-splitter-color);
  border-top-width: 0;
}

.sources-list.sources-list-has-overflow:not(.sources-list-custom-root)
  .debugger-settings-menu-button {
  inset-inline-end: 15px;
  html[dir="rtl"] & {
    inset-inline-end: 14px;
  }
}

.sources-list .sources-clear-root-container {
  grid-area: custom-root;
}

.sources-list :is(.tree, .no-sources-message) {
  grid-area: sources-tree-or-empty-message;
}

/****************/
/*  Custom root */
/****************/

.sources-clear-root-container {
  width: 100%;
  text-align: start;
  white-space: nowrap;
  color: inherit;
  display: flex;
  border-bottom: 1px solid var(--theme-splitter-color);
}

.sources-clear-root {
  width: 24px;
  height: 24px;
  padding: 4px;
  outline-offset: -2px;
}

.sources-clear-root-container .devtools-separator {
  height: 20px;
  margin: 2px 4px;
}

.sources-clear-root-label {
  width: 100%;
  padding: 4px;
  line-height: 16px;
}

/*****************/
/*  Sources tree */
/*****************/

.sources-list .tree {
  flex-grow: 1;
  padding: 4px 0;
  user-select: none;

  white-space: nowrap;
  overflow: auto;
  min-width: 100%;

  display: grid;
  grid-template-columns: 1fr;
  align-content: start;

  line-height: 1.4em;
}

.sources-list .tree .node {
  display: flex;
  align-items: center;
  width: 100%;
  padding-block: 8px;
  padding-inline: 6px 8px;
}

.sources-list .tree .node {
  padding: 2px 3px;
  position: relative;
}


html:not([dir="rtl"]) .sources-list .tree .node > div {
  margin-left: 10px;
}

html[dir="rtl"] .sources-list .tree .node > div {
  margin-right: 10px;
}

.sources-list .img {
  margin-inline-end: 4px;
}

.sources-list .tree .label .suffix {
  font-style: italic;
  font-size: 0.9em;
  color: var(--theme-comment);
}

.sources-list .tree .focused .label .suffix {
  color: inherit;
}

.sources-list .tree .tree-node:not(.focused) .blackboxed {
  color: #806414;
}

.sources-list .img.blackBox {
  mask-size: 13px;
  background-color: #806414;
}

.sources-list .tree .label {
  display: inline-block;
  line-height: 16px;
}

.source-list-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  justify-content: center;
  text-align: center;
  min-height: var(--editor-footer-height);
  flex-shrink: 0;
  border-block-start: 1px solid var(--theme-warning-border);
  user-select: none;
  padding: 3px 10px;
  color: var(--theme-warning-color);
  background-color: var(--theme-warning-background);
}

.source-list-footer .devtools-togglebutton {
  background-color: var(--theme-toolbar-hover);
}

.source-list-footer .devtools-togglebutton:hover {
  background-color: var(--theme-toolbar-hover);
  cursor: pointer;
}


/* Removes start margin when a custom root is used */
.sources-list-custom-root
  .tree
  > .tree-node[data-expandable="false"][aria-level="0"] {
  padding-inline-start: 4px;
}

.sources-list .tree-node[data-expandable="false"] .tree-indent:last-of-type {
  margin-inline-end: 0;
}


/*****************/
/*   No Sources  */
/*****************/

.no-sources-message {
  display: flex;
  justify-content: center;
  align-items: center;
  font-style: italic;
  text-align: center;
  padding: 0.5em;
  font-size: 12px;
  user-select: none;
}
