@import "mixins/mixins";
@import "common/var";
@import "button";
@import "button-group";

@include b(calendar) {
  background-color: $--color-white;
  color: $--color-text-1;
  min-width: 1049px;
  width: 100%;

  @include e(header) {
    display: flex;
    justify-content: space-between;
    padding: 13px 24px;
    border: $--calendar-border;
    .el-select{
      width: 100px;
      height: 36px;

      + .el-select {
        margin-left: 8px;
      }
    }
    .el-button {
      margin-left: 16px;
    }
    .el-radio-button__inner{
      padding: 3px 15px;
    }
    .el-button-group{
      display: inline-block;
      .el-button{
        margin-left: 0;
        padding: 10px;
        &:first-child{
          border-top-right-radius: 0;
          border-bottom-right-radius: 0;
          margin-right: -1px;
          &:active{
            position: relative;
            z-index: 1;
          }
        }
        &:last-child{
          border-top-left-radius: 0;
          border-bottom-left-radius: 0;
        }
        &:hover {
          background: $--color-fill-3;
        }
      }
    }

    .el-radio-button__orig-radio:checked + .el-radio-button__inner {
      border-radius: 0;
    }
  }

  @include e(header-slots) {
    border: $--calendar-border;
  }

  @include e(title) {
    color: $--color-text-1;
    // align-self: center;
    font-size: 0;
    height: 36px;
    display: flex;
    align-items: center;
    .el-button {
      vertical-align: top;
    }
  }

  @include e(body) {
    padding: 12px 20px 35px;
  }
}

@include b(calendar-month) {
  table-layout: fixed;
  width: 100%;

  @include e(weeks) {
    display: flex;
  }

  @include e(week) {
    padding: 12px 0;
    color: $--color-text-1;
    font-weight: $--font-weight-400;
    border-right: $--border-1 solid $--color-border-2;
    text-align: left;
    padding-left: 16px;
    line-height: 24px;
    flex: 1;

    &:first-child{
      border-left: $--border-1 solid $--color-border-2;
    }
  }

  &:not(.is-range) {
    .prev,
    .next {
      color: $--color-text-4;
    }
  }

  @include e(row-item) {
    border-bottom: $--calendar-border;
    border-right: $--calendar-border;
    vertical-align: top;
    flex: 1;
    transition: background-color 0.2s ease;

    .el-calendar-month--events {
      font-size: $--font-size-title-2;
      width: 0;
      height: 0;

      &-li {
        position: absolute;
        cursor: pointer;
        margin-top: 4px;
        .el-calendar-month--events-item {
          height: 100%;
          line-height: 18px;
          border-radius: $--border-radius-small;
          padding-left: 8px;
          background-color: $--primary-2;
          color: $--primary-6;
          font-size: $--font-size-body-1;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          position: relative;
          &:before {
            content: '';
            background: var(--bgColor);
            display: block;
            position: absolute;
            left: 0;
            top: 0;
            width: 2px;
            height: 18px;
            border-radius: $--border-radius-small $--border-radius-none $--border-radius-none $--border-radius-small;
          }
        }
        .el-calendar-month--events-last-item {
          height: 100%;
          line-height: 18px;
          border-radius: $--border-radius-small;
          padding-left: 8px;
          color: $--color-text-2;
          font-size: $--font-size-body-1;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          border-radius: $--border-radius-small;
          height: 18px;
        }
      }
    }

    @include when(selected) {
      .month-text {
        color: $--color-white;
        background-color: $--primary-6;
        border-radius: $--border-radius-circle;
      }
    }

    @include when(today) {
      color:  $--color-text-1;
      .month-text {
        border-radius: $--border-radius-circle;
        width: 32px;
        height: 32px;
        border: $--border-1 solid $--primary-6;
      }
    }
  }

  @include e(row) {
    position: relative;
    display: flex;

    &:nth-child(2) {
      .el-calendar-month__row-item {
        border-top: $--calendar-border;
      }
    }
    &-item {
      &:first-child {
        border-left: $--calendar-border;
      }
    }
  }

  @include e(row--hide-border) {
    .el-calendar-month__row-item {
      border-top: none;
    }
  }

  @include b(calendar-day) {
    box-sizing: border-box;
    padding: 8px;
    height: $--calendar-cell-width;
    font-size: $--font-size-title-1;

    &:hover {
      cursor: pointer;
      background-color: $--color-bg-3;
    }

    span {
      min-width: 32px;
      height: 32px;
      display: inline-flex;
      justify-content: center;
      align-items: center;
    }
  }
}
.el-calendar__body {
  padding: 0;
}
.el-calendar_month {
  display: flex;
  flex-wrap: wrap;
  border-right: $--calendar-border;
}

