/**=====================
  2.17 Forms CSS Start
==========================**/

@use "../utils/mixin" as *;
@use "../utils/variables" as *;

.form-label {
  margin-bottom: 4px;
  font-size: 14px;
}

.col-form-label {
  padding-bottom: 4px;
}

.form-space {
  margin-bottom: -10px;

  >div {
    margin-bottom: 10px;
  }
}

.theme-form {
  .form-control {
    :focus {
      box-shadow: 0 0 0 0.2rem rgba(171, 140, 228, 0.05);
    }
  }

  textarea {
    border-color: $form-input-border-color;

    &::-webkit-input-placeholder {
      color: $form-placeholder-color;
      font-size: $form-placeholder-font-size;
      letter-spacing: $form-placeholder-letter-spacing;
      font-weight: $form-placeholder-font-weight;
    }
  }

  input[type=text],
  input[type=email],
  input[type=search],
  input[type=password],
  input[type=number],
  input[type=tel],
  input[type=date],
  input[type=datetime-local],
  input[type=time],
  input[type=datetime-local],
  input[type=month],
  input[type=week],
  input[type=url],
  input[type=file],
  textarea,
  select {
    border-color: $gray-60;
    background-color: $form-input-bg-color;
    font-size: $form-placeholder-font-size;
    color: $form-placeholder-color;
    padding: 12px 10px;
    -webkit-box-shadow: none;
    box-shadow: none;

    &::-webkit-input-placeholder {
      color: $form-placeholder-color;
      font-size: $form-placeholder-font-size;
      letter-spacing: $form-placeholder-letter-spacing;
      font-weight: $form-placeholder-font-weight;
    }
  }

  input[type=file] {
    height: auto;
  }

  select.form-control:not([size]):not([multiple]) {
    border-color: $form-input-border-color;
    font-size: $form-placeholder-font-size;
  }

  .checkbox {
    label {
      padding-left: 10px;

      [dir="rtl"] & {
        padding-right: 10px;
        padding-left: unset;
      }
    }
  }

  .login-divider {
    position: relative;
    clear: both;
    height: 0;
    margin: 30px 0;
    border-top: 1px solid $light-semi-gray;

    &:before {
      position: absolute;
      top: -11px;
      left: 40%;
      margin-left: -10px;
      padding: 0 5px;
      color: $theme-font-color;
      background: $white;
      content: "Or Login With";

      [dir="rtl"] & {
        left: unset;
        right: 40%;
        margin-left: unset;
        margin-right: -10px;
      }
    }
  }

  .btn-fb,
  .btn-twitter,
  .btn-google,
  .btn-linkedin,
  .btn-dribble {
    color: $white;
    width: 100%;
  }

  .btn-fb {
    background-color: $fb;
  }

  .btn-twitter {
    background-color: $twitter;
  }

  .btn-google {
    background-color: $google-plus;
  }

  .btn-linkedin {
    background-color: $linkedin;
  }

  .btn-dribble {
    background: #e74c88;
  }
}

.form-inline {
  display: flex;
  -webkit-box-flex: 0;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  flex-flow: row wrap;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  margin-bottom: 0;

  .col-form-label {
    margin-right: 5px;

    [dir="rtl"] & {
      margin-left: 5px;
      margin-right: unset;
    }
  }
}

.search-form {
  .form-group {
    &:before {
      position: absolute;
      content: "";
      width: 1px;
      height: 25px;
      background: #e8ebf2;
      left: 82px;
      top: 50px;

      [dir="rtl"] & {
        left: unset;
        right: 82px;
      }
    }

    &:after {
      position: absolute;
      content: "\f002";
      font-family: "FontAwesome";
      top: 53px;
      left: 53px;
      color: #8e8e8e;

      [dir="rtl"] & {
        left: unset;
        right: 53px;
      }
    }
  }

  input {
    border: 1px solid $light-semi-gray;
    padding: 10px 10px 10px 70px;
    border-radius: 10px;
    background-color: rgba($light-color, 0.3);


    [dir="rtl"] & {
      padding: 10px 70px 10px 10px;
    }

    &:focus {
      outline: none !important;
    }
  }
}

.form-label-align-right {
  label {
    text-align: right;
    padding-top: 17px;
    font-weight: 500;
  }
}

// Custom style

.needs-validation {
  &.was-validated {

    .form-control,
    .form-select {
      &:valid {
        border-color: $success-color;

        ~.valid-feedback {
          color: $success-color;
        }
      }

      &:invalid {
        border-color: $danger-color;

        ~.invalid-feedback {
          color: $danger-color;
        }
      }
    }
  }
}

