/*
 * Copyright (c) 2014 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.
 */

:host {
  flex: none;
  padding: 0 2px;
}

:host-context(.-theme-with-dark-background) {
  --accent-color: #4688f1;
}

.toolbar-shadow {
  position: relative;
  white-space: nowrap;
  height: 26px;
  overflow: hidden;
  z-index: 12;
  display: flex;
  flex: none;
  align-items: center;
}

.toolbar-shadow.wrappable {
  flex-wrap: wrap;
  overflow: visible;
}

.toolbar-shadow.toolbar-grow-vertical {
  height: initial;
}

.toolbar-shadow.vertical {
  flex-direction: column;
  height: auto;
  align-items: flex-start;
}

.toolbar-item {
  position: relative;
  display: flex;
  background-color: transparent;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  height: 26px;
  border: none;
  white-space: pre;
}

.toolbar-item,
.toolbar-item .devtools-link {
  color: #5a5a5a; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-dropdown-arrow {
  background-color: #6d6d6d; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  pointer-events: none;
  flex: none;
}

.toolbar-button.dark-text .toolbar-dropdown-arrow {
  background-color: #333; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

select.toolbar-item:disabled + .toolbar-dropdown-arrow {
  opacity: 50%;
}
/* Toolbar item */

.toolbar-button {
  white-space: nowrap;
  overflow: hidden;
  min-width: 28px;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
}

.toolbar-text {
  margin: 0 5px;
  flex: none;
  color: #5a5a5a; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-text:empty {
  margin: 0;
}

.toolbar-has-dropdown {
  justify-content: space-between;
  padding: 0 3px 0 5px;
  border: 1px solid transparent;
}

.toolbar-has-dropdown-shrinkable {
  flex-shrink: 1;
}

.toolbar-has-dropdown .toolbar-text {
  margin: 0 4px 0 0;
  text-overflow: ellipsis;
  flex: auto;
  overflow: hidden;
  text-align: right;
}

.toolbar-has-glyph .toolbar-text {
  margin-left: -4px;
}

.toolbar-render-as-links * {
  font-weight: initial;
  color: var(--color-link);
  text-decoration: underline;
  cursor: pointer;
}

.toolbar-render-as-links button {
  height: 15px;
  margin: 2px;
}

.toolbar-render-as-links button:focus-visible {
  outline: auto 5px -webkit-focus-ring-color;
}

:not(.toolbar-render-as-links) .toolbar-button:focus-visible::after {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  right: 2px;
  background-color: rgb(0 0 0 / 8%); /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  border-radius: 2px;
  content: "";
}

.toolbar-glyph {
  background-color: #5a5a5a; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  flex: none;
}
/* Button */

.toolbar-button:disabled {
  opacity: 50%;
}

.toolbar-button.toolbar-state-on .toolbar-glyph {
  background-color: var(--accent-color);
}

.toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,
.toolbar-button.toolbar-state-off.toolbar-default-with-red-color .toolbar-glyph {
  background-color: rgb(216 0 0) !important; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):not(.toolbar-button-secondary) {
  font-weight: bold;
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover:not(:active) {
  background-color: var(--accent-color);
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:active:hover {
  background-color: var(--accent-color);
}

.toolbar-toggled-gray:not(.toolbar-render-as-links) .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover {
  background-color: var(--toolbar-bg-color);
}

.toolbar-button.dark-text .toolbar-text {
  color: #333 !important; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-button.toolbar-state-on .toolbar-text {
  color: var(--accent-color);
}

:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph {
  background-color: #333; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

:not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text {
  color: #333; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-glyph {
  background-color: var(--color-background);
}

.toolbar-blue-on-hover .toolbar-button:not(.toolbar-state-on):enabled:hover .toolbar-text {
  color: #fff; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-glyph {
  background-color: var(--accent-color);
}

.toolbar-button.toolbar-state-on:enabled:hover:not(:active) .toolbar-text {
  color: var(--accent-color);
}

.toolbar-toggled-gray .toolbar-button.toolbar-state-on {
  background-color: var(--toolbar-bg-color) !important;
}

:host-context(.-theme-with-dark-background) .toolbar-button.toolbar-state-on.toolbar-toggle-with-red-color .toolbar-glyph,
:host-context(.-theme-with-dark-background) .toolbar-button.toolbar-state-off.toolbar-default-with-red-color .toolbar-glyph {
  background-color: hsl(0deg 100% 65%) !important;
}
/* Checkbox */

.toolbar-item.checkbox {
  padding: 0 5px 0 2px;
}

.toolbar-item.checkbox:hover {
  color: #333; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}
/* Select */

.toolbar-select-container {
  display: inline-flex;
  flex-shrink: 0;
  margin-right: 6px;
}

select.toolbar-item {
  min-width: 38px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0 13px 0 5px;
  margin-right: -10px;
  position: relative;
  height: 22px;
  margin-top: 2px;
  margin-bottom: 2px;
}

select.toolbar-item:disabled {
  opacity: 50%;
}

select.toolbar-item:focus-visible {
  background: rgb(0 0 0 / 8%); /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  border-radius: 2px;
}

select.toolbar-item:focus-visible > * {
  background: var(--color-background);
}
/* Input */

.toolbar-input {
  width: 120px;
  height: 19px;
  padding: 4px 3px 3px 3px;
  margin: 1px 3px;
  background-color: var(--color-background);
  border: 1px solid transparent;
  min-width: 35px;
  box-shadow: var(--focus-ring-inactive-shadow);
}

.toolbar-input.focused,
.toolbar-input:not(.toolbar-input-empty) {
  box-shadow: var(--focus-ring-active-shadow);
}

.toolbar-input > input {
  border: none;
  flex-grow: 1;
}

.toolbar-input-clear-button {
  opacity: 70%;
  flex-basis: 13px;
  flex-shrink: 0;
  height: 16px;
}

.toolbar-input-clear-button > .search-cancel-button {
  display: block;
}

.toolbar-input-clear-button:hover {
  opacity: 99%;
}

.toolbar-input-empty .toolbar-input-clear-button {
  display: none;
}

.toolbar-prompt-proxy {
  flex: 1;
}

.toolbar-input-prompt {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  cursor: auto;
}
/* Separator */

.toolbar-divider {
  background-color: #ccc; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  width: 1px;
  margin: 5px 4px;
  height: 16px;
}

.toolbar-spacer {
  flex: auto;
}
/* Long click */

.long-click-glyph {
  position: absolute;
  background-color: #5a5a5a; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  top: 0;
  left: 0;
}

.toolbar-button.emulate-active {
  background-color: rgb(163 163 163); /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

.toolbar-shadow.floating {
  flex-direction: column;
  height: auto;
  background-color: var(--color-background);
  border: 1px solid #ccc; /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
  margin-top: -1px;
  width: 28px;
  left: -2px;
}

input[is=history-input] {
  border: 1px solid transparent;
  line-height: 16px;
  padding: 1px;
}

input[is=history-input]:hover {
  box-shadow: var(--focus-ring-inactive-shadow);
}

input[is=history-input]:focus,
input[is=history-input]:not(:placeholder-shown) {
  box-shadow: var(--focus-ring-active-shadow);
}

.toolbar-item.warning {
  background: hsl(0deg 100% 95%); /* stylelint-disable-line plugin/use_theme_colors */
  /* See: crbug.com/1152736 for color variable migration. */
}

devtools-icon.breaking-change {
  margin: 0 7px;
}

@media (forced-colors: active) {
  .toolbar-button:disabled {
    opacity: 100%;
  }

  .toolbar-item,
  .toolbar-text {
    color: ButtonText;
  }

  select.toolbar-item:disabled,
  select.toolbar-item:disabled + .toolbar-dropdown-arrow {
    opacity: 100%;
    background-color: Graytext;
  }

  .toolbar-button.toolbar-state-on .toolbar-glyph {
    forced-color-adjust: none;
    background-color: Highlight;
  }

  .toolbar-button.toolbar-state-on .toolbar-text {
    forced-color-adjust: none;
    color: Highlight;
  }

  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-text,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus:not(:active) .toolbar-text {
    color: HighlightText;
  }

  .toolbar-button:disabled [is=ui-icon].icon-mask {
    background-color: GrayText;
    color: GrayText;
  }

  :not(.toolbar-render-as-links) .toolbar-button:disabled .toolbar-glyph {
    background-color: GrayText;
    color: GrayText;
  }

  .toolbar-button:enabled.hover:not(:active) .toolbar-glyph,
  .toolbar-button:focus,
  .toolbar-button:hover:enabled,
  .toolbar-toggled-gray:not(.toolbar-render-as-links) .toolbar-button:not(.toolbar-has-glyph):not(.toolbar-has-dropdown):not(.largeicon-menu):hover {
    forced-color-adjust: none;
    background-color: Highlight;
  }

  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover .toolbar-glyph,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:focus .toolbar-glyph,
  :not(.toolbar-render-as-links) .toolbar-button:enabled:hover:not(:active) .toolbar-glyph,
  .toolbar-button:enabled:hover [is=ui-icon].icon-mask,
  .toolbar-button:enabled:focus [is=ui-icon].icon-mask {
    background-color: HighlightText;
  }

  .toolbar-input {
    forced-color-adjust: none;
    background: canvas;
    box-shadow: var(--focus-ring-inactive-shadow);
  }

  .toolbar-input.focused,
  .toolbar-input:not(.toolbar-input-empty) {
    forced-color-adjust: none;
    background: canvas;
    box-shadow: var(--focus-ring-active-shadow);
  }

  .toolbar-input:hover {
    box-shadow: var(--focus-ring-active-shadow);
  }

  .toolbar-item .devtools-link {
    color: linktext;
  }
}
