@import "./abstracts/variable";
@import "./abstracts/mixin";

@include b(month-panel) {
  font-size: $-calendar-fs;

  @include e(title) {
    padding: 5px 0;
    text-align: center;
    font-size: $-calendar-panel-title-fs;
    color: $-calendar-panel-title-color;
    padding: $-calendar-panel-padding;
  }
  @include e(weeks) {
    display: flex;
    height: $-calendar-week-height;
    line-height: $-calendar-week-height;
    box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.02);
    color: $-calendar-week-color;
    font-size: $-calendar-week-fs;
    padding: $-calendar-panel-padding;
  }
  @include e(week) {
    flex: 1;
    text-align: center;
  }
  @include e(container) {
    padding: $-calendar-panel-padding;
    box-sizing: border-box;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  @include e(time) {
    display: flex;
    box-shadow: 0px -4px 8px 0px rgba(0, 0, 0, 0.02);
  }
  @include e(time-label) {
    position: relative;
    flex: 1;
    font-size: $-picker-column-fs;
    text-align: center;
    line-height: 125px;
    color: $-picker-column-color;

    &::after {
      position: absolute;
      content: '';
      height: 35px;
      top: 50%;
      left: 0;
      right: 0;
      transform: translateY(-50%);
      background: $-picker-column-select-bg;
      z-index: 0;
    }
  }
  @include e(time-text) {
    position: relative;
    z-index: 1;
  }
  @include e(time-picker) {
    padding: 10px 0;
    flex: 3;
  }
}

@include b(month) {
  @include e(title) {
    padding: 13px 0;
    text-align: center;
    font-size: $-calendar-panel-title-fs;
    color: $-calendar-panel-title-color;
  }
  @include e(days) {
    display: flex;
    flex-wrap: wrap;
    font-size: $-calendar-day-fs;
    color: $-calendar-day-color;
  }
  @include e(day) {
    position: relative;
    width: 14.285%;
    height: $-calendar-day-height;
    line-height: $-calendar-day-height;
    text-align: center;

    @include when(disabled) {
      .wd-month__day-text {
        color: $-calendar-disabled-color;
      }
    }
    @include when(current) {
      color: $-calendar-active-color;
    }
    @include when(selected) {
      .wd-month__day-container {
        border-radius: $-calendar-active-border;
        background: $-calendar-active-color;
        color: #fff;
      }
    }
    @include when(middle) {
      .wd-month__day-container {
        background: $-calendar-range-color;
      }
    }
    @include when(start) {
      &::after {
        position: absolute;
        content: '';
        height: $-calendar-day-height;
        top: 0;
        right: 0;
        left: 50%;
        background: $-calendar-range-color;
        z-index: 1;
      }
      &.is-without-end::after {
        display: none;
      }
      .wd-month__day-container {
        background: $-calendar-active-color;
        color: #fff;
        border-radius: $-calendar-active-border;
      }
    }
    @include when(end) {
      &::after {
        position: absolute;
        content: '';
        height: $-calendar-day-height;
        top: 0;
        left: 0;
        right: 50%;
        background: $-calendar-range-color;
        z-index: 1;
      }
      .wd-month__day-container {
        background: $-calendar-active-color;
        color: #fff;
        border-radius: $-calendar-active-border;
      }
    }
    @include when(same) {
      .wd-month__day-container {
        background: $-calendar-active-color;
        color: #fff;
        border-radius: $-calendar-active-border;
      }
    }
  }
  @include e(day-container) {
    position: relative;
    z-index: 2;
  }
  @include e(day-text) {
    font-weight: $-calendar-day-fw;
  }
  @include e(day-top) {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    line-height: 1.1;
    font-size: $-calendar-info-fs;
    text-align: center;
  }
  @include e(day-bottom) {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    line-height: 1.1;
    font-size: $-calendar-info-fs;
    text-align: center;
  }
}


@include b(year-panel) {
  font-size: $-calendar-fs;
  padding: $-calendar-panel-padding;

  @include e(title) {
    padding: 5px 0;
    text-align: center;
    font-size: $-calendar-panel-title-fs;
    color: $-calendar-panel-title-color;
    box-shadow: 0px 4px 8px 0 rgba(0, 0, 0, 0.02);
  }
  @include e(container) {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@include b(year) {
  @include e(title) {
    padding: 13px 0;
    text-align: center;
    font-size: $-calendar-panel-title-fs;
    color: $-calendar-panel-title-color;
  }
  @include e(months) {
    display: flex;
    flex-wrap: wrap;
    font-size: $-calendar-day-fs;
    color: $-calendar-day-color;
  }
  @include e(month) {
    position: relative;
    width: 25%;
    height: $-calendar-day-height;
    line-height: $-calendar-day-height;
    text-align: center;

    @include when(disabled) {
      .wd-year__month-text {
        color: $-calendar-disabled-color;
      }
    }
    @include when(current) {
      color: $-calendar-active-color;
    }
    @include when(selected) {
      color: #fff;

      .wd-year__month-text {
        border-radius: $-calendar-active-border;
        background: $-calendar-active-color;
      }
    }
    @include when(middle) {
      background: $-calendar-range-color;
    }
    @include when(start) {
      color: #fff;

      &::after {
        position: absolute;
        top: 0;
        right: 0;
        left: 50%;
        bottom: 0;
        content: '';
        background: $-calendar-range-color;
      }
      .wd-year__month-text {
        background: $-calendar-active-color;
        border-radius: $-calendar-active-border;
      }
      &.is-without-end::after {
        display: none;
      }
    }
    @include when(end) {
      color: #fff;

      &::after {
        position: absolute;
        top: 0;
        left: 0;
        right: 50%;
        bottom: 0;
        content: '';
        background: $-calendar-range-color;
      }
      .wd-year__month-text {
        background: $-calendar-active-color;
        border-radius: $-calendar-active-border;
      }
    }
    @include when(same) {
      color: #fff;

      .wd-year__month-text {
        background: $-calendar-active-color;
        border-radius: $-calendar-active-border;
      }
    }
  }
  @include e(month-text) {
    width: $-calendar-month-width;
    margin: 0 auto;
    text-align: center;
  }
  @include e(month-top) {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    line-height: 1.1;
    font-size: $-calendar-info-fs;
    text-align: center;
  }
  @include e(month-bottom) {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    line-height: 1.1;
    font-size: $-calendar-info-fs;
    text-align: center;
  }
}