// openassessment: utilities - developer
// ====================

// NOTES:
// * use this area for any developer-needed or created styling that needs to be refactored into patterns or visually polished. Please list any template/view that your styles reference when definining them (example below):

// --------------------
// Views: Error
// --------------------
// .crazy-new-feature {
//   background: transparent;
// }

// --------------------
// Views: Counterbalancing XBlock workbench styling
// --------------------

// --------------------
// Views: Static HTML Page Display
// --------------------
.view--placeholder {
  background: $bg-view;
  margin: ($baseline-v*2) $baseline-h;
}

// --------------------
// Developer styles for Staff Section
// --------------------

// edX constants
$lighter-base-font-color: rgb(100,100,100);
$link-hover: $edx-blue-l1 !default; // from our Pattern Library http://ux.edx.org/elements/colors/

.wrapper--openassessment .wrapper--staff-area {
  width: 100%;
  overflow: auto;
  margin-top: $baseline-v;
  padding-top: 20px;

  .wrapper--staff-toolbar {
    position: relative;
    text-align: right;
    margin: 0 0 8px;
    padding: 10px;

    .ui-staff__button {
      @extend %btn-reset;

      padding: ($baseline-v/4) ($baseline-v/2);
      border-radius: ($baseline-v/4);
      text-transform: uppercase;
      color: $lighter-base-font-color;
      background-color: $shadow-l2;

      &.is--active {
        color: white;
        background-color: $edx-pink;

        &:hover {
          background-color: $edx-pink-d1;
        }
      }

      &:hover {
        color: white;
        background-color: $link-hover;
      }
    }
  }

  .wrapper--ui-staff {
    margin-top: 0;

    .ui-staff_close_button {
      margin: 0;
      padding: 0;
      border: 0;
      float: right;
      background-color: $staff-bg;

      // Remove button styling
      font-size: 12px;
      -webkit-appearance: none;
      background-image: none;
      text-shadow: none;
      box-shadow: none;
      border: none;
      border-image: none;

      &:hover {
        color: $white;
      }
    }
  }
}

.staff-info__student {
  .label {
    color: $heading-staff-color;
    margin-bottom: ($baseline-v/2);

    input {
      display: block;
      padding-top: 0;
      padding-bottom: 0;
    }
  }

  .title {
    @extend %hd-2;
    color: $heading-staff-color;
    margin-bottom: ($baseline-v/2);
  }

  .title--sub {
    @extend %hd-4;
    color: $heading-staff-color;
    margin-top: ($baseline-v/2);
    margin-bottom: ($baseline-v/2);
  }

  .student__answer__display__content {
    border: 1px solid rgba($copy-staff-color, 0.25);
    padding: ($baseline-v/2) ($baseline-h/4);
    margin-bottom: ($baseline-v/2);
  }

  .staff-info__student__report {
    list-style-type: none;

    .title {
      @extend %t-strong;
      margin-top: ($baseline-v/2);
      border-top: 1px solid $heading-staff-color;
      padding: ($baseline-v/2) ($baseline-h/2) ($baseline-v/2) 0;

      span {
        font-weight: inherit;
      }
    }
  }

  .value {
    width: $max-width/2;
  }
}

// --------------------
// Developer Styles for Student Training
// --------------------
.step--student-training {

  // submission
  .student-training__display {
    @extend %ui-subsection;
  }

  .student-training__display__header {
    @include clearfix();
  }

  .student-training__display__title {
    @extend %t-heading;
    margin-bottom: ($baseline-v/2);
    color: $heading-secondary-color;
  }

  .student-training__display__response {
    @extend %ui-subsection-content;
    @extend %copy-3;
    @extend %ui-content-longanswer;
    @extend %ui-well;
    color: $copy-color;
  }

  // assessment form
  .student-training__assessment {

    // fields
    .assessment__fields {
      margin-bottom: $baseline-v;
    }

    // rubric question
    .assessment__rubric__question {
      @extend %ui-rubric-question;
    }

    // rubric options
    .question__answers {
      @extend %ui-rubric-answers;
      overflow: visible; // needed for ui-hints
    }

    // general feedback question
    .assessment__rubric__question--feedback {

      textarea {
        @extend %ui-content-longanswer;
        min-height: ($baseline-v*5);
      }
    }
  }

  // TYPE: correct
  .message--correct {
    @extend .message--complete;
    margin-top: $baseline-v;

    &.is--hidden {
      height: 0;
      width: 0;
      padding: 0;
      margin: 0;

      .step__header {
        border-bottom: none;
      }
    }
  }

  // TYPE: incorrect
  .message--incorrect {
    @extend .message--incomplete;
    margin-top: $baseline-v;

    &.is--hidden {
      height: 0;
      width: 0;
      padding: 0;
      margin: 0;

      .step__header {
        border-bottom: none;
      }
    }
  }
}

