// Calendars
.#{$namespace}calendar {
  border: $border-width solid $line-color-primary;
  border-radius: $border-radius;
  display: block;
  min-width: 280px;
  background: $background-color-white;

  .#{$namespace}calendar-nav {
    align-items: center;
    border-top-left-radius: $border-radius;
    border-top-right-radius: $border-radius;
    display: flex;
    font-size: $font-size-lg;
    padding: calc($unit-1 + $unit-h) $unit-6;
    justify-content: space-between;
    height: $component-size-xl;
  }

  .#{$namespace}calendar-header,
  .#{$namespace}calendar-body {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0 $layout-spacing;

    .#{$namespace}calendar-date {
      flex: 0 0 14.28%; // 7 calendar-items each row
      max-width: 14.28%;
      text-align: center;
    }
  }

  .#{$namespace}calendar-header {
    // border-bottom: $border-width solid $line-color-primary;
    color: $text-color-secondary-light;
    font-size: $font-size;
    text-align: center;
    padding: $layout-spacing 0;
  }

  .#{$namespace}calendar-body {
    color: $text-color-primary;
    background: $background-color-white;
    padding-bottom: $layout-spacing;
  }

  .#{$namespace}calendar-date {
    border: 0;
    padding: $unit-1;

    .#{$namespace}date-item {
      @include control-transition();
      appearance: none;
      background: transparent;
      border: $border-width solid transparent;
      border-radius: 50%;
      color: $text-color-primary;
      cursor: pointer;
      font-size: $font-size;
      height: calc($unit-7 - $unit-h);
      width: calc($unit-7 - $unit-h);
      line-height: $unit-5;
      outline: none;
      padding: $unit-h;
      position: relative;
      text-align: center;
      text-decoration: none;
      vertical-align: middle;
      white-space: nowrap;

      &.#{$namespace}date-today {
        border-color: $line-color-primary;
        color: $text-color-primary;
      }

      // &:focus {
      //   @include control-shadow();
      // }

      // &:focus,
      &:hover {
        background: $background-color-primary;
        border-color: $line-color-primary;
        color: $text-color-primary;
        text-decoration: none;
      }
      &:active,
      &.#{$namespace}active {
        background: $color-primary;
        border-color: transparent;
        color: $color-white;
      }

      // Calendar badge support
      // &.badge {
      //   &::after {
      //     position: absolute;
      //     top: 3px;
      //     right: 3px;
      //     transform: translate(50%, -50%);
      //   }
      // }
    }

    &.#{$namespace}disabled .#{$namespace}date-item,
    &.#{$namespace}disabled .#{$namespace}calendar-event,
    .#{$namespace}date-item:disabled,
    .#{$namespace}calendar-event:disabled {
      cursor: default;
      opacity: .25;
      pointer-events: none;
    }
  }

  .#{$namespace}calendar-range {
    position: relative;

    &::before {
      background: $color-primary-light;
      content: "";
      height: $unit-5;
      left: 0;
      position: absolute;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
    }
    &.#{$namespace}range-start {
      &::before {
        left: 50%;
      }
    }
    &.#{$namespace}range-end {
      &::before {
        right: 50%;
      }
    }

    .#{$namespace}date-item {
      color: $text-color-primary;
    }
  }

  .#{$namespace}calendar-footer {
    height: $unit-12;
    margin: 0 $unit-4;
    padding: 0 $unit-1;
    text-align: right;
    .#{$namespace}btn {
      margin-left: $unit-3;
    }
  }

}
