@import "../../styles/index.scss";

.impact-portal-container {
  position: absolute;
  z-index: 9999;
}

.ia-select-container-v3-blanket {
  bottom: 0;
  left: 0;
  top: 0;
  right: 0;
  position: fixed;
  z-index: 9998;
}

.impact-monthRangePicker-main-container {
  display: flex;
  font-family: $fontFamily;

  &.label-flex-column {
    flex-direction: column;

    .monthRangePicker-label {
      margin-bottom: 6px;
    }
  }

  .monthRangePicker-label {
    font-family: $fontFamily;
    color: $textButtonFontColor;
    font-size: $smallFontSize;
    line-height: 16px;
    font-weight: $normalFontWeight;
  }

  .monthRangePicker-container {
    position: relative;
    width: 282px;
  }

  .monthRangePicker-input-container {
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 32px;

    &:hover .dateRangePicker-input-start-date,
    &:focus-within .dateRangePicker-input-start-date {
      border: 1px solid $primaryColor;
      border-right: none;
    }

    &:hover .dateRangePicker-input-end-date,
    &:focus-within .dateRangePicker-input-end-date {
      border: 1px solid $primaryColor;
      border-left: none;
    }

    .dateRangePicker-input-start-date {
      font-family: $fontFamily;
      font-weight: $normalFontWeight;
      color: $mainFontColor;
      font-size: 14px;
      width: 123px;
      box-sizing: border-box;
      padding-left: 12px;
      border: 1px solid $deactivateColor;
      border-right: none;
      border-radius: 8px 0 0 8px;

      &.active {
        width: 76px;
      }

      &.error {
        border-left: 1px solid $errorColor;
        border-top: 1px solid $errorColor;
        border-bottom: 1px solid $errorColor;
      }

      &::placeholder {
        color: $lightGrayColor;
      }

      &:focus {
        outline: none;
      }

      &:focus:not(:placeholder-shown) {
        color: $primaryColor;
      }

      &:focus::placeholder {
        color: $primaryColor;
      }
    }

    .dateRangePicker-input-end-date {
      font-family: $fontFamily;
      font-weight: $normalFontWeight;
      color: $mainFontColor;
      font-size: 14px;
      width: 100%;
      box-sizing: border-box;
      border: 1px solid $deactivateColor;
      border-left: none;
      border-radius: 0 8px 8px 0;
      background: url("../../assets/calendar.svg") no-repeat;
      background-color: $whiteColor;
      background-size: 14px;
      background-position: center right 12px;

      @media screen and (max-width: 1399px) and (min-width: 1200px) {
        padding-left: 10px;
        background-position: center right 10px;
        background-size: 13px;
      }

      &::placeholder {
        color: $lightGrayColor;
      }

      &:focus {
        outline: none;
      }

      &.error {
        border-right: 1px solid $errorColor;
        border-top: 1px solid $errorColor;
        border-bottom: 1px solid $errorColor;
      }

      &:focus:not(:placeholder-shown) {
        color: $primaryColor;
      }

      &:focus::placeholder {
        color: $primaryColor;
      }
    }

    .close-icon {
      position: absolute;
      right: 36px;
      top: 16px;
      transform: translateY(-50%);
      cursor: pointer;
      border-radius: 4px;
      @include focus-visible-ring;
    }
  }
  &.disabled {
    pointer-events: none;
    & .monthRangePicker-label {
      color: $lightGrayColor;
    }
    .dateRangePicker-input-start-date,
    .dateRangePicker-input-end-date {
      border-color: $disabledSecondaryBorder;
      background-color: $disabledSecondaryBg;
      color: $lightGrayColor;
    }
    .dateRangePicker-input-end-date {
      background-image: url("../../assets/calendarDisable.svg");
      background-repeat: no-repeat;
      background-position: center right 12px;
      background-size: 14px;
    }
    .close-icon {
      & path {
        fill: $lightGrayColor;
      }
    }
  }
}

