@import "defs.less";


/****************************************************************************
 * Review-specific macros
 ****************************************************************************/

/* Keep the label from shifting when the pencil icon is hidden/shown. */
.inline-editor-label() {
  display: block;
  line-height: 16px;
  vertical-align: top;
}

.rich-text-loading() {
  color: transparent;
  background: white url("../images/spinner.gif") no-repeat @box-padding @box-padding;
}


/****************************************************************************
 * Actions
 ****************************************************************************/
.actions-container {
  background: @review-request-actions-bg;
  border-bottom: 1px @review-request-actions-border-color solid;
  float: right;
  width: 100%;
  .border-radius(@box-inner-border-radius @box-inner-border-radius 0 0);

  &>ul {
    min-height: 2em;
  }
}


.actions {
  float: right;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;

  a {
    color: black;
    cursor: pointer;
    display: block;
    text-decoration: none;
    padding: 6px 10px;

    border-left: 1px @review-request-action-border-color solid;
  }

  img {
    vertical-align: middle;
  }

  li {
    float: left;
    margin: 0;
    padding: 0;

    &:hover {
      background-color: @review-request-action-hover-bg;
    }

    &:active {
      background-color: @review-request-action-active-bg;
    }

    &.primary {
      background-color: @review-request-action-primary-bg;
    }

    &.primary:hover {
      background-color: @review-request-action-primary-hover-bg;
    }

    &.primary:active {
      background-color: @review-request-action-primary-active-bg;
    }
  }

  .menu {
    background: @review-request-action-menu-bg;
    border: 1px @review-request-action-menu-border-color solid;
    float: none;
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    z-index: @z-index-menu;
    .border-radius(0 0 @box-border-radius @box-border-radius);
    .box-shadow(@box-shadow);

    li {
      background: @review-request-action-bg;
      border: 0;
      float: none;
      margin: 0;
      padding: 0;

      &:last-child {
        .border-radius(0 0 @box-border-radius @box-border-radius);
      }

      &:hover {
        background-color: @review-request-action-menu-item-hover-bg;
      }

      a {
        color: black;
        border: 0;
        display: block;
        margin: 0;
        padding: 8px 10px;
        text-decoration: none;
      }
    }
  }
}

.actions>li:last-child {
  .border-radius(0 @box-inner-border-radius 0 0);
}


/****************************************************************************
 * Code Mirror
 ****************************************************************************/
.CodeMirror {
  border: @textarea-border;
  height: auto;
  margin: @textarea-editor-margin;

  .CodeMirror-lines {
    padding: @textarea-editor-padding;
  }

  .CodeMirror-scroll {
    overflow-y: hidden;
    overflow-x: auto;
  }

  pre {
    padding: 0;
  }

  .cm-header {
    color: black;
  }

  .cm-comment {
    color: #4444cc;
  }

  .cm-variable-2 {
    color: black;
  }
}


/****************************************************************************
 * Review Request Box
 ****************************************************************************/
.markdown-info {
  color: blue;
  font-size: 8pt;
  font-weight: normal;
  float: right;
  line-height: 25px;
  margin-right: 0.5em;
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }
}