// --------------------
// Developer Styles for Studio Editing of OA problems
// --------------------

#openassessment-editor {
  margin-bottom: 0;
  height: 100%;

  .openassessment_editor_content_and_tabs {
    width: 100%;
    height: Calc(100% - 55px);
  }

  #oa_editor_window_title{
    @include float(left);
  }

  input[type="number"]{
    background-image: -moz-linear-gradient(#F2F2F2,#FFF);
    background-image: -webkit-linear-gradient(#F2F2F2,#FFF);
    background-image: linear-gradient(#F2F2F2,#FFF);
    width: 45%;
  }

  #openassessment_editor_header {
    background-color: #e5e5e5;
    width: 100%;
    top: 0;
    height: 42px;

    .editor_tabs {

      width: 35%;
      min-width: 190px;
      max-width: 360px;
      @include float(right);

      .oa_editor_tab {
        @include float(right);
        padding: 0;
        width: 29%;
        margin: 0px 2%;
        height: 35px;
        @include border-radius(5px);
        box-shadow: none;
        border: 0;
        @include text-align(center);

        a {
          @include padding(8px, 0, 0, 0);
          width: 100%;
          text-transform: uppercase;
          outline-color: transparent;
        }
      }

      .ui-state-default.oa_editor_tab{
        background: #e5e5e5 none;
        a {
          color: $edx-gray-d3;
        }
      }

      .ui-state-active.ui-state-default.oa_editor_tab:hover,
      .ui-state-active.oa_editor_tab {
        background: $edx-gray-d2 none;
        a {
          color: $white;
        }
      }

      .ui-state-default.oa_editor_tab:hover{
        background-color: $edx-gray-t3;
      }
    }
  }

  #openassessment_validation_alert{
    width: 100%;
    @include border-top-left-radius(2px);
    @include border-top-right-radius(2px);
    background-color: #323232;
    border-bottom: 3px solid rgb(192, 172, 0);
    padding: 10px;
    position: absolute;
    z-index: 10;
    max-height: 200px;

    .openassessment_alert_icon{
      position: absolute;
      top: 35%;
      font-size: 200%;
      @include left(3%);
    }

    .openassessment_alert_icon:before{
      font-family: FontAwesome;
      content: "\f071";
      display: inline-block;
      color: rgb(192, 172, 0);
      @include float(left);
      height: 0;
      width: 0;
    }
    .openassessment_alert_header {
      width: 85%;
      @include margin(0, 5%, 0, 10%);

      .openassessment_alert_title {
        width: auto;
        color: white;
      }

      .openassessment_alert_message {
        font-size: 80%;
        color: darkgray;
      }
    }

    // with cancel
    .openassessment_alert_close {
      display: inline-block;
      position: absolute;
      top: 0px;
      @include right(0px);
      color: #e9e9e9;
      @include text-align(center);
      margin: 5px 10px;

      [class^="icon"] {
        width: auto;
        margin: 0;
        padding: 2px;
      }

      &:hover {
        color: $blue;
      }
    }
  }

  .oa_editor_content_wrapper {
    height: Calc(100% - 42px);
    width: 100%;
    @include border-radius(3px);
    border: 1px solid $edx-gray-d1;
    background-color: white;
    overflow-y: scroll;
    position: absolute;
    bottom: 0;
    z-index: 11;

    transition: height 1s ease-in-out 0;
    -webkit-transition: height 1s ease-in-out 0;
    -moz-transition: height 1s ease-in-out 0;
  }

  #openassessment_rubric_editor {
    width: 100%;
    height: 100%;
  }

  #oa_basic_settings_editor {
    #openassessment_title_editor_wrapper{
      label{
        width: 25%;
        @include text-align(left);
      }
      input{
        width: 45%;
        min-width: 100px;
      }
    }
  }

  #openassessment_step_select_description{
    @include padding(10px, 10px, 0, 10px);
    font-size: 80%;
    border-top: 1px solid $edx-gray-d1;
    margin: 7.5px;
  }

  .openassessment_assessment_module_settings_editor.openassessment_shrink_for_drag{
    height: 40px;
  }

  #ai_training_examples{
    @include margin(5px, 20px, 10px, 10px);
    height: 300px;
    width: Calc(100% - 20px);
    resize: none;
    font: inherit;
    line-height: 110%;
    font-size: 80%;
    padding: 5px 10px;
  }

  .openassessment_assessment_module_settings_editor{
    @include padding(0, 15px, 0, 0);
    margin: 10px;
    border: 1px solid $edx-gray-l3;
    @include border-radius(3px);
    position: relative;
    background-color: white;

    .drag-handle{
      position: absolute;
      background: center $edx-gray-t1;
      display: block;
      top: 0px;
      @include right(0px);
      z-index: 10;
      width: 15px;
      height: 100%;
      @include border-left(1px solid $edx-gray-l3);
      cursor: move;
      @include transition(none);
    }

    .openassessment_description_closed{
      @include padding(5px, 15px, 5px, 15px);
      font-size: 75%;
      margin: 0;
    }
    .openassessment_description{
      @include padding(5px, 15px, 0, 15px);
      font-size: 75%;
      margin: 0;
    }

  }

  .openassessment_assessment_module_settings_editor.ui-sortable-helper{
    opacity: 50%;
    border-color: #009fe6;
  }

  .openassessment_assessment_module_settings_editor:hover {
    border-color: $blue;
    .drag-handle {
      background-color: #009fe6;
      border-color: #009fe6;
      @include transition(none);
    }
  }

  .openassessment_description{
    font-size: 75%;
    margin: 0;
  }

  .openassessment_inclusion_wrapper{
    background-color: $edx-gray-t1;
    margin: 0;
    @include padding(7px, 5px, 7px, 13px);
    @include border-top-left-radius(2px);
    @include border-top-right-radius(2px);

    label{
      cursor: pointer;
      @include margin-left(($baseline-h/4));
    }
  }

  .openassessment_inclusion_wrapper:hover{
    background-color: $edx-gray-t2;
  }

  label{
    @include padding-right(10px);
  }

  .xblock_actions {
     background-color: $edx-gray-l2;
     position: absolute;
     width: 100%;
     bottom: 0;
   }

  .openassessment_tab_instructions {
      background-color: $edx-gray-t1;
      border-bottom: 1px solid $edx-gray-d1;
      padding: 10px;
  }

  .openassessment_container_header {
    margin: ($baseline-v/2) ($baseline-h/4);
    padding-bottom: $baseline-v/4;
    border-bottom: 1px solid;
    overflow: auto;
    color: $edx-gray-d2;
  }

  .action.expand-collapse {
    @include float(left);
    .ui-toggle-expansion {
      color: $edx-gray-d2;
      cursor: pointer;
    }
    .ui-toggle-expansion:hover {
      color: $edx-gray-d1;
      cursor: pointer;
    }
  }

  .openassessment_container_header_title_box {
    @include float(left);
    width: 80%;
    display: inline-block;
  }

  .openassessment_container_header_title {
    text-transform: uppercase;
    cursor: default;
    padding-top: 2px;
  }

  .openassessment_container_guide {
    @extend %t-small;
  }

  .openassessment_container_remove_button{
    cursor: pointer;
    h2:after{
      font-family: FontAwesome;
      content: "\f00d";
      display: inline-block;
      color: inherit;
      margin: 0 5px;
    }
    h2{
      text-transform: uppercase;
      font-size: 80%;
      @include float(right);
      display: inline-block;
      padding: 3px 8px 3px 13px;
    }
    @include float(right);
  }
  .openassessment_container_remove_button:hover{
    background-color: $edx-gray-d2;
    border-radius: 4px;
    color: white;
  }

  .openassessment_container_add_button {
    h6:before{
      font-family: "FontAwesome";
      display: inline-block;
      @include margin-left(5px);
      @include margin-right(10px);
      width: auto;
      height: auto;
      content: "\f067";
    }

    background-color: white;
    border: 1px solid;
    border-radius: 4px;
    text-align: center;
    color: #009fe6;
    padding: 10px;
    margin: 15px 10px;
  }

  .openassessment_container_add_button.openassessment_highlighted_field {
    color: red;
    border-width: 2px;
  }

  .openassessment_container_add_button:hover {
    color: white;
    background-color: #009fe6;
    cursor: pointer;
  }

  .openassessment_container_remove_button.is--disabled,
  .openassessment_container_remove_button.is--disabled:hover,
  .openassessment_container_add_button.is--disabled,
  .openassessment_container_add_button.is--disabled:hover {
    color: $edx-gray-l2;
    background-color: transparent;
    cursor: auto;
  }

  #oa_prompts_editor_wrapper {

    .wrapper-comp-settings {
      display: block;
    }

    .openassessment_prompt_description {
      width: 100%;
      min-height: 100px;
      resize: none;
      border: 1px solid #b2b2b2;
      border-radius: 4px;
      padding: 10px;
      font-family: $f-sans-serif;
      font-size: 14px;
      overflow: auto;
      -webkit-box-shadow: none;
      -moz-box-shadow: none;
      box-shadow: none;
    }

    .openassessment_prompt_description.openassessment_highlighted_field {
      border: 2px solid red;
    }
  }

  #oa_rubric_editor_wrapper{

    .wrapper-comp-settings{
      display: block;
    }

    .openassessment_criterion {

      .openassessment_criterion_add_option {
        h2:before {
          font-family: FontAwesome;
          content: "\f067";
          display: inline-block;
          margin: 0 5px;
        }
        @include text-align(center);
        border: 1px solid;
        color: #009fe6;
        background-color: white;
        padding: 7.5px;
        @include margin(10px, 10px, 10px, 20px);
        @include border-radius(3px);
        cursor: pointer;
      }

      .openassessment_criterion_add_option:hover{
        background-color: #009fe6;
        color: white;
      }

      .openassessment_criterion_basic_editor{
        .comp-setting-entry{
          @include padding-right(0);
          @include margin-right(10px);
          overflow: auto;

          .wrapper-comp-settings{
            label{
              padding: 0;
              margin: 0;
              width: 100%;

              input{
                font-size: 11px;
                @include float(right);
                width: 70%;
              }
            }
            .openassessment_criterion_prompt{
              padding: 10px;
              @extend .openassessment_large_text_input;
              width: 70%;
              @include float(right);
            }
            .openassessment_criterion_prompt.openassessment_highlighted_field{
              border: 2px solid red;
            }
          }
        }
      }

      .openassessment_criterion_feedback_wrapper{

        .openassessment_criterion_feedback_header {
          background-color: $edx-gray-l2;
          padding: 5px;
          margin: 10px;
          @include border-radius(3px);

        }

        label{
          width: 100%;
          select{
            @include float(right);
            @include margin-right(24%);
          }
        }

        .openassessment_criterion_feedback_direction{
          label{
            @include margin-left(15px);
          }
        }
      }
    }

    .openassessment_criterion_option{
      @include padding(5px, 5px, 5px, 15px);

      .openassessment_criterion_option_remove_button{
        @extend .openassessment_container_remove_button;
      }

      .openassessment_option_header{
        background-color: $edx-gray-t1;
        @include padding(5px, 5px, 5px, 10px);
        @include margin(5px, 5px, 8px, 5px);
        @include border-radius(3px);
        overflow: auto;

        .openassessment_option_header_title{
          cursor: default;
          @include float(left);
          @include padding(2.5px, 0, 0, 5px);
        }

        .openassessment_option_header_remove{
          @extend .openassessment_container_remove_button;
        }
      }

      .openassessment_criterion_option_point_wrapper{
        width: 30%;
        border-top: none;
        @include padding(10px, 5px, 10px, 0px);
        @include float(left);
        margin: 0;

        .wrapper-comp-setting{
          min-width: 150px;
        }

        label{
          width: 100%;
          @include padding-left(Calc((100% - 150px)/2));
          margin: 0;
          @include float(right);

          input{
            min-width: 50px;
            padding: 10px;
            @include float(right);
            width: 30%;
            font-size: 11px;
          }
        }
      }

      .openassessment_criterion_option_name_wrapper{
        @include float(left);
        width: 70%;
        @include padding(10px, 10px, 10px, 20px);
        border-top: 0;
        margin: 0;

        label{
          width: 100%;
          vertical-align: middle;
          padding: 0;
          margin: 0;

          input{
            padding: 10px;
            font-size: 11px;
            width: 56%;
            @include float(right);
          }
        }
      }

      .openassessment_criterion_option_explanation_wrapper{
        @include padding(15px, 5px, 0px, 20px);
        width: 100%;
        display: inline-block;
        margin: 0;

        label {
          width: 100%;
          @include text-align(left);
          margin: 0;

          textarea {
            padding: 10px;
            @extend .openassessment_input_styling;
            height: 70px;
            width: 69.5%;
            @include float(right);
          }
        }
      }
    }

    .openassessment_large_text_input{
      height: 70px;
      width: 70%;
      @extend .openassessment_input_styling;
    }

    .openassessment_input_styling{
      resize: none;
      box-sizing: border-box;
      border: 1px solid #b2b2b2;
      border-radius: 2px;
      background-image: -webkit-linear-gradient(#F2F2F2,#FFF);
      background-image: -moz-linear-gradient(#F2F2F2,#FFF);
      background-image: linear-gradient(#F2F2F2,#FFF);
      @include single-box-shadow(0, 1px, 2px, 0, rgba(0, 0, 0, 0.1), inset);
      font-family: 'Open Sans', sans-serif;
      font-size: 11px;
      color: #4c4c4c;
    }

    #openassessment_rubric_feedback_wrapper{
      padding: 0;


      #openassessment_rubric_feedback_header{
        background-color: $edx-gray-t1;
        @include padding(7.5px, 7.5px, 7.5px, 15px);
        @include margin(10px, 10px, 0, 10px);
        border-radius: 3px;
      }

      label{
        padding-top: 10px;
      }

      textarea{
        padding: 10px;
        @extend .openassessment_large_text_input;
        width: 70%;
        @include float(right);
      }
    }
  }


  hr{
    background-color: transparent;
    color: $edx-gray-d3;
    height: 1px;
    border: 0px;
    clear: both;
  }

}

