/*
*   this file includes report item styles.
*   @giraykarasinir
*/

.jfReport, .jfPresentation {
  .reportItem {
    position: absolute;
    transition: .3s ease-in-out;

    &Inner {
      padding: 5px;

      strong {
        font-family: inherit;
      }
    }

    &-header {
      font-weight: 500;
      will-change: transform;
    }

    &-headerLine {
      margin: 8px auto;
      will-change: transform;
    }

    &-subHeader {
      color: #9798AE;
      will-change: transform;
    }

    &-header + .reportItem-subHeader {
      margin-top: 5px;
    }

    &-line {
      width: 100%;
      border: none;
      border-color: $gray;
      will-change: transform;
    }

    &.isDraggingLayerElement {
      opacity: .8;
      transition: none;
      cursor: grabbing;
    }

    .jfReportEditable {
      display: block;
      overflow-wrap: break-word;
    }

    .jfReportEditable:empty {
      text-decoration: inherit;

      &:empty:before {
        content: attr(placeholder);
      }
    }

    .isUnread {
      background: #fff;
    }
  }

  .reportHandle {
    opacity: 1;
    pointer-events: all;

    &:after {
      content: "";
      position: absolute;
      display: block;
      background-color: #FFFFFF;
      border: 2.5px solid #0099FF;
      transition: .3s ease-in-out;
    }

    &:not(.forLine):after {
      top: 2px;
      left: 1.5px;
      width: 3px;
      height: 3px;
      min-width: 3px;
      min-height: 3px;
      max-height: 3px;
      max-width: 3px;
      border-radius: 3px;
    }

    &.forLine {
      &:after {
        border-radius: 4px;
      }
      &:not(.isVertical) {
        &:after {
          top: -0.5px;
          bottom: 1px;
          left: calc(50% - 6px);
          width: 8px;
          height: 4px;
          max-width: 8px;
          min-width: 8px;
          min-height: 4px;
          max-height: 4px;
        }
      }

      &.isVertical {
        &:after {
          top: calc(50% - 6px);
          left: -1px;
          right: 1px;
          height: 8px;
          width: 4px;
          min-width: 4px;
          max-width: 4px;
          min-height: 8px;
          max-height: 8px;
        }
      }
    }

    &:hover {
      &:after {
        background-color: #FFFFFF;
      }
    }
  }

  .reportRotater {
    position: absolute;
    left: calc(50% - 15px);
    top: -50px;
    padding: 5px;
    background-color: #ddefff;
    border: 2px solid #0099FF;
    border-radius: 50%;

    &:before {
      content: "";
      position: absolute;
      bottom: -20px;
      left: calc(50% - .5px);
      width: 1px;
      height: 20px;
      background-color: $blue;
    }
  }

  .reportItemWrapper.isSelected {
    .jfReportEditable {
      cursor: text;

      &:empty:focus:before {
        color: $placeholderColor;
      }
    }
  }

  .reportItemResizer {
    border: 3px solid #0099FF;
    border-radius: 3px;
    transition: all .3s;

    &.hideVerticalHandle {
      .forLine.isVertical:after {
        opacity: 0;
      }
    }

    &.hideHorizontalHandle {
      .forLine:not(.isVertical):after {
        opacity: 0;
      }
    }

    &-wrapper {
      &:hover {
        .reportItemResizer {
          border: 3px solid #0099FF;
        }
      }
    }
  }
}

.jfReport, .jfPresentation, .pageThumbnailHelper, .slides-navigator {
  .reportItem {
    .fitFor- {
      width: 100%;
      height: 100%;
    }
    .fitFor-2px {
      height: calc(100% - 4px);
      width: calc(100% - 4px);
      margin-top: 2px;
      margin-left: 2px;
      &.forStar {
        height: calc(100% - 5px);
      }
    }
    .fitFor-4px {
      height: calc(100% - 6px);
      width: calc(100% - 6px);
      margin-top: 3px;
      margin-left: 3px;
      &.forStar {
        height: calc(100% - 10px);
        width: calc(100% - 8px);
        margin-top: 5px;
        margin-left: 4px;
      }
    }
    .fitFor-6px {
      height: calc(100% - 8px);
      width: calc(100% - 8px);
      margin-top: 4px;
      margin-left: 4px;
      &.forStar {
        height: calc(100% - 12px);
        width: calc(100% - 10px);
        margin-top: 6px;
        margin-left: 5px;
      }
    }
  }
}

.pageThumbnailHelper, .slides-navigator {
  .reportItemWrapper {
    width: 100%;
    height: 100%;
  }
}

.jfReport {
  .report-item-toolbar {
    position: absolute;
    background-color: #FFFFFF;
    padding: 4px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: all;
    z-index: 2;
    gap: 4px;
    box-shadow: 0 4px 8px 0 rgba(84, 95, 111, 0.15), 0 0 2px 0 rgba(37, 45, 91, 0.1);

    &.right-align {
      flex-direction: column;
      top: 50%;
      transform: translateY(-50%);
      right: -24px;
      animation: .2s fadeRight forwards;
    }

    &.left-align {
      flex-direction: column;
      top: 50%;
      transform: translateY(-50%);
      left: -24px;
      animation: .2s fadeLeft forwards;
    }

    &.top-align {
      flex-direction: row;
      top: calc(100% + 8px);
      transform: translateX(50%);
      right: 50% !important;
      animation: .2s fadeTop forwards;
    }

    &.bottom-align {
      flex-direction: row;
      bottom: -48px;
      transform: translateX(50%);
      right: 50% !important;
      animation: .2s fadeBottom forwards;
    }

    &-item {
      max-width: 24px;
      max-height: 24px;
      min-width: 24px;
      min-height: 24px;
      width: 100%;
      height: 100%;
      display: flex;
      padding: 4px;
      flex-shrink: 0;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      border-radius: 4px;
      background-color: #F9F9FF;
      transition: $transition;

      .toolbar-icon {
        width: 16px;
        height: 16px;
        color: #0A1551;
        fill: #0A1551;
        transition: $transition;
      }

      &:where(:hover) {
        background-color: #E3E5F5;
        transition: $transition;
      }

      &:hover.primary {
        background-color: #EDF8FF;

        .toolbar-icon {
          color: #0075E3;
          fill: #0075E3;
        }
      }

      &:hover.error {
        background-color: #FEF2F2;

        .toolbar-icon {
          color: #DC2626;
          fill: #DC2626;
        }
      }
    }

    &.isLocked.forLocked {
      background-color: #C8CEED;

      .report-item-toolbar-item {
        background-color: #C8CEED;

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

  @keyframes fadeRight {
    0% {
      right: -24px;
      opacity: 0;
    }
    100% {
      right: -38px;
      opacity: 1;
    }
  }

  @keyframes fadeLeft {
    0% {
      left: -24px;
      opacity: 0;
    }
    100% {
      left: -38px;
      opacity: 1;
    }
  }

  @keyframes fadeTop {
    0% {
      top: -24px;
      opacity: 0;
    }
    100% {
      top: -38px;
      opacity: 1;
    }
  }

  @keyframes fadeBottom {
    0% {
      bottom: -24px;
      opacity: 0;
    }
    100% {
      bottom: -38px;
      opacity: 1;
    }
  }
}