.review-request {
  /*
   * Any changes to this need to be reflected in _resizeLayout in
   * reviewRequestEditorView.js
   */
  @details-width: 300px;

  background-color: #fefadf;
  background-image: url('../images/review_request_box_top_bg.png');

  label {
    color: @review-request-label-color;
    font-weight: bold;
  }

  noscript form {
    margin: 10px 5px 5px 5px;
    text-align: right;
  }

  textarea {
    border: @textarea-border;
    height: 1.5em;
    overflow: hidden;
  }

  .box-inner {
    background-image: url('../images/review_request_box_bottom_bg.png');
  }

  .content {
    padding: @box-padding;
    position: relative;

    &.sliding {
      margin-top: -5px;
    }

    img {
      border: none;
    }

    .editable.loading {
      .rich-text-loading();
    }

    .field-container {
      position: relative;

      &>pre {
        .pre-wrap;
        background-color: #FFFFFF;
        border: @textarea-border;
        margin: @textarea-editor-margin;
        padding: @textarea-editor-padding;
      }
    }
  }

  .content-divider {
    border-top: 1px #C2C1B0 solid;
  }

  .inline-editor-form {
    &.summary-editor {
      margin-top: -2px;
      margin-left: -3px;
    }

    input[type='text']:not(:focus) {
      .box-shadow(0px 0px 4px rgba(255, 0, 0, .75));
    }
  }

  .main {
    clear: both;
    padding: 0;
  }

  #required-field-legend {
    color: darkRed;
    font-weight: bold;
    padding: @box-padding;
  }

  .controls {
    list-style: none;
    margin: 0;
    padding: 0 8px 4px 8px;
    text-align: right;

    a {
      color: black;
      text-decoration: none;

      &:hover {
        color: #0000C0;
      }
    }

    li {
      display: inline;
      padding-left: 8px;
    }

    .rb-icon {
      vertical-align: bottom;
    }
  }

  .header {
    padding: @box-padding;
  }

  .star {
    float: left;
    margin-right: 10px;
  }

  #review_request_details {
    border-spacing: 0px;
    float: right;
    width: @details-width;
    padding: @box-padding;

    a {
      color: @review-request-link-color;
      text-decoration: none;
    }

    th {
      color: #39350b;
      font-weight: bold;
      text-align: left;
      white-space: nowrap;
    }

    tbody {
      td, th {
        padding: 0;
        vertical-align: top;
      }

      th, td .field {
        padding-top: 3px;
      }

      td {
        padding-left: 1em;

        span {
          display: inline-block;
          margin-right: 4px;
          word-wrap: break-word;
        }

        .editicon {
          margin-left: 0;
        }
      }

      th {
        padding-bottom: 1.5em;
        padding-left: 1em;
        text-align: right;
        white-space: nowrap;
      }
    }

    thead {
      &.first-fieldset th {
        padding-top: 0;
      }

      th {
        color: @review-request-label-color;
        font-size: 120%;
        padding: 2em 0 1em 0;
      }
    }

    #target_people .inactive {
      text-decoration: line-through;
    }

    .buttons {
      display: block;
      margin-bottom: 1em;
      padding: 6px 0 0 0;

      input {
        font-size: 11px;
      }
    }
  }

  #review_request_extra {
    clear: both;

    h3 {
      color: @review-request-label-color;
      font-size: 120%;
      margin: 0;
      padding: 0;
    }

    label.textarea-label {
      display: block;
      min-height: 16px;

      img {
        vertical-align: middle;
      }
    }
  }

  #review_request_main {
    margin-right: @details-width;
    position: relative;

    label {
      font-size: 120%;
    }
  }

  #review-request-warning {
    background-color: @review-request-warning-bg;
    border: 1px solid @review-request-warning-border-color;
    display: none;
    font-weight: bold;
    padding: 5px;
    text-align: center;
  }

  #diff_revision {
    font-weight: bold;
    text-align: right;
    vertical-align: bottom;
  }

  #status {
    color: #39350b;
    margin: 5px 0;
  }

  #summary_wrapper {
    @line-height: 2.6em;

    line-height: @line-height;
    padding: 0;

    label, #field_summary {
      font-size: 14px;
    }

    label {
      margin-right: 0.5em;
    }

    .rb-icon-edit {
      vertical-align: text-bottom;
    }

    #field_summary {
      display: inline;

      a {
        color: black;
        text-decoration: none;
      }
    }
  }

  .actions-container {
    .star {
      margin: 5px 0 0 5px;
    }
  }

  #updated_time, #created_time {
    text-align: right;
    vertical-align: bottom;
  }

  .editicon {
    text-decoration: none;
  }

  .required-flag {
    color: @required-flag-color;
    font-size: 10px;
    font-weight: bold;
    padding: 0 2px;
  }
}

#review_request_form {
  input[type='text'], textarea {
    width: 400px;
  }
}


/****************************************************************************
 * Review UIs
 ****************************************************************************/
.review-ui-box {
  &.has-review-ui-box-content .actions-container {
    .border-radius(@box-inner-border-radius @box-inner-border-radius 0 0);

    .actions > li:last-child {
      .border-radius(0 @box-inner-border-radius 0 0);
    }
  }

  .actions-container {
    .border-radius(@box-inner-border-radius);

    .actions > li:last-child {
      .border-radius(0 @box-inner-border-radius @box-inner-border-radius 0);
    }
  }

  .review-ui-box-content {
    clear: both;
    padding: 0;
  }
}


/****************************************************************************
 * Reviews
 ****************************************************************************/

.box {
  &.collapsed {
    .body {
      display: none;
    }

    .banner {
      margin-bottom: 0;
    }
  }

  .collapse-button {
    border: 1px #333333 solid;
    cursor: pointer;
    float: left;
    margin-right: 0.5em;
    margin-top: -1px;
    padding: 0;
  }
}

