@use './theme.scss' as *;

$root: 'date-picker';
$caption: 'caption';

.#{$root} {
  @include date-picker-theme-modifiers();

  --rdp-cell-size: 30px;
  --rdp-outline: 0;
  --rdp-outline-selected: 0;

  position: relative;
  z-index: 1;
  width: fit-content;

  &__calendar {
    position: absolute;
    z-index: 2;
    display: flex;
    margin: 5px 0;
    border-radius: 10px;
    background-color: date-picker-theme-color('background');
    border: 1px solid date-picker-theme-color('border');
    box-shadow: 0 5px 20px 0 date-picker-theme-color('shadow');
  }

  &__body {
    padding: 10px 20px 20px;

    &--isSingle {
      width: 252px;
    }

    &--isRange {
      width: 492px;
    }
  }

  &__sidebar {
    padding: 20px 0;
    border-right: 1px solid date-picker-theme-color('border');
  }

  &__error {
    color: date-picker-theme-color('error');
    font-size: 12px;
    line-height: 20px;
    font-weight: 500;
  }

  &__container,
  &__month {
    margin: 0;
  }

  &__months {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
  }

  &__caption {
    display: block;

    &--isStart:not(.#{$root}__caption--isEnd) {
      .#{$caption}__nav:last-child {
        visibility: hidden;
      }
    }

    &--isEnd:not(.#{$root}__caption--isStart) {
      .#{$caption}__nav:first-child {
        visibility: hidden;
      }
    }
  }

  &__day {
    padding-bottom: 10px;
    font-size: 12px;
    line-height: 15px;
    font-weight: 500;
    text-transform: uppercase;
    color: date-picker-theme-color('text-secondary');
  }

  &__button {
    &:hover {
      background-color: date-picker-theme-color('hover');
    }

    &:focus,
    &:focus-visible {
      background-color: date-picker-theme-color('hover');
    }
  }

  &__date {
    position: relative;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    color: date-picker-theme-color('text-primary');
    font-size: 12px;
    line-height: 20px;
    font-weight: 400;
    border: 0;
    cursor: pointer;

    &--isToday {
      font-weight: 600;
    }

    &--isMiddle {
      background-color: transparent;

      &::before {
        content: '';
        position: absolute;
        z-index: -1;
        left: -2.5px;
        top: 0;
        display: block;
        width: 30px;
        height: 25px;
        background-color: date-picker-theme-color('interaction');
      }
    }

    &--isStart {
      color: date-picker-theme-color('text-active');

      &::after {
        content: '';
        position: absolute;
        z-index: -1;
        top: 0;
        left: 50%;
        display: block;
        width: 15px;
        height: 25px;
        background-color: date-picker-theme-color('interaction');
      }

      &.#{$root}__date--isEnd {
        &::before {
          display: none;
        }
      }
    }

    &--isEnd {
      color: date-picker-theme-color('text-active');

      &::before {
        content: '';
        position: absolute;
        z-index: -1;
        top: 0;
        right: 50%;
        display: block;
        width: 15px;
        height: 25px;
        background-color: date-picker-theme-color('interaction');
      }

      &.#{$root}__date--isStart {
        &::after {
          display: none;
        }
      }
    }

    &--isSelected:not(&--isMiddle) {
      color: date-picker-theme-color('text-active');
      background-color: date-picker-theme-color('accent');
    }

    &--isSelected {
      &:hover {
        color: date-picker-theme-color('text-active');
        background-color: date-picker-theme-color('accent');
      }

      &:focus,
      &:focus-visible {
        color: date-picker-theme-color('text-active');
        background-color: date-picker-theme-color('accent');
      }
    }

    &--isDisabled {
      color: date-picker-theme-color('text-disabled');
      cursor: default;

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

  &__footer {
    margin-top: 20px;
  }
}
