// Select Input
input[type="text"],
input[type="password"],
input[type="number"],
input[type="checkbox"],
input[type="radio"],
input[type="date"],
select,
textarea {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  align-items: center;
  border: 0.5px solid $grey40;
  border-radius: 8px;
  box-shadow: none;
  display: inline-flex;
  font-size: 1rem;
  justify-content: flex-start;
  line-height: 1.5;
  vertical-align: top;

  &:focus {
    outline: none;
    box-shadow: 0px 0px 0px 1.5px $blue90;
    border-color: transparent;
  }
}
select,
input[type="text"],
input[type="password"],
input[type="number"] {
  padding-bottom: calc(0.5em - 1px);
  padding-left: calc(0.75em - 1px);
  padding-right: calc(0.75em - 1px);
  padding-top: calc(0.5em - 1px);
}
select {
  min-width: 15ch;
  color: $grey100;
  padding-right: 2rem;
  padding-left: 0.5em;
  max-width: 100%;
  cursor: pointer;
  transition: all 0.2s ease-in;
  &:disabled {
    color: $grey60;
  }

  &:not([multiple]) {
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &.inline:not([multiple]) {
    border-radius: 0;
    border: none;

    &:hover {
      background-color: #F8F8F8;
      color: $grey100;
    }

    &:active {
      background-color: #F8F8F8;
      color: $text-active;
    }
  }

  &::-ms-expand {
    display: none;
  }
}

.select {
  position: relative;
  min-width: 15ch;
  display: grid;
  grid-template-areas: "select";
  cursor: pointer;
  align-items: center;
  background-image: linear-gradient(to top, #f9f9f9, #fff 33%);

  &:not(.select--multiple)::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: $blue90;
    justify-self: end;
    margin-right: 1rem;
  }

  /*  &.is-danger:not(.select--multiple)::after{
    color: #D43A25;
  } */
  &.is-danger:not(.select--multiple)::before {
    content: "\f06a";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: #D43A25;
    justify-self: end;
    margin-right: 2.5rem;
    z-index: 1;
  }

  &.select--multiple {
    padding: 0.5rem;
  }

  &.is-danger select {
    //box-shadow: 0px 0px 0px 1.5px #D43A25;
    //border-color: transparent;
    padding-right: 3.5rem;
  }

  /*   &.is-warning:not(.select--multiple)::after{
    color: $yellow50;
  } */
  &.is-warning:not(.select--multiple)::before {
    content: "\f071";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: $yellow50;
    justify-self: end;
    margin-right: 2.5rem;
    z-index: 1;
  }

  &.is-warning select {
    //box-shadow: 0px 0px 0px 1.5px $yellow50;
    //border-color: transparent;
    padding-right: 4rem;
  }
}

select,
.select:after,
.select:before {
  grid-area: select !important;
}



.select select[multiple] {
  height: auto;
  padding: 0;
}

.select select[multiple] option {
  padding: 1.5em;
}

input[type="text"], input[type="password"],
input[type="number"] {
  padding-right: 2rem;
  &:active {
    box-shadow: 0px 0px 0px 1.5px $blue90;
    border-color: transparent;
    color: $text-active;
  }

  &:disabled {
    border-color: $grey60;
    box-shadow: none;
  }

}

.input-control{
  display: grid;
  grid-template-areas: "inputControl";
  min-width: 15ch;
  align-items: center;
  position: relative;
  &.--textfield {
    &::after {
      content: "";
    }

    &.is-danger:not(.textarea)::before {
      content: "\f06a";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      color: #D43A25;
      justify-self: end;
      margin-right: 1rem;
      z-index: 1;
    }

    &.is-danger input {
      box-shadow: 0px 0px 0px 1.5px #D43A25;
      border-color: transparent;
      padding-right: 3.5rem;
    }

    &.is-danger .icon {
      margin-right: 2.5rem;
    }

    &.is-warning:not(.textarea)::before {
      content: "\f071";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      color: $yellow50;
      justify-self: end;
      margin-right: 1rem;
      z-index: 1;
    }

    &.is-warning .icon {
      margin-right: 2.5rem;
    }

    &.is-warning input {
      box-shadow: 0px 0px 0px 1.5px $yellow50;
      border-color: transparent;
      padding-right: 3.5rem;
    }
  }

    // Textarea
    &.--textarea.is-danger textarea {
      box-shadow: 0px 0px 0px 1.5px #D43A25;
      border-color: transparent;
      padding-top: 1rem;
      padding-right: 1.5rem;
    }

    &.--textarea.is-danger::before {
      content: "\f06a";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      color: #D43A25;
      justify-self: end;
      margin-right: 1rem;
      position: absolute;
      top: 10%;
      z-index: 1;
    }

    &.--textarea.is-danger .icon {
      margin-right: 2.5rem;
    }

    &.--textarea.is-warning textarea {
      box-shadow: 0px 0px 0px 1.5px $yellow50;
      border-color: transparent;
      padding-top: 1rem;
      padding-right: 1.5rem;
    }

    &.--textarea.is-warning::before {
      content: "\f071";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      color: $yellow50;
      justify-self: end;
      margin-right: 1rem;
      position: absolute;
      top: 10%;
      margin-right: 1rem;
    }

    &.--textarea.is-warning .icon {
      margin-right: 2.5rem;
    }
  &.--textarea .icon {
    position: absolute;
    top: 10%;
    margin-right: 1rem;
  }
  & .icon {
    justify-self: end;
    color: $blue90;
    margin-right: 1rem;
  }
}

input[type="text"],input[type="password"],
input[type="number"],
.input-control:after,
.input-control::before,
.icon {
  grid-area: inputControl;
}

.textarea-length {
  justify-self: end;
  font-size: x-small;
  align-self: end;
  position: absolute;
  padding: 0.5em;
  top: -20px;
  right: 5%
}

.form-label {
  font-weight: 400;
  letter-spacing: 0.25px;
  color: $grey100;
  margin-left: 8px;
}

.notes {
  color: $grey70;
  font-weight: 400;
  letter-spacing: 0.25px;
  padding: 0.5em;
  font-size: smaller;
}

.disabled {
  color: lighten($color: $grey70, $amount: 40) !important;
}



// Toggle

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  margin-left: 8px;
  height: 24px;
  & input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  & .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 17.8785px;
    background-color: $grey70;
    ;
    -webkit-transition: .4s;
    transition: .4s;

    &::before {
      position: absolute;
      content: "";
      height: 18px;
      width: 18px;
      left: 10%;
      bottom: 13%;
      border-radius: 50%;
      background-color: white;
      -webkit-transition: .4s;
      transition: .4s;
    }
  }

  & input:checked+.slider {
    background-color: #006ABA;
  }

  & input:checked+.slider:before {
    box-shadow: 0 0 1px #2196F3;
  }

  & input:checked+.slider:before {
    -webkit-transform: translateX(120%);
    -ms-transform: translateX(120%);
    transform: translateX(120%);
  }

  & input:disabled+.slider {
    background-color: lighten($color: $grey70, $amount: 40);
  }

  & input:disabled+.slider::before {
    box-shadow: 0 0 1px lighten($color: $grey70, $amount: 40);
  }
}

