%date-pick-selected {
  color: $white !important;
  @extend %gradient-primary;
}

%date-pick-disabled {
  color: $disabled-bg !important;
  background: $gray-lightest-5 !important;
  border-color: transparent !important;
}

//日期框
.#{$date-pick-prefix-cls}er {
  // position: relative;
  font-size: $input-font-size;
  .input-wrap {
    display: inline-block;
    width: 100%;
    position: relative;
    vertical-align: middle;

    .input-icon {
      user-select: none;
      position: absolute;
      right: $input-padding-x;
      top: 50%;
      transform: translate(0,-50%);
      color: $gray;
      font-size: 16px;
      transition: all .3s;
      line-height: 1;
      .aid-close-circle {
        display: none;
      }
    }
    input.#{$input-prefix-cls} {
      padding-right: ($input-padding-x * 2 + 1);
    }

  }

  //clear
  &--clear {
    @include hover {
      .input-icon {
        @extend %input-icon;
        .aid-close-circle {
          display: inline;
        }
      }
    }
  }
}

//下拉面板
.#{$date-pick-prefix-cls} {
  $root: #{&};
  min-width: auto !important;
  font-size: inherit;
  padding: 0;
  //content
  &-content{
    display:flex;
  }
  //panel
  &__panel {
    display: flex;
    flex-direction: column;
    background: $white;
    @include clearfix();

  }

  //row
  &__row{
    display: flex;
    height:$date-panel-height;
    overflow: hidden;
    &--start,
    &--end{
      width:$date-panel-width;
      height:100%;
    }
    &--start {
      #{$root}-range &{
        float: left;
        #{$root}__header{
          @include border-right-radius(0);
        }
      }
    }
    &--end {
      height:100%;
      #{$root}-range &{
        float: left;
      }
      #{$root}__header {
        border-left: 1px solid rgba($white, 0.18);
        #{$root}-range &{
          @include border-left-radius(0);
        }
      }
      #{$root}__body {
        border-left: 1px solid $divider-bg;
      }
    }
  }

  table {
    width: 100%;
    max-width: 100%;
    background-color: transparent;
    text-align: center;
    vertical-align: middle;
    border-collapse: separate;
    border-spacing:0 nth($datePicker-date-spacer,2);
    th {
      padding:0 nth($datePicker-date-spacer,1) 3px 0;
      font-weight: 400;
      color:$gray;
      text-align: center;
      font-size:  $datePicker-weekDays-font-size;
      height:18px;
      line-height: 1;
      &:last-child{
        padding-right:0;
      }
    }
    td {
      padding:0 nth($datePicker-date-spacer,1) 0 0;
      font-size:$datePicker-date-font-size;
      cursor: pointer;
      &:last-child{
        padding-right:0;
      }
      >a{
        border: 1px solid transparent;
        height: $datePicker-date-height;
        line-height: $datePicker-date-height - 2;
      }
      //same day,month,year
      &#{$root}__today {
        color: $brand-primary;
        &>a{
          border-color: $brand-primary;
        }
      }

      //增加 解决bug 日期组件点击区域和事件响应区域不一致
      &:not(#{$root}--selected):not(#{$root}--in-selected):not(#{$root}__other-month) {
        >a{
          &:hover{
            background: rgba($brand-primary, 0.1);
          }
        }
      }

      //删除 解决bug 日期组件点击区域和事件响应区域不一致
      /*@include hover {
        outline: none;
        &:not(#{$root}--selected):not(#{$root}--in-selected):not(#{$root}__other-month) {
          a{
            background: rgba($brand-primary, 0.1);
          }
        }
      }*/
    }
  }

  //header
  &__header {
    padding:0 $datePicker-padding-x;
    font-size: $datePicker-header-font-size;
    font-weight: 400;
    text-align: center;
    color: $datePicker-header-color;
    height:$datePicker-header-height;
    line-height:$datePicker-header-height;
    border-bottom: 1px solid $gray-lightest;
    background-color: $brand-primary;
    @include border-top-radius($border-radius);

    //cmd
    #{$root}__cmd {
      cursor: pointer;
      font-size: 1.5rem;
      color: #FFF;
      &--prev{
        float: left;
      }
      &--next{
        float:right;
      }
    }
    //标题
    >span{
      cursor: pointer;
      justify-self: center;

      a {
        color: #FFF;
      }
    }
  }


  &__body{
    padding:0 $datePicker-padding-x;
  }

  //footer
  &__footer {
    padding:$datePicker-footer-padding;
    border-top: 1px solid $divider-bg;
    text-align: right;
  }



  //日期选择
  &__date{
    &>a{
      color: inherit;
      display: inline-block;
      width: $datePicker-date-width;
      vertical-align: middle;
      border-radius: $datePicker-date-border-radius;
    }
  }

  //other month
  &__other-month {
    color: $disabled-bg !important;
  }


  //日期范围选择
  &-range {
    table tr td:first-child{
      @include border-left-radius($border-radius);
    }
    table tr td:last-child{
      @include border-right-radius($border-radius);
    }
  }

  //checked
  &--selected {
    &>a{
      @extend %date-pick-selected;
    }
    &-min{
      background: rgba($brand-primary, 0.1);
      border-top-left-radius: $datePicker-date-border-radius;
      border-bottom-left-radius: $datePicker-date-border-radius;
    }
    &-max{
      background: rgba($brand-primary, 0.1);
      background: -webkit-linear-gradient(left,rgba($brand-primary, 0.1) 40% ,#fff 0);
      border-top-right-radius: $datePicker-date-border-radius;
      border-bottom-right-radius: $datePicker-date-border-radius;

    }
  }
  &--in-selected {
    background: rgba($brand-primary, 0.1);
  }

  // disabled
  &--disabled {
    cursor: not-allowed !important;
    > a{
      @extend %date-pick-disabled;
      cursor: not-allowed;
    }

    & + #{$root}--disabled {
      position: relative;
      > a {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
      }

      &::before {
        position: absolute;
        top: 0;
        left: -15px;
        width: 18px;
        height: $datePicker-date-height;
        content: "";
        background-color: $gray-lightest-5;
        background-clip: content-box;
        border-top: 2px solid $gray-lightest-5;
        border-right: 2px solid transparent;
        border-bottom: 2px solid $gray-lightest-5;
        border-left: 2px solid transparent;
      }
    }

    &:hover > a{
      @extend %date-pick-disabled;
    }
  }

  a.date-pick--disabled {
    @extend %date-pick-disabled;
  }

  //快捷选项
  &__sidebar {
    flex-grow: 1;
    background: $gray-lightest-5;
    @include border-right-radius($border-radius);
    padding: 14px;
    overflow-y: auto;
    max-height: $date-panel-height;
    @extend %thin-scroll;
  }


  //月份选择，年份选择
  &__month-panel,
  &__year-panel{
    display:flex;
    flex-direction: column;
    height:100%;
    #{$root}__body{
      flex: 1;
    }
    table {
      height: 100%;
      tbody td {
        padding: $datePicker-other-panel-date-padding;
        a {
          width: $datePicker-other-panel-date-width;
          border-radius: 2px;
          display: inline-block;
        }
      }
    }
  }

  //时间选择
  &__time-panel {
    position:relative;
    height:100%;
    .#{$date-pick-prefix-cls}__header,
    .#{$date-pick-prefix-cls}__body{
      padding-left:$datePicker-padding-x;
      padding-right:$datePicker-padding-x;
    }
    .#{$date-pick-prefix-cls}__body{
      position:relative;
      padding:0;
    }
    .time-spinner {
      height:100%;
      text-align: center;
      overflow: hidden;
      &__title {
        padding:0;
        margin:0;
        overflow: hidden;
        li {
          list-style: none;
          float: left;
          width: 33.3333%;
          text-align: center;
          padding: 0;
          height:40px;
          line-height: 40px;
          color:$gray;
          font-size:$datePicker-date-font-size;
          margin-left: -1px;
          &:nth-child(2) {
            border-left: 1px solid #e9e9e9;
            border-right: 1px solid #e9e9e9;
          }
        }
      }
      &__select {
        float: left;
        font-size: $font-size-sm;
        border: 1px solid #e9e9e9;
        border-width: 0 1px;
        margin-left: -1px;
        width: 33.3333%;
        position: relative;
        overflow: hidden;
        font-size:$datePicker-date-font-size;
        &:last-child{
          border:none;
        }

        ul {
          // @extend %transparent-scroll;
          list-style: none;
          padding: 0;
          margin:0;
          max-height: $time-spinner-height;
          overflow-y: auto;
          width: 100%;

          li {
            margin: 0;
            cursor: pointer;
            a {
              width: 100%;
              height: 40px;
              line-height: 40px;
              display: inline-block;
              border-radius: $datePicker-date-border-radius;
              @include hover{
                outline: none;
                &:not(.time-spinner--selected){
                  background: $gray-lightest-10;
                }
              }
            }

            &.blank {
              height: $datePicker-date-height;
              margin-top: -4px;
              margin-bottom: 0;
            }
          }
        }
      }
      //checked
      &--selected {
        color: $brand-primary !important;
        background: $list-hover-bg;
      }
    }
  }
}