.custom-input {
  &.was-validated {

    .form-control,
    .form-select {
      &:valid {
        border-color: $success-color;
      }

      &:invalid {
        border-color: $danger-color;
      }
    }
  }

  .valid-tooltip {
    background-color: $success-color;
  }

  .invalid-tooltip {
    background-color: rgba($danger-color, 0.8);
  }

  .invalid-feedback {
    color: $danger-color !important;
  }

  .form-check {
    .form-check-input {

      &:valid {
        border-color: $success-color;
      }

      &:invalid {
        border-color: $danger-color;
      }

      &:invalid~.form-check-label {
        color: $danger-color;
      }

      &:valid~.form-check-label {
        color: $success-color;
      }

      &:checked {
        background-color: $success-color;
      }
    }

    .invalid-feedback {
      color: $danger-color;
    }
  }

  .form-check {
    &.form-switch {
      .form-check-input {
        [dir="rtl"] & {
          margin-left: 7px;
        }
      }
    }
  }
}

// checkbox and radio
.form-check-reverse {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  padding: 0;

  .form-check-input {
    float: left;
    margin-right: 0;
    margin-left: 10px;
  }
}

.checkbox-checked {
  &.card-wrapper {
    h6 {
      &.sub-title {
        font-weight: 500;
      }
    }
  }

  .form-check-input {
    &:checked {
      background-color: $primary-color;
      border-color: $primary-color;
    }

    &:focus {
      border-color: $primary-color;
      box-shadow: 0 0 0 4px rgba($primary-color, 0.25);
    }
  }

  .card-wrapper {
    .form-check {
      &:last-child {
        min-height: 0;
        margin-bottom: 0;

        label {
          margin-bottom: 0;
        }
      }
    }
  }
}

.form-check-size {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;

  .form-check-inline {
    margin: 0;
    min-height: 0;

    [dir="rtl"] & {
      margin: 0;
    }

    .form-check-input {
      @include pixelstrap-size(18px, 18px);
      margin-top: 0;
    }

    .check-size {
      @include pixelstrap-size(36px, 18px);
      margin-top: 0;
    }

    label {
      margin: 0;
    }
  }
}

// img checkbox
.main-img-checkbox {
  .img-checkbox {
    position: relative;
    @include pixelstrap-flex(flex, center, center);

    .main-img-cover {
      position: absolute;
      top: 15px;
      left: 15px;
      @include pixelstrap-size(24px, 24px);

      [dir="rtl"] & {
        left: unset;
        right: 15px;
      }
    }

    .form-check-label {
      width: 100%;
    }

    img {
      width: 100%;
      height: 220px;
      object-fit: cover;
    }
  }
}

// icons radio button
.main-icon-checkbox {
  &.checkbox {
    label {
      margin-top: 0;

      &::before {
        content: '';
        @include pixelstrap-size(100%, 100%);
        margin-left: 1px;
        background-color: transparent;
        top: 0;
        display: block;

        [dir="rtl"] & {
          margin-left: unset;
          margin-right: 1px;
        }
      }
    }

  }

  &.checkbox-primary {
    input[type=checkbox]:checked {
      +label::before {
        color: transparent;
        border: 2px solid $primary-color;
      }
    }

    input[type=checkbox] {
      opacity: 1;
    }

    .form-check-input {
      border: 1px solid $gray-60;

      &.checkbox-shadow {
        &:focus {
          box-shadow: none;
        }
      }

      &:checked[type=checkbox] {
        background-image: none;
      }
    }
  }
}

.main-radio-toggle,
.main-checkbox-toggle {
  .btn {
    margin-bottom: 0;
  }
}

.radio-wrapper,
.checkbox-wrapper {
  display: flex;
  gap: calc(8px + (16 - 8) * ((100vw - 320px) / (1920 - 320)));
  flex-wrap: wrap;
  justify-content: center;

  @media (max-width:1200px) {
    justify-content: unset;
  }

  li {
    position: relative;
    width: 100%;
    padding: 12px;
    border: none;
    text-align: center;
    @include pixelstrap-flex(flex, center, center);
    max-width: 130px;

    @media (max-width:1335px) {
      max-width: 113px;
    }

    @media (max-width:1232px) {
      padding: 10px;
      max-width: 105px;
    }

    .form-check-input {
      position: absolute;
      @include pixelstrap-size(100%, 100%);
      float: none;
      margin: 0;
      top: 0;
      left: 0;
      opacity: 1;
      border-radius: 0;
      background-color: transparent;
      border: 1px solid $gray-60;

      &:focus {
        box-shadow: none;
      }

      &[type=radio] {
        opacity: 1;
      }

      &:checked {
        border: 2px solid $primary-color;
        background-color: transparent;

        &[type=radio] {
          background-image: none;
          box-shadow: unset;
        }
      }
    }

    .form-check-label {
      position: unset;
      padding: 0;
      margin-bottom: 0;

      &:after {
        content: none;
      }

      &::before {
        content: none;
      }

      i {
        font-size: 18px;
        padding-right: 8px;

        [dir="rtl"] & {
          padding-right: 0;
          padding-left: 8px;
        }
      }

      span {
        font-size: 16px;
      }
    }
  }
}

