@import './token.less';

.@{ns}-ScheduleCalendar {
  &-icon {
    position: absolute;
    bottom: @Calendar-icon-bottom;
    left: 50%;
    transform: translateX(-50%);
    display: block;
    width: @Calendar-icon-width;
    height: @Calendar-icon-height;
    border-radius: 50%;
    z-index: 10;
  }
  &-action {
    display: block;
    padding: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    color: inherit;
    &:not(:disabled):not(.is-disabled):hover {
      color: inherit;
      background: transparent;
      border-color: transparent;
    }
  }
  .rdtDay {
    position: relative;
  }

  &-text-overflow {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: absolute;
    width: 100%;
  }

  .rdt .rdtPicker {
    td.rdtActive {
      background: transparent;
      color: @Calendar-color;
      > span {
        background: transparent !important;
      }
    }
    td.rdtActive:hover {
      background: @Calendar-cell-onHover-bg;
    }
  }
}

.@{ns}-ScheduleCalendar-large {
  width: 100%;

  .rdtPicker {
    width: 100%;
    table {
      border-collapse: collapse;
      border-spacing: 0;
      td {
        border: @Calendar-borderWidth solid var(--color-border);
      }
    }
  }

  .rdtDay {
    height: @Calendar-rdt-day;
    vertical-align: top;
  }

  .@{ns}-ScheduleCalendar-large-day-wrap {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    height: 100%;
    .@{ns}-ScheduleCalendar-large-schedule-content {
      position: relative;
      z-index: 10;
      border-radius: @border-radius;
      text-align: left;
      padding: @Calendar-schedule-content-padding;
      height: @Calendar-schedule-content-height;
      color: @Calendar-schedule-content-color;
    }
  }

  .@{ns}-ScheduleCalendar-action {
    z-index: 20;
    position: relative;
  }
}

.@{ns}-CalendarMobile {
  height: 100%;
  width: 100%;
  overflow: scroll;

  &-pop {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 90vh;
    background: #fff;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    border-width: 0;
  }

  &-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  &-header {
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(125, 126, 128, 0.16);
    position: relative;

    .subtitle-text {
      display: inline-block;
      width: 110px;
      position: relative;
    }

    .rdtPrev {
      width: 20px;
      height: 44px;
      display: block;
      position: absolute;
      top: 0;
      left: -20px;
    }
    .rdtNext {
      width: 20px;
      height: 44px;
      display: block;
      position: absolute;
      top: 0;
      right: -20px;
    }
  }

  &-title,
  &-subtitle {
    height: 44px;
    font-weight: 500;
    line-height: 44px;
    text-align: center;
  }

  &-title {
    font-size: @font-size-lg;
  }

  &-weekdays {
    display: flex;

    .weekday {
      flex: 1;
      line-height: 30px;
      text-align: center;
    }
  }

  &-close {
    position: absolute;
    z-index: 1;
    color: #c8c9cc;
    font-size: 16px;
    cursor: pointer;
    top: 11px;
    right: 16px;
  }

  &-body::-webkit-scrollbar {
    width: 0;
  }

  &-body {
    flex: 1;
    overflow-y: scroll;

    table {
      border-spacing: 0 4px;
    }

    .rdt .rdtPicker td.rdtActive,
    .rdt .rdtPicker td.rdtActive:hover {
      background: transparent;
      color: @Calendar-color;
      text-shadow: none;
    }

    .rdt .rdtPicker tr td.rdtDisabled,
    .rdt .rdtPicker tr td.rdtDisabled:hover {
      color: #999;
    }

    .rdtOldNone td.rdtOld {
      display: none;
    }

    .rdtPicker td {
      height: 56px;
      position: relative;
    }

    .rdt .rdtPicker {
      td.rdtDay,
      td.rdtDay:hover,
      td.rdtDisabled,
      td.rdtDisabled:hover {
        background: transparent;
      }
    }

    .calendar-wrap {
      position: relative;
      width: 50px;
      height: 100%;
      text-align: center;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
    }
  }

  &-embed &-body {
    .calendar-wrap {
      width: auto;
      max-width: 50px;
    }
  }

  &-footer {
    flex-shrink: 0;

    .date-range-confirm {
      height: 36px;
      margin: 7px 0;
      border-radius: @border-radius-md;
      display: block;
    }
    .is-disabled {
      opacity: 0.5;
      color: @Button--primary-color;
      background: @Button--primary-bg;
      border-color: @Button--primary-bg;
      filter: none;
    }
    &-toolbar {
      padding: 0 16px;
    }
    &-ranges {
      background: #fff;
      box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.02);
      border-radius: 24px;
      overflow-x: auto;
      position: relative;
      height: 48px;
      line-height: 48px;
    }
    .@{ns}-DateRangePicker-rangers {
      position: absolute;
      white-space: nowrap;
      .@{ns}-DateRangePicker-ranger {
        margin: 0 25px;
      }
    }
    .@{ns}-DatePicker-shortcuts {
      width: auto;
    }
  }

  &-calendar-wrap {
    padding: @gap-sm 0;
  }

  & &-calendar-wrap &-calendar .rdtPicker {
    width: 100%;
    padding: 0;
    .rdtOld {
      visibility: hidden;
    }
    .rdtNew {
      display: none;
    }
    .rdtBetween {
      background: @Calendar-cell-onBetween-bg !important;
      color: @Button--primary-bg;
    }
    .rdtRangeStart,
    .rdtRangeStart:hover,
    .rdtRangeEnd,
    .rdtRangeEnd:hover {
      .calendar-wrap {
        background: @Calendar-cell-onActive-bg !important;
        color: #fff;
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
      }
    }

    .rdtRangeHasEnd,
    .rdtRangeHasEnd:hover {
      background: linear-gradient(
        to right,
        transparent 0%,
        transparent 50%,
        @Calendar-cell-onBetween-bg 51%,
        @Calendar-cell-onBetween-bg 100%
      ) !important;
    }

    .rdtRangeEnd,
    .rdtRangeEnd:hover {
      background: linear-gradient(
        to right,
        @Calendar-cell-onBetween-bg 0%,
        @Calendar-cell-onBetween-bg 50%,
        transparent 51%,
        transparent 100%
      ) !important;
    }
  }

  &-calendar-header {
    height: 30px;
    line-height: 30px;
    text-align: center;
  }

  &-range-text {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    color: #fff;
    font-size: @font-size-sm;
    white-space: nowrap;
  }

  &-calendar-wrap {
    position: relative;
  }

  &-calendar-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    color: rgba(242, 243, 245, 0.8);
    font-size: 160px;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }

  &-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 136px;
    height: 36px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 4px;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  &-time {
    height: 180px;
    &-title {
      border: @Calendar-borderWidth solid var(--border-color-darken);
      border-left: none;
      border-right: none;
      text-align: center;
      height: 30px;
      line-height: 30px;
    }
    .rdtPicker {
      margin: 0 auto;
    }
  }
  .@{ns}-CalendarTime {
    height: 130px;
    overflow: hidden;
  }
  .@{ns}-PickerColumns-header {
    display: none;
  }
}
