/* 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
 * #import=//resources/cr_components/composebox/composebox_shared_style.css.js
 * #import=./searchbox_shared_style.css.js
 * #scheme=relative
 * #include=cr-icons-lit composebox-shared-style searchbox-shared-style
 * #css_wrapper_metadata_end */

:host {
  -webkit-app-region: drag;
  position: relative;
  /* Preserves 2px border width parity with omnibox-everywhere-omnibox to
   * prevent layout shift when toggling between searchbox and composebox,
   * and matches the -2px search-animated-glow inset. */
  border: 2px solid transparent;
  border-radius: 28px;
  box-sizing: border-box;
  --composebox-cancel-button-top: var(--cr-composebox-cancel-button-top, 10px);
  --cr-composebox-background-color: var(--color-searchbox-background);
  --input-bottom-spacing: 10px;
  --text-input-top-spacing: 10px;
  --text-input-inline-end-spacing: 80px;
  --text-input-inline-start-spacing: 16px;
  --cr-searchbox-match-padding-inline-start: 16px;
  --text-input-max-height: 190px;
  --color-composebox-type-ahead: var(
      --color-searchbox-placeholder,
      var(--color-omnibox-foreground-disabled, #5f6368));
  --color-composebox-type-ahead-chip: var(
      --color-omnibox-composebox-chip-background,
      rgba(26, 115, 232, 0.1));
  --color-composebox-font-light: var(
      --color-searchbox-foreground,
      var(--color-omnibox-text, #1f1f1f));
  --color-composebox-font: var(--color-composebox-font-light);
  --color-composebox-input-icon: var(--color-composebox-type-ahead);
  --color-searchbox-results-foreground: var(--color-composebox-font-light);
  --color-searchbox-results-icon: var(--color-composebox-input-icon);
  --color-composebox-submit-button-background: var(
      --color-omnibox-composebox-submit-button-background,
      #1a73e8);
}

#composebox {
  /* Transparent so search-animated-glow behind it (z-index: 1) can render
   * the background and energy glow effect via composebox-background. */
  background-color: transparent;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  height: calc-size(auto, size);
  max-height: var(--cr-composebox-max-height, 422px);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  transition:
    opacity var(--fade-duration) ease-in-out,
    visibility var(--fade-duration) ease-in-out;
  padding-bottom: 10px;
  z-index: 2;
}

:host([is-collapsible][expanding_]:not([show-dropdown])) #composebox {
  min-height: unset;
}

:host([is-dragging-file]) #composebox * {
  pointer-events: none;
}

#inputContainer {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  overflow: hidden;
  width: 100%;
}

#carouselContainer {
  align-items: flex-end;
  display: flex;
  flex-direction: row;
}

#contextEntrypoint {
  position: relative;
  z-index: var(--cr-composebox-context-menu-z-index, 1001);
}

#contextEntrypoint::part(entrypoint-button) {
  --cr-icon-button-size: 36px;
}

cr-composebox-tool-chip {
  padding-inline-start: 8px;
}

search-animated-glow {
  border-radius: inherit;
  inset: -2px;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

#shadow-container {
  position: absolute;
  inset: 0;
  box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.25);
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}

/* Needed because composebox_submit.css sets opacity: 0.4 on #submitIcon
 * when disabled. For loomnibox, we want the submit icon to remain at
 * full opacity even when the input is empty. */
cr-composebox-submit::part(submit-icon),
cr-composebox-input::part(cancel) {
  opacity: 1;
}

/* Override default absolute positioning from composebox_submit.css so the
 * submit button flows normally in #actionButtons next to voice/lens. */
cr-composebox-submit::part(submit) {
  position: relative;
  inset-inline-end: unset;
  bottom: unset;
  opacity: 1;
}

#bottomControls {
  min-height: 48px;
  position: relative;
}

#bottomControls #contextEntrypoint {
  padding-inline-start: 0;
}

#actionButtons {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* TODO(crbug.com/532200145): Refine the selectors. New interactive elements
 * must be added to this list because the root container has
 * '-webkit-app-region: drag' enabled; otherwise, clicks will be swallowed by
 * the window drag handler. */
cr-composebox-input::part(input),
cr-composebox-input::part(cancel),
cr-composebox-input::part(cancel-icon),
cr-composebox-input::part(action-icon),
cr-composebox-submit::part(submit),
cr-composebox-submit::part(submit-icon),
#context,
#contextEntrypoint,
cr-composebox-contextual-entrypoint-and-menu,
cr-composebox-contextual-entrypoint-button,
cr-composebox-tool-chip,
.searchbox-icon-button,
#voiceSearchButton,
#lensSearchButton,
#screenshotMenu {
  -webkit-app-region: no-drag;
}

cr-composebox-input::part(icon-container) {
  -webkit-app-region: drag;
  -webkit-user-drag: none;
}
