/* 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);
  --dock-bottom-image: url(chrome://devtools/skin/images/dock-bottom.svg);
  --dock-side-image: url(chrome://devtools/skin/images/dock-side.svg);
  --dock-undock-image: url(chrome://devtools/skin/images/dock-undock.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-frames-image: url(images/command-frames.svg);
  --command-splitconsole-image: url(images/command-console.svg);
  --command-noautohide-image: url(images/command-noautohide.svg);
  --command-rulers-image: url(images/command-rulers.svg);
  --command-measure-image: url(images/command-measure.svg);
}

.theme-firebug {
  --close-button-image: url(chrome://devtools/skin/images/firebug/close.svg);
  --dock-bottom-image: url(chrome://devtools/skin/images/firebug/dock-bottom.svg);
  --dock-side-image: url(chrome://devtools/skin/images/firebug/dock-side.svg);
  --dock-undock-image: url(chrome://devtools/skin/images/firebug/dock-undock.svg);

  --command-paintflashing-image: url(images/firebug/command-paintflashing.svg);
  --command-screenshot-image: url(images/firebug/command-screenshot.svg);
  --command-responsive-image: url(images/firebug/command-responsivemode.svg);
  --command-scratchpad-image: url(images/firebug/command-scratchpad.svg);
  --command-pick-image: url(images/firebug/command-pick.svg);
  --command-frames-image: url(images/firebug/command-frames.svg);
  --command-splitconsole-image: url(images/firebug/command-console.svg);
  --command-noautohide-image: url(images/firebug/command-noautohide.svg);
  --command-rulers-image: url(images/firebug/command-rulers.svg);
  --command-measure-image: url(images/firebug/command-measure.svg);
}

/* Toolbox tabbar */

.devtools-tabbar {
  -moz-appearance: none;
  display: flex;
  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;
}

.toolbox-tabs-wrapper .all-tools-menu {
  border-inline-end: 1px solid var(--theme-splitter-color);
  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-option-container,
#toolbox-controls,
#toolbox-dock-buttons {
  display: flex;
  align-items: stretch;
}

/* Toolbox tabs */

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

.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);
}

/* Hide tab icons when the viewport width is limited */
@media (max-width: 700px) {
  .devtools-tab-label {
    /* Set the end padding on the label to make sure the label gets faded out properly */
    padding-inline-end: 5px;
  }

  .devtools-tab:not(.devtools-tab-icon-only) {
    padding-inline-start: 5px !important;
  }

  /* Hide the icons */
  .devtools-tab:not(.devtools-tab-icon-only) > img {
    display: none;
  }
}

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

/* Save space on the tab-strip in Firebug theme */
.theme-firebug .devtools-tab {
  -moz-box-flex: initial;
}

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

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

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

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

/* Display execution pointer in the Debugger tab to indicate
   that the debugger is paused. */
.theme-firebug #toolbox-tab-jsdebugger.devtools-tab:not(.selected).highlighted {
  background-color: rgba(89, 178, 234, .2);
  background-image: url(chrome://devtools/skin/images/firebug/tool-debugger-paused.svg);
  background-repeat: no-repeat;
  padding-left: 13px !important;
  background-position: 3px 6px;
}

.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);
}

/* The options tab is special - it doesn't have the same parent
   as the other tabs (toolbox-option-container vs toolbox-tabs) */
#toolbox-option-container .devtools-tab {
  border-color: transparent;
  border-width: 0;
  padding-inline-start: 1px;
}
#toolbox-option-container img {
  margin: 0 3px;
}

/* Toolbox controls */

/* Save space in Firebug theme */
.theme-firebug #toolbox-controls button {
  margin-inline-start: 0 !important;
  min-width: 12px;
  margin: 0 1px;
}

#toolbox-close::before {
  background-image: var(--close-button-image);
}

#toolbox-dock-bottom::before {
  background-image: var(--dock-bottom-image);
}

#toolbox-dock-side::before {
  background-image: var(--dock-side-image);
}

#toolbox-dock-window::before {
  background-image: var(--dock-undock-image);
}

#toolbox-dock-bottom-minimize::before {
  background-image: url("chrome://devtools/skin/images/dock-bottom-minimize@2x.png");
}

#toolbox-dock-bottom-minimize.minimized::before {
  background-image: url("chrome://devtools/skin/images/dock-bottom-maximize@2x.png");
}

/* Command buttons */

.command-button,
#toolbox-controls > button,
#toolbox-dock-buttons > 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-splitconsole::before {
  background-image: var(--command-splitconsole-image);
}

#command-button-noautohide::before {
  background-image: var(--command-noautohide-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:-moz-locale-dir(ltr) {
  background-position: right;
}

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

/* 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;
}