// Checkbox

input[type="checkbox"]{
  background-color: #fff;
  margin: 0;
  font: inherit;
  color: currentColor;
  width: 1.25em;
  height: 1.25em;
  background-color: $blue10;
  border: 1.5px solid $blue90;
  border-radius: 4px;
  transition: all .4s ease-in;
  transform: translateY(-0.075em);
  min-width: 20px;
  &.large{
    width: 32px;
    height: 32px;
  }
  &:hover {
    border: 1.5px solid $blue100;
    background-color: $blue20;
  }
  &:focus{
    box-shadow: 0px 0px 0px .5px $blue90;
  }
  &.is-white{
    background-color: white;
    &:hover{
      background-color: $grey10;
    }
  }

}


.input-control.--checkbox, .--radio {
  width: fit-content;
  min-height: 40px;
  min-width: 40px;
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  & input[type="checkbox"]:not(.large):checked::after, input[type="radio"]:not(.large):checked::after{
    content: "\f00c";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: $blue90;
    justify-self: center;
    margin-left: 10%;
    z-index: 1;
  }
  & input[type="checkbox"]:checked::after, input[type="radio"]:checked::after{
    content: "\f00c";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: $blue90;
    justify-self: center;
   font-size: 20px;
   margin-left: 20%;
   z-index: 1;
  }
  & input:disabled{
    background-color: $grey20;
    border-color:$grey60;
  }
  & input[type="checkbox"]:checked:disabled:after, input[type="radio"]:checked:disabled:after{
    color: $grey60;
  }

  & input[type="checkbox"]:indeterminate::after{
    content: "\f068";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    color: $blue90;
    justify-self: center;
    margin-left: 10%;
    z-index: 1;
  }
  & input[type="checkbox"]:indeterminate:disabled::after {
    color: $grey60;
  }
}

