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

.list {
  flex: auto 0 1;
  overflow-y: auto;
  flex-direction: column;

  --override-background-list-item-color: hsl(0deg 0% 96%);

  &:has(div) {
    border: var(--sys-size-1) solid var(--sys-color-divider);
  }
}

.theme-with-dark-background .list,
:host-context(.theme-with-dark-background) .list {
  --override-background-list-item-color: hsl(0deg 0% 16%);
}

.list-separator {
  background: var(--sys-color-divider);
  height: 1px;
}

.list-item {
  flex: none;
  min-height: 30px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.list-item:focus-within:not(:active) {
  background: var(--sys-color-state-hover-on-subtle);
}

.list-widget-input-validation-error {
  color: var(--sys-color-error);
  margin: 0 5px;
}

.controls-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: none;
}

.controls-gradient {
  flex: 0 1 50px;

  .list-item:hover & {
    background-image: linear-gradient(90deg, transparent, var(--sys-color-cdt-base-container));
  }

  .list-item:focus-within:not(:active) & {
    background-image: linear-gradient(90deg, transparent, var(--override-background-list-item-color));
  }
}

.controls-buttons {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  pointer-events: auto;
  visibility: hidden;
  background-color: var(--sys-color-cdt-base-container);

  .list-item:hover & {
    visibility: visible;
  }

  .list-item:focus-within:not(:active) & {
    background-color: var(--override-background-list-item-color);
    visibility: visible;
  }
}

.editor-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: none;
  background: var(--sys-color-surface3);
  overflow: hidden;
}

.editor-content {
  flex: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.editor-buttons {
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding: 5px;
  gap: var(--sys-size-6);
}

.editor-buttons > button {
  flex: none;
  margin-right: 10px;
}

.editor-content input {
  margin-right: 10px;
}

.editor-content input.error-input {
  background-color: var(--sys-color-cdt-base-container);
}

.text-prompt-container {
  padding: 3px 6px;
  height: 24px;
  border: none;
  box-shadow: var(--legacy-focus-ring-inactive-shadow);
  border-radius: 2px;
  width: 100%;
  background-color: var(--sys-color-cdt-base-container);

  &:focus {
    border: 1px solid var(--sys-color-state-focus-ring);
  }

  & .text-prompt {
    width: 100%;
  }
}

@media (forced-colors: active) {
  .list-item:focus-within .controls-buttons,
  .list-item:hover .controls-buttons {
    background-color: canvas;
  }

  .list-item:focus-within,
  .list-item:hover {
    forced-color-adjust: none;
    background: Highlight;
  }

  .list-item:focus-within *,
  .list-item:hover * {
    color: HighlightText;
  }

  .list-item:focus-within .controls-gradient,
  .list-item:hover .controls-gradient {
    background-image: unset;
  }
}