.ia-month-picker-container {
  width: 586px;
  height: 276px;
  border: 1px solid $menuBorderColor;
  border-radius: 12px;
  padding: 16px;
  position: absolute;
  top: 40px;
  left: 0;
  background-color: $whiteColor;
  box-shadow: 0px 0px 4px 0px $boxShadowColor;
  z-index: 1200;
}

.month-range-picker-selected-year {
  font-family: $fontFamily;
  font-size: $normalFontSize;
  font-weight: $normalFontWeight;
  color: $mainFontColor;
  line-height: 16px;
}

.month-range-picker-year-select-container {
  width: 85px;

  .ia-select-styled-dropdown-main-button {
    padding: 6px;
    border: none !important;
  }

  .ia-select-button-clear-icon {
    display: none;
  }

  .ia-select-chevron-icon {
    margin-left: -110px;
    margin-right: 36px;
    background: url("../../assets/arrowDownMonthRange.svg") no-repeat;
    background-size: 10px;
    background-position: center;
  }
}

.month-range-picker-month-select-dropdown,
.month-range-picker-year-select-dropdown {
  z-index: 9999;
  min-width: 115px !important;
  width: 115px !important;
}

.ia-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-inline: 8px;
  & .Mui-focusVisible {
    @include focus-visible-ring;
  }
}

.ia-render-month-container {
  display: flex;
  justify-content: space-between;
}

.ia-render-month {
  display: flex;
  gap: 36px;
  row-gap: 10px;
  flex-wrap: wrap;
  width: 252px;
  height: 128px;
  margin-top: 16px;
}

.ia-month {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  height: 36px;
  width: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid transparent;

  &:hover:not(.start, .end) {
    background-color: $lightBlueColor;
    border: 1px solid $accordionBgBackground;
    border-radius: 8px;
    color: $secondaryColor;
  }

  &.current-month {
    border: 1px solid $lightBlueColor;
    border-radius: 8px;
  }

  @include focus-visible-ring;
  @include focus-visible-disabled;
}

.ia-calendar-month {
  font-family: $fontFamily;
  font-size: 12px;
  font-weight: 500;
  line-height: 15px;
  text-align: left;
  text-underline-position: from-font;
  text-decoration-skip-ink: none;
}

.ia-month.start,
.ia-month.end {
  background-color: $primaryColor;
  color: white;
  border-radius: 8px;
  position: relative;
}

.ia-month.end.has-start-month::before {
  content: "";
  position: absolute;
  top: 0;
  left: -47px;
  height: 100%;
  background-color: $lightBlueColor;
  z-index: -1;
  right: 6px;
}

/* Style for selected months */
.ia-month.selected {
  background-color: transparent;
  /* remove blue from individual boxes */
  position: relative;
  border: 1px solid transparent;
  border-radius: 0;

  &:hover {
    &::before {
      border-radius: 6px;
    }
  }
}

.ia-month.selected::before {
  content: "";
  position: absolute;
  top: 0;
  left: -47px;
  /* extend into previous gap */
  right: 0px;
  /* extend into next gap */
  height: 100%;
  background-color: $lightBlueColor;
  z-index: -1;
}

/* Style for hovered previous to end - prevent ::before and use ::after */
.ia-month.selected.hovered-previous-to-end::before {
  display: none;
}

.ia-month.selected.hovered-previous-to-end::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0px;
  /* extend into next gap */
  right: -47px;
  /* extend into previous gap */
  height: 100%;
  background-color: $lightBlueColor;
  z-index: -1;
}

.month4,
.month8,
.month12 {
  &:after {
    right: -1px !important;
  }
}

.month1,
.month5,
.month9 {
  &::before {
    left: -1px !important;
  }

  &.start,
  &.end {
    &::before {
      left: 4px !important;
    }
  }
}

/* Style for disabled months (future months) */
.ia-month.disabled,
.ia-month:disabled {
  color: $lightGrayColor;
  pointer-events: none;
  cursor: default;
}

.ia-vertical-line {
  margin-block: 16px 0px;
  border: 0.5px solid $disabledSecondaryBorder;
}

.ia-calendar-button {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
}
