@import 'variables';
@import 'mixins';

.form {
  //max-width: 700px;

  &.inline-form {
    display: flex;
    position: relative;
    justify-content: center;
    margin: 0 auto;

    .input-wrapper {
      position: relative;

      .error-message {
        position: absolute;
        left: 0;
        bottom: -25px;
      }
    }
  }

  &.block-form {

    .switch-wrapper {
      padding-bottom: 13px;
      margin-bottom: 13px;
      border-bottom: 1px solid $light_background;

      &:last-child {
        padding-bottom: 0;
        margin-bottom: 0;
        border-bottom: none;
      }
    }

    .wrapper-inline {
      display: flex;
      margin: 0 -15px;

      .block-wrapper {
        width: 100%;
        padding: 0 15px;
      }
    }

    .block-wrapper {
      margin-bottom: 32px;

      label {
        @include font-size(14);
        color: rgba($text, 0.8);
        font-weight: 700;
        display: block;
        margin-bottom: 7px;
        text-align: left;
      }

      &:last-child {
        margin-bottom: 0;
      }
    }

    .button {
      margin-top: 50px;
    }
  }

  .inline-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .switch-label {
      .input-help {
        padding-top: 0;
      }

      .input-label {
        font-weight: 700;
        color: $text;
        @include font-size(16);
        margin-bottom: 5px;
      }
    }
  }

}

.input-help {
  @include font-size(12);
  color: $text-muted;
  line-height: 1.35;
  padding-top: 10px;
  display: block;
}

.single-line-form {
  display: flex;

  .submit-button {
    margin-left: 20px;
  }
}

.error-message {
  @include font-size(14);
  color: $danger;
  padding-top: 5px;
  display: block;
  text-align: left;
}

textarea {
  width: 100%;
}

textarea,
input[type="password"],
input[type="text"],
input[type="number"],
input[type="email"] {
  //border: 1px solid transparent;
  //@include transition(150ms);
  //@include font-size(16);
  //border-radius: 8px;
  //padding: 13px 20px;
  //appearance: none;
  //font-weight: 700;
  //outline: 0;
  //width: 100%;
  //box-shadow: 0 1px 5px rgba(0, 0, 0, 0.12);
  //background: hsla(210, 10%, 98%, 1);

  &.is-error {
    border-color: $danger;
    //box-shadow: 0 1px 5px rgba($danger, 0.3);
  }

  &::placeholder {
    color: rgba($text, 0.5);
    @include font-size(15);
  }

  &:focus {
    //box-shadow: 0 1px 5px rgba($theme, 0.3);
  }

  &[disabled] {
    //background: white;
    color: rgba($text, 0.8);
    -webkit-text-fill-color: rgba($text, 0.8);
    opacity: 1;
    cursor: not-allowed;
  }
}

input[type="color"] {
  width: 38px !important;
  height: 40px;
  border: none;
  outline: none;
  background: none;
  min-width: initial !important;
}

.additional-link {
  @include font-size(16);
  margin-top: 50px;
  display: block;

  b, a {
    cursor: pointer;

    &:hover {
      text-decoration: underline;
    }
  }
}

@media only screen and (max-width: 1024px) {
  .form {
    max-width: 100%;
  }
}

@media only screen and (max-width: 960px) {
  .form {

    .button {
      margin-top: 20px;
      width: 100%;
      margin-left: 0;
      margin-right: 0;
    }

    input, textarea {
      width: 100%;
      min-width: 100%;
    }

    &.block-form {

      .block-wrapper {
        display: block;

        label {
          width: 100%;
          padding-right: 0;
          display: block;
          margin-bottom: 7px;
          text-align: left !important;
          @include font-size(14);
          padding-top: 0;
        }
      }

      .button {
        margin-top: 25px;
        margin-left: 0;
        margin-right: 0;
      }
    }

    &.inline-form {
      display: block;

      .input-wrapper .error-message {
        position: relative;
        bottom: 0;
      }
    }

    .button {
      padding: 14px 32px;
    }
  }

  .single-line-form {
    display: block;

    .submit-button {
      margin-left: 0;
      margin-top: 20px;
      width: 100%;
    }
  }

  textarea,
  input[type="password"],
  input[type="number"],
  input[type="text"],
  input[type="email"] {
    padding: 14px 20px;
  }
}

@media only screen and (max-width: 690px) {

  .form.block-form .wrapper-inline {
    display: block;
  }
}

.dark {

  .form {

    .input-help {
      color: $dark_mode_text_secondary;
    }

    &.block-form {

      .block-wrapper label {
        color: $dark_mode_text_primary;
      }

      .switch-wrapper {
        border-color: $dark_mode_border_color;
      }
    }

    .inline-wrapper {

      .switch-label {

        .input-label {
          color: $dark_mode_text_primary;
        }
      }
    }
  }

  textarea,
  input[type="password"],
  input[type="text"],
  input[type="number"],
  input[type="email"] {
    border-color: $dark_mode_foreground;
    background: $dark_mode_foreground;
    color: $dark_mode_text_primary;


    &::placeholder {
      color: $dark_mode_text_secondary;
    }

    &[disabled] {
      //background: $dark_mode_foreground;
      color: rgba($dark_mode_text_secondary, 0.8);
      -webkit-text-fill-color: rgba($dark_mode_text_secondary, 0.8);
    }
  }

  .popup-wrapper {

    textarea,
    input[type="password"],
    input[type="text"],
    input[type="number"],
    input[type="email"] {
      background: lighten($dark_mode_foreground, 3%);
    }
  }
}