.review {
  .box {
    background-color: #e9edf5;
    background-image: url('../images/review_box_top_bg.png');
  }

  .banner {
    margin-top: 10px;

    &.floating {
      border-top: 0;
      margin-top: 0;
    }
  }

  .body {
    background-color: #FAFAFA;
    border: 1px #AAAAAA solid;
    clear: both;
    margin: 5px;
    padding: 10px;

    pre {
      .pre-wrap;
    }

    .comment-text:target {
      background-color: #E7EDF3;
      border: 1px solid @dark-blue;
      padding: 1em;
    }

    .body_top, .body_bottom {
      margin: 0;
    }
  }

  .box-inner {
    background-image: url('../images/review_box_bottom_bg.png') !important;
    min-height: 32px;
  }

  .controls {
    list-style: none;
    margin: 0;
    padding: 0 8px 4px 8px;
    text-align: right;

    a {
      text-decoration: none;
    }

    li {
      display: inline;
    }
  }

  .comments, .review-comments {
    border: 0;

    dd {
      margin-bottom: 20px;
    }

    dt thead th {
      font-weight: normal;
    }

    .filename a {
      color: black;
      font-weight: bold;
    }

    .file-attachment {
      background: #F0F0F0;
      border: 1px #C0C0C0 solid;
      padding: 5px;

      .file-attachment-comment-header {
        font-size: 120%;
        white-space: nowrap;

        a {
          text-decoration: none;
        }

        img {
          padding-right: 10px;
          vertical-align: middle;
        }

        .caption {
          color: black;
          margin: 5px 0 0 32px;
        }

        .filename {
          color: black;
          font-weight: bold;
          margin: 0;
          vertical-align: middle;
        }
      }

      .thumbnail {
        margin-top: 0.5em;
      }
    }

    .screenshot {
      background: #F0F0F0;
      border: 1px #C0C0C0 solid;
      font-size: 120%;

      img {
        padding: 5px;
      }

      .filename {
        display: block;
        margin: 0;
        padding: 5px 10px;
      }
    }

    .sidebyside th {
      /*
       * The line numbers aren't clickable in the comment fragments in reviews,
       * so show a standard cursor instead of a pointer cursor.
       */
      cursor: initial;
    }
  }

  .diff-error tbody {
    border: 1px @diff-error-border-color solid;
  }

  .header {
    padding: 2px 4px 4px 4px;

    a {
      color: black;
      text-decoration: none;
    }
  }

  .reviewer {
    float: left;
    font-weight: bold;
    padding-top: 2px;

    a {
      position: relative;
    }
  }

  .posted_time {
    text-align: right;
    padding-top: 2px;
  }

  .reply-comments {
    margin: 20px 0 0 0;
    padding: 0;

    &>li {
      display: inline;

      &.draft {
        dt label a {
          color: #4e9a06;
        }
      }

      dl {
        border-left: 2px #D0D0D0 solid;

        /*
         * Set a border-bottom to prevent a bug in IE where, without a
         * border-bottom, the content of the dl will shift left by the
         * border-left size for every following item.
         */
        border-bottom: 1px #FAFAFA solid;
        margin: 0;
        padding: 5px;

        dt {
          label {
            .inline-editor-label();

            a {
              color: #AB5603;
              font-size: 1.1em;
              font-weight: bold;
              text-decoration: none;
            }
          }

          span {
            color: #487858;
            font-weight: normal;
          }
        }

        dd {
          margin-left: 10px;
        }
      }
    }
  }

  .shipit {
    background: #aeff60;
    border: 1px #888888 solid;
    font-weight: bold;
    left: -10px;
    margin-bottom: 8px;
    padding: 4px 8px;
    position: relative;
    width: 4.5em;
    top: -8px;
    .border-radius(@box-border-radius 0 @box-border-radius 0);

    &.with-issues {
      border: 1px darken(@issue-opened-bg, 70%) solid;
      color: #205003;
      width: 11em;
      #gradient > .vertical-three-colors(@issue-opened-bg, @issue-opened-bg, 25%,
                                         darken(@issue-opened-bg, 30%));
    }
  }
}

.sidebyside.loading {
  /* Helps us better keep the size, as long as the comment is within a chunk. */
  padding: 2px 2px 1px 2px;
  width: 100%;

  tbody {
    background: #F3F3F3 url("../images/spinner.gif") no-repeat center center;

    td {
      padding: 1em;
    }
  }
}


/****************************************************************************
 * Change Descriptions
 ****************************************************************************/
#field_changedescription {
  .pre-wrap;
  background-color: @textarea-editor-background;
  border: @textarea-border;
  margin: @textarea-editor-margin;
  padding: @textarea-editor-padding;

  &.loading {
    .rich-text-loading();
  }
}

