/*
*   this file includes pane styles.
*   @giraykarasinir
*/
/* stylelint-disable no-descending-specificity */

.jfReport {
  display: flex;
  position: absolute;

  &-pane {
    // Panel Layout //

    .toolItem {
      flex-shrink: 0;

      & > span {
        @include text-ellipsis;
      }

      &:not(.toolSection) {
        height: 54px;
        padding: 0;
      }

      &.toolSection {
        cursor: inherit;
      }

      &.toolTitle {
        font-size: 1.125rem;
        padding: 0 20px;

        &.hasSearch {
          align-items: flex-start;
          flex-direction: column;
          height: auto;
          padding: 14px 20px;
        }

        .titleIcon {
          margin-right: 10px;
        }

        &.hasAdditional {
          justify-content: space-between;
          padding-right: 40px;

          .titleName {
            flex: 1;
            margin-right: 5px;
          }
        }
      }

      &-icon {
        width: 54px;
        flex-shrink: 0;

        .jfReportSVG {
          transition: .3s fill ease-in-out;
        }
      }

      &-name {
        display: inline-block;
        vertical-align: middle;
        padding: 0 15px;
        transition: .3s ease-in-out;
      }

      &-tabs {
        z-index: 1;
        flex-shrink: 0;
      }

      &-tabContent {
        height: 100%;
        overflow-y: auto;

        &.hasInnerScroll {
          padding: 25px 10px;

          .toolItem {
            display: flex;
            flex-direction: column;
            height: 100%;
          }
        }

        &:not(.hasInnerScroll):after {
          content: "";
          display: block;
          height: 30px;
          pointer-events: none;
        }
      }

      &-subSection {
        display: flex;
        flex-direction: column;

        &-title {
          display: flex;
          align-items: center;
          justify-content: center;
          height: 36px;
          font-size: 0.875rem;
          font-weight: 400;
          line-height: 20px;
          letter-spacing: -0.084px;
          white-space: nowrap;
          user-select: none;
          pointer-events: none;
        }
      }

      .note {
        opacity: .6;
        font-size: .75rem;
        font-style: italic;
      }

      &.previewPanel {
        padding: 20px 30px;
        border-radius: 2px;
        border-bottom: none;
      }
    }

    .no-search-result-text {
      text-align: center;
      margin-top: 20px;
    }

    .toolSection {
      margin: 0 10px;

      & + .toolSection {
        margin-top: 20px;
      }

      & + hr {
        border: none;
        margin: 20px -10px 0;

        & + .toolSection {
          margin-top: 20px;
        }

        & + hr {
          display: none;

          & + .toolSection {
            margin-top: 30px;
          }
        }
      }

      &-wrapper {
        &:not(:last-child) {
          margin-bottom: 20px;
        }
      }

      &-subItem {
        flex: 1;
        &.hasAspect {
          flex: 0 0 24px;
        }
      }

      &-title {
        margin-bottom: 10px;

        &:empty {
          display: none;
        }
      }

      &-title:empty + .toolSection {
        margin-top: 30px;
      }

      &-subLabel {
        margin-top: 5px;
        font-size: .75rem;
        color: $infoGray;
      }

      &.isHalf {
        width: calc(50% - 20px);
        display: inline-block;
        vertical-align: middle;
      }

      .forAspect {
        width: 24px;
        padding: 12px 0;
        &:before, &:after {
          content: "";
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          width: 4px;

          border-bottom: 1px solid #303339;
        }
        &:before {
          left: 0;
        }
        &:after {
          right: 0;
        }
      }
    }

    .toolTabs {
      flex-shrink: 0;
      font-size: 0.875rem;

      &-indicator {
        left: 0;
        bottom: 0;
        height: 4px;
        transition: left .3s ease-in-out;

        &[data-tab="2"] {
          width: 50%;
        }

        &[data-tab="3"] {
          width: 33.3%;
        }
      }

      label {
        height: 55px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex: 1 1;
        padding: 8px;
        text-align: center;
        user-select: none;
        cursor: pointer;
        transition: .3s ease-in-out;
        overflow: hidden;

        span {
          display: inline-block;
          vertical-align: middle;
          @include text-ellipsis;
        }
      }

      &-tab {
        display: none;
      }

      &.left[data-tab="2"],
      &.right[data-tab="2"] {
        .toolTabs-tab[tab-count="0"]:checked ~ .toolTabs-indicator {
          left: 0;
        }
        .toolTabs-tab[tab-count="1"]:checked ~ .toolTabs-indicator {
          left: 50%;
        }
      }

      &.left[data-tab="3"],
      &.right[data-tab="3"] {
        .toolTabs-tab[tab-count="0"]:checked ~ .toolTabs-indicator {
          left: 0;
        }
        .toolTabs-tab[tab-count="1"]:checked ~ .toolTabs-indicator {
          left: 33.3%;
        }
        .toolTabs-tab[tab-count="2"]:checked ~ .toolTabs-indicator {
          left: 66.6%;
        }
      }
    }

    // Panel Layout //

    // Panel Open & Hide Actions //


    .paneClose {
      top: 18px;
      right: 17px;
      padding: 0;
      z-index: 2;
      transition: .5s ease-in-out;

      .jfReportSVG {
        width: 20px;
        height: 20px;
        transition: .3s fill;
      }
    }

    .paneToggler {
      position: absolute;
      top: 15px;
      width: 36px; // IE FIX //
      padding: 10px;
      border: none;
      border-radius: 6px;
      background-color: $blue;
      transition: .5s ease-in-out;
      z-index: 2;
      opacity: .3;

      &:hover {
        box-shadow: 0 0 0 5px rgba(106, 110, 143, 0.25);
      }

      .jfReportSVG {
        width: 16px;
        height: 16px;
      }

      &.addElementToggle {
        width: 54px;
        background-color: #252D5B;
        height: 54px;
        border-radius: 100px;
        justify-content: center;
        padding: 14px;

        span {
          color: #ffffff;
          font-size: 15px;
        }

        .plus-icon {
          width: 28px;
          height: 28px;
        }
      }

      &.settingsToggle {
        background-color: #FFFFFF;
        border-radius: 100px;
        padding: 11px;
        width: 54px;
        height: 54px;

        .jfReportSVG {
          width: 24px;
          height: 23px;
        }
      }
    }

    .showAll {
      margin-right: 10px;
    }

    .toolItemWrapper {
      opacity: 1;
      transition: all .5s  ease-in-out;
    }

    &.jfReport-toolbox .toolItemWrapper {
      width: calc(#{$left-pane-width} - 1px);
    }

    &.jfReport-toolbox .tabs {
      max-width: $left-pane-width;
    }

    &.jfReport-settings .toolItemWrapper {
      width: calc(#{$right-pane-width} - 1px);
    }

    &.jfReport-settings .tabs {
      max-width: $right-pane-width;
    }

    &.jfReport-toolbox {
      .paneToggler {
        left: -100%;
      }

      .toolItem:not(.toolTitle) {
        cursor: pointer;
        cursor: grab;
      }
    }

    &:not(.jfReport-settings) {
      .toolItem:not(.toolTitle) {
        transition: .3s ease-in-out;

        .toolItem-icon {
          height: 53px;
          transition: .3s ease-in-out;
        }

        &.isOneLine {
          display: flex;
          justify-content: space-between;
          align-items: center;

          .toolSection-title {
            margin-bottom: 0;
          }
        }
      }
    }

    &.jfReport-settings {
      animation: .5s ease-in-out openRightSide forwards;
      right: 0;

      .paneToggler {
        right: -290px;
      }
    }

    &.forSlides {
      .paneToggler {
        top: 85px;
      }
    }

    &.isIdle {
      border-width: 0;
      box-shadow: none;
      flex: 0;

      .paneClose {
        opacity: 0;
      }

      .toolItemWrapper {
        opacity: 0;
      }
    }

    &.isIdle:not(.jfReport-settings) {
      transform: translateX(-#{$left-pane-width});

      .paneToggler {
        left: calc(100% + 15px);

        &.addElementToggle {
          left: calc(100% + 12px);
        }
      }
    }

    &.isIdle:not(.jfReport-toolbox) {
      animation: .5s ease-in-out closeRightSide forwards;

      .paneToggler {
        right: 15px;
      }

      .paneClose {
        right: calc(-#{$right-pane-width} + 15px);
      }

      .toolItemWrapper {
        margin-right: -#{$right-pane-width};
      }
    }

    &.otherOpened:not(.jfReport-toolbox).forSlides {
      .paneToggler {
        right: -290px;
      }
    }

    &.otherOpened:not(.jfReport-toolbox).forSettings {
      .paneToggler {
        right: -550px;
      }
    }

    &.forAllSlides:not(.jfReport-toolbox) {
      top: 0;
      left: 0;
      max-width: none;
      opacity: 1;
      background-color: #ededf4;
      z-index: 11;
      animation: .5s ease-in-out openAllSlide forwards;

      &.isIdle {
        pointer-events: none;
        user-select: none;
        animation: .5s ease-in-out closeAllSlide forwards;

        .toolItemWrapper {
          margin: unset;
        }
      }

      .paneClose {
        top: 15px;
        left: 15px;
        padding: 11px 13px;
        border-radius: 4px;
        background-color: #2e354a;
      }
    }

    .toolScrollableContent {
      flex-grow: 1;
    }

    &.forSettings .toolItem-tabContent:not(.hasInnerScroll) {
      padding: 25px 10px 150px;
    }

    // Panel Open & Hide Actions //

    &.forSlides .toolItem-tabContent {
      padding: 0 0 39px;

      .recharts-responsive-container > div {
        padding: 23px 10px 30px;

        & > div {
          position: relative;
        }
      }
    }

    &.forAllSlides .toolItem-tabContent {
      padding: 35px 75px 70px;

      @media screen and (max-width: 828px) {
        padding: 35px 35px 70px;
      }
    }
  }
}

@keyframes openRightSide {
  0% {
    width: 0;
  }
  100% {
    width: $right-pane-width;
  }
}

@keyframes closeRightSide {
  0% {
    width: $right-pane-width;
  }
  100% {
    width: 0;
  }
}

@keyframes openAllSlide {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes closeAllSlide {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
