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

/* #css_wrapper_metadata_start
 * #type=style-lit
 * #import=//resources/cr_elements/cr_icons_lit.css.js
 * #scheme=relative
 * #include=cr-icons-lit
 * #css_wrapper_metadata_end */

:host {
  display: flex;
  flex: 1;
  width: 100%;
}

#inputInnerContainer {
  align-items: flex-start;
  display: flex;
  min-height: var(--cr-searchbox-input-height, 48px);
  position: relative;
  width: 100%;
}

:host([multi-line-enabled]) textarea {
  background-color: var(--color-cr-searchbox-input-textarea, transparent);
  box-sizing: border-box;
  field-sizing: content;
  line-height: 24px;
  max-height: 190px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: calc((var(--cr-searchbox-height) - 24px) / 2);
  resize: none;
  scrollbar-width: none;
  white-space: pre-wrap;
}

:host([multi-line-enabled]) #input::-webkit-scrollbar {
  display: none;
}

:is(input, textarea) {
  background-color: var(--color-cr-searchbox-input-textarea, transparent);
  border: none;
  color: var(--color-searchbox-foreground);
  font-family: inherit;
  font-size: inherit;
  height: 100%;
  outline: none;
  padding-top: 20px;
  position: relative;
  width: 100%;
}

input::-webkit-search-decoration,
input::-webkit-search-results-button,
input::-webkit-search-results-decoration {
  display: none;
}

/* Visually hide the cancel button but do not set display to none or
 * visibility to hidden as this causes issues with NVDA not reading out the
 * full value of the searchbox input as the user selects suggestion matches.
 * See crbug.com/1312442 for more context. */
input::-webkit-search-cancel-button {
  appearance: none;
  margin: 0;
}

:is(input, textarea)::placeholder {
  color: var(--color-searchbox-placeholder);
  opacity: var(--placeholder-opacity);
  white-space: nowrap;
}

:is(input, textarea):focus::placeholder {
  /* Visually hide the placeholder on focus. The placeholder will still be
   * read by screen readers. Using color: transparent or other ways of
   * visually hiding the placeholder does not work well with 'Find in page...'
   * as the placeholder text can get highlighted. */
  visibility: hidden;
}

cr-searchbox-icon {
  height: 100%;
  padding-inline-end: var(--cr-searchbox-icon-right-position, 4px);
  padding-inline-start: var(--cr-searchbox-icon-left-position);
  position: relative;
  top: var(--cr-searchbox-icon-top-position);
  pointer-events: none;
}

@media (forced-colors: active) {
  cr-searchbox-icon {
    border-radius: 4px;
  }
}

:is(input, textarea),
cr-searchbox-icon,
#keyword {
  z-index: 100;
}

#keyword {
  align-self: center;
  border-inline-end: 1px solid var(--color-omnibox-keyword-selected);
  color: var(--color-omnibox-keyword-selected);
  margin-inline-end: 8px;
  padding-inline-end: 8px;
  user-select: none;
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
}