.changedesc {
  &.box {
    background-color: #fefadf;
    background-image: url('../images/review_request_box_top_bg.png');
  }

  .body {
    clear: both;
    padding: @box-padding;

    &>ul {
      list-style: none;
      margin: 1em 0 1em 0;
      padding: 0;

      &>li {
        margin: 3em 0 0 0;

        &:first-child {
          margin-top: 0;
        }
      }
    }

    a {
      color: default;
      text-decoration: none;

      &:hover {
        text-decoration: underline;
      }
    }

    /* Field labels */
    h3 {
      color: @review-request-label-color;
      font-size: 110%;
      margin: 1em 0 0.5em 0;
      padding: 0;

      &.status {
        /* Add some separation between this and the other fields. */
        margin-bottom: 2em;

        &:last-child {
          /*
           * If it's the last child, we don't want that separation, or it'll
           * have an odd amount of extra space.
           */
          margin-bottom: 0.5em;
        }

        .value {
          color: black;
          font-weight: normal;
        }
      }
    }

    /* Used in the textarea field diffs and the Change Summary section. */
    > pre {
      background-color: #FFFFFF;
      border: @textarea-border;
      padding: @textarea-editor-padding;
      font-size: 9pt;
      .pre-wrap;
    }

    /*
     * File attachment/screenshot change lists.
     *
     * These differ from the other field change lists in that they have
     * mini-section labels underneath for each file.
     */
    .caption-changed {
      margin: 2em 0 0 2em;
      padding: 0;

      a {
        /* Treat the link like a field. */
        font-weight: bold;
      }

      td, th {
        vertical-align: top;
      }

      td {
        padding-left: 1em;
      }

      th {
        text-align: right;
      }
    }

    /* Displays changes for field values, with "-" and "+" markers. */
    .changed {
      border: @textarea-border;
      border-collapse: collapse;
      display: inline-block;
      margin: 0;
      padding: 0;
      vertical-align: top;

      a {
        color: blue;
        text-decoration: none;

        &:first-child {
          margin-left: 0;
        }

        &:hover {
          text-decoration: underline;
        }
      }

      td, th {
        font-family: @textarea-font-family;
        padding: 0.3em 0.6em;
      }

      td {
        background: #FEFEFE;
      }

      .new-value .marker {
        background: @diff-insert-linenum-color;
      }

      .old-value .marker {
        background: @diff-delete-linenum-color;
      }
    }

    /* The "Change Summary" section. */
    .changedesc-text {
      margin-bottom: 2em;

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

    /* The diff for text areas. */
    .diffed-text-area {
      background: white;
      border: @textarea-border;
      border-collapse: collapse;
      padding: 0;
      width: 100%;

      a {
        text-decoration: underline;
      }

      pre {
        background: none;
        border: 0;
        margin: 0;
        padding: 0;
        .pre-wrap;
      }

      td {
        font-family: @textarea-font-family;
        padding: 2px 4px;
        vertical-align: top;
        .pre-wrap;
      }

      .delete {
        .line {
          background: @diff-delete-color;
        }

        /* The '-' or '+' marker. */
        .marker {
          color: #990000;
          background: @diff-delete-linenum-color;
        }
      }

      .insert {
        .line {
          background: @diff-insert-color;
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-insert-linenum-color;
        }
      }

      .line {
        width: 100%;

        /*
         * Make sure any images in the Markdown-rendered text are kept
         * small, but with the correct aspect ratio.
         */
        img {
          width: auto;
          max-height: 100px;
        }
      }

      /* The '-' or '+' marker. */
      .marker {
        background: #F9F9F9;
        font-family: @textarea-font-family;
        font-size: @textarea-font-size;
        font-weight: bold;
        text-align: center;
      }

      .replace-new {
        .line {
          background: @diff-insert-color;

          .hl {
            background: desaturate(darken(@diff-insert-color, 15%), 30%);
          }
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-insert-linenum-color;
        }
      }

      .replace-old {
        .line {
          background: @diff-delete-color;

          .hl {
            background: desaturate(darken(@diff-delete-color, 10%), 20%);
          }
        }

        /* The '-' or '+' marker. */
        .marker {
          background: @diff-delete-linenum-color;
        }
      }
    }

    /* Styling for the "Diff" field updates. */
    .diff-changes {
      .line-counts {
        margin-left: 0.5em;

        .delete-count {
          color: @diff-delete-line-count-color;
        }

        .insert-count {
          color: @diff-insert-line-count-color;
        }
      }
    }

    /* Styles for the file listing for the "Diff" field. */
    .diff-index {
      margin-bottom: 0;

      .diff-file-icon {
        min-width: 20px;
        min-height: 20px;
      }

      .diff-file-info {
        /* Compensate for the lack of diff-chunks-cell column. */
        width: 100%;
      }
    }

    .primary-fields {
      h3:first-child {
        margin-top: 2em;
      }
    }

    /*
     * Secondary fields are in more of a Field: Value display, with the
     * fields lining up.
     */
    .secondary-fields {
      width: 100%;

      h3 {
        margin: 2px 1em 0 0;
        padding: 0;
        text-align: right;
      }

      &>tbody>tr {
        &>td,
        &>th {
          padding: 0.5em 0;
          vertical-align: top;
          white-space: nowrap;
        }

        &>td {
          /*
           * Between this and the white-space: nowrap above, the field labels
           * will end up taking the minimum size without wrapping, and the
           * rest of the width will be given to the value.
           */
          width: 100%;

          &>p {
            /*
             * If the field value is rendered inside a <p>, make sure it
             * aligns with the field label.
             *
             * Note that the label has a larger font than this, so we can't
             * reuse the same pixel value. We have to bump it.
             */
            &:first-child {
              margin-top: 3px;
            }

            /* Don't take up more room than we need in the last <p>. */
            &:last-child {
              margin-bottom: 0;
            }
          }
        }
      }
    }
  }

  .box-inner {
    background-image: url('../images/review_request_box_bottom_bg.png') !important;
    min-height: 32px;
  }

  .header {
    padding: 2px 4px 4px 4px;

    a {
      color: black;
      text-decoration: none;
    }

    b {
      float: left;
      font-weight: bold;
    }

    .reviewer {
      padding-top: 2px;
    }

    .posted_time {
      text-align: right;
    }
  }
}


/****************************************************************************
 * Updates Bubble
 ****************************************************************************/

#updates-bubble {
  background: #FFF1AB;
  border: 1px #666666 solid;
  bottom: 1px;
  font-size: 110%;
  padding: 0.8em;
  position: fixed;
  right: 1px;

  a, a:visited {
    color: #0000CC;
    text-decoration: none;
  }

  #updates-bubble-buttons {
    margin-left: 2em;
  }
}


