%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-lighter;
      font-size: 1.3em;
      transition: all .3s;
      line-height: 1;
      .aid-close-circle {
        display: none;
      }
    }
    input.#{$input-prefix-cls} {
      padding-right: ($input-padding-x * 2 + 1.06);
    }

  }

  //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;
  //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);
        @include active-primary(true);
        #{$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;
    @include border-top-radius($border-radius);
    @include active-primary;

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


  &__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: $datePicker-other-panel-date-border-radius;
          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;
    }
    &:after{
      height: 28px;
      background-color: #fff;
      opacity: 0.7;
      filter: alpha(opacity=70);
      content: " ";
      width: 100%;
      position: absolute;
      left: 0;
      right: 0;
      z-index: 10;
      bottom: 0;
      background: linear-gradient(#fff, #f5f5f5);
    }
    .time-spinner {
      height:100%;
      text-align: center;
      overflow: hidden;
      &__title {
        padding:0;
        margin:0;
        overflow: hidden;
        li {
          font-weight: 500;
          list-style: none;
          float: left;
          width: 33.3333%;
          text-align: center;
          padding: 0;
          height:18px;
          line-height: 18px;
          margin:8px 0 14px;
          color:$gray;
          font-size:$datePicker-date-font-size;
        }
      }
      &__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;
            margin-bottom:nth($datePicker-date-spacer,2);
            a {
              width: $datePicker-date-width;
              height: $datePicker-date-height;
              line-height: $datePicker-date-height;
              display: inline-block;
              border-radius: $datePicker-date-border-radius;
              @include hover{
                outline: none;
                &:not(.time-spinner--selected){
                  background: rgba($brand-primary, 0.1);
                }
              }
            }

            &.blank {
              height: $datePicker-date-height;
              margin-top: -4px;
              margin-bottom: 0;
            }
          }
        }
      }
      //checked
      &--selected {
        @extend %date-pick-selected;
      }
    }
  }
}
