/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

:host {
  --input-text-min-height: var(--button-min-height);
  --input-text-border-color: var(--border-color-interactive);
  --input-text-border-color-disabled: var(--border-color-interactive-disabled);
  --input-text-border: var(--border-width) solid var(--input-text-border-color);
  --input-text-border-radius: var(--border-radius-medium);
  --input-text-background-color: Field;
  --input-text-color: FieldText;
  --input-text-background-color-disabled: var(--button-background-color-disabled);
  --input-text-opacity-disabled: var(--button-opacity-disabled);
  --input-text-icon-size: var(--icon-size-xsmall);
}

#input {
  width: 100%;
  max-width: var(--input-text-max-width);
  min-height: var(--input-text-min-height);
  padding-inline: var(--space-medium);
  border: var(--input-text-border);
  border-radius: var(--input-text-border-radius);
  box-sizing: border-box;
  background-color: var(--input-text-background-color);
  color: var(--input-text-color);

  @media (-moz-platform: macos) {
    /* TODO(emilio, bug 1815264): The default macOS system font size is too
     * small. Ensure some sane minimum. */
    font-size: max(1em, 12px);
  }

  &:disabled {
    border-color: var(--input-text-border-color-disabled);
    background-color: var(--input-text-background-color-disabled);
    opacity: var(--input-text-opacity-disabled);
  }

  &.with-icon {
    padding-inline-start: calc(2 * var(--space-medium) + var(--input-text-icon-size));
    background-repeat: no-repeat;
    background-size: var(--input-text-icon-size);
    background-position: var(--space-medium) center;
    background-image: var(--input-background-icon);
    -moz-context-properties: fill;
    fill: var(--icon-color);

    &:dir(rtl) {
      background-position: center right var(--space-medium);
    }
  }

  &[type="search"] {
    --input-background-icon: url(chrome://global/skin/icons/search-textbox.svg);
    padding-inline-end: var(--space-xxsmall);
  }

  &::placeholder {
    text-overflow: ellipsis;
  }
}