/****************************************************************************
 * Review Form
 ****************************************************************************/
#review-form {
  overflow: auto;
  padding: 10px;

  label {
    color: black;
    font-weight: bold;
    margin-top: 10px;
  }

  .edit-field {
    margin: 1em 0;

    .comment-text-field {
      label {
        .inline-editor-label();
      }
    }
  }

  .spinner {
    background: url("../images/spinner.gif") no-repeat center center;
    height: 16px;
    margin: 3em auto;
  }

  #review-form-comments {
    background: none;

    .comments {
      list-style: none;
      margin: 0;
      padding: 0;

      li {
        margin: 2em 0;
        padding: 0;

        .edit-fields {
          margin-left: 4em;
        }
      }
    }
  }
}


/****************************************************************************
 * Uploaded files
 ****************************************************************************/
.file-container {
  &.editing .file {
    .border-radius(@box-border-radius @box-border-radius 0 0);

    .file-caption-container {
      padding-left: 0;
      padding-right: 0;

      .file-caption {
        text-overflow: initial;
      }
    }
  }

  .file {
    @file-attachment-bg: white;
    @file-attachment-width: 300px;
    @file-attachment-border-color: #CCCCCC;

    background-color: #FEFEFE;
    border: 1px @file-attachment-border-color solid;
    display: block;
    float: left;
    position: relative;
    margin: 0 1.5em 1.5em 0;
    max-width: @file-attachment-width;
    width: @file-attachment-width;
    .border-radius(@box-border-radius);
    .box-shadow(@box-shadow);
    .box-sizing(border-box);

    .actions {
      li {
        line-height: 16px;

        &:first-child a {
          .border-radius(0 0 0 @box-inner-border-radius);
        }

        &:last-child a {
          .border-radius(0 @box-inner-border-radius 0 0);
        }

        &:first-child:last-child a {
          .border-radius(0 @box-inner-border-radius 0 @box-inner-border-radius);
        }

        &:hover {
          background: transparent;
        }

        a {
          border-left: 1px #DDD solid;
          border-bottom: 1px #DDD solid;
          color: black;
          padding: 6px 8px;

          &:hover {
            background: #EEEEEE;
            text-decoration: none;
          }
        }
      }
    }

    .file-header {
      @file-header-height: 2.5em;

      background: @file-attachment-bg;
      padding: 0 0.5em;
      line-height: @file-header-height;
      height: @file-header-height;
      .border-radius(@box-border-radius @box-border-radius 0 0);
      .ellipsize();

      a {
        color: blue;
        font-weight: bold;
        text-decoration: none;
      }

      img {
        vertical-align: middle;
      }
    }

    .file-thumbnail-container {
      @thumbnail-height: 100px;

      background: @file-attachment-bg;
      height: @thumbnail-height;
      padding: 1em;
      text-align: center;

      a {
        color: black;
        text-decoration: none;
      }

      pre {
        font-size: x-small;
      }

      .thumbnail-properties () {
        max-height: @thumbnail-height;
        max-width: 100%;
        margin: 0;
        padding: 0;
      }

      .file-thumbnail-overlay {
        .thumbnail-properties();
        position: absolute;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: @z-index-event-overlay;
      }

      .file-thumbnail {
        .thumbnail-properties();
        border: 0;
        overflow: hidden;
        text-align: left;
        white-space: nowrap;
        vertical-align: middle;
      }

      .file-thumbnail-clipped {
        .thumbnail-properties();
        border: 0;
        overflow: hidden;
        text-align: left;
        font-size: 8pt;

        /* Override the styling used for the <pre>s for fields. */
        pre {
          background-color: transparent;
          border: 0;
          margin: 0;
          padding: 0;
        }
      }
    }

    .file-caption-container {
      @caption-height: 31px;

      border-top: 1px #EEEEEE solid;
      line-height: 2.5em;
      padding: 0 30px;
      position: relative;
      text-align: center;
      .border-radius(0 0 7px 7px);

      a {
        color: black;
        text-decoration: none;

        &.empty-caption {
          color: gray;
          font-style: italic;
        }
      }

      .file-caption {
        line-height: @caption-height;
        height: @caption-height;
        .ellipsize();

        .buttons {
          /*
           * This provides enough padding to cleanly cover much of any file
           * attachment's header below.
           */
          @buttons-padding-vert: 5px;

          position: absolute;
          padding: @buttons-padding-vert 0;

          /* Line up with .file's side borders. */
          margin: 0 0 0 -1px;

          text-align: center;
          background: darken(@file-attachment-bg, 5%);
          border: 1px @file-attachment-border-color solid;
          border-top: 0;
          display: block;
          width: @file-attachment-width;
          .border-radius(0 0 @box-border-radius @box-border-radius);
          .box-sizing(border-box);
          .box-shadow(@box-shadow);
          z-index: @z-index-deco;
        }
      }

      .inline-editor-form > input[type='text'] {
        background: transparent;
        border: 0;
        font-family: inherit;
        font-size: inherit;
        height: @caption-height;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;

        /*
         * The 4px is needed to align the input with the text. It matches
         * the margin between the text and pencil.
         */
        padding: 0 @edit-icon-margin 0 0;

        text-align: inherit;
        vertical-align: bottom;
        .box-sizing(border-box);

        &:focus {
          outline: 0;
        }

        /*
         * The box shadow doesn't display correctly in file attachment
         * thumbnails, so hide it. There will be a red background instead.
         */
        &:not(:focus) {
          background: rgba(255, 0, 0, 0.15);
          .box-shadow(none);
        }

        &::-ms-clear {
          display: none;
        }
      }

      .rb-icon-edit {
        vertical-align: middle;
        position: absolute;
        right: 6px;
        bottom: 6px;
      }
    }
  }
}


