// Open edX: Studio layout
// =======================
//
// Note: these styles replicate the Studio styles directly
// rather than benefiting from any Bootstrap classes. Ideally
// the layouts should be reimagined using Bootstrap and then
// these styles will no longer be necessary.

.content-wrapper {
  margin-top: $baseline;

  .course-tabs {
    padding-bottom: 0;

    .nav-item {
      &.active, &:hover{
        .nav-link {
          border-bottom-color: $brand-primary;
          color: $brand-primary;
        }
      }

      .nav-link {
        padding: $baseline/2 $baseline*3/4 $baseline*13/20;
        border-style: solid;
        border-width: 0 0 $baseline/5 0;
        border-bottom-color: transparent;

        @media (max-width: map-get($grid-breakpoints, md)) {
          border: none;
          text-align: left;
          padding: 0 0 $baseline/2 0;
        }
      }
    }
  }

  .main-container {
    border: 1px solid $inverse-color;
    background-color: $body-bg;

    .page-header {
      border-bottom: 1px solid $inverse-color;
      padding: 20px;
    }

    .page-content {
      padding: 20px;
    }
  }

  &.container-fluid {
    max-width: $studio-max-width;
  }
}

// studio - elements - layouts
// ====================

// layout - basic
// the wrapper around the viewable page area, excluding modal and other extra-view content
.wrapper-view {

}

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

// layout - basic page header
.wrapper-mast {
  margin: ($baseline*1.5) 0 0 0;
  padding: 0 $baseline;
  position: relative;

  .mast,
  .metadata {
    @include clearfix();
    position: relative;
    max-width: $studio-max-width;
    width: flex-grid(12);
    margin: 0 auto $baseline auto;
    color: $gray-dark;
  }

  .mast {
    border-bottom: 1px solid $gray-light;
    padding-bottom: ($baseline/2);

    // layout without actions
    .page-header {
      width: flex-grid(12);
    }

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

      .page-header {
        float: left;
        width: flex-grid(6,12);
        margin-right: flex-gutter();
      }

      .nav-actions {
        position: relative;
        bottom: -($baseline*0.75);
        float: right;
        width: flex-grid(6,12);
        text-align: right;

        .nav-item {
          display: inline-block;
          vertical-align: top;
          margin-right: ($baseline/2);

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

        // buttons
        .button {
          @extend %btn-primary-blue;
          @extend %sizing;

          .action-button-text {
            display: inline-block;
            vertical-align: baseline;
          }

          .icon {
            display: inline-block;
            vertical-align: baseline;
          }

          // CASE: new/create button
          &.new-button,
          &.button-new {
            @extend %btn-primary-green;
            @extend %sizing;
          }
        }
      }
    }

    // layout with actions
    &.has-subtitle {

      .nav-actions {
        bottom: -($baseline*1.5);
      }
    }

    // layout with breadcrumb navigation
    &.has-navigation {

      .nav-actions {
        bottom: -($baseline*1.5);
      }

      .navigation-item {
        @extend %cont-truncated;
        display: inline-block;
        vertical-align: bottom; // correct for extra padding in FF
        max-width: 250px;
        color: $gray-dark;

        &.navigation-current {
          @extend %ui-disabled;
          color: $gray;
          max-width: 250px;

          &:before {
            color: $gray;
          }
        }
      }

      .navigation-link:hover {
        color: $brand-primary;
      }

      .navigation-item:before {
        content: " / ";
        margin: ($baseline/4);
        color: $gray;

        &:hover {
          color: $gray;
        }
      }

      .navigation .navigation-item:first-child:before {
        content: "";
        margin: 0;
      }
    }
  }

  // CASE: wizard-based mast
  .mast-wizard {

    .page-header-sub {
      @extend %t-title4;
      color: $gray;
      font-weight: 300;
    }

    .page-header-super {
      @extend %t-title4;
      float: left;
      width: flex-grid(12,12);
      margin-top: ($baseline/2);
      border-top: 1px solid $gray-lighter;
      padding-top: ($baseline/2);
      font-weight: 600;
    }
  }

  // page metadata/action bar
  .metadata {

  }
}

// layout - basic page content
.wrapper-content {
  margin: 0;
  padding: 0 $baseline;
  position: relative;
}

.content {
  @include clearfix();
  @extend %t-copy-base;
  max-width: $studio-max-width;
  width: flex-grid(12);
  margin: 0 auto;
  color: $gray-dark;

  header {
    position: relative;
    margin-bottom: $baseline;
    border-bottom: 1px solid $gray-lighter;
    padding-bottom: ($baseline/2);

    .title-sub {
      @extend %t-copy-sub1;
      display: block;
      margin: 0;
      color: $gray-light;
    }

    .title-1 {
      @extend %t-title3;
      @extend %t-strong;
      margin: 0;
      padding: 0;
      color: $gray-dark;
    }
  }
}

// 3/4 - 1/4 two col layout
%two-col-1 {
  .content-primary {
    float: left;
    margin-right: flex-gutter();
    width: flex-grid(9,12);
    box-shadow: none;
    border: 0;
    background-color: $white;
  }

  .content-supplementary {
    float: left;
    width: flex-grid(3,12);
  }
}


// layout - primary content
.content-primary {

  .title-1 {
    @extend %t-title3;
  }

  .title-2 {
    @extend %t-title4;
    margin: 0 0 ($baseline/2) 0;
  }

  .title-3 {
    @extend %t-title6;
    margin: 0 0 ($baseline/2) 0;
  }

  header {
    @include clearfix();

    .title-2 {
      width: flex-grid(5, 12);
      margin: 0 flex-gutter() 0 0;
      float: left;
    }

    .tip {
      @extend %t-copy-sub2;
      width: flex-grid(7, 12);
      float: right;
      margin-top: ($baseline/2);
      text-align: right;
      color: $gray-dark;
    }
  }
}

// layout - supplemental content
.content-supplementary {

  > section {
    margin: 0 0 $baseline 0;
  }
}

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

// layout - grandfathered
.main-wrapper {
  position: relative;
  margin: 0 ($baseline*2);
}

.inner-wrapper {
  @include clearfix();
  position: relative;
  max-width: 1280px;
  margin: auto;

  > article {
    clear: both;
  }
}

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

.sidebar {
  float: right;
  width: 28%;
}

.left {
  float: left;
}

.right {
  float: right;
}
