// studio - views - container
// ==========================
// The container view renders xblocks at three levels: Page Level, Nesting Level, and Element Level.

// For containers rendered at the element level, the container is rendered in a way that allows the user to navigate to a separate container page for that container making its children populate the nesting and element levels.

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

// view-specific utilities
// --------------------
%status-value-base {
  @extend %t-title7;
  @extend %t-strong;
}

%status-value-sub1 {
  @extend %t-title8;
  display: block;
}

// UI: container page view
// --------------------
.view-container {
  @extend %two-col-1;

  .wrapper-mast {

    .mast {
      border-bottom: none;
      padding-bottom: 0;

      .page-header {

        .page-header-title {
          @extend %t-title4;
          @extend %t-strong;
        }

        .is-editable {

          // TOOD: abstract this out into a Sass placeholder
          .incontext-editor-input {
            @include transition(box-shadow $tmg-f1 ease-in-out 0, color $tmg-f1 ease-in-out 0);
            @extend %t-title4;
            @extend %t-strong;
            width: 100%;
            background: none repeat scroll 0 0 $white;
            border: 0;
            box-shadow: 0 0 2px 2px $shadow inset;

            // STATE: focus
            &:focus {
              box-shadow: 0 0 2px 2px rgba($ui-action-primary-color-focus, 0.50) inset;
              color: $ui-action-primary-color-focus;
            }
          }
        }
      }

      &.has-actions {

        .nav-actions {

          .button {
            @extend %t-action3;
            @extend %t-regular;
            padding: ($baseline/4) ($baseline*0.75);
          }
        }
      }
    }
  }

  .content-primary {

    .no-container-content {
      @extend %no-content;
      padding: ($baseline*1.5) ($baseline*2);

      // custom rules to reuse xblock validation styling in ui-well context
      .fa-warning {
        display: none;
      }
    }

    .container-message {

      .message {
        border-radius: 3px 3px 0 0;
      }
    }

    // dragging bits
    .ui-sortable-helper {

      article {
        display: none;
      }
    }

    // drop target
    .component-placeholder {
      height: ($baseline*2.5);
      opacity: .5;
      margin: $baseline;
      background-color: $gray-l5;
      border-radius: ($baseline/2);
      border: 2px dashed $gray-l2;
    }
  }

  .content-supplementary {

    label {
      @extend %t-title8;
    }

    // UI: publishing details/summary
    .bit-publishing {
      @extend %bar-module;

      // CASE: content is ready to be made live
      &.is-ready {
        @extend %bar-module-green;
      }

      // CASE: content is live
      &.is-live {
        @extend %bar-module-blue;
      }

      // CASE: content has warnings
      &.has-warnings {
        @extend %bar-module-yellow;
      }

      // CASE: content has erors
      &.has-errors {
        @extend %bar-module-red;
      }

      // CASE: content is staff only
      &.staff-only,
      &.is-staff-only {
        @extend %bar-module-black;

        &.is-scheduled .wrapper-release .copy {
          text-decoration: line-through;
        }
      }

      // CASE: content is gated
      &.is-gated {
        @extend %bar-module-black;
      }

      .bar-mod-content {
        border: 0;
        padding: ($baseline/2) ($baseline*0.75) ($baseline/4) ($baseline*0.75);

        .title {
          margin-bottom: ($baseline/10);
        }
      }

      .wrapper-last-draft {

        .date,
        .user {
          @extend %t-strong;
        }

        .user {
          @extend %cont-text-wrap;
        }
      }

      .wrapper-release {

        .release-date {
          @extend %status-value-base;
        }

        .release-with {
          @extend %status-value-sub1;
        }
      }

      .wrapper-visibility {

        .copy {
          @extend %status-value-base;
          margin-bottom: ($baseline/10);
        }

        .icon {
          color: $gray-d1;
        }

        .inherited-from {
          @extend %status-value-sub1;
        }

        // UI: note about specific access
        .note-visibility {
          @extend %status-value-sub1;

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

      .wrapper-pub-actions {
        border-top: 1px solid $gray-l4;
        margin-top: ($baseline/2);
        padding: $baseline ($baseline*0.75) ($baseline*0.75) ($baseline*0.75);

        .action-publish {
          @extend %btn-primary-blue;
          display: block;
          padding: ($baseline/4) ($baseline/2) ($baseline/3) ($baseline/2);
        }

        .action-discard {
          @extend %t-copy-sub1;
          display: block;
          margin-top: ($baseline/2);
          text-align: right;

          &.is-disabled {
            pointer-events: none;
            color: $gray-l1;
          }
        }
      }
    }

    // versioning widget
    .unit-publish-history {

      .wrapper-last-publish {
        margin-bottom: $baseline;
        padding: ($baseline*0.75);
        background-color: $white;

        .copy {
          @extend %t-copy-sub2;
          color: $gray;
        }

        .date,
        .user {
          @extend %t-strong;
        }

        .user {
          @extend %cont-text-wrap;
        }
      }
    }

    // location widget
    .unit-location, .library-location {
      @extend %bar-module;
      border-top: none;

      .wrapper-unit-id, .wrapper-library-id {

        .unit-id-value, .library-id-value {
          @extend %status-value-base;
          display: inline-block;
          width: 100%;
        }

        .tip {
          @extend %t-copy-sub2;
          display: inline-block;
          margin: ($baseline/4) 0;
          color: $gray-l2;
        }
      }

      .wrapper-unit-tree-location {

        .item-title {
          @extend %cont-text-wrap;

          a {
            color: $blue;

            &:hover {
              color: $orange-d1;
            }
          }
        }

        // CASE: is current item being edited/viewed
        .is-current {
          background: $gray-l4;

          .unit-title a {
            @extend %ui-disabled;
            @extend %t-strong;
            color: $color-heading-base;
          }
        }

        // typographical overrides (based off of outline-simple)
        .section-header, .subsection-header {
          line-height: 0;
          margin-bottom: ($baseline/2);
        }

        .section-header {
          border-bottom: 1px solid $gray-l4;
          padding-bottom: ($baseline/2);
        }

        // subsections overrides (based off of outline-simple)
        .outline-subsection {
          border: none;
          padding: 0;
        }

        // units overrides (based off of outline-simple)
        .outline-unit {
          padding: 3px 6px;
        }
      }
    }
  }
}
