/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */

:root {
  --close-button-image: url(chrome://devtools/skin/images/close.svg);
  --more-button-image: url(chrome://devtools/skin/images/more.svg);

  --command-paintflashing-image: url(images/command-paintflashing.svg);
  --command-screenshot-image: url(images/command-screenshot.svg);
  --command-responsive-image: url(images/command-responsivemode.svg);
  --command-scratchpad-image: url(images/tool-scratchpad.svg);
  --command-pick-image: url(images/command-pick.svg);
  --command-pick-accessibility-image: url(images/command-pick-accessibility.svg);
  --command-frames-image: url(images/command-frames.svg);
  --command-rulers-image: url(images/command-rulers.svg);
  --command-measure-image: url(images/command-measure.svg);
  --command-chevron-image: url(images/command-chevron.svg);
}

/* Toolbox tabbar */

.devtools-tabbar {
  -moz-appearance: none;
  /* For narrow devtool width, we define the each column width of tabbar.
    Defined layout is as follow:

    -------------------------------------------------
    | Picker |  tooltabs  |  commands |   controls  |
    |  auto  | 26px ~ 1fr |    auto   |  max-content|
    -------------------------------------------------
  */
  display: grid;
  grid-template-columns: auto minmax(26px, 1fr) auto max-content;
  background: var(--theme-tab-toolbar-background);
  border-bottom: 1px solid var(--theme-splitter-color);
  box-sizing: border-box;
  min-height: 29px;
}

.toolbox-tabs-wrapper {
  position: relative;
  display: flex;
  flex: 1;
}

/* These classes use to stretch the tool tabs wrapper width if toolbox does'n
  have start buttons or end buttons element. */

.devtools-tabbar .toolbox-tabs-wrapper {
  grid-column-start: 2;
  grid-column-end: 3;
}

.devtools-tabbar-has-start .toolbox-tabs-wrapper {
  grid-column-start: 1;
}

.devtools-tabbar-has-end .toolbox-tabs-wrapper {
  grid-column-end: 4;
}

.toolbox-tabs-wrapper .tools-chevron-menu {
  border-top-width: 0;
  border-bottom-width: 0;
}

.toolbox-tabs {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  margin: 0;
  flex: 1;
  overflow: hidden;
}

/* Set flex attribute to Toolbox buttons and Picker container so,
   they don't overlap with the tab bar */
#toolbox-buttons-start,
#toolbox-buttons-end,
#toolbox-controls {
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

/* Toolbox tabs */

.devtools-tab {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-color: transparent;
  flex-shrink: 0;
}

.devtools-tab-label {
  font-size: 12px;
  mask-image: linear-gradient(to left, transparent 0, black 6px);
  /* Set the end padding on the label to make sure the label gets faded out properly */
  padding-inline-end: 10px;
  min-width: 1px;
}

.devtools-tab-label:-moz-locale-dir(rtl) {
  mask-image: linear-gradient(to right, transparent 0, black 6px);
}

.devtools-tab-icon-only {
  min-width: 24px;
}

.devtools-tab {
  color: var(--theme-toolbar-color);
}

.devtools-tab:hover,
.devtools-tab:focus {
  background-color: var(--theme-toolbar-hover);
}

/* Remove system control border from devtools-tab. */
.devtools-tab::-moz-focus-inner {
  border: 0;
}

.devtools-tab:hover:active {
  background-color: var(--theme-toolbar-hover-active);
}

.devtools-tab.selected {
  color: var(--theme-toolbar-selected-color);
}

.devtools-tab > img {
  border: none;
  margin: 0;
  margin-inline-start: 10px;
  margin-inline-end: 5px;
  max-height: 16px;
  width: 16px; /* Prevents collapse during theme switching */
  vertical-align: text-top;
  flex-shrink: 0;
}

.devtools-tab > label {
  white-space: nowrap;
  margin: 0 4px;
}

.devtools-tab > img {
  -moz-context-properties: fill;
  fill: var(--theme-toolbar-color);
}

.devtools-tab.selected > img {
  fill: var(--theme-toolbar-selected-color);
}

.devtools-tab.highlighted > img {
  fill: var(--theme-toolbar-highlighted-color);
}

#devtools-chevron-menu-button::before {
  -moz-context-properties: fill;
  fill: var(--theme-toolbar-photon-icon-color);
}

/* Toolbox controls */

#tools-chevron-menu-button::before {
  top: 0;
  offset-inline-end: 0;
  background-image: var(--command-chevron-image);
  background-position: center;
}