/****************************************************************************
 * Screenshots
 ****************************************************************************/
.screenshot-caption {
  background-color: #F6F6F6;
  border: 1px #999999 solid;
  border-top: 1px #CCCCCC solid;
  padding: 2px 8px;
  .border-radius(0 0 @box-border-radius @box-border-radius);

  img {
    vertical-align: bottom;
  }
}

.screenshot-container {
  background: white;
  float: left;
  display: inline;
  margin-bottom: 10px;
  margin-right: 10px;
  max-width: 400px;
  min-width: 130px;
  text-align: center;
  vertical-align: middle;
  position: relative;
  .border-radius(@box-border-radius);

  &:hover {
    background-color: #F6F6F6;

    .screenshot-caption {
      background-color: #E6E6E6;
    }
  }

  a {
    color: black;
    text-decoration: none;
  }

  .image {
    border: 1px #999999 solid;
    border-bottom: 0;
    cursor: pointer;
    height: 100px;
    line-height: 100px;
    margin: 0 auto;
    vertical-align: bottom;
    .border-radius(@box-border-radius @box-border-radius 0 0);

    &.loading {
      background: white url("../images/spinner.gif") no-repeat center center;
    }

    img {
      vertical-align: middle;
      .border-radius(@box-inner-border-radius @box-inner-border-radius 0 0);
    }
  }
}


/****************************************************************************
 * Screenshot Thumbnails
 ****************************************************************************/
#screenshot-thumbnails {
  margin: 2px;
  padding: 0.5em;

  &.dragover {
    border: 2px green dashed;
    display: block;
    margin: 0;
  }
}


/****************************************************************************
 * List of Attached Files
 ****************************************************************************/
#file-list {
  margin: 2px;
  padding: 1em 0.5em 0.5em 0.5em;

  &.dragover {
    border: 2px green dashed;
    display: block;
    margin: 0;
  }

  h1.drop-indicator {
    clear: both;
    text-align: center;
  }
}


/****************************************************************************
 * Comment detail dialog
 ****************************************************************************/
