/*
Sidebar.scss
==========================================================================
sidebar.scss styles all of the right sidebar content
*/

$icon_size: 18px;

/*
add a margin to sidebar content
this offsets the persistent header & ensures long content is inside the viewport
*/
.sidebar-inner {
  padding-bottom: 120px;
}

/* IE8 requires both the margin and padding to offset the header*/
.lt-ie9 {
  .secondary-content {
    padding-bottom: 140px;
  }
}

/*
Sidebar
=======
*/
.secondary-content {
  font-size: 0.875em;
  @include sans-font-regular;

  /* reset the margin and padding of all sidebar lists*/
  ul,
  li {
    @include reset;
  }

/*
Sidebar Expandables
-------------------
*/

  // @todo generalize this so that the id isn't required
  .expandable, #definition .group {
    cursor: pointer;
    background-color: $gray_lightest;
    width: 100%;

    &.has-content {
      background-color: $blue_lightest;
    }

    h4 {
      display: inline-block;
    }

    a {
      float: right;
      font-size: $icon_size;
      line-height: 40px;
      margin-right: 25px;
    }
  }

  header {
    &.expandable a:before {
      @extend .cf-icon;
      content: '\e003';
      color: $blue_light;
    }

    &.open a:before {
      @extend .cf-icon;
      content: '\e007';
      color: $blue_light;
    }
  }

  .open-definition header a:before {
    @extend .cf-icon;
    content: '\e107';
    color: $blue_light;
  }

  /*
  Helpers
  -------------------
  */
  .sidebar-subsection {
    border-bottom: 1px solid $gray_light;
    padding-bottom: 28px;
    padding-top: 28px;
  }

  .sidebar-subsection:first-child {
    padding-top: 0;
  }

  .sidebar-subsection:last-child {
    border-bottom: none;
    padding-bottom: 10px;
  }
}


/*
Sidebar Headers
===============
*/
// @todo - this is used by definitions but _not_ by other sidebar headers.
// Combine
.open-definition {

  &.spinner {
    background: $gray_lightest url('../img/blue_spinner.gif') no-repeat center right;
    background-position-x: 92%;

    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
      background: $gray_lightest url('../img/blue_spinner@2x.gif') no-repeat center right;
      background-position-x: 92%;
      background-size: 19px 19px;
    }
  }
}

/*
Regs Meta
===============
Regs Meta contains the sub-content meta data found in the sidebar
*/

.expand-drawer,
.expandable {
  @include border-bottom-light;
}

.regs-meta {

  // Headers within the sidebar should be <h4>
  h4 {
    padding: 0 10px;
    font-size: 1em * $sans_font_scale_factor;
    line-height: 40px;
    margin: 0;
    letter-spacing: 1px;
    color: $gray_darkest;
    @include sans-font-regular;

    &.important {
      color: $red;
    }

  }

  h5 {
    font-size: 16px * $sans_font_scale_factor;
    margin: 0;
  }

  /* We either use a subtitle + "What's this?" or an inline explanation
     paragraph to describe what this panel is used for */
  .subtitle {
    display: inline-block;
    margin: 0;
    @include sans-font-regular;
    font-size: 1em;
    text-transform: none;
    padding-right: 10px;
  }

  .explanation {
    color: $gray_light;
    margin: 0;
  }

  .divided-list {
    margin-top: 12px;
    border-top: 1px solid $gray_light;

    li {
      display: block;
      @include border-bottom-light;
      padding: 0.5em;
    }
  }

  .chunk {
    padding: 1em;

    /* add a top border to IE8 since it does not recognize .last-child to remove the bottom border*/
    .lt-ie9 & {
      li:first-child a:link {
        @include border-top-light;
      }
    }
  }

  #sxs-list .sxs-link {
    @include sans-font-bold;
    color: $black;
    text-decoration: none;

    .cf-icon-right {
      float: right;
      font-size: $icon_size;
      line-height: 2;
      color: $gray_light;
    }

    &:hover, &:active {
      text-decoration: none;
      color: $blue_light;

      .cf-icon-right {
        color: $blue_light;
      }
    }
  }
}

/*
Definitions
===========
When open definitions appear in the right sidebar
*/

.sidebar-inner .open-definition,
.spinner {
  @include border-bottom-light;
}

.open-definition ol,
.active-term {
  @include sans-font-bold;
}

