@import "../../../../es/style/themes/default";
@import "../../../../es/style/mixins/index";
@import "../../trigger-field/style/mixin";

@date-picker-prefix: ~"@{c7n-pro-prefix}-calendar";
@date-picker-width: 2.8rem;
@date-picker-horizontal-padding: .12rem;
@date-picker-border-base: @border-width-base @border-style-base @input-border-color;
@date-time-list-width: (@date-picker-width - @date-picker-horizontal-padding * 2 + .02rem) / 3;
@date-time-list-item-height: .24rem;

.@{date-picker-prefix} {
  &-picker {
    .trigger;

    &-popup {
      width: @date-picker-width;
      background-clip: padding-box;
      line-height: 1.5;
    }

    &-suffix {
      display: flex;
      cursor: pointer;
      justify-content: center;
      align-items: center;
      height: 100%;
      padding: .05rem .03rem;
      width: auto;

      .@{iconfont-css-prefix} {
        display: block;
      }
    }
  }

  &-body {
    padding: .08rem @date-picker-horizontal-padding;
    overflow: hidden;
    table {
      width: 100%;
      font-size: @font-size-lg;
    }
    th {
      line-height: .18rem;
      width: .33rem;
      padding: .06rem 0;
      text-align: center;
      font-weight: normal;
    }
  }
  &-cell {
    text-align: center;
    padding: .03rem 0;
    height: .3rem;
    &-inner {
      display: block;
      margin: 0 auto;
      border-radius: @border-radius-sm;
      height: .24rem;
      line-height: .22rem;
      border: @border-width-base @border-style-base transparent;
      padding: 0;
      background-color: transparent;
      text-align: center;
      transition: background .3s ease;
      cursor: pointer;
      &:hover {
        background-color: @item-hover-bg;
      }
      &:active {
        color: #fff;
        background-color: @primary-5;
      }
    }
  }

  &-old &-cell-inner,
  &-new &-cell-inner {
    color: @disabled-color;
  }

  &-today &-cell-inner {
    border-color: @primary-color;
    font-weight: bold;
    color: @primary-color;
  }

  &-selected &-cell-inner {
    background: @primary-color;
    color: #fff;
    border: @border-width-base @border-style-base transparent;

    &:hover {
      background: @primary-color;
    }
  }

  &-disabled &-cell-inner {
    cursor: not-allowed;
    color: #bcbcbc;
    background: @disabled-bg;
    border-radius: 0;
    width: auto;
    border: @border-width-base @border-style-base transparent;

    &:hover {
      background: @disabled-bg;
    }
  }
  &-disabled&-today &-cell-inner {
    position: relative;
    &:before {
      content: " ";
      position: absolute;
      top: .01rem;
      left: .01rem;
      width: .2rem;
      height: .2rem;
      border: @border-width-base @border-style-base #bcbcbc;
      border-radius: @border-radius-base;
    }
  }

  &-day-panel &-cell-inner,
  &-time-panel &-cell-inner {
    width: .24rem;
  }

  &-month-panel &-cell,
  &-year-panel &-cell {
    padding: .2rem 0;
  }

  &-month-panel &-cell-inner,
  &-year-panel &-cell-inner {
    display: inline-block;
    padding: 0 .06rem;
  }

  &-time-panel &-cell-inner {
    height: @date-time-list-item-height - .06rem;
    line-height: @date-time-list-item-height - .07rem;
  }

  &-header {
    height: .4rem;
    line-height: .4rem;
    text-align: center;
    user-select: none;
    border-bottom: @border-width-base @border-style-base @border-color-split;
    padding: 0 .07rem;

    a:hover {
      color: @link-hover-color;
    }
  }
  &-prev-year,
  &-prev-month,
  &-next-year,
  &-next-month {
    color: @text-color-secondary;
    font-family: Arial, "Hiragino Sans GB", "Microsoft Yahei", "Microsoft Sans Serif", sans-serif;
    padding: 0 .05rem;
    font-size: .14rem;
  }

  &-prev-year,
  &-prev-month {
    float: left;
  }

  &-next-year,
  &-next-month {
    float: right;
  }

  &-view-select {
    padding: 0 .02rem;
    font-weight: bold;
    color: @text-color;
    line-height: .34rem;
  }

  &-footer {
    position: relative;
    text-align: center;
    border-top: @border-width-base @border-style-base @border-color-split;
    line-height: .39rem;
    height: .39rem;
    button {
      transition: all .3s ease-out, visibility 0s;
    }
  }
  &-footer-now-btn {
    position: absolute;
    left: .12rem;
  }
  &-footer-view-select {
    position: absolute;
    right: .12rem;
  }

  &-week-panel {
    tbody tr {
      &:hover {
        .@{date-picker-prefix}-cell-inner {
          background-color: @item-hover-bg;
        }
      }
      &:active {
        .@{date-picker-prefix}-cell-inner {
          color: #fff;
          background-color: @primary-5;
        }
      }
      .@{date-picker-prefix}-selected .@{date-picker-prefix}-cell-inner {
        color: #fff;
        background-color: @primary-color;
      }
    }
    .@{date-picker-prefix}-cell {
      &-inner {
        border-radius: 0;
      }
      &:first-child .@{date-picker-prefix}-cell-inner {
        border-top-left-radius: @border-radius-base;
        border-bottom-left-radius: @border-radius-base;
      }
      &:last-child .@{date-picker-prefix}-cell-inner {
        border-top-right-radius: @border-radius-base;
        border-bottom-right-radius: @border-radius-base;
      }
    }
  }

  &-week-cell &-cell-inner {
    color: @disabled-color;
  }

  &-time-panel {
    height: 2.26rem;
    &-inner {
      position: relative;
      height: @date-time-list-item-height;
    }
  }

  &-time-list {
    position: relative;
    width: 33.33%;
    height: 100%;
    float: left;
    &:first-child .@{date-picker-prefix}-time-focus {
      border-top-left-radius: @border-radius-base;
      border-bottom-left-radius: @border-radius-base;
      border-right: 0;
    }
    &:nth-child(3) .@{date-picker-prefix}-time-focus {
      border-top-right-radius: @border-radius-base;
      border-bottom-right-radius: @border-radius-base;
      border-left: 0;
    }
    ul {
      position: absolute;
      top: 50%;
      list-style: none;
      margin: 0;
      padding: 0;
      width: 100%;
      transition: top .3s ease;
    }
    li {
      list-style: none;
      height: @date-time-list-item-height;
    }
  }
  &-time-focus, &-time-focus-active {
    position: absolute;
    top: 450%;
    border: @border-width-base @border-style-base @input-border-color;
  }
  &-time-focus {
    width: 100%;
    height: 100%;
    &-active {
      width: 33.33%;
      height: 100%;
      .active();
      border-radius: @border-radius-base;
      transition: left .3s ease;
    }
  }
  &-h &-time-focus-active {
    left: 0;
  }

  &-m &-time-focus-active {
    left: 33.33%;
  }

  &-s &-time-focus-active {
    left: 66.66%;
  }
}