.comment-dlg {
  border: 1px black solid;
  cursor: default;
  margin-top: 8px;
  position: absolute;

  form {
    background-color: #aceb6f;
    display: block;
    padding: @comment-dlg-padding;

    .buttons {
      margin: 0;

      input[type="button"] {
        margin-right: (@comment-dlg-padding / 2);
      }
    }
  }

  h1 {
    background: transparent;
    border: 0;
    margin: 0;
    padding: 0;
  }

  img.ui-resizable-grip {
    /* Use -1 for bottom and right so it overlaps the resize borders. */
    bottom: -1px;
    cursor: se-resize;
    padding: 0.5em;
    position: absolute;
    right: -1px;
    z-index: @z-index-deco;
  }

  .comment-dlg-body,
  .comment-dlg-footer,
  .comment-dlg-header {
    position: relative;
  }

  .comment-dlg-footer {
    padding: @comment-dlg-padding 0 0 0;

    .status {
      display: none;
      font-style: italic;
      margin-bottom: @comment-dlg-padding;
    }
  }

  .comment-dlg-header {
    padding: 0 0 @comment-dlg-padding 0;
    line-height: 16px;

    .markdown-info {
      line-height: inherit;
    }
  }

  .comment-dlg-options {
    list-style: none;
    margin: 0;
    padding: @comment-dlg-padding 0 0 0;

    li {
      margin: (@comment-dlg-padding / 2) 0;
      padding: 0;

      &:first-child {
        margin-top: 0;
      }

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

  .other-comments {
    background-color: #a1c0e3;
    border-right: 1px black solid;
    padding: @comment-dlg-padding;

    ul {
      background-color: white;
      border: 1px #333333 solid;
      list-style: none;
      margin: @comment-dlg-padding 0 0 0;
      overflow: auto;
      padding: 0;
      position: relative;

      li {
        padding: @comment-dlg-padding;

        &.even {
          background-color: #F3F3F3;
        }

        h2 {
          font-size: 90%;
          margin: 0 0 @comment-dlg-padding 0;
          padding: 0;

          .actions {
            font-weight: normal;
            right: @comment-dlg-padding;

            a {
              background-color: #EEEEEE;
              border: 1px black outset;
              color: black;
              cursor: pointer;
              text-decoration: none;
              margin-left: @comment-dlg-padding;
              padding: 3px;

              &:hover {
                background-color: #F6F6F6;
              }
            }
          }
        }

        pre {
          .pre-wrap;
          font-size: 90%;
        }
      }
    }
  }

  .text-editor {
    border: @textarea-border;
    margin: 0;

    .CodeMirror, textarea {
      border: 0;
    }
  }

  .ui-icon-gripsmall-diagonal-se {
    background: url('../images/resize-grip.png') no-repeat top left;
  }
}

.issue-state {
  @issue-state-height: 26px;

  font-weight: bold;
  line-height: @issue-state-height;
  min-height: @issue-state-height;
  padding: 0.3em 0.6em 0.3em 0.6em;
  position: relative;

  input, .back-to-issue-summary {
    /*
     * This keeps a consistency with the browser. By default, Chrome uses
     * a margin of 2px, and changing it to 0 actually makes things look
     * off-center.
     */
    margin: 2px 2px 2px 0.2em;
    vertical-align: middle;
  }

  .issue-container {
    position: relative;
  }

  .rb-icon {
    margin: 0 0.2em;
  }

  &.dropped {
    background: @issue-discarded-bg;
    border: 1px solid @issue-discarded-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-discarded-link-color;
    }
  }

  &.open {
    background: @issue-opened-bg;
    border: 1px solid @issue-opened-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-opened-link-color;
    }
  }

  &.resolved {
    background: @issue-resolved-bg;
    border: 1px solid @issue-resolved-border-color;

    .back-to-issue-summary, .back-to-issue-summary:visited {
      color: @issue-resolved-link-color;
    }
  }

  .back-to-issue-summary {
    font-size: 13px;
    font-weight: normal;
    text-decoration: none;
    padding: 0 0.5em;
    position: absolute;
    right: 0;
    height: 24px;
    line-height: 24px;

    &:hover {
      text-decoration: underline;
    }
  }

  .issue-message {
    margin-right: 0.5em;
    vertical-align: middle;
  }
}


/****************************************************************************
 * Banners
 ****************************************************************************/
#discard-banner,
#submitted-banner {
  background: #E0E0E0;
  border: 1px #808080 solid;
  .border-radius(@box-border-radius);
  .box-shadow(@box-shadow);
}

#draft-banner {
  .border-radius(@box-border-radius);
  .box-shadow(@box-shadow);
}

#draft-banner,
#discard-banner,
#submitted-banner {
  p label {
    .inline-editor-label();
  }

  &>p {
    margin: 1em 0 0 0;
  }
}

#review-banner {
  padding-bottom: 4em;

  .banner {
    border-left: 0;
    border-right: 0;
    border-top: 0;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: @z-index-banner;
    .box-shadow(@box-shadow);
  }
}


/****************************************************************************
 * Tooltips
 ****************************************************************************/
.tooltip {
  background-color: #fef6b3;
  border: 1px #a58600 solid;
  padding: 4px;
  position: absolute;

  &.comments {
    border: 1px black solid;
    border-bottom: 0;
    padding: 0;

    ul {
      list-style: none;
      margin: 0;
      padding: 0;

      li {
        background-color: #a1c0e3;
        border-bottom: 1px #5170b3 solid;
        margin: 0;
        padding: 5px;

        &.draft {
          background-color: #aceb6f;
          border-bottom: 1px black solid;
        }

        pre {
          .pre-wrap;
          font-size: 90%;
          margin: 0;
          padding: 0;
        }
      }
    }
  }
}


/****************************************************************************
 * Bubbles
 ****************************************************************************/
.bubble {
  background-color: white;
  border: 1px black solid;
  font-size: 10pt;
  font-weight: bold;
  padding: 6px;
  position: absolute;
  white-space: nowrap;
  z-index: @z-index-dialog;
  .border-radius(8px);
}


/****************************************************************************
 * Issue Summary
 ****************************************************************************/

.issue-table-wrapper {
  clear: both;
  margin: 8px 9px 14px 9px;
}