@include b(calendar__week) {
  height: 760px;
  overflow: hidden;

  ul {
    list-style: none;
  }
  @include m(header) {
    // box-shadow: 0px 2px 10px -$--border-1 rgba(0,0,0,0.08);
    box-shadow: $--shadow1-center;
    position: relative;
    z-index: 1;
    &-grid {
      display: flex;
      flex: 1 0 auto;
    }

    &-item {
      border: $--border-1 solid $--color-border-3;
      flex: 1;
      display: flex;
      align-items: center;
      border-left: $--border-1 solid transparent !important;
      border-top: $--border-1 solid transparent !important;
      height: 48px;
      padding-left: 16px;
      & span + span {
        margin-left: 5px;
      }

      &:first-child {
        border-left: $--border-1 solid $--color-border-3 !important;
        border-bottom: none;
      }

      @include when(today) {
        .date {
          position: relative;
          &::before {
            content: "";
            position: absolute;
            display: inline-block;
            width: 32px;
            height: 32px;
            border: $--border-1 solid $--primary-6;
            border-radius: $--border-radius-circle;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            box-sizing: border-box;
          }
        }
      }

      &-borderless {
        border-bottom: 0;
      }

      // &.next, &.prev{
      //   color: $--color-text-4;
      //   .festival {
      //     color: $--color-text-4;
      //   }
      // }
      &.disabled {
        color: $--color-text-4;
        .festival {
          color: $--color-text-4;
        }
      }

      .date{
        font-size: $--font-size-title-1;
      }

      .festival {
        color: $--color-text-2;
        font-size: $--font-size-body-1;
        margin-left: 14px;
      }
    }

    
    &-left {
      width: 12.5%;
      height: 100%;
      color: $--color-text-3;
      font-size: $--font-size-body-3;
      display: flex;
      align-items: flex-end;
      border-left: $--border-1 solid $--color-border-3;
      border-right: $--border-1 solid $--color-border-3;
      border-bottom: $--border-1 solid $--color-border-3;
      span {
        width: 100%;
        // margin-right: 8px;
        text-align: center;
        padding-bottom: 10px;
        i {
          cursor: pointer;
          transform: rotate(90deg);
          transition: transform .2s ease;
          font-size: $--font-size-title-1;
        }
      }
    }

    &-event {
      font-size: $--font-size-title-2;
      display: flex;
      // min-height: 48px;
      transition: height .2s ease;
      overflow: hidden;


      &-wrap {
        padding-left: 0;
        position: relative;
        display: flex;
        flex: 1 0 auto;
        // min-height: 48px;
      }

      &-skeleton {
        display: flex;
        flex: 1 1 auto;
        li {
          flex: 1 1 auto;
          border-right: $--border-1 solid $--color-border-3;
          border-bottom: $--border-1 solid $--color-border-3;
        }
      }

      &-grid {
        position: absolute;
        width: 100%;
      }

      &-li {
        position: absolute;
        cursor: pointer;
        &-last {
          color: $--color-text-2;
          font-size: $--font-size-body-1;
          padding-left: 8px;
          line-height: 18px;
          @include when(history) {
            color: $--color-text-2;
          }
        }
      }

      // &-item {
      //   height: 100%;
      //   line-height: 18px;
      //   border-radius: $--border-radius-medium;
      //   // margin: 4px 0;
      //   padding-left: 8px;
      //   background-color: $--primary-2;
      //   font-size: $--font-size-body-1;
      //   color: $--primary-6;
      //   overflow: hidden;
      //   text-overflow: ellipsis;
      //   white-space: nowrap;
      //   // border: $--border-1 solid # $--color-white
      //   @include when(history) {
      //     background: $--primary-2;
      //     color: $--color-text-3;
      //   }
      // }
      &-item {
        height: 100%;
        line-height: 18px;
        border-radius: $--border-radius-small;
        padding-left: 8px;
        background-color: $--primary-2;
        font-size: $--font-size-body-1;
        color: $--primary-6;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        @include when(history) {
          // background: $--primary-2;
          color: $--color-text-3;
          background: $--primary-2;
          // color: $--primary-6;
        }
      }
    }
  }

  @include m(main) {
    height: calc(100% - 130px);

    @include m(wrapper) {
      height: 100%;

      .el-scrollbar__wrap {
        overflow-x: hidden;
      }
    }

    @include m(list) {
      display: flex;
    }

    @include m(left) {
      height: auto;
      width: 12.5%;
      position: relative;
    }

    @include m(times) {
      position: relative;
      background-color: $--color-white;
      box-sizing: border-box;
    }

    @include m(time) {
      position: relative;
      height: $--calendar-week-day-width;
      text-align: right;
      border-left: $--border-1 solid $--color-border-3;
      border-right: $--border-1 solid $--color-border-3;

      // &:first-child::after {
      //   content: "";
      //   border-bottom: $--border-1 solid $--color-border-3;
      //   position: absolute;
      //   left: 0;
      //   right: 0;
      //   z-index: 3;
      //   pointer-events: none;
      // }

      &:last-child::after {
        content: "";
        border-bottom: $--border-1 solid $--color-border-3;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 3;
        pointer-events: none;
        top: $--calendar-week-day-width;
      }

      span {
        position: relative;
        font-size: $--font-size-body-3;
        line-height: 22px;
        top: -11px;
        height: 22px;
        display: inline-block;
        margin-right: 8px;
        color: $--color-text-3;
      }
    }

    @include m(grid) {
      display: flex;
      position: relative;
      height: 100%;
      flex: 1;
    }

    @include m(skeleton) {
      position: relative;
      width: 100%;

      li {
        height: $--calendar-week-day-width / 2;
        border-right: $--border-1 solid $--color-border-3;
      }

      li:last-child, li:nth-last-child(2) {
        height: 0;
      }
    }

    @include m(row) {
      &:not(:first-child)::after {
        content: "";
        border-bottom: $--border-1 solid $--color-border-3;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 3;
        pointer-events: none;
      }
    }

    &-grid {
			// display: flex;
      // pointer-events: none;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 0 4px;
    }

    &-li {
      // position: relative;
      position: absolute;
      left: 0;
      right: 0;
      z-index: 5;
      overflow: hidden;
      color: $--color-text-1;
    }

    &-li-left{
      .el-calendar__week--main-item{
        padding-right: 0;
      }
    }

    &-li-right{
      .el-calendar__week--main-item{
        padding-left: 0;
      }
    }

    &-li-rowhelf-top{
      .el-calendar__week--main-item{
        padding-bottom: 2px;
      }
    }
    
    &-li-rowhelf-bottom{
      .el-calendar__week--main-item{
        padding-top: 2px;
      }
    }
    
    &-li-columnhelf-left{
      .el-calendar__week--main-item{
        padding-right: 2px;
      }
    }

    &-li-columnhelf-right{
      .el-calendar__week--main-item{
        padding-left: 2px;
      }
    }

    &-item {
      width: 100%;
      height: 100%;
      line-height: 22px;
      font-size: $--font-size-body-1;
      padding: 4px;
      // height: 100%;
      // line-height: 20px;
      // font-size: 12px;
      // overflow: hidden;
      // // background: $--color-white;
      // background: $--primary-2;
      // color: $--primary-6;
      // // border: $--border-1 solid $--primary-6;
      // font-weight: 500;
      // padding: 8px;
      .el-calender__day--main-item-content{
        background: $--primary-2;
        font-weight: $--font-weight-400;
        padding: 4px 8px;
        border-radius: $--border-radius-small;
        color: $--primary-6;
        width: 100%;
        height: 100%;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }

      @include when(history) {
        // color: #C9CDD4;
        // border-color: #94BFFF;
        // background: $--primary-2;
        // color: $--color-text-3;
        .el-calender__day--main-item-content{
          background: $--primary-2;
          // color: $--primary-6;
          color: $--color-text-3;
        }
      }
      .el-popover__reference__parent {
        height: 100%;
        .el-popover__reference-wrapper {
          height: 100%;
          .el-popover__reference {
            height: 100%;
          }
        }
      }
    }

    &-timeline {
      position: absolute;
      left: 100%;
      width: 700%;
      height: 1px;
      background: $--color-danger;
      z-index: 6;
    }

    &-now {
      position: absolute;
      left: 0;
      width: calc(100% - 10px);
      text-align: right;
      height: 20px;
      line-height: 20px;
      color: $--color-danger;
      margin: 45px 8px 0 2px;
      z-index: 5;
      background: $--color-white;
    }

    &-dot {
      position: absolute;
      width: 8px;
      height: 8px;
      background: $--color-danger;
      border-radius: 50%;
      z-index: 6;
    }
  }
}