.tools-chevron-menu:-moz-locale-dir(rtl) {
  transform: rotate(180deg);
}

/* On OSX the cursor turns into a window-resizing cursor at the edges of the
 * window, so bring the end of the toolbox in. */
:root[platform="mac"] #toolbox-controls {
  margin-inline-end: 3px;
}

#toolbox-buttons-end > .devtools-separator {
  margin-inline-start: 5px;
  margin-inline-end: 5px;
}

#toolbox-close {
  min-width: 24px;
}

#toolbox-close::before {
  fill: var(--theme-toolbar-photon-icon-color);
  background-image: var(--close-button-image);
}

#toolbox-meatball-menu-button {
  min-width: 24px;
}

#toolbox-meatball-menu-button::before {
  fill: var(--theme-toolbar-photon-icon-color);
  background-image: var(--more-button-image);
}

/* Command buttons */

.command-button,
#toolbox-controls > button {
  /* !important is needed to override .devtools-button rules in common.css */
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  position: relative;
  min-width: 24px;
}

#command-button-pick {
  min-width: 32px;
}

/* Command button images */

#command-button-paintflashing::before {
  background-image: var(--command-paintflashing-image);
}

#command-button-screenshot::before {
  background-image: var(--command-screenshot-image);
}

#command-button-responsive::before {
  background-image: var(--command-responsive-image);
}

#command-button-scratchpad::before {
  background-image: var(--command-scratchpad-image);
}

#command-button-pick::before {
  background-image: var(--command-pick-image);
}

#command-button-pick.accessibility::before {
  background-image: var(--command-pick-accessibility-image);
}

#command-button-eyedropper::before {
  background-image: var(--command-eyedropper-image);
}

#command-button-rulers::before {
  background-image: var(--command-rulers-image);
}

#command-button-measure::before {
  background-image: var(--command-measure-image);
}

#command-button-frames::before {
  background-image: var(--command-frames-image);
}

#command-button-frames {
  background-image: url("chrome://devtools/skin/images/dropmarker.svg");
  background-repeat: no-repeat;

  /* Override background-size from the command-button.
   The drop down arrow is smaller */
  background-size: 8px 4px !important;
  min-width: 32px;
}

#command-button-frames::before {
  /* The frames button has a drop-down arrow making it asymmetrical.
   * Drop the margin on the non-arrow side to make it fit more symmetrical. */
  margin-inline-start: 0px;
  /* The direction of devtools-button is forced to 'ltr' for text-as-image
   * buttons. We don't need that here (there's no text in this button) and we
   * want the logical properties to reflect the text direction so unset it. */
  direction: unset;
}

#command-button-frames:-moz-locale-dir(ltr) {
  background-position: right 2px top 14px;
}

#command-button-frames:-moz-locale-dir(rtl) {
  background-position: left 2px top 14px;
}

/* Toolbox panels */

.toolbox-panel {
  display: -moz-box;
  -moz-box-flex: 1;
  visibility: collapse;
}

.toolbox-panel[selected] {
  visibility: visible;
}

/**
 * When panels are collapsed or hidden, making sure that they are also
 * inaccessible by keyboard. This is not the case by default because the are
 * predominantly hidden using visibility: collapse; style or collapsed
 * attribute.
 */
.toolbox-panel *,
#toolbox-panel-webconsole[collapsed] * {
  -moz-user-focus: ignore;
}

/**
 * Enrure that selected toolbox panel's contents are keyboard accessible as they
 * are explicitly made not to be when hidden (default).
 */
.toolbox-panel[selected] * {
  -moz-user-focus: normal;
}

/* Toolbox tabs reordering */
#toolbox-container.tabs-reordering > .theme-body {
  pointer-events: none;
}

#toolbox-container.tabs-reordering .devtools-tab:not(.selected):hover .devtools-tab-line {
  background: transparent;
  opacity: 0;
  transition: none;
}

#toolbox-container.tabs-reordering .devtools-tab.selected {
  background-color: var(--theme-toolbar-hover);
  z-index: 1;
}
