.nut-calendar {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  font-size: $calendar-base-font-size;
  background-color: $color-background-overlay;
  color: $color-title;
  overflow: hidden;
  height: 100%;

  &.nut-calendar-title {
    .nut-calendar-header {
      .calendar-title {
        font-size: $calendar-base-font-size;
      }
    }
  }

  .nut-calendar-taro {
    height: 60vh;
  }

  .popup-box {
    height: 100%;
  }

  ::-webkit-scrollbar {
    display: none;
  }

  // 头部导航
  &-header {
    display: flex;
    flex-direction: column;
    text-align: center;

    &-buttons {
      height: $calendar-header-height;
    }
  }

  &-title {
    color: $color-title;
    font-size: $calendar-title-font-size;
    font-weight: $calendar-title-font-weight;
    line-height: scale-px(50px);
  }

  &-sub-title {
    padding: scale-px(7px) 0;
    line-height: scale-px(22px);
    font-size: $calendar-sub-title-font-size;
  }

  &-weeks {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: scale-px(36px);
    border-radius: 0 0 scale-px(12px) scale-px(12px);
    box-shadow: 0 scale-px(4px) scale-px(10px) 0 rgba($color: #000000, $alpha: 0.06);
  }

  &-week-item {
    &:first-of-type,
    &:last-of-type {
      color: $color-primary;
    }
  }

  // 内容区域
  &-content {
    flex: 1;
    width: 100%;
    display: block;
    overflow-y: auto;
  }

  &-pannel {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    box-sizing: border-box;

    .calendar-loading-tip {
      height: scale-px(50px);
      line-height: scale-px(50px);
      text-align: center;
      position: absolute;
      top: scale-px(-50px);
      left: 0;
      right: 0;
      font-size: $font-size-s;
      color: $color-text;
    }
  }

  &-month {
    display: flex;
    flex-direction: column;
    text-align: center;

    &-title {
      height: scale-px(23px);
      line-height: scale-px(23px);
      margin: scale-px(8px) 0;
    }
  }

  &-days {
    overflow: hidden;
  }

  &-day {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    float: left;
    width: $calendar-day-width;
    height: $calendar-day-height;
    font-weight: $calendar-day-font-weight;
    margin-bottom: scale-px(4px);

    // 部分 Taro 机型下子节点不会稳定继承父级 color，颜色直接落到最内层文案。
    &-day,
    &-info-curr {
      color: $color-title;
    }

    &:nth-child(7n + 0),
    &:nth-child(7n + 1) {
      color: $color-primary;

      .nut-calendar-day-day,
      .nut-calendar-day-info-curr {
        color: $color-primary;
      }
    }

    &-info,
    &-info-curr {
      position: absolute;
      bottom: scale-px(5px);
      width: 100%;
      font-size: $font-size-s;
      line-height: scale-px(14px);
    }

    &-info-top {
      position: absolute;
      width: 100%;
      top: scale-px(5px);
    }

    &-info-bottom {
      position: absolute;
      width: 100%;
      bottom: scale-px(5px);
    }

    &-active {
      background-color: $calendar-active-background-color;
      color: $color-primary-text !important;
      border-radius: $calendar-day-active-border-radius;

      &.active-start {
        border-radius: 0;
        border-top-left-radius: $calendar-day-active-border-radius;
        border-bottom-left-radius: $calendar-day-active-border-radius;
      }

      &.active-end {
        border-radius: 0;
        border-top-right-radius: $calendar-day-active-border-radius;
        border-bottom-right-radius: $calendar-day-active-border-radius;
      }

      &.nut-calendar-day-active .nut-calendar-day-info {
        color: $color-primary-text;
      }

      &.nut-calendar-day-active .nut-calendar-day-day,
      &.nut-calendar-day-active .nut-calendar-day-info-curr {
        color: $color-primary-text;
      }
    }

    &-disabled {
      color: $calendar-disable-color !important;

      &.nut-calendar-day-disabled .nut-calendar-day-day,
      &.nut-calendar-day-disabled .nut-calendar-day-info-curr {
        color: $calendar-disable-color;
      }

      .nut-calendar-day-info-curr {
        display: none;
      }
    }

    &-choose {
      background-color: $calendar-choose-background-color;
      color: $calendar-choose-color;

      &.nut-calendar-day-choose .nut-calendar-day-day,
      &.nut-calendar-day-choose .nut-calendar-day-info-curr {
        color: $calendar-choose-color;
      }

      &-disabled {
        background-color: $calendar-choose-disable-background-color;
        color: $calendar-disable-color !important;

        &.nut-calendar-day-choose-disabled .nut-calendar-day-day,
        &.nut-calendar-day-choose-disabled .nut-calendar-day-info-curr {
          color: $calendar-disable-color;
        }

        .nut-calendar-day-info-curr {
          display: none;
        }
      }
    }
  }

  // 底部导航
  &-footer {
    display: flex;
    width: 100%;
    flex-direction: column;
    background-color: $white;

    .calendar-confirm-btn {
      height: scale-px(40px);
      line-height: scale-px(40px);
      margin: scale-px(6px) scale-px(16px);
      text-align: center;
      border-radius: $radius-base;
      background: $button-primary-background-color;
      color: $color-primary-text;
      font-weight: $font-weight-bold;
    }
  }
}

.nut-calendar-popup .nut-popup-title-right {
  top: scale-px(7px) !important;
}

[dir='rtl'] .nut-calendar,
.nut-rtl .nut-calendar {
  &-day {
    float: right;

    &-active {
      &.active-start {
        border-top-left-radius: 0;
        border-top-right-radius: $calendar-day-active-border-radius;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: $calendar-day-active-border-radius;
      }

      &.active-end {
        border-top-right-radius: 0;
        border-top-left-radius: $calendar-day-active-border-radius;
        border-bottom-right-radius: 0;
        border-bottom-left-radius: $calendar-day-active-border-radius;
      }
    }
  }
}