input[type="checkbox"], .input-control:after,
.input-control:before {
  grid-area: inputControl;
}



input[type="radio"]{
  background-color: #fff;
  margin: 0;
  font: inherit;
  color: currentColor;
  width: 1.25em;
  height: 1.25em;
  background-color: $blue10;
  border: 1.5px solid $blue90;
  border-radius: 50%;
  min-width: 20px;
  transition: all .4s ease-in;
  transform: translateY(-0.075em);
  &.large{
    width: 32px;
    height: 32px;
  }
  &:hover {
    border: 1.5px solid $blue100;
    background-color: $blue20;
  }
  &:focus{
    box-shadow: 0px 0px 0px .5px $blue90;
  }
  &:disabled {
    background-color: $grey20;
    border-color:$grey60;
  }

  &.is-white{
    background-color: white;
    &:hover{
      background-color: $grey10;
    }
  }
}

// DatePicker
input[type="date"]{
  padding-bottom: calc(0.3em - 1px);
  padding-left: calc(0.65em - 1px);
  padding-right: calc(0.65em - 1px);
  padding-top: calc(0.3em - 1px);
  position: relative;
  width: 100%;
  &::-webkit-calendar-picker-indicator{
    background-image: none;
    z-index: 2;
  }
  &::after{
    content: "\f133";
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 400;
    position: absolute;
    left: auto;
    right: 10px;
    color: #005392;
    z-index: 0;
  }
  &:disabled{
    box-shadow: none;
    border-color: $grey60;
    &::after{
      color: $grey60;
    }
  }
}


.input-control.--date{
  @extend .input-control;
  & input[type="date"]:disabled{
    box-shadow: none;
  }
  &.is-danger input[type="date"]{
    box-shadow: 0px 0px 0px 1.5px #D43A25;
    border-color: transparent;
    &::after{
      content: "\f06a";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      position: absolute;
      left: auto;
      right: 10px;
      color: #D43A25;
      z-index: 0;
    }
  }
  &.is-danger input[type="date"]:disabled{
    box-shadow: none;
    border-color: $grey60;
    &::after{
      content: "\f133";
      font-weight: 400;
      color: $grey60;
    }
  }
  &.is-warning input[type="date"]{
    box-shadow: 0px 0px 0px 1.5px $yellow50;
    border-color: transparent;
    &::after{
      content: "\f071";
      font-family: "Font Awesome 6 Free" !important;
      font-weight: 900;
      position: absolute;
      left: auto;
      right: 10px;
      color: $yellow50;
      z-index: 0;
    }
  }
  &.is-warning input[type="date"]:disabled{
    box-shadow: none;
    border-color: $grey60;
    &::after{
      content: "\f133";
      font-weight: 400;
      color: $grey60;
    }
  }
}

.date-event{
  border-bottom: 2px solid $orange60;
}
