.btn {
  font-size: .85rem;
  height: 100%;
  padding: .7rem;
  cursor: pointer;

  span {
    margin-left: .5rem;
  }

  &__danger {
    background: var(--kbin-button-danger-bg);;
    border: var(--kbin-button-danger-border);
    color: var(--kbin-button-danger-text-color) !important;
    font-weight: bold;

    &:hover,
    &:focus-visible {
      background: var(--kbin-button-danger-hover-bg);
      color: var(--kbin-button-danger-text-hover-color) !important;
    }

    a, a:hover {
      color: var(--kbin-button-danger-text-hover-color) !important;
    }

  }

  &__primary {
    background: var(--kbin-button-primary-bg);;
    border: var(--kbin-button-primary-border);
    color: var(--kbin-button-primary-text-color) !important;
    font-weight: bold;

    &:hover,
    &:focus-visible {
      background: var(--kbin-button-primary-hover-bg);
      color: var(--kbin-button-primary-text-hover-color) !important;
    }

    a, a:hover {
      color: var(--kbin-button-primary-text-hover-color) !important;
    }
  }

  &__secondary {
    background: var(--kbin-button-secondary-bg);
    border: var(--kbin-button-secondary-border);
    color: var(--kbin-button-secondary-text-color) !important;

    &:hover,
    &:focus-visible {
      background: var(--kbin-button-secondary-hover-bg);
      color: var(--kbin-button-secondary-text-hover-color) !important;
    }
  }

  &__secondry {
    background: var(--kbin-button-secondary-bg);
    border: var(--kbin-button-secondary-border);
    color: var(--kbin-button-secondary-text-color) !important;

    &:hover,
    &:focus-visible {
      background: var(--kbin-button-secondary-hover-bg);
      color: var(--kbin-button-secondary-text-hover-color) !important;
    }
  }
}

select {
  -webkit-appearance: menulist-button;
}

input,
textarea {
  background: var(--kbin-input-bg);
  border: var(--kbin-input-border);
  color: var(--kbin-input-text-color);
  font-family: var(--kbin-body-font-family);
  font-size: .9rem;

  &::placeholder {
    color: var(--kbin-input-placeholder-text-color) !important;
  }
}

