/* mixins & extensions */

@keyframes in {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes in-down {
  0% {
    opacity: 0;
    transform: translate3D(0, -5px, 0);
  }

  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}

@keyframes in-up {
  0% {
    opacity: 0;
    transform: translate3D(0, 5px, 0);
  }

  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}

@keyframes in-scale {
  0% {
    opacity: 0;
    transform: scale3D(0.95, 0.95, 1);
  }

  100% {
    opacity: 1;
    transform: scale3D(1, 1, 1);
  }
}

/**
* Currently only used in Checkbox.
*/

:root {
  --calcite-popper-transition: 150ms ease-in-out;
}

:host([hidden]) {
  display: none;
}

:host([scale=s]) textarea, :host([scale=s]) input, :host([scale=s]) .calcite-input-prefix, :host([scale=s]) .calcite-input-suffix {
  font-size: var(--calcite-font-size--2);
  padding: 0.5rem;
  height: 2rem;
}

:host([scale=s]) textarea {
  min-height: 32px;
}

:host([scale=s]) .calcite-input-number-button-wrapper, :host([scale=s]) .calcite-action-wrapper calcite-button, :host([scale=s]) .calcite-action-wrapper calcite-button button {
  height: 2rem;
}

:host([scale=s]) textarea, :host([scale=s]) input[type=file] {
  height: auto;
}

:host([scale=s]) .calcite-input-clear-button {
  min-height: 32px;
  min-width: 32px;
}

:host([scale=m]) textarea, :host([scale=m]) input, :host([scale=m]) .calcite-input-prefix, :host([scale=m]) .calcite-input-suffix {
  font-size: var(--calcite-font-size--1);
  padding: 0.75rem;
  height: 44px;
}

:host([scale=m]) textarea {
  min-height: 44px;
}

:host([scale=m]) .calcite-input-number-button-wrapper, :host([scale=m]) .calcite-action-wrapper calcite-button, :host([scale=m]) .calcite-action-wrapper calcite-button button {
  height: 44px;
}

:host([scale=m]) textarea, :host([scale=m]) input[type=file] {
  height: auto;
}

:host([scale=m]) .calcite-input-clear-button {
  min-height: 44px;
  min-width: 44px;
}

:host([scale=l]) textarea, :host([scale=l]) input, :host([scale=l]) .calcite-input-prefix, :host([scale=l]) .calcite-input-suffix {
  font-size: var(--calcite-font-size-1);
  padding: 1rem;
  height: 56px;
}

:host([scale=l]) textarea {
  min-height: 56px;
}

:host([scale=l]) .calcite-input-number-button-wrapper, :host([scale=l]) .calcite-action-wrapper calcite-button, :host([scale=l]) .calcite-action-wrapper calcite-button button {
  height: 56px;
}

:host([scale=l]) textarea, :host([scale=l]) input[type=file] {
  height: auto;
}

:host([scale=l]) .calcite-input-clear-button {
  min-height: 56px;
  min-width: 56px;
}

:host([disabled]) {
  pointer-events: none;
}

:host([disabled]) .calcite-input-wrapper {
  opacity: var(--calcite-ui-opacity-disabled);
  pointer-events: none;
}

:host([disabled]) textarea, :host([disabled]) input {
  pointer-events: none;
}

:host textarea,
:host input {
  display: flex;
  position: relative;
  min-width: 20%;
  max-width: 100%;
  max-height: 100%;
  flex: 1;
  box-sizing: border-box;
  -webkit-appearance: none;
  font-family: inherit;
  transition: 150ms ease-in-out, height 0s;
  box-shadow: 0 0 0 0 transparent;
  outline: 0;
  margin: 0;
  background-color: var(--calcite-ui-foreground-1);
  color: var(--calcite-ui-text-1);
  font-weight: 400;
  border-radius: 0;
  -webkit-border-radius: 0;
}

:host input[type=search]::-webkit-search-decoration {
  -webkit-appearance: none;
}

:host textarea,
:host input {
  outline-offset: 0;
  outline-color: transparent;
  transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
}

:host textarea:focus,
:host input:focus {
  outline: 2px solid var(--calcite-ui-brand);
  outline-offset: -2px;
}

:host input, :host textarea {
  color: var(--calcite-ui-text-1);
  border: 1px solid var(--calcite-ui-border-1);
}

:host input:-ms-input-placeholder, :host textarea:-ms-input-placeholder {
  color: var(--calcite-ui-text-3);
  font-weight: 400;
}

:host input::placeholder, :host input:-ms-input-placeholder, :host input::-ms-input-placeholder, :host textarea::placeholder, :host textarea:-ms-input-placeholder, :host textarea::-ms-input-placeholder {
  color: var(--calcite-ui-text-3);
  font-weight: 400;
}

:host input:focus, :host textarea:focus {
  border-color: var(--calcite-ui-brand);
  color: var(--calcite-ui-text-1);
}

:host input[readonly], :host textarea[readonly] {
  background-color: var(--calcite-ui-background);
}

:host input[readonly]:focus, :host textarea[readonly]:focus {
  color: var(--calcite-ui-text-1);
}

:host calcite-icon {
  color: var(--calcite-ui-text-1);
}

:host slot:not[name=input-message] {
  display: block;
  margin-bottom: 0.375rem;
  color: var(--calcite-ui-text-2);
  font-weight: 500;
}

:host([icon]) input {
  padding-left: 2.25rem;
}

:host([icon]) .calcite--rtl input {
  padding-right: 2.25rem;
  padding-left: 0.75rem;
}

:host([icon][scale=l]) .calcite--rtl input {
  padding-right: 3rem;
  padding-left: 0.75rem;
}

:host([icon][scale=l]) input {
  padding-left: 3rem;
}

.calcite-input-element-wrapper {
  display: inline-flex;
  flex: 1;
  min-width: 20%;
  position: relative;
  order: 3;
}

.calcite-input-icon {
  display: block;
  position: absolute;
  pointer-events: none;
  transition: 150ms ease-in-out;
  top: calc(50% - 9px);
  left: 0.75rem;
  margin: 1px auto 0;
  z-index: 1;
}

:host([scale=l]) .calcite-input-icon {
  top: calc(50% - 12px);
}

.calcite--rtl .calcite-input-icon {
  left: unset;
  right: 0.75rem;
}

input[type=text]::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}

