// studio - elements - forms
// ====================

// forms - general
input[type="text"],
input[type="email"],
input[type="password"],
textarea.text {
  padding: 6px 8px 8px;
  @include box-sizing(border-box);
  border: 1px solid $gray-l2;
  border-radius: 2px;
  @include linear-gradient($gray-l5, $white);
  background-color: $gray-l5;
  box-shadow: inset 0 1px 2px $shadow-l1;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px;
  color: $baseFontColor;
  outline: 0;

  &::-webkit-input-placeholder,
  &:-moz-placeholder,
  &:-ms-input-placeholder {
      color: $gray-l2;
  }

  &:focus {
    @include linear-gradient($paleYellow, tint($paleYellow, 90%));
    outline: 0;
  }
}

// ====================

// forms - fields - not editable
.field.is-not-editable {

  & label.is-focused {
   color: $gray-d2;
  }

  label, input, textarea {
    pointer-events: none;
  }
}

// ====================

// field with error
.field.error {

  input, textarea {
    border-color: $red;
  }
}

// ====================

// forms - additional UI
form {

  .note {
    @include box-sizing(border-box);

    .title {

    }

    .copy {

    }

    // note with actions
    &.has-actions {
      @include clearfix();

      .title {

      }

      .copy {

      }

      .list-actions {

      }
    }
  }

  .note-promotion {

  }
}

// ELEM: form wrapper
.wrapper-create-element {
  height: 0;
  margin-bottom: $baseline;
  opacity: 0.0;
  pointer-events: none;
  overflow: hidden;

  &.animate {
    @include transition(opacity $tmg-f1 ease-in-out 0s, height $tmg-f1 ease-in-out 0s);
  }

  &.is-shown {
    height: auto; // define a specific height for the animating version of this UI to work properly
    opacity: 1.0;
    pointer-events: auto;
  }
}

// ELEM: form
// form styling for creating a new content item (course, user, textbook)
form[class^="create-"] {
  @extend %ui-window;

  .title {
    @extend %t-title4;
    font-weight: 600;
    padding: $baseline ($baseline*1.5) 0 ($baseline*1.5);
  }

  fieldset {
    padding: $baseline ($baseline*1.5);
  }


  .list-input {
    @extend %cont-no-list;

    .field {
      margin: 0 0 ($baseline*0.75) 0;

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

      &.required {

        label {
          font-weight: 600;
        }

        label:after {
          margin-left: ($baseline/4);
          content: "*";
        }
      }

      label, input, textarea {
        display: block;
      }

      label {
        @extend %t-copy-sub1;
        @include transition(color $tmg-f3 ease-in-out 0s);
        margin: 0 0 ($baseline/4) 0;

        &.is-focused {
          color: $blue;
        }
      }


      input, textarea {
        @extend %t-copy-base;
        @include transition(all $tmg-f2 ease-in-out 0s);
        height: 100%;
        width: 100%;
        padding: ($baseline/2);

        &.long {
          width: 100%;
        }

        &.short {
          width: 25%;
        }

        /*@include placeholder {
          color: $gray-l3;
        }*/

        &:focus {

          + .tip {
            color: $gray;
          }
        }
      }

      textarea.long {
        height: ($baseline*5);
      }

      input[type="checkbox"] {
        display: inline-block;
        margin-right: ($baseline/4);
        width: auto;
        height: auto;

        & + label {
          display: inline-block;
        }
      }

      .tip {
        @extend %t-copy-sub2;
        @include transition(color, 0.15s, ease-in-out);
        display: block;
        margin-top: ($baseline/4);
        color: $gray-l3;
      }

      .tip-error {
        display: none;
        float: none;
      }

      &.error {
        label {
          color: $red;
        }

        .is-showing {
            @extend %anim-fadeIn;
        }

        .is-hiding {
            @extend %anim-fadeOut;
        }

        .tip-error {
          display: block;
          color: $red;
        }

        input {
          border-color: $red;
        }
      }
    }

    .field-inline {

      input, textarea, select {
        width: 62%;
        display: inline-block;
      }

      .tip-stacked {
        display: inline-block;
        float: right;
        width: 35%;
        margin-top: 0;
      }

      &.error {
        .tip-error {
        }
      }

    }

    .field-group {
      @include clearfix();
      margin: 0 0 ($baseline/2) 0;

      .field {
        display: block;
        width: 47%;
        border-bottom: none;
        margin: 0 ($baseline*0.75) 0 0;
        padding: ($baseline/4) 0 0 0;
        float: left;
        position: relative;

        &:nth-child(odd) {
          float: left;
        }

        &:nth-child(even) {
          float: right;
          margin-right: 0;
        }

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

  .actions {
    box-shadow: inset 0 1px 2px $shadow;
    margin-top: ($baseline*0.75);
    border-top: 1px solid $gray-l1;
    padding: ($baseline*0.75) ($baseline*1.5);
    background: $gray-l6;

    .action {
      @include transition(all $tmg-f2 linear 0s);
      display: inline-block;
      padding: ($baseline/5) $baseline;
      font-weight: 600;
      text-transform: uppercase;
    }

    .action-primary {
      @include blue-button;
      @extend %t-action2;
    }

    .action-secondary {
      @include grey-button;
      @extend %t-action2;
    }
  }
}

// ====================

// forms - grandfathered
input.search {
  padding: 6px 15px 8px 30px;
  @include box-sizing(border-box);
  border: 1px solid $darkGrey;
  border-radius: 20px;
  background: url(../img/search-icon.png) no-repeat 8px 7px #edf1f5;
  font-family: 'Open Sans', sans-serif;
  color: $baseFontColor;
  outline: 0;

  &::-webkit-input-placeholder {
      color: #979faf;
  }
}

label {
  font-size: 12px;
}

code {
  padding: 0 4px;
  border-radius: 3px;
  background: #eee;
  font-family: Monaco, monospace;
}

.CodeMirror {
  font-size: 13px;
  background: #fff;
}

.text-editor {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  @include box-sizing(border-box);
  border: 1px solid $mediumGrey;
  @include linear-gradient(top, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3));
  background-color:  #edf1f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset;
  font-family: Monaco, monospace;
}
