@import 'modules/app/viewports';

$inputMarginLeft: 48px;

.cmf-comment-dialog {
  @include viewport-mobile {
    padding: 6px;
    padding-top: 6px;
  }

  position: relative;
  padding-top: 10px;

  &:hover {
    .wrapper-icon-sort-comments {
      visibility: visible;
    }
  }
}

.comments__item.child {
  display: none;

  &.child-visible {
    display: block;
  }
}

.app-comments-list,
.app-comments-list li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.before-input app-cmf-comment:last-child {
  display: block;
  margin-bottom: 16px;
}

app-cmf-comment {
  width: 100%;
}

.icon-sort-comments {
  cursor: pointer;

  position: relative;
  z-index: 1;
  right: 10px;
  bottom: 5px;

  height: 25px;
}

.wrapper-icon-sort-comments {
  display: flex;
  justify-content: flex-end;

  width: 100%;
  height: 0;

  visibility: hidden;
}

.filter-wrap {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.app-comments-loading {
  padding: 20px 0;
}

.app-comment-form {
  margin-bottom: 28px;

  &.comments-orientation:has(.comment-type-editing) {
    margin-top: 64px;
  }
}

.app-comment-form .reply-icon {
  transform: rotate(90deg);
  margin-right: 12px;
  margin-left: 7px;
}

:host {
  &.calculate-width {
    .app-comment-form {
      width: calc(100% - 100px);
    }
  }
}

.app-comment-form:has(.editable-item) {
  margin-top: 23px;

  app-cmf-gravatar {
    display: none;
  }

  .editor-form-actions {
    padding-left: 0;
  }

  .text-input-wrapper {
    margin-left: 0;
  }
}

::ng-deep .app-comment-body .app-comment-form:has(.comment-type-editing) {
  margin-top: -7px;
}

.app-comment-form-field {
  @include viewport-mobile {
    width: 100%;
    min-width: 280px;
  }

  display: flex;
  align-items: flex-start;

  width: 100%;
  min-width: 330px;
  min-height: 50px;
}

.app-comment-form-field:not(.comment) {
  font-size: 14px;
}

.app-comment-form-field.comment {
  width: 100%;
  outline: none;

  &.align-top {
    align-items: flex-start;
  }
}

.editor-form-actions {
  @include viewport-mobile {
    display: grid;
    grid-template-columns: 100px 1fr;
  }

  display: flex;
  justify-content: flex-start;

  width: 100%;
  margin-bottom: 10px;
  padding-left: $inputMarginLeft;

  line-height: 32px;

  wg-button {
    margin-right: 5px;
  }

  wg-button:focus-visible {
    outline: 2px solid var(--accent-color-bg) !important;
    outline-offset: 2px;
  }
}

.app-comment-text-input {
  box-sizing: content-box;
}

.chat-editor-wrap {
  position: relative;
  width: 100%;

  .custom-button-wrap {
    position: absolute;
    z-index: 1;
    top: 10px;
    right: 0;

    display: flex;

    .custom-button {
      padding: 5px 4px;

      // background-color: var(--color-gray-eee);
      border-radius: 5px;

      &__text {
        font-size: 14px;
      }
    }
  }
}

.lock-button {
  gap: 0;
  margin-left: auto;
}

.lock-button-caption {
  margin-left: 10px;
}

.file-upload {
  display: none;
}

.app-comment-text-input {
  cursor: text;
  width: 100%;
}

.add-file-icon {
  cursor: pointer;
  position: relative;
  top: 2px;
}

.comments-add-smiles-icon {
  cursor: pointer;
  position: relative;
  top: 2px;
}

.icon-comment-save {
  cursor: pointer;

  position: relative;
  top: 2px;
  left: 7px;

  margin-left: 5px;

  color: #0095ff;

  &.disabled {
    color: var(--color-gray-888);
  }
}

.text-input-wrapper {
  position: relative;

  display: flex;
  align-items: flex-end;

  width: calc(100% - 30px);
  min-height: 45px;
  margin-bottom: 10px;
  margin-left: 5px;
  padding: 5px 15px;

  border: 1px solid var(--chat-border-color);
  border-radius: 3px;
}

.new-comment-placeholder {
  padding-left: 10px;
  color: var(--color-gray-888);
}

.comment-gravatar {
  position: relative;
  margin-top: 2px;
  margin-right: 12px;

  // bottom: 6px;

  &.align-top {
    bottom: 0;
  }
}

.input-comments-buttons-wrapper {
  display: flex;
  flex-grow: 1;
  align-items: center;
  justify-content: flex-end;

  margin-bottom: 3px;
}

.input-comments-text-wrapper {
  display: flex;
  align-items: center;
  width: 85%;
  margin: auto 0;

  &.toolbar-view {
    width: 100%;
  }
}

.wrapper-private-trigger {
  display: flex;
  gap: 5px;
  align-items: center;

  height: 100%;
  margin-left: $inputMarginLeft;
  padding-bottom: 10px;

  .private-trigger {
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 30px;
    min-height: 30px;

    background-color: var(--color-gray-fff);
    border-radius: 15px;
  }
}

::ng-deep .comment-private-settings-overlay {
  display: flex;
  flex-direction: column;

  width: 395px;
  padding: 5px 0;

  background-color: var(--color-gray-fff);
  border-radius: 5px;
  box-shadow:
    0 2px 1px -1px rgb(0 0 0 / 20%),
    0 1px 1px 0 rgb(0 0 0 / 20%),
    0 1px 2px 1px rgb(0 0 0 / 20%);

  .private-settings__item {
    cursor: pointer;

    display: flex;
    gap: 7px;

    min-height: 25px;
    padding: 10px;

    &.default-item {
      align-items: center;
      margin-bottom: 5px;
      padding-bottom: 15px;
      border-bottom: 1px solid var(--color-gray-aaa);
    }

    .caption {
      min-width: fit-content;
    }

    .spectators {
      max-width: 180px;
      margin-left: 5px;
    }

    .selected {
      margin-left: auto;
      color: var(--color-gray-aaa);
    }
  }
}

div[id*='chat-toolbar'] {
}

.view-form-icon {
  cursor: pointer;
  display: flex;

  &.disabled {
    cursor: default;
    opacity: 0.6;
  }
}

.custom-button {
  cursor: pointer;
  display: flex;
  gap: 5px;
  padding: 0 2px;

  &__icon {
    display: flex;
    align-items: center;
  }
}

::ng-deep .cmf-comment-dialog {
  .app-comment-form {
    .mce-content-body:not([dir='rtl'])[data-mce-placeholder]:not(.mce-visualblocks)::before {
      left: 10px;
    }
  }

  span blockquote {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid #ccc;
  }

  span .mce-preview-object video,
  span .mce-preview-object audio {
    position: relative;
    z-index: 9;
  }
}

:host ::ng-deep {
  .hidden-toolbar {
    height: 1px;
    margin-bottom: 0;
    visibility: hidden;
    border-bottom: 0;
  }

  .toolbar-view.focused .mce-content-body {
    min-height: 145px;
  }
}

.shortcut-hint {
  margin-bottom: 15px;
  margin-left: 38px;
  font-size: 12px;
  color: var(--color-gray-aaa);

  .accent {
    font-weight: 600;
  }

  .shortcut {
    padding: 2px 4px;
    background-color: #091e420f;
    border-radius: 2px;
  }
}

.text-input-wrapper-active {
  padding: 0;

  ::ng-deep .tox.tox-tinymce .tox-editor-container .tox-editor-header {
    padding-right: 50px;
    padding-left: 15px;
    border-bottom: 1px solid #ccc !important;
  }

  ::ng-deep .tox-toolbar__group {
    padding-top: 5px;
  }

  ::ng-deep .tox-sidebar-wrap {
    padding: 0 15px !important;
  }

  ::ng-deep .tox-toolbar__primary {
    background: 0 0 !important;
  }
}

::ng-deep .app-comment-form-field .mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {
  overflow: hidden;

  max-width: 70%;
  height: 100%;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-type-editing {
  position: absolute;
  top: -43px;
  left: 0;

  display: grid;
  grid-template-columns: auto 20px auto 4fr;

  width: 100%;

  font-weight: 500;
}

.is-editing-existing-comment {
  top: -110px;
  margin-top: 69px;
}

.is-replying-to-comment {
  top: 12px;
  width: calc(100% - 100px);
}

.comment-type-text {
  cursor: pointer;
  border-bottom: 2px solid lightgray;
}

.comment-type-space {
  border-bottom: 2px solid lightgray;
}

.comment-type-selected {
  padding-bottom: 5px;
  color: var(--accent-color-bg);
  border-bottom: 2px solid var(--accent-color-bg);
}

.comment-type-not-selected {
  padding-bottom: 5px;

  &:hover {
    border-bottom: 2px solid var(--color-gray-aaa);
  }
}

.comment-type {
  cursor: pointer;
  width: 100%;
}

.comment-type-link {
  cursor: pointer;

  position: relative;
  z-index: 1;

  font-weight: 500;
  color: var(--accent-color-bg);

  &:hover {
    border-bottom: 1px solid var(--accent-color-bg);
  }
}

.width-auto {
  width: auto;
}

.margin-top-36 {
  margin-top: 36px;
}

.private-comment-link {
  margin-right: 10px;
}

.regular-comment-link {
  margin-left: 10px;
}