input,
textarea,
select,
button {

  &[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

textarea {
  box-sizing: border-box;
  height: 5rem;
  padding: 1rem .5rem;
  resize: vertical;
  width: 100%;
}

input[type=radio] {
  border-radius: 50%;
}

input[type=checkbox],
input[type=radio] {
  -webkit-appearance: none;
  appearance: none;
  font-size: 0.9rem;
  display: grid;
  margin: 0px;
  width: 1.5rem;
  height: 1.5rem;
  justify-content: center;
  align-items: center;
  align-content: center;
  cursor: pointer;

  &::before {
    font-family: var(--kbin-font-awesome-font-family);
    content: "\f00c";
    transform: scale(0);
    transition: 100ms transform ease-in;
  }

  &:checked::before {
    transform: scale(1);
  }

  &[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
  }

}

label {
  display: block;
}

input[type=text],
input[type=email],
input[type=password],
input[type=select-one] {
  display: block;
  padding: 1rem .5rem;
  width: 100%;
}

.password-preview {
  display: grid;
  grid-template-areas:
      "label label"
      "password preview";
  justify-items: start;
  align-items: end;
  grid-template-columns: 2fr 0fr;

  label {
    grid-area: label;
  }

  input[type=password],
  input[type=text] {
    grid-area: password;
    width: 100%;

    .rounded-edges & {
      border-top-right-radius: 0px !important;
      border-bottom-right-radius: 0px !important;
    }
  }

  .password-preview-button {
    display: flex;
    justify-content: center;
    align-items: center;
    grid-area: preview;
    width: 40px;
    cursor: pointer;
    height: 100%;
    margin: 0;

    .rounded-edges & {
      border-top-left-radius: 0px !important;
      border-bottom-left-radius: 0px !important;
    }
  }
}


form {
  div {
    margin-bottom: 1rem;

    ul {
      color: var(--kbin-danger-color);
      font-weight: bold;
      list-style: none;
      margin: 1rem 0;
      padding: 0;
    }

    ul li {
      padding: 0;
    }
  }

  .help-text {
    font-size: 0.8rem;
  }

  .length-indicator {
    font-size: 0.8rem;
  }
}

.checkbox {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;

  input[type=checkbox] {
    margin-right: .5rem;
  }
}

.ts-wrapper {
  div {
    margin-bottom: 0;
  }

  &.single .ts-control {
    background: var(--kbin-meta-bg);
    box-shadow: none;
  }

  .clear-button {
    color: var(--kbin-meta-text-color);
    font-size: 1.5rem;
  }

  .ts-control {
    background: var(--kbin-input-bg) !important;
    border: var(--kbin-input-border) !important;
    border-radius: 0;
    box-shadow: none !important;
    color: var(--kbin-input-text-color);
    display: flex;
    flex-flow: row wrap;
    gap: .5rem;
    padding: 1rem .5rem;
    width: 100%;
    line-height: normal;

    input {
      color: var(--kbin-input-text-color);
      width: auto;
      min-width: 8rem;
    }

    & > * {
      font-size: .85rem;
    }
  }

  &.multi {
    .ts-control {
      > [data-value].item,
      > [data-value].active {
        background-image: none;
        background: var(--kbin-button-primary-bg);
        color: var(--kbin-button-primary-text-color);
        border: var(--kbin-button-primary-border);
        border-radius: 0;
        text-shadow: none;
        box-shadow: none;
        padding: 0 .5rem;
        height: 2rem;
        max-width: fit-content;
        margin: 0;
        overflow: clip;
      }
    }

    &.plugin-remove_button:not(.rtl) .item > .remove {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      border-left: var(--kbin-button-primary-border);
      margin-left: .5rem;
      padding: 0 .5rem 0 .4375rem;
      height: 100%;

      &:hover {
        background-color: var(--kbin-button-primary-hover-bg);
        color: var(--kbin-button-primary-text-hover-color);
      }
    }
  }


  &.single.input-active .ts-control input {
    color: var(--kbin-meta-text-color)
    //display: none !important;
  }

  &.single .ts-control, .ts-dropdown.single {
    border: var(--kbin-input-border);
  }

  .ts-dropdown {
    font-size: .85rem;
    line-height: normal;
    margin: -1px 0 0;
    border: var(--kbin-input-border);
    border-top: 0;
    background: var(--kbin-input-bg);
    color: var(--kbin-meta-text-color);
    box-shadow: var(--kbin-shadow);
    overflow: clip;

    .active {
      color: var(--kbin-meta-text-color);
    }

    &.single .active {
      background: var(--kbin-options-bg);
    }

    &.multi .active {
      background-color: var(--kbin-input-bg);
    }
  }

  &.multi.has-items .ts-control {
    padding: .5rem;
  }
}

.actions ul {
  margin: 0;

  > img {
    height: max-content;
    order: -2;
    flex: calc(100% - 2.5rem);
    width: 100%;
    max-height: 15rem;
    margin-bottom: .75rem;
    object-fit: contain;
    background-color: hsla(0, 0%, 0%, 0.75);

    .rounded-edges & {
      border-radius: var(--kbin-rounded-edges-radius);
    }

    + .btn-link {
      order: -1;
      width: 2rem;
      height: 2rem;
      margin-left: -2.25rem;
      color: var(--kbin-button-secondary-text-color);
      background: var(--kbin-button-secondary-bg);
      border: var(--kbin-button-secondary-border);

      &:hover {
        color: var(--kbin-button-secondary-text-hover-color);
        background: var(--kbin-button-secondary-hover-bg);
      }
    }
  }
}

.actions,
.actions ul,
.params {
  display: flex;
  gap: .25rem;
  justify-content: flex-end;
  align-items: center;

  .btn-link i {
    position: relative;
  }

  div {
    margin-bottom: 0;
  }

  div button {
    height: 100%;
    white-space: nowrap;
  }

  .ts-control {
    padding: .5rem;
  }

  .ts-wrapper {
    &.single .ts-control, .ts-dropdown.single {
      background: var(--kbin-input-bg) !important;
      border: var(--kbin-meta-border) !important;
      box-shadow: none;
    }
  }
}

.row.actions ul {
  flex-flow: row wrap;
  width: 100%;
}

select {
  background: var(--kbin-button-secondary-bg);
  border: var(--kbin-button-secondary-border);
  color: var(--kbin-button-secondary-text-color) !important;
  padding: 0.65rem;
  border-radius: 0;
  cursor: pointer;
  font-size: .85rem;
}

.actions {
  @include media-breakpoint-down(sm) {
    text-align: right;

    > * {
      margin-bottom: .5rem !important;
    }
  }
}

.params {
  color: var(--kbin-meta-text-color);
  font-size: .813rem;
  gap: 1rem;
  margin-bottom: .5rem !important;
  overflow: visible;

  > div {
    align-items: center;
    display: flex;
    flex-direction: row-reverse;
  }

  &__left {
    margin-bottom: 1rem;
  }
}

.radios {
  > div {
    display: flex;
    flex-wrap: wrap;

    label {
      margin-right: 1rem;
    }
  }
}

.actions select {
  max-width: 6.4rem;
}

markdown-toolbar {

  > * {
    @include cursor-pointer;
    @include simple-transition;

    &:focus,
    &:hover {
      color: var(--kbin-section-link-hover-color);
    }
  }

}