input[type=text]::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-results-button,
input[type=search]::-webkit-search-results-decoration,
input[type=date]::-webkit-clear-button,
input[type=time]::-webkit-clear-button {
  display: none;
}

.calcite-input-clear-button {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  cursor: pointer;
  min-height: 100%;
  border: 1px solid var(--calcite-ui-border-1);
  transition: 150ms ease-in-out;
  pointer-events: initial;
  background-color: var(--calcite-ui-foreground-1);
  border-left: none;
  order: 4;
}

.calcite-input-clear-button:hover, .calcite-input-clear-button:focus {
  background-color: var(--calcite-ui-foreground-2);
}

.calcite-input-clear-button:active {
  background-color: var(--calcite-ui-foreground-3);
}

.calcite-input-clear-button:disabled {
  opacity: var(--calcite-ui-opacity-disabled);
}

.calcite--rtl .calcite-input-clear-button {
  border-left: 1px solid var(--calcite-ui-border-1);
  border-right: none;
}

.calcite-input-clear-button {
  outline-offset: 0;
  outline-color: transparent;
  transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;
}

.calcite-input-clear-button:focus {
  outline: 2px solid var(--calcite-ui-brand);
  outline-offset: -2px;
}

.calcite-input-loading {
  display: block;
  pointer-events: none;
  position: absolute;
  top: 1px;
  left: 1px;
  right: 1px;
}

.calcite-action-wrapper {
  display: flex;
  order: 7;
}

.calcite-input-prefix,
.calcite-input-suffix {
  display: flex;
  align-items: center;
  align-content: center;
  height: auto;
  min-height: 100%;
  word-break: break-word;
  -webkit-user-select: none;
      -ms-user-select: none;
          user-select: none;
  box-sizing: border-box;
  font-weight: 500;
  border: 1px solid var(--calcite-ui-border-1);
  background-color: var(--calcite-ui-background);
  color: var(--calcite-ui-text-2);
  line-height: 1;
}

.calcite-input-prefix {
  order: 2;
  border-right-width: 0px;
}

.calcite-input-suffix {
  order: 5;
  border-left-width: 0px;
}

.calcite--rtl .calcite-input-prefix {
  border-right-width: 1px;
  border-left-width: 0px;
}

.calcite--rtl .calcite-input-suffix {
  border-left-width: 1px;
  border-right-width: 0px;
}

:host([readonly]) .calcite-input-number-button-item {
  pointer-events: none;
}

:host([alignment=start]) textarea, :host([alignment=start]) input {
  text-align: left;
}

:host([alignment=end]) textarea, :host([alignment=end]) input {
  text-align: right;
}

:host([alignment=start]) .calcite--rtl textarea, :host([alignment=start]) .calcite--rtl input {
  text-align: right;
}

