@import '../helpers/helpers';

.flatpickr-datepicker {
  margin-top: 16px;

  &__label {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;

    .icon-info {
      cursor: pointer;
      margin-left: 8px;
    }
  }

  &__field {
    border-radius: 3px;
    border: 1px solid $gray;
    padding: 7px 8px 7px 16px;
    display: flex;
    align-items: center;
    max-width: 100%;
    position: relative;
    transition: all .3s;

    &.active,
    &:hover {
      border-color: $blue;
    }
  }

  .icon-wrap {
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    &--cross {
      cursor: pointer;
      display: none;
    }

    & + .icon-wrap {
      margin-left: 8px;
    }
  }

  .icon-calendar {
    font-size: 1rem;
    color: $blue;
  }

  .flatpickr {
    &-input {
      padding: 0;
      border: none;
      font-size: 1rem;
      font-weight: 400;
      line-height: 1.5rem;
      outline: none;
      width: 100%;
    }

    &-calendar {
      &:before,
      &:after {
        content: none;
      }

      &.static {
        left: 0;
        width: 100%;

        &.open {
          margin-top: 4px;
          padding: 16px;
          border-radius: 3px;
          box-shadow: 0 0 15px 0 rgba(0, 0, 0, .20);
        }
      }
    }

    &-monthSelect-months {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      margin: 12px 0 0;
      grid-gap: 8px;
      justify-items: center;
      align-items: center;
    }

    &-monthSelect-month {
      margin: 0;
      width: 100%;
      font-size: .875rem;
      font-style: normal;
      font-weight: 400;
      line-height: 1.375rem;
      padding: 4px;
      border-radius: 999px;
      max-width: 78px;
      color: $gray-dark;

      &.selected {
        background: $blue;
        border-color: $blue;
        color: $white;

        &:hover {
          border-color: $blue;
          background: $blue;
          color: $gray-dark;
        }
      }

      &:not(.flatpickr-disabled):hover {
        border-color: $blue;
        background: transparent;
      }

      &.flatpickr-disabled {
        color: $gray-wait;
        pointer-events: none;

        &:hover {
          border: none;
        }
      }

      &.today {
        border-color: transparent;

        &:hover {
          border-color: $blue;
          background: transparent;
          color: initial;
        }
      }
    }

    &-current-month {
      padding-top: 0;
      height: auto;

      input.cur-year {
        padding-left: 0;
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 1.375rem;
        text-align: center;
      }
    }

    &-prev-month.flatpickr-disabled,
    &-next-month.flatpickr-disabled {
      display: block;
      opacity: .6;
      pointer-events: none;
    }

    &-months {
      .flatpickr-prev-month,
      .flatpickr-next-month {
        position: relative;
        display: flex;
        align-items: center;
        height: auto;
        padding: 0;

        svg path {
          fill: $blue;
        }
      }

      .flatpickr-month {
        height: 100%;

        .flatpickr-current-month {
          width: 100%;
          left: auto;
          position: relative;
        }
      }
    }

    &-current-month {
      .numInputWrapper {
        &:hover {
          background: transparent;
        }

        .arrowUp,
        .arrowDown {
          content: none;
          display: none;
        }
      }
    }

    &-wrapper {
      flex: 1;
      position: initial;
      width: 100%;
    }

    &-rContainer {
      width: 100%;
    }
  }
}
