@import "../../assets/scss/main";

$headerHeight: 64px;

.datepicker {
  &__wrapper {
    &.popoverIsActive {
      &::v-deep {
        .input__content {
          border-color: var(--input-color) !important;
        }

        .datepicker {
          @include verySmall-block {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            height: 100%;
            width: 100%;
            display: flex;
            z-index: 100;
            flex-direction: column;
            justify-content: flex-start;

            > span {
              height: 100%;

              > .vc {
                &-popover {
                  &-content {
                    &-wrapper {
                      height: 100%;
                      width: 100%;
                      transform: none !important;
                      position: relative !important;
                      display: flex;

                      .vc {
                        &-popover-content {
                          margin: 0 !important;
                          box-shadow: none !important;
                          border: none !important;
                          border-radius: 0 !important;
                          height: 100%;
                        }

                        &-container {
                          height: 100%;

                          .vc-arrows-container {
                            top: 90px;
                          }
                        }

                        &-pane {
                          &-container {
                            height: 100%;
                            display: flex;
                            flex-direction: column;
                            overflow-y: auto;
                          }

                          &-layout {
                            margin-top: $headerHeight;
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
            &__header {
              background-color: $white;
              padding: 22px 10px 22px 16px;
              @include headline;
              color: $gray1000;
              border-bottom: 1px solid $gray30;
              display: flex;
              align-items: center;
              justify-content: space-between;
              order: -1;
              z-index: 10;
              top: 0;
              left: 0;
              right: 0;
              position: fixed;
              width: 100%;
              height: $headerHeight;

              &__text {
                &.withPlaceholder {
                  color: $gray60;
                }
              }
            }

            &__cross {
              margin-left: 18px;
            }

            &__inputs {
              display: none !important;
            }
          }
        }
      }
    }
  }
}

::v-deep {
  .vc-container {
    width: 100%;

    &.vc-popover-content {
      border: 1px solid $borderColor;
      border-radius: $borderRadius;
      box-shadow: $elevation;
      min-width: 290px;
      margin-top: 8px;
    }

    .vc-popover-caret {
      display: none;
    }

    .vc {
      &-weeks {
        padding: 0 16px 20px;
      }

      &-day {
        margin-bottom: 2px;
        margin-right: 2px;
        min-height: 32px;
        min-width: 36px;

        &:nth-child(7n) {
          margin-right: 0;
        }

        &.on-left {
          .vc {
            &-highlight-base-middle {
              border-bottom-left-radius: $borderRadius !important;
              border-top-left-radius: $borderRadius !important;
            }
          }
        }

        &.on-right {
          .vc {
            &-highlight-base-middle {
              border-bottom-right-radius: $borderRadius !important;
              border-top-right-radius: $borderRadius !important;
            }
          }
        }

        &.is-first-day {
          .vc {
            &-highlight-base-middle {
              border-bottom-left-radius: $borderRadius !important;
              border-top-left-radius: $borderRadius !important;
            }
          }
        }

        &.is-last-day {
          .vc {
            &-highlight-base-middle {
              border-bottom-right-radius: $borderRadius !important;
              border-top-right-radius: $borderRadius !important;
            }
          }
        }

        &-content {
          @include text;
          font-weight: $regular;
          color: $gray1000;
          border-radius: $borderRadius;
          position: relative;
          height: 100%;
          width: 100%;

          &.is-disabled {
            color: $gray60;
            pointer-events: none;
          }

          &:hover {
            background-color: transparent;
            border: 2px solid $primary;
          }

          &:focus {
            background-color: transparent;
          }
        }

        &.is-today {

          .vc-highlights {

            & + span {
              color: $white;
              font-weight: $medium !important;
            }
          }

          .vc-day-content {
            color: $gray1000;
            background: none;
            font-weight: $medium !important;
          }
        }

        &-layer {
          overflow: visible;
        }
      }

      &-highlights {
        + span {
          font-weight: $regular !important;
        }
      }

      &-highlight {
        background-color: $primary !important;
        width: 100%;
        height: 100%;
        border-radius: $borderRadius !important;
        border: none !important;

        &-base-middle {
          opacity: 0.1 !important;
          border-radius: 0 !important;
          margin: 0 0 0 -2px;
          width: calc(100% + 4px);
        }

        &-base-start, &-base-end {
          opacity: 0.1 !important;
          margin: 0;
        }

        &-base-start {
          border-bottom-right-radius: 0 !important;
          border-top-right-radius: 0 !important;
        }

        &-base-end {
          border-bottom-left-radius: 0 !important;
          border-top-left-radius: 0 !important;
          margin-left: -2px;
        }

      }

      &-weekday {
        @include captionOne;
        font-weight: $regular;
        color: $gray100;
        padding: 0 0 8px 0;
      }

      &-header {
        padding: 28px 0 24px 0;
      }

      &-title {
        @include headline;
        font-weight: $bold;
        color: $gray1000;
      }

      &-arrows-container {
        padding: 0 16px;
        top: 28px;
      }

      &-arrow {
        background-color: transparent;
        border: none;
        box-shadow: none;
      }

      &-nav-popover-container {
        box-shadow: none;
        border-radius: $borderRadius;
        background: $gray700;
        border: none;
        padding: 0;

        *:focus {
          border-color: $gray700;
        }

        .vc {
          &-nav {
            &-header {
              padding: 8px 4px;
            }

            &-arrow {
              border: none;
            }

            &-title {
              @include text;
              font-weight: $medium;
              color: $white;
            }

            &-items {
              padding: 0 6px 6px 6px;
            }

            &-item {
              @include text;
              font-weight: $regular;
              color: $white;
              padding: 6px 2px;
              width: 46px;
              box-sizing: border-box;
              box-shadow: none;

              &:focus {
                border-color: $gray700;
              }

              &:hover {
                background: inherit;
                border-color: $white;
                color: $white;
              }

              &.is-active, &.is-current {
                background: $white;
                color: $gray700;
              }
            }
          }
        }

        .nav {
          &__arrow {
            position: absolute;
            bottom: calc(100% - 1px);
            left: 50%;
            transform: translate(-50%, 0);

            .svgIcon {
              svg {
                * {
                  &[stroke] {
                    stroke: var(--icon-color);
                  }

                  &[fill] {
                    fill: var(--icon-color);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
