/*
*   this file includes text editor additional styles.
*   @giraykarasinir
*/

.jfReport {
  .ql-editor {
    a {
      pointer-events: none;
    }
  }
}

.jfReport, .jfPresentation {
  .quill {
    overflow: visible;
  }

  .ql-editor {
    padding: 0;
    line-height: inherit;
    font-style: inherit;
    overflow-y: visible;
    &[contentEditable="true"] {

      /* In the edit mode Text element height and scrollable area for quill editor
      * And calculation applied for tolerance, banner height etc. in each report item
      */
      max-height: calc(100% - 2.5rem);
      cursor: text;
    }

    a {
      text-decoration: underline;
    }
  }

  .ql-container {
    height: 100%;
    overflow: visible;
    font-family: inherit;
    font-size: inherit;

    &.ql-snow {
      border: none;

      a {
        color: initial;
      }
    }

    .ql-blank:before {
      left: 0;
      right: 0;
      font-style: inherit;
    }
  }

  .ql-toolbar {
    font-family: inherit;
    font-size: .75rem;
    margin-top: 10px;
    width: 100%;
    background-color: transparent;

    .toolbarWrapper {
      flex-wrap: nowrap;
      background-color: $white;
      border: 1px solid $inputGrayBorder;
      border-radius: 3px;
      max-width: 100%;
      padding: 4px;
      right: 0;
      box-shadow: 0 2px 4px 0 rgba(#0A1551, 0.04);

      &.isOpened {
        width: auto;
      }
    }

    .ql-button {
      width: 20px;
      flex-shrink: 0;

      svg {
        width: 16px;
      }

      &.hiddenVisibility {
        display: none;
      }

      .ql-stroke {
        stroke: #6F76A7;
      }

      .ql-fill {
        fill: #6F76A7;
        stroke-width: 0;
      }

      &.ql-active {
        .ql-stroke {
          stroke: #6F76A7;
        }

        .ql-fill {
          fill: #6F76A7;
        }
      }
    }

    .ql-select .ql-picker-label, .ql-button {
      display: inline-flex;
      justify-content: center;
      align-items: center;
      height: 20px;
      padding: 0;
      border-radius: 3px;
      border: none;
      color: #6F76A7;

      &:hover {
        stroke: $blue;
      }

      &.ql-active {
        color: #8D8FA8;
        background-color: rgba($inputGrayBorder, .3);
        border-radius: 3px;
      }
    }

    .qlMore {
      height: 20px;
      color: #8D8FA8;
      position: absolute;
      right: 0;
      background-color: $white;
      border-radius: 0 5px 5px 0;
    }

    .ql-transparent {
      opacity: 1;
    }

    .ql-picker.ql-size {
      width: 52px;

      .ql-picker-label {
        justify-content: flex-start;
        padding-left: 5px;
        margin-left: 0;
      }
    }

    .ql-select {
      width: auto;
      height: 20px;
      flex-shrink: 0;
      font-size: .75rem;

      &.hiddenVisibility {
        display: none;
      }

      .ql-active {
        .ql-stroke {
          stroke: #8D8FA8;
        }
      }
    }

    .ql-select:not(.ql-size) .ql-picker-label {
      width: 20px;
      margin-left: 0;
    }

    .ql-divider {
      width: 1px;
      flex-shrink: 0;
      background-color: rgba($inputGrayBorder, .3);
      margin-left: 4px;
    }

    .ql-picker-options {
      background-color: #FBFBFE;
      border: 1px solid $inputGrayBorder;
      border-radius: 3px;
      max-height: 200px;
      overflow: auto;
    }

    .ql-color svg, .ql-align .ql-picker-label svg {
      width: 16px;
    }

    .ql-align .ql-picker-options {
      margin-left: 2px;
    }

    &.isOpened {
      max-width: none;
    }
  }

  .ql-tooltip {
    /* stylelint-disable-next-line declaration-no-important */
    position: static !important;
    align-items: center;
    height: 30px;
    /* stylelint-disable-next-line declaration-no-important */
    margin-top: 38px !important;
    /* stylelint-disable-next-line declaration-no-important */
    transform: none !important;
    background-color: $inputGray;
    border: 1px solid $inputGrayBorder;
    border-radius: 3px;
    box-shadow: none;
    font-size: .75rem;
    font-weight: 500;
    padding: 4px 4px 4px 8px;
    color: #8483A9;
    width: 100%;
    max-width: 394px;
    min-width: 325px;
    margin-left: auto;

    input[type="text"] {
      border-radius: 3px;
      height: 20px;
      font-size: .75rem;
      padding: 0 5px;
      background-color: #F3F3FE;
      color: rgba(#6F76A7, 0.6);
      border: 0;
      width: 100%;
    }

    &:not(.ql-hidden) {
      display: flex;
    }

    a.ql-action {
      margin-left: 4px;
      padding: 2px 8px;
      height: 20px;
      color: $white;
      background-color: $blue;
      line-height: 16px;
      border-radius: 3px;

      &:after {
        margin: 0;
        padding: 0;
        border: none;
      }
    }

    &.ql-editing {
      background-color: $white;
      box-shadow: 0 0 4px rgba(10, 21, 81, 0.06);
    }

    &[data-mode="link"]:before {
      content: "Link";
      color: #6F76A7;
    }
  }

  .ql-editing {
    z-index: 100000;
  }

  .ql-toolbar.ql-snow {
    padding: 0;
    border: none;

    .ql-picker {
      border-radius: 3px;
      &:hover {
        background-color: #F3F3FE;
      }
    }

    .ql-button,
    .ql-icon-picker,
    .ql-color-picker,
    .ql-color + .ql-divider {
      margin-left: 8px;
    }
  }

  .report-item-toolbar + .ql-toolbar.ql-snow {
    .ql-stroke {
      /* stylelint-disable-next-line declaration-no-important */
      stroke: #6F76A7 !important;
    }

    .ql-fill {
      /* stylelint-disable-next-line declaration-no-important */
      fill: #6F76A7 !important;
    }
  }
}

.report-item-toolbar + .ql-toolbar.ql-snow .ql-button:hover {
  background-color: #F3F3FE;
}
