/*
 * Copyright 2023 Harness, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

.wrapper {
  padding-top: 0 !important;
}

.header {
  position: sticky;
  top: 0;
  padding: var(--spacing-medium) 0 !important;
  width: 100%;
  z-index: 5;

  /* Create a mask to hide left, right edges of
     contents scrolled up over sticky header */
  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    height: 100%;
    width: calc(100% + 10px);
    background-color: var(--page-background);
    z-index: -1;
  }

  &.stickied {
    background-color: var(--primary-bg) !important;
  }

  .scrollTop {
    display: none;
    padding-left: var(--spacing-small);

    &.show {
      display: inline-block;
    }
  }

  .refreshBtn {
    background: var(--orange-50) !important;
    color: #c05809 !important;
    border: 1px solid var(--yellow-300) !important;
    border-radius: 4px;
    padding: 0 10px !important;
    height: 28px !important;

    font-size: 13px !important;
    margin: 0 var(--spacing-xsmall) 0 var(--spacing-medium) !important;

    &:hover {
      font-weight: 500 !important;
      box-shadow: none !important;
      border-color: #c05809;
    }
  }
}

.diffStatsLabel {
  font-size: var(--font-size-small) !important;
  font-weight: 600 !important;
  color: var(--grey-700) !important;
}

.main {
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-medium);
  box-sizing: border-box;
  min-height: 64px;

  // This is buggy, especially when scrolling
  // @see https://github.com/rtfpessoa/diff2html/issues/99
  &.enableDiffLineBreaks {
    :global {
      .d2h-code-line,
      .d2h-code-line-ctn {
        white-space: pre-wrap !important;
      }

      .d2h-code-line,
      .d2h-code-side-line,
      .d2h-code-line-ctn {
        width: revert !important;
      }
    }
  }
}

.container {
  background-color: var(--primary-bg) !important;
}

.hideBtn {
  display: none;
}

.refreshIcon {
  padding-left: var(--spacing-xsmall) !important;
  padding-right: var(--spacing-xsmall);
}

.repeatBtn {
  margin-left: var(--spacing-xsmall) !important;
}

.popover {
  transform: translateY(5px) !important;

  .menuItem {
    strong {
      display: inline-block;
      margin-left: 10px;
    }

    p {
      font-size: 13px;
      padding-left: 27px;
      line-height: 16px;
      margin: 5px 0;
      max-width: 320px;
    }
  }
  .menuReviewItem {
    &.bp3-disabled {
      opacity: 0.5 !important;
    }
    .reviewIcon {
      margin-top: 2px;
    }

    strong {
      display: inline-block;
      margin-left: 10px;
    }

    p {
      font-size: 13px;
      padding-left: var(--spacing-small);
      line-height: 16px;
      max-width: 320px;
    }
    &:hover p {
      color: var(--white) !important;
    }
    &:hover .reviewIcon {
      color: var(--white) !important;
    }
  }
  :global {
    .menuReviewItem:hover {
      reviewIcon {
        color: white !important;
      }
      p {
        color: transparent !important;
      }
    }
  }
}

.approvedContainer {
  :global([class*='bp3-button']) {
    --background-color: var(--green-700) !important;
    --background-color-hover: var(--green-900) !important;
    --background-color-active: var(--green-900) !important;
  }
}

.changeReqContainer {
  :global([class*='bp3-button']) {
    --background-color: var(--orange-800) !important;
    --background-color-hover: var(--orange-900) !important;
    --background-color-active: var(--orange-900) !important;
  }
}

.reviewButton {
  &.hide {
    visibility: hidden;
  }

  &.disabled {
    pointer-events: none;
    opacity: 0.5;
  }
}

.commitsDropdown {
  cursor: pointer;
  background-color: var(--grey-100) !important;
  border-radius: 4px;
  padding: var(--spacing-xsmall) var(--spacing-4) !important;
}

.btnDisabled {
  opacity: 0.5;
}

.changeReqBtn {
  --background-color: var(--orange-800) !important;
  --background-color-hover: var(--orange-900) !important;
  --background-color-active: var(--orange-900) !important;
}

.approvedBtn {
  --background-color: var(--green-700) !important;
  --background-color-hover: var(--green-900) !important;
  --background-color-active: var(--green-900) !important;
}