.month-table .#{$date-pick-prefix-cls}--in-selected {
  background: transparent;
  a {
    background: rgba($brand-primary, .1);
  }
}

.#{$date-pick-prefix-cls}__month-panel .month-table tbody td a {
  width: 100%;
}

.time-scroll {
  display: flex;
  height: 100%;
  overflow: hidden;
  text-align: center;
  &__title {
    display: flex;
    padding: 0;
    margin: 0;
    overflow: hidden;
    li {
      flex: 1;
      height: 40px;
      padding: 0;
      margin-left: -1px;
      font-size: 12px;
      line-height: 40px;
      color: #666;
      text-align: center;
      list-style: none;
    }
  }
  &__select {
    flex: 1;
    margin-left: -1px;
    overflow: hidden;
    font-size: 12px;
    border: 1px solid #e9e9e9;
    border-width: 0 1px;
    ul {
      width: 100%;
      max-height: 190px;
      padding: 0;
      margin: 0;
      overflow-y: auto;
      list-style: none;
      li {
        height: 40px;
        margin: 0;
        line-height: 40px;
        cursor: pointer;
        &.blank {
          height: 24px;
          margin-top: -4px;
          margin-bottom: 0;
        }
        a {
          display: block;
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  &--selected {
    color: #0b82ff!important;
    background: rgba(11,130,255,.05);
  }
}