//For Both of these, we use high specificity to overload the previous styles
//without the important tag.
.modal-lg.modal-window.confirm.openassessment_modal_window{
  height: 80%;
  top: 10%;
  min-width: 600px;
}

.openassessment_full_height.edit-xblock-modal,
.openassessment_full_height.xblock-editor,
.openassessment_full_height.xblock.xblock-studio_view.xblock-initialized,
[class*="view-"] .modal-lg.modal-editor .openassessment_full_height.modal-content
{
  height: 100%;
}

#openassessment-editor {
  .openassessment_highlighted_field{
     border-color: red;
     border-width: 2px;
  }
}

#student_training_settings_editor {

  .openassessment_training_example {
    padding: 5px;
    .openassessment_training_example_header {
      margin: 10px;
      padding: 5px;
      border-bottom: 1px solid;
      overflow: auto;
      color: $edx-gray-d2;

      .openassessment_training_example_header_title {
        text-transform: uppercase;
        width: 50%;
        display: inline-block;
        @include float(left);
        padding-top: 2px;
      }

      .openassessment_training_example_remove {
        @include padding(3px, 5px, 3px, 7px);
        cursor: pointer;
        border-radius: 4px;

        h2:after {
          font-family: FontAwesome;
          content: "\f00d";
          display: inline-block;
          color: inherit;
          margin: 0 5px;
        }
        h2 {
          text-transform: uppercase;
          font-size: 80%;
          @include float(right);
          display: inline-block;
        }
        @include float(right);
      }

      .openassessment_training_example_remove:hover {
        background-color: lightgray;
      }

    }

    .openassessment_training_example_body {
      @include padding(0, 15px, 15px, 15px);
      position: relative;
      overflow: scroll;
      .openassessment_training_example_essay_wrapper {
        width: 58%;
        display: inline-block;
        position: absolute;
        @include left(15px);
        height: 100%;
        textarea {
          min-height: 90px;
          height: Calc(100% - 35px);
          resize: none;
          box-sizing: border-box;
          border: 1px solid #b2b2b2;
          border-radius: 2px;
          @include padding(6px, 8px, 8px, 8px);
          background-color: white;
          @include single-box-shadow(0, 1px, 2px, 0, rgba(0, 0, 0, 0.1), inset);
          font-family: 'Open Sans', sans-serif;
          font-size: 11px;
          color: #4c4c4c;
          @include margin(5px, 15px, 0, 10px);
          width: Calc(100% - 25px);
        }
      }

      .openassessment_training_example_scored_rubric {
        width: 40%;
        display: inline-block;
        @include float(right);
        min-height: 150px;
        .openassessment_training_example_criteria_selections {
          .comp-setting-entry {
            .wrapper-comp-setting{
              min-width: 100px;
            }
            margin: 0;
            padding: 10px;
            label{
              width: 100%;
              @include margin-left(0);
              select {
                width: 60%;
                @include float(right);
              }
            }
          }
        }
      }
    }
  }

  .openassessment_add_training_example {
    color: #009fe6;
    @include text-align(center);
    padding: 5px;
    border: 1px solid;
    border-radius: 4px;
    margin: 10px;
  }

  .openassessment_add_training_example:hover {
    color: white;
    background-color: #009fe6;
    cursor: pointer;
  }

  .openassessment_add_training_example:before {
    font-family: "FontAwesome";
    display: inline-block;
    width: auto;
    height: auto;
    content: "\f067";
    margin: 0 10px;
  }
}