.rtl-input {
  .form-check {
    &.form-check-inline {
      [dir="rtl"] & {
        padding: 0;
      }
    }

    &.form-switch {
      [dir="rtl"] & {
        padding-right: 40px;
      }

      .form-check-input {
        [dir="rtl"] & {
          margin-left: unset;
          margin-right: -40px;
          float: right;
        }
      }
    }
  }
}

// Custom form
.radio-form {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;

  .form-check {
    min-height: 0;
    margin-bottom: 0;

    .form-check-label {
      margin-bottom: 0;
    }
  }
}

// default-form start
.basic-form {
  position: relative;

  svg {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);

    [dir="rtl"] & {
      right: 0;
      left: 12px;
    }

    &.stroke-icon {

      width: 25px;
      height: 25px;
      stroke: $dark-color;
      position: absolute;
      top: 50%;
      right: 12px;
      transform: translateY(-50%);

      [dir="rtl"] & {
        right: unset;
        left: 12px;
      }
    }
  }
}

.form-check {
  margin-bottom: 0;

  [class*="form-check-"] {
    cursor: pointer;
  }
}

.theme-form {
  .custom-input {
    .row {
      .col {
        .row {
          &:last-child {
            label {
              margin: 0;
            }
          }
        }
      }
    }
  }

  &.dark-inputs {
    input::file-selector-button {
      border-radius: 30px;
    }
  }

  .form-floating {
    >label {
      [dir="rtl"] & {
        left: unset;
        right: 0;
      }
    }
  }
}

// Create Project
.create-project-form {
  .form-label {
    color: var(--body-font-color);
  }

  input[type="date" i]::-webkit-calendar-picker-indicator {
    cursor: pointer;
  }

  .form-control,
  .form-select {
    border-color: $gray-60;
    background-color: $form-input-bg-color;
    font-size: $form-placeholder-font-size;
    color: $form-placeholder-color;
    padding: 12px 10px;
    -webkit-box-shadow: none;
    box-shadow: none;

    &::-webkit-input-placeholder {
      color: $form-placeholder-color;
      font-size: $form-placeholder-font-size;
      letter-spacing: $form-placeholder-letter-spacing;
      font-weight: $form-placeholder-font-weight;
    }
  }

  input[type="file"] {
    padding: 6px 12px;
  }

  .bootstrap-select {
    width: 100% !important;

    .dropdown-toggle {
      width: 100%;
      padding: 12px 10px;
      background-color: unset !important;
      border-radius: 6px;
      border-color: $gray-60 !important;
      color: $form-placeholder-color;

      &:focus {
        outline: unset !important;
      }

      &::after {
        font-size: 15px;
        color: $dark-color-light;
      }

      .filter-option {
        white-space: initial;
      }
    }

    .bs-searchbox {
      .form-control {
        padding: 6px 10px;
      }
    }
  }

  .was-validated {
    .bootstrap-select {
      select {
        &:valid+.dropdown-toggle {
          border-color: $success-color !important;
        }
      }
    }
  }
}

.animated-form {
  form {
    input.error {
      border-color: $danger-color;
      margin: 0;
    }

    input.success {
      border-color: $success-color;
    }

    .animated {
      -webkit-animation-fill-mode: both;
      -moz-animation-fill-mode: both;
      -ms-animation-fill-mode: both;
      -o-animation-fill-mode: both;
      animation-fill-mode: both;
      -webkit-animation-duration: 1s;
      -moz-animation-duration: 1s;
      -ms-animation-duration: 1s;
      -o-animation-duration: 1s;
      animation-duration: 1s;
    }

    @-webkit-keyframes input-shake {

      0%,
      100% {
        -webkit-transform: translateX(0);
      }

      10%,
      30%,
      50%,
      70%,
      90% {
        -webkit-transform: translateX(-10px);
      }

      20%,
      40%,
      60%,
      80% {
        -webkit-transform: translateX(10px);
      }
    }

    @-moz-keyframes input-shake {

      0%,
      100% {
        -moz-transform: translateX(0);
      }

      10%,
      30%,
      50%,
      70%,
      90% {
        -moz-transform: translateX(-10px);
      }

      20%,
      40%,
      60%,
      80% {
        -moz-transform: translateX(10px);
      }
    }

    @-o-keyframes input-shake {

      0%,
      100% {
        -o-transform: translateX(0);
      }

      10%,
      30%,
      50%,
      70%,
      90% {
        -o-transform: translateX(-10px);
      }

      20%,
      40%,
      60%,
      80% {
        -o-transform: translateX(10px);
      }
    }

    @keyframes input-shake {

      0%,
      100% {
        transform: translateX(0);
      }

      10%,
      30%,
      50%,
      70%,
      90% {
        transform: translateX(-10px);
      }

      20%,
      40%,
      60%,
      80% {
        transform: translateX(10px);
      }
    }

    .input-shake {
      -webkit-animation-name: input-shake;
      -moz-animation-name: input-shake;
      -o-animation-name: input-shake;
      animation-name: input-shake;
    }
  }
}

/**=====================
  2.17 Forms CSS Ends
==========================**/