@include b(calendar__day) {
  height: 760px;
  overflow: hidden;

  ul {
    list-style: none;
  }
  @include m(header) {  
    // box-shadow: 0px 2px 10px -1px rgba(0,0,0,0.08);
    box-shadow: $--shadow1-center;
    position: relative;
    z-index: 1;
    &-date{
      width: 100%;
      height: 48px;
      display: flex;
      align-items: center;
      color: $--color-text-1;
      font-weight: $--font-weight-500;
      font-size: $--font-size-title-1;
      padding: 0 24px;
      border: $--border-1 solid $--color-border-3;
      border-top: none;
    }
    &-grid {
      display: flex;
      flex: 1 0 auto;
    }

    &-item {
      border: $--border-1 solid $--color-border-3;
      flex: 1;
      display: flex;
      align-items: center;
      border-left: $--border-1 solid transparent;
      border-top: $--border-1 solid transparent;
      height: 48px;
      padding-left: 16px;
      & span + span {
        margin-left: 5px;
      }

      &:first-child {
        border-left: $--border-1 solid $--color-border-3;
        border-bottom: none;
      }

      @include when(today) {
        .date {
          position: relative;
          &::before {
            content: "";
            position: absolute;
            display: inline-block;
            width: 32px;
            height: 32px;
            border: $--border-1 solid $--primary-6;
            border-radius: $--border-radius-circle;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            box-sizing: border-box;
          }
        }
      }

      &-borderless {
        border-bottom: 0;
      }

      // &.next, &.prev{
      //   color: $--color-text-4;
      //   .festival {
      //     color: $--color-text-4;
      //   }
      // }
      &.disabled {
        color: $--color-text-4;
        .festival {
          color: $--color-text-4;
        }
      }

      .date{
        font-size: $--font-size-title-1;
      }

      .festival {
        color: $--color-text-2;
        font-size: $--font-size-body-1;
        margin-left: 14px;
      }
    }

    
    &-left {
      width: 12.5%;
      height: 100%;
      color: $--color-text-3;
      font-size: $--font-size-body-3;
      display: flex;
      align-items: flex-end;
      border-left: $--border-1 solid $--color-border-3;
      border-right: $--border-1 solid $--color-border-3;
      border-bottom: $--border-1 solid $--color-border-3;
      span {
        width: 100%;
        // margin-right: 8px;
        text-align: center;
        padding-bottom: 10px;
        i {
          cursor: pointer;
          transform: rotate(90deg);
          transition: transform .2s ease;
          font-size: $--font-size-title-1;
        }
      }
    }

    &-event {
      font-size: $--font-size-title-2;
      display: flex;
      // min-height: 48px;
      transition: height .2s ease;
      overflow: hidden;
      flex-wrap: wrap;

      &-wrap {
        padding-left: 0;
        position: relative;
        display: flex;
        flex: 1 0 auto;
        border-right: $--border-1 solid $--color-border-3;
        border-bottom: $--border-1 solid $--color-border-3;
        // min-height: 48px;
      }

      &-skeleton {
        display: flex;
        flex: 1 1 auto;
        li {
          flex: 1 1 auto;
          border-right: $--border-1 solid $--color-border-3;
          border-bottom: $--border-1 solid $--color-border-3;
        }
      }

      &-grid {
        position: absolute;
        width: 100%;
      }

      &-li {
        position: absolute;
        cursor: pointer;
        &-last {
          color: $--color-text-2;
          font-size: $--font-size-body-1;
          padding-left: 8px;
          line-height: 18px;
          @include when(history) {
            color: $--color-text-2;
          }
        }
      }

      &-item {
        height: 100%;
        line-height: 18px;
        border-radius: $--border-radius-small;
        padding-left: 8px;
        background-color: $--primary-2;
        font-size: $--font-size-body-1;
        color: $--primary-6;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        @include when(history) {
          // background: $--primary-2;
          // color: $--color-text-3;
          background: $--primary-2;
          color: $--color-text-3;
        }
      }
    }
  }

  @include m(main) {
    height: calc(100% - 130px);

    @include m(wrapper) {
      height: 100%;

      .el-scrollbar__wrap {
        overflow-x: hidden;
      }
    }

    @include m(list) {
      display: flex;
    }

    @include m(left) {
      height: auto;
      width: 12.5%;
      position: relative;
    }

    @include m(times) {
      position: relative;
      background-color: $--color-white;
      box-sizing: border-box;
    }

    @include m(time) {
      position: relative;
      height: $--calendar-week-day-width;
      text-align: right;
      border-left: $--border-1 solid $--color-border-3;
      border-right: $--border-1 solid $--color-border-3;

      // &:first-child::after {
      //   content: "";
      //   border-bottom: $--border-1 solid $--color-border-3;
      //   position: absolute;
      //   left: 0;
      //   right: 0;
      //   z-index: 3;
      //   pointer-events: none;
      // }

      &:last-child::after {
        content: "";
        border-bottom: $--border-1 solid $--color-border-3;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 3;
        pointer-events: none;
        top: $--calendar-week-day-width;
      }

      span {
        position: relative;
        font-size: $--font-size-body-3;
        line-height: 22px;
        top: -11px;
        height: 22px;
        display: inline-block;
        margin-right: 8px;
        color: $--color-text-3;
      }
    }

    @include m(grid) {
      display: flex;
      position: relative;
      height: 100%;
      flex: 1;
    }

    @include m(skeleton) {
      position: relative;
      width: 100%;

      li {
        height: $--calendar-week-day-width/ 2;
        border-right: $--border-1 solid $--color-border-3;
      }

      li:last-child, li:nth-last-child(2) {
        height: 0;
      }
    }

    @include m(row) {
      &:not(:first-child)::after {
        content: "";
        border-bottom: $--border-1 solid $--color-border-3;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 3;
        pointer-events: none;
      }
    }

    &-grid {
      // pointer-events: none;
      position: absolute;
      width: 100%;
    }

    &-li {
      position: absolute;
      // left: 4px;
      // right: 0;
      z-index: 5;
      width: calc(100% - 8px);
      overflow: hidden;
      color: $--color-text-1;
      // display: flex;
    }

    &-li-left{
      .el-calendar__day--main-item{
        padding-right: 0;
      }
    }

    &-li-right{
      .el-calendar__day--main-item{
        padding-left: 0;
      }
    }

    &-li-rowhelf-top{
      .el-calendar__day--main-item{
        padding-bottom: 2px;
      }
    }
    
    &-li-rowhelf-bottom{
      .el-calendar__day--main-item{
        padding-top: 2px;
      }
    }
    
    &-li-columnhelf-left{
      .el-calendar__day--main-item{
        padding-right: 2px;
      }
    }

    &-li-columnhelf-right{
      .el-calendar__day--main-item{
        padding-left: 2px;
      }
    }

    &-item {
      width: 100%;
      height: 100%;
      line-height: 22px;
      font-size: $--font-size-body-1;
      padding: 4px;
      // background: $--color-white;
      // border: $--border-1 solid $--primary-6;
      .el-calender__day--main-item-content{
        background: $--primary-2;
        font-weight: $--font-weight-400;
        padding: 4px 8px;
        border-radius: $--border-radius-small;
        color: $--primary-6;
        width: 100%;
        height: 100%;
        overflow: hidden;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
      }
      // &+.el-calendar__day--main-item{
      //   margin-left: 4px;
      // }

      @include when(history) {
        // color: #C9CDD4;
        // border-color: #94BFFF;
        .el-calender__day--main-item-content{
          background: $--primary-2;
          color: $--color-text-3;
          // color: $--primary-6;
        }
      }
            
      .el-popover__reference__parent {
        height: 100%;
        .el-popover__reference-wrapper {
          height: 100%;
          .el-popover__reference {
            height: 100%;
          }
        }
      }
    }

    &-timeline {
      position: absolute;
      left: 100%;
      width: 700%;
      height: 1px;
      background: $--color-danger;
      z-index: 6;
    }

    &-now {
      position: absolute;
      left: 0;
      width: calc(100% - 10px);
      text-align: right;
      height: 20px;
      line-height: 20px;
      color: $--color-danger;
      margin: 45px 8px 0 2px;
      z-index: 5;
      background: $--color-white;
    }

    &-dot {
      position: absolute;
      width: 8px;
      height: 8px;
      background: $--color-danger;
      border-radius: $--border-radius-circle;
      z-index: 6;
    }
  }
}