#openassessment-editor .wrapper-comp-settings .list-input.settings-list .field.comp-setting-entry select {
  padding: 5px;
}

//---------------------------
// Developer Styles for Image Submission
//---------------------------

.step--response {

  .action--upload {
    @extend %btn--secondary;
    @extend %action-2;
    @include text-align(center);
    @include float(right);
    display: inline-block;
    margin: ($baseline-v/2) 0;
    box-shadow: none;

  }

  .file--upload {
    margin: $baseline-v ($baseline-v/2);
  }
}
.self-assessment__display__header
.self-assessment__display__title,
.peer-assessment__display__header
.peer-assessment__display__title,
.staff-assessment__display__header
.staff-assessment__display__title,
.submission__answer__display
.submission__answer__display__title{
  margin: 10px 0;
}


.self-assessment__display__image,
.peer-assessment__display__image,
.staff-assessment__display__image,
.submission__answer__display__image{
  @extend .submission__answer__display__content;
  max-height: 400px;
  @include text-align(left);
  overflow: auto;
  img{
    max-height: 100%;
    max-width: 100%;
  }
}
.submission__answer__display__image
.submission--image{
  max-height: 250px;
  max-width: 100%;
}

#openassessment__leaderboard {
  font-family: "Open Sans","Helvetica Neue",Helvetica,Arial,sans-serif;

  .step__counter, .step__counter:before {
    display: none;
  }

  .step__title {

    .wrapper--copy{
      @include margin-left(0);
      @include padding-left(0);
      @include border-left(0);
      width: 100%;
    }
  }

  .step__label, .grade__value {
    display: inline-block;
    vertical-align: middle;
  }

  .step__label {
    @include margin-right(($baseline-h/4));
  }

  .leaderboard__title{
    @extend %t-superheading;
    color: $heading-primary-color;
  }

  .list.leaderboard__score__list{
    list-style-type: none;

    li.leaderboard__score__item {
      margin: 15px 0;

      .leaderboard__list__number{
        display: inline-block;
        background: $edx-gray-d2;
        color: white;
        @include padding(5px, 5px, 3px, 5px);
        font-size: 16px;
        min-width: 35px;
        @include text-align(center);
        @include border-top-right-radius(2px);
        @include border-top-left-radius(2px);
      }

      .leaderboard__score__image{
        max-height:150px;
        max-width:100%;
        @include margin-right(20px);
        margin-bottom: 20px;
        @include float(left);
      }

      .leaderboard__score__title{
        font-size: 15px;
        color: $edx-gray-l1;
        text-transform: uppercase;
        display: inline-block;
        @include padding-left(15px);
      }

      .leaderboard__answer{
        border-top: 2px solid $edx-gray-d2;
        @include single-box-shadow(0, 0, 3px, 1px, rgba(10, 10, 10, 0.1), inset);
        padding: 10px;
        max-height: 200px;
        overflow-y: scroll;
        font-size: 14px;
      }
    }
  }
}