#issue-summary-table {
  border-spacing: 0;
  width: 100%;

  tr {
    td {
      border-width: 0 0 1px 0;
      border-style: solid;
      padding: 5px 5px;
      vertical-align: top;

      a {
        color: #0000CC;
        text-decoration: none;
      }
    }

    &.hidden {
      display: none;
    }
  }

  thead {
    th {
      background: url("../../djblets/images/datagrid/header_bg.png") repeat-x bottom left;
      border-color: #999;
      border-style: solid;
      border-width: 1px 0;
      cursor: pointer;
      height: 21px;
      padding: 2px 5px;
      text-align: left;
      white-space: nowrap;

      &:hover {
        background: url("../../djblets/images/datagrid/header_bg_primary.png") repeat-x bottom left;
      }
    }

    .description-header {
      border-left-width: 1px;
    }

    .status-header {
      border-right-width: 1px;
    }
  }

  .issue {
    .status {
      border-right-width: 1px;
    }

    .summary-table-description {
      border-left-width: 1px;
      width: 100%;
    }

    &.open {
      td {
        background-color: #FDF4A4;
        border-color: @dark-yellow;
      }
    }

    &.dropped {
      td {
        background-color: @light-grey;
        border-color: #AAA;
      }
    }

    &.resolved {
      td {
        background-color: #FFF;
        border-color: #AAA;
      }
    }

    &:hover td {
      background-color: #D4E0F3;
      border-color: @dark-blue;
    }

    .summary-anchor {
      color: #000;
      display: block;
      overflow: hidden;
      text-decoration: none;
    }
  }

  .no-issues {
    td {
        background-color: #FFF;
        border-color: #999;
        border-width: 1px;
    }
  }

  .status {
    text-transform: capitalize;
  }

  .comment-id, .last-updated, .reviewer, .status {
    white-space: nowrap;
  }
}

#issue-summary {
  .header {
    padding-bottom: 0;
    position: relative;

    .counters {
      position: absolute;
      bottom: 0;
      right: @box-padding;

      .counter {
        margin-left: 4px;

        &.total {
          label, span {
            font-weight: bold;
          }
        }

        label {
          color: black;
          font-weight: normal;
          margin-right: 3px;
        }
      }
    }

    .filters {
      margin: 3px 0 0 0;

      .filter-wrapper {
        display: inline;
        margin: 0 4px;
      }
    }
  }
}


/****************************************************************************
 * Rich text
 ****************************************************************************/

/*
 * Note that there's similar styling code in
 * reviewboard/notifications/templatetags/markdown_email.py. If you make
 * substantial changes here, you may also want to make changes there.
 */

.rich-text {
  .hide-br() {
    br {
      display: none;
    }
  }

  .show-br() {
    br {
      display: block;
    }
  }

  line-height: @textarea-line-height;
  .box-sizing(border-box);

  * {
    margin: 0;
    padding: 0;

    line-height: inherit;
    text-rendering: inherit;
    white-space: normal;

    .show-br();
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
  }

  p {
    white-space: inherit;

    /* Don't show both the <br> and the blank line. */
    .hide-br();
  }

  ul, ol {
    line-height: 0;
    margin: 0;
    padding: 0;

    p {
      /*
       * <p> tags in a list do not preserve whitespace, since there's
       * mandatory leading whitespace before the content.
       */
      .show-br();
    }

    ul, ol {
      margin-left: 2ch;
    }
  }

  ol {
    /*
     * We want to keep wrapped text within the confines of the list item. So:
     *
     * 1. This is long text that
     *    wraps like this.
     *
     * Instead of:
     *
     * 1. This is long text that
     * wraps like this.
     *
     * To do this, we need to use display: table and display: table-cell.
     * However, that loses item counter rendering, so we have to do counters
     * ourselves. In combination with StyledOListBlockProcessor in
     * reviewboard/reviews/markdown_extensions.py, this maintains compatibility
     * with the start= attribute.
     */
    counter-reset: li;
    display: table;
    list-style-position: inside;

    > li {
      counter-increment: li;
      display: table;

      &::before {
        content: counter(li) ". ";
        padding-right: 1ch;
        display: table-cell;
        text-align: right;
      }
    }
  }

  ul {
    list-style-position: outside;
    list-style: disc;
    margin-left: 2ch;
  }

  li {
    line-height: @textarea-line-height;

    ~ li:last-child {
      p:last-child {
        margin-bottom: 0;
      }
    }

    p {
      margin-bottom: @textarea-line-height;

      /*
       * If the list item ends up with a sole <p>, just remove the margins.
       * Depending on neighboring elements, Python Markdown will sometimes
       * create list items this way.
       */
      &:first-child:last-child {
        margin: 0;
      }
    }
  }

  table {
    th, td {
      border-bottom: 1px solid #bbb;
      padding: 0.2em 1em;
    }
  }

  code {
    color: #4444cc;
  }

  pre {
    .pre-wrap;
    font-size: inherit;
    margin-left: 2.5em;

    * {
      .pre-wrap;
    }
  }

  blockquote {
    border-left: 1px solid #bbb;
    padding-left: 1em;
    margin-left: 0.5em;
  }

  hr {
    border: 1px solid #ddd;
  }
}


// vim: set et ts=2 sw=2:
