@import '../colors';
@import '../mixins';

.input-forms.v4 {
  @include font-base;
  font-weight: $font-weight-regular;
  position: relative;
  display: block;
  margin-top: 0;

  .input-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: $color-N0;
    padding: 0;
    margin: 0;

    &.disabled {
      color: $color-N400;
      border-color: $color-N200;
      background-color: $color-N100;
    }

    &.focused {
      border-color: $color-N0;
    }

    .btn-area {
      right: 16px;
      cursor: pointer;
      position: absolute;
      top: 0;
      z-index: 10;
      color: $color-N700;
      height: 24px;
      width: 24px;
      align-items: center;
      display: flex;
      justify-content: center;
      margin: 14px 0;

      .icon-item {
        margin: 0;
        align-items: center;
      }
    }

    svg {
      position: absolute;
      pointer-events: none;
      width: 100%;
      height: 100%;
      border-radius: 8px;

      .form-border {
        stroke: $color-N200;
      }

      .form-focus-border {
        stroke: none;

        &.focused {
          stroke: $color-B400;
          stroke-dasharray: 400%;
          stroke-dashoffset: 400%;
          animation: dash 1s linear forwards;
        }

        &.danger {
          stroke: $color-R400;
          animation: blink 1s 3;
        }
      }
    }

    label {
      position: absolute;
      top: 0;
      left: 16px;
      height: 20px;
      transition: all 0.2s ease-out;
      transform-origin: 0 100%;
      text-align: initial;
      pointer-events: none;
      margin: 16px 0;

      &.active {
        transform: translateY(-8px);
        z-index: 1;
        left: 16px;
        padding: 0;

        .tix-font.v4 {
          @include font-size-small-desktop;
        }

        &.mobile {
          .tix-font.v4 {
            @include font-size-b3;
          }
        }
      }

      &.danger {
        color: $color-R400;
      }

      &.dropdown {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: calc(100% - 54px);
      }

      .tix-font.v4 {
        margin: 0;
      }
    }

    .input-text.v4,
    .input-select.v4 {
      -webkit-appearance: none;
      -moz-appearance: none;
      @include font-base;
      @include font-size-b3-desktop;
      appearance: none;
      background: transparent;
      border: none;
      caret-color: $color-B400;
      color: $color-N800;
      height: 52px;
      padding: 16px 16px 0 16px;
      box-sizing: border-box;
      outline: none;
      width: 100%;
      box-shadow: none;
      transition: all 0.3s;

      &.mobile {
        @include font-size-b2;
      }

      &.primary {
        &.dropdown {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          user-select: none;
          cursor: pointer;
        }
      }

      &.icon-right,
      &.dropdown {
        padding-right: 45px;
      }

      &.dropdown {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        user-select: none;
        cursor: pointer;
      }

      &:disabled {
        cursor: not-allowed;
        color: $font-color-low-emphasis;
      }
    }

    .input-select {
      cursor: pointer;
    }

    .wrapper-textarea.v4 {
      caret-color: $color-B400;
      position: relative;
      border-radius: 8px;
      box-sizing: border-box;
      outline: none;
      min-height: 100px;
      width: 100%;
      font-size: 14px;
      box-shadow: none;
      transition: all 0.3s;

      ~ label {
        top: 0;
        left: 0;
        padding: 16px;
        margin: 0;
      }

      textarea {
        padding: 14px 16px 16px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        @include font-base;
        @include font-size-b3-desktop;
        color: $color-N800;
        width: 100%;
        height: 100%;
        margin-top: 10px;
        border: none;
        overflow: auto;
        outline: none;
        background-color: transparent;

        &.mobile {
          @include font-size-b2;
        }

        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        box-shadow: none;

        resize: none; /*remove the resize handle on the bottom right*/

        &:disabled {
          cursor: not-allowed;
          color: $font-color-low-emphasis;
        }
      }

      .max-length-textarea {
        font-size: 12px;
        margin: 2px 0 0;
        font-weight: normal;
        color: $color-N500;
        text-align: right;
        position: absolute;
        right: 16px;
        bottom: 8px;
        float: right;
      }
    }
  }

  .description {
    margin-top: 4px;
    color: $color-N600;
    width: 100%;

    &.danger {
      color: $color-R400;
    }
  }

  @keyframes blink {
    50% {
      stroke: $color-N200;
    }
  }

  @keyframes dash {
    to {
      stroke-dashoffset: 0;
    }
  }
}

.dropdown-menu {
  @include font-base;
  ul {
    margin: 0;
    padding: 0;

    .list-option.v4 {
      &.template {
        display: flex;
        justify-content: space-between;
        list-style-type: none;
        align-items: center;
        padding: 12px 0;
        font-size: 16px;
        color: $color-N500;
        cursor: pointer;

        &:not(:last-child) {
          border-bottom: 0.5px solid $color-N200;
        }

        .tix-icon {
          color: $color-B400;
          visibility: hidden;
        }

        &.active {
          .tix-icon {
            visibility: visible;
          }
        }
      }
    }
  }

  p {
    margin: 0;
  }
}
