/*
 * 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.
 */

.main {
  --box-radius: 5px;

  max-width: 900px;
  box-sizing: border-box;
  position: sticky;
  left: 0;
  background: var(--white) !important;

  &.fluid {
    max-width: none;
    position: inherit;
  }

  &:has([data-comments-collapsed='true']) {
    > div:first-of-type {
      padding-bottom: var(--spacing-small);
    }

    [data-reply-placeholder] {
      display: none;
    }
  }

  &:has([data-outdated='true']) [data-section-id='CodeSuggestionBlockButtons'] {
    display: none;
  }

  .box {
    box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16),
      0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
    border-radius: var(--box-radius);
  }

  .viewer {
    padding-bottom: var(--spacing-xsmall) !important;

    :global {
      .wmde-markdown .anchor {
        display: none;
      }
    }

    .deleted {
      padding: var(--spacing-xsmall) var(--spacing-small) !important;
      background-color: var(--grey-50) !important;
      color: var(--grey-350) !important;
      border: 1px solid var(--grey-100);
      display: inline-block;
      border-radius: var(--box-radius);
    }

    .outdated {
      background: var(--orange-50) !important;
      color: #c05809 !important;
      border: 1px solid var(--yellow-300) !important;
      padding: 4px 6px !important;
      border-radius: 4px !important;
      font-weight: 700;
      font-size: 10px;
      line-height: 15px;
      text-transform: uppercase;
    }
  }

  .replyPlaceHolder {
    background: var(--grey-50);
    border-top: 1px solid var(--grey-100);
    align-items: center;
    border-bottom-left-radius: var(--box-radius);
    border-bottom-right-radius: var(--box-radius);

    > div:last-of-type {
      flex-grow: 1;
      padding: 0;
      margin: 0;
    }
  }

  .newCommentContainer {
    background: var(--grey-50) !important;
    border-radius: 5px;

    &.hasThread {
      border-top: 1px solid var(--grey-100);
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
  }

  .editCommentContainer {
    padding: var(--spacing-small) !important;
    border-radius: var(--box-radius);
  }

  .outletTopOfFirstOfComment {
    padding-bottom: var(--spacing-large) !important;
    overflow: auto;
  }
}

.optionMenuIcon {
  align-items: center;

  &:not(.edit) {
    :global {
      .bp3-icon {
        padding-right: var(--spacing-xlarge);

        svg {
          width: 16px !important;
          height: 16px !important;
          path {
            fill: #fff !important;
          }
        }
      }
    }
  }

  &.edit > div {
    padding-left: 4px;
  }
}

.deleteIcon {
  > .bp3-icon {
    padding-right: var(--spacing-xlarge);
  }
  span[data-icon='main-trash'] {
    > svg {
      height: 14px;
      width: 13px;
    }
  }

  :global(.bp3-text-overflow-ellipsis) {
    padding-top: 2px !important;
  }
}

.toggleComment {
  all: unset;
  border: none !important;
  width: 14px;
  height: 14px;
  position: absolute;
  top: 3px;
  left: 5px;

  &::after {
    content: attr(data-threads-count);
    position: absolute;
    left: 15px;
    top: -2px;
    font-size: 9px;
    font-weight: bold;
    line-height: 1;
    color: var(--black);
  }
}