.open-definition {


  p {
    font-family: $body_font;
    font-weight: normal;
  }

  & > p {
    clear: left;
  }

  header {
    border-bottom: 1px solid $gray_light;
  }

  .definition-text,
  .definition-warning {
    padding: 1em;

    p {
      margin-top: 0;
      line-height: 1.7em;
    }

    &.inactive,
    &.inactive a.citation.definition {
      color: $gray;
    }
  }

  .definition-warning {
    color: $red;
    border-bottom: 1px solid $gray_light;
    margin: 0 1em;
    padding: 1em 0 0 0;

    p {
      @include sans-font-regular;
      font-size: .9em;
    }

    .msg {
      padding-bottom: 0;
      border-bottom: none;
    }
  }

  .msg {
    width: 85%;
    float: left;
    border-bottom: 1px solid $gray_dark;
    padding-bottom: 1em;
  }

  .update-definition {
    display: inline;
  }
}

#definition .error {
  padding: 1em;
}

.js .expand-drawer.start-collapsed {
  display: none;
}

/*
continue links */
.update-definition {
  @include sans-font-bold;
  display: inline-block;
  margin: 0 15px 0 0;
}

/*
Help Text
===========
Styles for the UI help slide down
*/

.help-title {
  margin: 0;
  padding-right: 10px;
  display: inline-block;
  padding-bottom: 0;
}

.help-list {
  li {
    margin-top: 15px;
    color: $gray_darkest;
  }

  .cf-icon-right {
    margin-top: -4px;
  }

  .modified {
    border-right: 8px solid $green_light;
  }

  .deleted {
    border-right: 8px solid $red_light;
    text-decoration: line-through;
    color: $gray;
  }
}

.help-list {
  margin-bottom: 15px;
}

.help-list li img {
  padding-bottom: 10px;
  padding-top: 5px;
}

.help-icon {
  display: inline-block;
  width: 40px;
  padding: 10px;
  margin-right: 15px;
  border-radius: 4px;
  background-color: $gray_lightest;
  text-align: center;
  vertical-align: middle;
}

.help-sample {
  width: 60px;
  display: block;
  float: left;
  font-family: $body_font;
}

.help-text {
  float: left;
}

.sample-menu {
  display: block;
  background: $gray_lightest;
  padding: 15px;
  border-bottom: 1px solid $gray_light;
}

.sample-menu:first-child {
  border-top: 1px solid $gray_light;
}

#print_part {
  .group {
    background-color: $gray_lightest;
    @include border-bottom-light;
  }

  .cf-icon-print {
    float: right;
    color: $action_color;
    // The print icon is a bit smaller than chevrons; enlarge it
    font-size: $icon_size + 3;
    line-height: 40px;
    margin-right: 15px;
  }
}

/*
Small screens
---------------
*/

@media only screen and (max-width: 480px) {
  .sidebar-inner {
    padding-bottom: 30px;
  }
}

@media only screen and (max-width: 780px) {
  .secondary-content {
    position: static;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    border-left: none;
    padding-left: 40px;

    .regs-meta {
      width: 100%;
      float: left;
    }

    /* reset expandable styles */
    .expandable {
      h4 {
        font-size: .875em;
      }

      a {
        margin-right: 25px;
      }
    }
  }

  .regs-meta {
    border-top: 1px solid $gray_light;
  }

  /*
  Definitions
  ------------
  definitions are positioned in a fixed window at the bottom of the viewport
  */
  .open-definition {
    position: fixed;
    top: 60%;
    bottom: 0;
    left: 0;
    min-width: 100%;
    min-height: 200px;
    padding: 0 20px 80px 50px;
    background: $gray_lightest;
    @include border-top-light($width: 2px);
    z-index: 200;
    overflow-y: scroll;

    .definition-text {
      border-bottom: none;
    }

    .definition-warning {
      border-bottom: 0;
    }
  }

  .lt-ie9 {
    .definition-text {
      padding-bottom: 160px;
    }
  }
}

@media only screen and (max-width: 860px) {
  // Prevent expandables from going to two lines for as long as possible
  .secondary-content {
    .expandable {
      h4 {
        font-size: 0.75em;
      }

      a {
        margin-right: 10px;
      }
    }
  }

  #print_part .cf-icon-print {
    margin-right: 0;
  }
}