.el-calendar__simple {
  min-width: 270px;

  .el-date-picker {
    width: 100%;
    box-shadow: none;
    border: 0;

    .el-date-picker__header-label {
      &:hover {
        color: $--color-text-1;
      }
    }

    .el-calendar-picker-header {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }

  .is-senior {
    border: 0;
    border-bottom: $--border-1 solid $--card-border-color;
    border-radius: $--border-radius-medium $--border-radius-medium $--border-radius-none $--border-radius-none;
  }

  .el-date-picker__header--bordered {
    border-bottom: 0;
  }

  .el-picker-panel__body {
    border-radius: $--border-radius-none $--border-radius-none $--border-radius-medium $--border-radius-medium;
  }

  .el-card__header {
    .today {
      float: right;
      font-size: $--font-size-body-3;
      color: $--primary-6;
      cursor: pointer;
    }
  }

  .el-date-table {
    width: calc(100% - 48px);
    margin: 12px 24px 24px;

    tr {
      display: flex;
      width: 100%;
      justify-content: space-between;
      margin-bottom: 19px;

      &:last-child {
        margin-bottom: 0;
      }
  
      td, th {
        width: 32px;
        height: 32px;
        position: relative;

        & > div:first-child {
          height: 32px;
        }
      }

      .custom-event {
        position: absolute;
        top: 24px;
        left: -5px;
        width: 40px;
        line-height: 20px;
        font-size: $--font-size-body-1;
        color: $--color-text-2;
        display: flex;
        flex-direction: column;
        align-items: center;
        height: initial;



        .event-wrap {
          display: flex;

          .eventTooltip {
            position: relative;
            margin-top: 4px;
            border-radius: $--border-radius-circle;
            width: 8px;
            height: 8px;
            border: $--border-1 solid $--color-white;

            &:nth-child(1) {
              background: $--primary-6;
            }
            &:nth-child(2) {
              background: $--color-success;
              margin-left: -3px;
            }
            &:nth-child(3) {
              background: $--color-text-placeholder;
              margin-left: -3px;
            }
          }
        }
      }
    }
  }
}
