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

.metrics {
  padding: 8px;
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  min-height: var(--metrics-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

:host {
  --metrics-height: 190px;

  height: var(--metrics-height);
  contain: strict;
}

:host(.invisible) {
  visibility: hidden;
  height: 0;
}

:host(.collapsed) {
  visibility: collapse;
  height: 0;
}
/* The font we use on Windows takes up more vertical space, so adjust
 * the height of the metrics sidebar pane accordingly.
 */
:host-context(.platform-windows) {
  --metrics-height: 214px;
}

.metrics .label {
  position: absolute;
  font-size: 10px;
  left: 4px;
}

.metrics .position {
  border: 1px rgb(66% 66% 66%) dotted; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  background-color: var(--color-background);
  display: inline-block;
  text-align: center;
  padding: 3px;
  margin: 3px;
  position: relative;
}

.metrics .margin {
  border: 1px dashed rgb(48 57 66); /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  background-color: var(--color-background);
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  padding: 3px 6px;
  margin: 3px;
  position: relative;
}

.metrics .border {
  border: 1px #000 solid; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  background-color: var(--color-background);
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  padding: 3px 6px;
  margin: 3px;
  position: relative;
}

.metrics .padding {
  border: 1px #808080 dashed; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  background-color: var(--color-background);
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  padding: 3px 6px;
  margin: 3px;
  position: relative;
  min-width: 120px;
}

.metrics .content {
  position: static;
  border: 1px #808080 solid; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  background-color: var(--color-background);
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  padding: 3px;
  margin: 3px;
  min-width: 80px;
  overflow: visible;
}

.metrics .content span {
  display: inline-block;
}

.metrics .editing {
  position: relative;
  z-index: 100;
  cursor: text;
}

.metrics .left {
  display: inline-block;
  vertical-align: middle;
}

.metrics .right {
  display: inline-block;
  vertical-align: middle;
}

.metrics .top {
  display: inline-block;
}

.metrics .bottom {
  display: inline-block;
}
/* All computed layout attributes except position have a quite light
 * background color applied to them, so the default light font in dark
 * mode is very low contrast. Therefore we swap back to a dark font by
 * default in dark mode because the background colors are lighter.
 */
:host-context(.-theme-with-dark-background) .metrics .margin,
:host-context(.-theme-with-dark-background) .metrics .border,
:host-context(.-theme-with-dark-background) .metrics .padding,
:host-context(.-theme-with-dark-background) .metrics .content {
  color: #222;
}
/* When you hover over margin the rest of the items get given a black
 * background and so then the black text we set above means the numbers
 * are invisible. So if you're hovering over the margin we set the
 * color of the text for all the children to light. This also fixes
 * hovering over anything within margin such as border/padding.
 */
:host-context(.-theme-with-dark-background) .metrics > div:hover div {
  color: #ccc;
}
