.unit .main-wrapper,
.subsection .main-wrapper {
  margin: 40px;
}

.main-column {
  float: left;
  width: 70%;
}

.unit-body.published {
  .components > li {
    border: none;

    .rendered-component {
      padding: 0 20px;
    }
  }
}

.unit-body {
  .breadcrumbs {
    border-radius: 3px 3px 0 0;
    border-bottom: 1px solid #cbd1db;
    @include linear-gradient(top, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 70%);
    background-color: #edf1f5;
    @include box-shadow(0 1px 0 rgba(255, 255, 255, .7) inset);
    @include clearfix;

    li {
      float: left;
    }

    a,
    .current-page {
      display: block;
      padding: 15px 35px 15px 30px;
      font-size: 14px;
      background: url(../img/breadcrumb-arrow.png) no-repeat right center;
    }
  }

  h2 {
    margin: 30px 0;
    color: #646464;
    font-size: 19px;
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .components {
    > li {
      position: relative;
      z-index: 10;
      margin: 20px 40px;
      border: 1px solid #d1ddec;
      border-radius: 3px;
      background: #fff;
      @include transition(none);

      &:hover {
        border-color: #6696d7;

        .drag-handle,
        .component-actions a {
          background-color: $blue;
        }

        .drag-handle {
          border-color: $blue;
        }
      }

      &.editing {
        border-color: #3c3c3c;
        box-shadow: 0 0 30px rgba(0, 0, 0, .5);
        position: relative;
        z-index: 99999;
        @include transition(all);

        .drag-handle,
        .component-actions {
          display: none;
        }

        .html-preview {
          display: none;
        }
      }

      &.component-placeholder {
        border-color: #6696d7;
      }

      .xmodule_display {
        padding: 40px 20px 20px;
      }

      .component-actions {
        position: absolute;
        top: 4px;
        right: 4px;
        @include transition(opacity .15s);
      }

      .edit-button,
      .delete-button {
        float: left;
        padding: 3px 10px 4px;
        margin-left: 3px;
        border: 1px solid #fff;
        border-radius: 3px;
        background: #d1ddec;
        font-size: 12px;
        color: #fff;
        @include transition(all .15s);

        &:hover {
          background-color: $blue;
          color: #fff;
        }

        .edit-icon,
        .delete-icon {
          margin-right: 4px;
        }
      }

      .drag-handle {
        position: absolute;
        display: block;
        top: -1px;
        right: -16px;
        z-index: -1;
        width: 15px;
        height: 100%;
        border-radius: 0 3px 3px 0;
        border: 1px solid #d1ddec;
        background: url(../img/white-drag-handles.png) center no-repeat #d1ddec;
        cursor: move;
        @include transition(all .15s);
      }

      &.new-component-item {
        border: none;
        border-radius: 3px;
        background: $lightGrey;
        @include clearfix;

        h5 {
          margin-bottom: 22px;
          color: $blue;
          font-weight: 700;
          text-align: center;
        }

        .rendered-component {
          display: none;
          background: #fff;
          border-radius: 3px 3px 0 0;
        }

        .new-component-type, .new-component-template {
          text-align: center;
          @include clearfix;

          li {
            display: inline;
          }

          a {
            position: relative;
            display: inline-block;
            width: 100px;
            height: 100px;
            margin-right: 10px;
            margin-bottom: 10px;
            border-radius: 8px;
            border: 1px solid #437fbf;
            background-color: $blue;
            font-size: 13px;
            line-height: 14px;
            color: #fff;
            text-align: center;
            @include box-shadow(0 1px 1px rgba(0, 0, 0, .25), 0 1px 0 rgba(255, 255, 255, .4) inset);
            @include transition(background-color .15s);

            &:hover {
              @include box-shadow(0 1px 1px rgba(0, 0, 0, .4), 0 1px 0 rgba(255, 255, 255, .4) inset, 0 0 20px rgba(255, 255, 255, .3) inset);
            }

            .name {
              position: absolute;
              bottom: 5px;
              left: 0;
              width: 100%;
              padding: 10px;
              @include box-sizing(border-box);
            }
          }
        }

        .new-component-template {
          a {
            height: 60px;
          }
        }

        .new-component,
        .new-component-templates {
          padding: 20px;
          @include clearfix;

          .cancel-button {
            @include blue-button;
            border-color: #30649c;
          }
        }

        .new-component-templates {
          display: none;
        }
      }
    }
  }

  .xmodule_display {
    padding: 10px 20px;
  }

  .editor {
    position: relative;
    background: $blue;
    padding: 20px;

    h5 {
      color: #fff;
      margin-bottom: 20px;
      font-weight: 700;
    }

    label {
      display: inline-block;
      width: 130px;
      color: #fff;
    }

    input {
      border-color: #3c3c3c;
    }

    .row {
      border-bottom: none;
      padding-bottom: 0;
      margin-bottom: 15px;

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

    .video-id-field,
    .transcript-field {
      width: 300px;
    }

    .browse-button {
      @include blue-button;
      border-color: #3c3c3c;
      font-size: 12px;
    }

    .save-button {
      @include orange-button;
      margin: 10px 8px 0 0;
      border-color: #3c3c3c;
    }

    .cancel-button {
      @include white-button;
      border-color: #3c3c3c;
    }

    .problem-settings-button {
      @include blue-button;
      @include box-sizing(border-box);
      width: 100%;
      padding: 12px 0 14px;
      text-align: center;

      &.is-open {
        border-radius: 0 0 3px 3px;
      }

      .settings-icon {
        margin-right: 10px;
      }
    }

    .editor-bar {
      position: relative;
      @include linear-gradient(top, #d4dee8, #c9d5e2);
      padding: 5px;
      border: 1px solid #3c3c3c;
      border-radius: 3px 3px 0 0;
      border-bottom-color: #a5aaaf;
      @include clearfix;

      a {
        display: block;
        float: left;
        padding: 3px 10px 7px;
        margin-left: 7px;
        border-radius: 2px;

        &:hover {
          background: rgba(255, 255, 255, .5);
        }
      }

      .editor-tabs {
        position: absolute;
        top: 10px;
        right: 10px;

        li {
          float: left;
        }

        .tab {
          height: 24px;
          padding: 7px 20px 3px;
          border: 1px solid #a5aaaf;          
          border-radius: 3px 3px 0 0;
          @include linear-gradient(top, rgba(0, 0, 0, 0) 87%, rgba(0, 0, 0, .06));
          background-color: #e5ecf3;
          font-size: 13px;
          color: #3c3c3c;
          box-shadow: 1px -1px 1px rgba(0, 0, 0, .05);

          &.current {
            background: #fff;
            border-bottom-color: #fff;
          }
        }

        .cheatsheet-toggle {
          width: 21px;
          height: 21px;
          padding: 0;
          margin: 3px 5px 0 16px;
          border-radius: 22px;
          border: 1px solid #a5aaaf;
          background: #e5ecf3;
          font-size: 13px;
          font-weight: 700;
          color: #565d64;
          text-align: center;
        }
      }
    }

    .problem-settings {
      display: none;
      padding: 20px 30px;
      background: rgba(0, 0, 0, .1);
      border: 1px solid #437fbf;
      border-bottom: none;
      border-radius: 3px 3px 0 0;
    }

    .CodeMirror {
      font-size: 13px;
      border: 1px solid #3c3c3c;
      border-top: none;
      background: #fff;
      color: #3c3c3c;
    }
  }

  .html-editor {
    .row {
      position: relative;
    }

    textarea {
      display: none;
    }

    .CodeMirror {
      display: none;
      position: absolute;
      top: 47px;
      width: 100%;
      height: 378px;
      @include box-sizing(border-box);
    }

    .editor-tabs {
      position: absolute;
      top: 31px;
      right: 30px;
      z-index: 99;

      li {
        float: left;
      }

      .tab {
        display: block;
        height: 24px;
        padding: 7px 20px 3px;
        margin-left: 7px;
        border: 1px solid #a5aaaf;          
        border-radius: 3px 3px 0 0;
        @include linear-gradient(top, rgba(0, 0, 0, 0) 87%, rgba(0, 0, 0, .06));
        background-color: #e5ecf3;
        font-size: 13px;
        color: #3c3c3c;
        box-shadow: 1px -1px 1px rgba(0, 0, 0, .05);

        &.current {
          background: #fff;
          border-bottom-color: #fff;
        }
      }
    }
  }

  .html-preview,
  .discussion-preview {
    padding: 20px 30px;
  }

  .discussion-id-field {
    width: 350px;
  }

  .discussion-module {
    position: relative;
    margin: 20px 0;
    padding: 20px;
    height: 40px;
    background: #f6f6f6 !important;
    border-radius: 3px;

    .discussion-show {
      position: relative;
      top: 3px;
      font-size: 14px;
      text-align: center;
      color: #3c3c3c;

      &.shown {
        .show-hide-discussion-icon {
          background-position: 0 0;
        }
      }

      .show-hide-discussion-icon {
        display: inline-block;
        position: relative;
        top: 5px;
        margin-right: 6px;
        width: 21px;
        height: 19px;
        background: url(../img/show-hide-discussion-icon.png) no-repeat;
        background-position: -21px 0;
      }
    }

    .new-post-btn {
      display: inline-block;
      float: right;
      height: 35px;
      padding: 0 15px;
      border-radius: 3px;
      border: 1px solid #2d81ad;
      @include linear-gradient(top, #6dccf1, #38a8e5);
      font-size: 13px;
      font-weight: 700;
      line-height: 32px;
      color: #fff;
      text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
      box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 1px 1px rgba(0, 0, 0, .15);

      &:hover {
        border-color: #297095;
        @include linear-gradient(top, #4fbbe4, #2090d0);
      }
    }

    .new-post-icon {
      display: block;
      float: left;
      width: 16px;
      height: 17px;
      margin: 7px 7px 0 0;
      background: url(../img/new-post-icon.png) no-repeat;
    }
  }  

  .component-editor {
    @include edit-box;
    display: none;
    padding: 20px;
    border-radius: 2px 2px 0 0;
    @include linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .1));
    background-color: $blue;
    color: #fff;
    @include box-shadow(none);

    .metadata_edit {
      margin-bottom: 20px;
      font-size: 13px;

      li {
        margin-bottom: 10px;
      }

      label {
        display: inline-block;
        margin-right: 10px;  
      }
    }

    .CodeMirror {
      border: 1px solid #3c3c3c;
      background: #fff;
      color: #3c3c3c;
    }

    h3 {
      margin-bottom: 10px;
      font-size: 18px;
      font-weight: 700;
    }

    h5 {
      margin-bottom: 8px;
      color: #fff;
      font-weight: 700;
    }

    .save-button {
      margin-top: 10px;
      margin: 15px 8px 0 0;
    }
  }
}

.unit-settings {
  .window-contents {
    padding: 10px 20px;
  }

  .unit-actions {
    border-bottom: none;
    padding-bottom: 0;
  }

  .published-alert {
    display: none;
    padding: 10px;
    border: 1px solid #edbd3c;
    border-radius: 3px;
    background: #fbf6e1;
    font-size: 14px;
    line-height: 1.4;

    div {
      margin-top: 15px;
    }
  }

  input[type="radio"] {
      margin-right: 7px;
  }

  .status {
    font-size: 12px;

    strong {
      font-weight: 700;
    }
  }

  .preview-button, .view-button {
    @include white-button;
    margin-bottom: 10px;
  }

  .publish-button {
    @include orange-button;
  }

  .delete-button {
    @include blue-button;
  }

  .delete-draft {
    display: inline-block;
  }

  .delete-button,
  .preview-button,
  .publish-button,
  .view-button {
    font-size: 11px;
    margin-top: 10px;
    padding: 6px 15px 8px;
  }
}

.unit-history {
  &.collapsed {
    h4 {
      border-bottom: none;
      border-radius: 3px;
    }

    .window-contents {
      display: none;  
    }
  }

  ol {
    border: 1px solid #ced2db;

    li {
      display: block;
      padding: 6px 8px 8px 10px;
      background: #edf1f5;
      font-size: 12px;

      &:hover {
        background: #fffcf1;

        .item-actions {
          display: block;
        }
      }

      &.checked {
        background: #d1dae3;
      }

      .item-actions {
        display: none;
      }

      input[type="radio"] {
        margin-right: 7px;
      }
    }
  }
}

.unit-location {
  .url {
    width: 100%;
    margin-bottom: 10px;
    @include box-shadow(none);
  }

  .draft-tag,
  .hidden-tag,
  .private-tag,
  .has-new-draft-tag {
    font-size: 8px;
  }

  .window-contents > ol {
    @include tree-view;

    .section-item {
      display: inline-block;
      width: 100%;
      font-size: 11px;
      padding: 2px 8px 4px;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;
      @include box-sizing(border-box);
    }

    ol {
      .section-item {
        padding-left: 20px;
      }

      .new-unit-item {
        margin-left: 20px;
      }
    }

    ol ol {
      .section-item {
        padding-left: 34px;
      }

      .new-unit-item {
        margin: 0 0 10px 41px;
      }
    }
  }
}

.edit-state-draft {
  .visibility,
  .edit-draft-message,
  .view-button {
    display: none;
  }

  .published-alert {
    display: block;
  }
}

.edit-state-public {
  .delete-draft,
  .component-actions,
  .new-component-item,
  .editing-draft-alert,
  .publish-draft-message,
  .preview-button {
    display: none;
  }

  .published-alert {
    display: block;
  }

  .drag-handle {
    display: none !important;
  }
}

.edit-state-private {
  .delete-draft,
  .publish-draft,
  .editing-draft-alert,
  .create-draft,
  .view-button {
    display: none;
  }
}

.simple-editor-cheatsheet {
  position: absolute;
  top: 0;
  left: 100%;
  width: 0;
  border-radius: 0 3px 3px 0;
  @include linear-gradient(left, rgba(0, 0, 0, .1), rgba(0, 0, 0, 0) 15px);
  background-color: #fff;
  overflow: hidden;
  @include transition(width .3s);

  &.shown {
    width: 300px;
  }

  .cheatsheet-wrapper {
    width: 240px;
    padding: 20px 30px;
  }

  h6 {
    margin-bottom: 7px;
    font-size: 15px;
    font-weight: 700;
  }

  .row {
    @include clearfix;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid #ddd !important;

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

  .col {
    float: left;

    &.sample {
      width: 60px;
      margin-right: 30px;
    }
  }

  pre {
    font-size: 12px;
    line-height: 18px;
  }

  code {
    padding: 0;
    background: none;
  }
}