:host([alignment=end]) .calcite--rtl textarea, :host([alignment=end]) .calcite--rtl input {
  text-align: left;
}

:host input[type=number] {
  -moz-appearance: textfield;
}

:host input[type=number]::-webkit-inner-spin-button, :host input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  margin: 0;
}

.calcite-input-number-button-wrapper {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transition: 150ms ease-in-out;
  pointer-events: none;
  order: 6;
}

:host([number-button-type=vertical]) .calcite-input-wrapper {
  flex-direction: row;
  display: flex;
}

:host([number-button-type=vertical]) input,
:host([number-button-type=vertical]) textarea {
  order: 2;
}

:host([number-button-type=horizontal]) .calcite--rtl .calcite-input-number-button-item[data-adjustment=down] calcite-icon {
  transform: rotate(-90deg);
}

:host([number-button-type=horizontal]) .calcite--rtl .calcite-input-number-button-item[data-adjustment=up] calcite-icon {
  transform: rotate(-90deg);
}

.calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=down], .calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=up] {
  min-height: 100%;
  max-height: 100%;
  order: 1;
  align-self: auto;
}

.calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=down] calcite-icon, .calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=up] calcite-icon {
  transform: rotate(90deg);
}

.calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=down] {
  border-left: 1px solid var(--calcite-ui-border-1);
  border-right: 0px;
}

.calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=up] {
  order: 5;
}

.calcite--rtl .calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=down] {
  border-right: 1px solid var(--calcite-ui-border-1);
  border-left: 0px;
}

.calcite--rtl .calcite-input-number-button-item.number-button-item-horizontal[data-adjustment=up] {
  border-left: 1px solid var(--calcite-ui-border-1);
  border-right: 0px;
}

:host([number-button-type=vertical]) .calcite-input-number-button-item[data-adjustment=down] {
  border-top: 0;
}

.calcite-input-number-button-item {
  display: flex;
  align-self: center;
  align-items: center;
  box-sizing: border-box;
  cursor: pointer;
  max-height: 50%;
  min-height: 50%;
  padding: 0 0.75rem;
  border: 1px solid var(--calcite-ui-border-1);
  transition: background-color 0.15s ease-in-out;
  pointer-events: initial;
  background-color: var(--calcite-ui-foreground-1);
  border-left: none;
}

.calcite-input-number-button-item calcite-icon {
  pointer-events: none;
}

.calcite-input-number-button-item:hover, .calcite-input-number-button-item:focus {
  background-color: var(--calcite-ui-foreground-2);
}

.calcite-input-number-button-item:active {
  background-color: var(--calcite-ui-foreground-3);
}

:host([number-button-type=vertical]) .calcite--rtl .calcite-input-number-button-item {
  border-right: none;
  border-left: 1px solid var(--calcite-ui-border-1);
}

.calcite-input-wrapper {
  display: flex;
  flex-direction: row;
  position: relative;
}

:host input::-webkit-calendar-picker-indicator {
  display: none;
}

:host input[type=date]::-webkit-input-placeholder {
  visibility: hidden !important;
}

:host textarea::-webkit-resizer {
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 0 0.375rem;
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .calcite-input-resize-icon-wrapper {
    display: none;
  }
}

.calcite-input-resize-icon-wrapper {
  background-color: var(--calcite-ui-foreground-1);
  color: var(--calcite-ui-text-3);
  position: absolute;
  z-index: 1;
  bottom: 2px;
  right: 2px;
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.calcite-input-resize-icon-wrapper calcite-icon {
  bottom: 4px;
  right: 4px;
  transform: rotate(-45deg);
}

.calcite--rtl textarea::-webkit-resizer {
  left: 0;
  right: unset;
}

.calcite--rtl .calcite-input-resize-icon-wrapper {
  left: 2px;
  right: unset;
}

.calcite--rtl .calcite-input-resize-icon-wrapper calcite-icon {
  bottom: 4px;
  right: 4px;
  transform: rotate(45deg);
}

:host([type=file]) input,
:host([type=file]) textarea {
  cursor: pointer;
  padding: 1.5rem;
  border: 1px dashed #d4d4d4;
  background-color: #f8f8f8;
  text-align: center;
}

:host(.no-bottom-border) input.sc-calcite-input {
  border-bottom: none;
}

:host([status=invalid]) .calcite-input-icon {
  color: var(--calcite-ui-danger);
}

:host([status=valid]) .calcite-input-icon {
  color: var(--calcite-ui-success);
}

:host([status=idle]) .calcite-input-icon {
  color: var(--calcite-ui-text-2);
}