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

.main-column {
  clear: both;
  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 40px 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;


      .title {
        margin: 0 0 15px 0;
        color: $mediumGrey;

        .value {
        }
      }

      &.new-component-item {
        padding: 20px;
        border: none;
        border-radius: 3px;
        background: $lightGrey;

        .new-component-button {
          display: block;
          padding: 20px;
          text-align: center;
          color: #6d788b;
        }

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

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

        .new-component-type {
          a,
          li {
            display: inline-block;
          }

          a {
            width: 100px;
            height: 100px;
            margin-right: 10px;
            margin-bottom: 10px;
            border-radius: 8px;
            font-size: 13px;
            line-height: 14px;
            text-align: center;
            @include box-shadow(0 1px 1px rgba(0, 0, 0, .2), 0 1px 0 rgba(255, 255, 255, .4) inset);

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

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

          .cancel-button {
            @include white-button;
          }

          // specific menu types
          &.new-component-problem {

            .ss-icon, .editor-indicator {
              display: inline-block;
            }
          }
        }

        .new-component-type,
        .new-component-template {
          @include clearfix;

          a {
            position: relative;            
            border: 1px solid $darkGreen;
            background: tint($green,20%);
            color: #fff;            
            @include transition(background-color .15s);

            &:hover {
              background: $brightGreen;
            }
          }
        }

        .new-component-template {
          margin-bottom: 20px;

          li:last-child {
            a {
              border-radius: 0 0 3px 3px;
              border-bottom: 1px solid $darkGreen;
            }
          }

          li:nth-child(2) {
            a {
              border-radius: 3px 3px 0 0;
            }
          }

          a {
            @include clearfix();
            display: block;
            padding: 7px 20px;
            border-bottom: none;
            font-weight: 300;

            .name {
              float: left;

              .ss-icon {
                @include transition(opacity .15s);
                position: relative;
                top: 1px;
                font-size: 13px;
                margin-right: 5px;
                opacity: 0.5;
              }
            }

            .editor-indicator {
              @include transition(opacity .15s);
              float: right;
              position: relative;
              top: 3px;
              font-size: 12px;
              opacity: 0.3;
            }

            .ss-icon, .editor-indicator {
              display: none;
            }

            &:hover {

              .ss-icon {
                opacity: 1.0;
              }

              .editor-indicator {
                opacity: 1.0;
              }
            }
          }

          // specific editor types 
          .empty {
            @include box-shadow(0 1px 3px rgba(0,0,0,0.2));
            margin-bottom: 10px;

            a {
              border-bottom: 1px solid $darkGreen;
              border-radius: 3px;
              font-weight: 500;
              background: $green;
            }
          }
        }

        .new-component {          
          text-align: center;

          h5 {
            color: $green;
          }
          
        }
      }
    }
  }

  .component {
    border: 1px solid $lightBluishGrey2;
    border-radius: 3px;
    background: #fff;
    @include transition(none);

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

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

    &.editing {
      border: 1px solid $lightBluishGrey2;
      z-index: auto;
      
      .drag-handle,
      .component-actions {
        display: none;
      }
    }

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

    .component-actions {
      position: absolute;
      top: 7px;
      right: 9px;
    }

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

  .xmodule_display {
    padding: 40px 20px 20px;
    overflow-x: auto;

    h1 {
      float: none;
      margin-left: 0;
    }
  }

  .wrapper-component-editor {
    z-index: 9999;
    position: relative;
  }

  .component-editor {
    @include edit-box;
    @include box-shadow(none);
    display: none;
    padding: 20px;
    border-radius: 2px 2px 0 0;

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

      li {
        margin-bottom: 10px;
      }

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

    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;
  }
}

// editing units from courseware
body.unit {

  .component {
    padding-top: 30px;

    .component-actions {
      @include box-sizing(border-box);
      position: absolute;
      width: 100%;
      padding: 15px;
      top: 0;
      left: 0;
      border-bottom: 1px solid $lightBluishGrey2;
      background: $lightGrey;
    }

    &.editing {
      padding-top: 0;
    }
  }
}
