@import '../../style/themes/default';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@timepicker-prefix-cls: ~'@{yg-prefix}-time-picker';
@timepicker-item-height: 30px;

.@{timepicker-prefix-cls}-panel {
  .reset-component;
  position: absolute;
  z-index: @zindex-picker;
  font-family: @font-family;

  &-inner {
    position: relative;
    left: -2px;
    font-size: @font-size-base;
    text-align: left;
    list-style: none;
    background-color: @component-background;
    background-clip: padding-box;
    border-radius: @border-radius-base;
    outline: none;
    box-shadow: @box-shadow-base;
  }

  &-input {
    width: 100%;
    max-width: @time-picker-panel-column-width * 3 - @control-padding-horizontal - 2px;
    margin: 0;
    padding: 0;
    line-height: normal;
    border: 0;
    outline: 0;
    cursor: auto;

    .placeholder;

    &-wrap {
      position: relative;
      box-sizing: content-box;
      padding: 7px 10px 7px @control-padding-horizontal;
      border-bottom: @border-width-base @border-style-base @border-color-split;
    }

    &-invalid {
      border-color: @error-color;
    }
  }

  &-narrow &-input-wrap {
    max-width: @time-picker-panel-column-width * 2;
  }

  &-select {
    position: relative; // Fix chrome weird render bug
    float: left;
    box-sizing: content-box;
    width: @time-picker-panel-column-width;
    max-height: @timepicker-item-height * 6;
    overflow: hidden;
    font-size: @font-size-base;
    border-left: @border-width-base @border-style-base @border-color-split;

    &:hover {
      overflow-y: auto;
    }

    &:first-child {
      margin-left: 0;
      border-left: 0;
    }

    &:last-child {
      border-right: 0;
    }

    &:only-child {
      width: 100%;
    }

    ul {
      box-sizing: content-box;
      width: 100%;
      margin: 0;
      padding: 0 0 @timepicker-item-height * 5;
      list-style: none;
    }

    li {
      box-sizing: content-box;
      width: ~'calc(100% - 10px)';
      height: @timepicker-item-height;
      margin: 0;
      padding: 0 0 0 @control-padding-horizontal;
      line-height: @timepicker-item-height;
      text-align: left;
      list-style: none;
      cursor: pointer;
      transition: background 0.3s;
      outline: none;
      user-select: none;
    }

    li:hover {
      background: @item-hover-bg;
    }

    li&-option-selected {
      font-weight: bold;
      background: @time-picker-selected-bg;
      &:hover {
        background: @time-picker-selected-bg;
      }
    }

    li&-option-disabled {
      color: @btn-disable-color;
      &:hover {
        background: transparent;
        cursor: not-allowed;
      }
    }
  }

  &-combobox {
    .clearfix;
  }

  &-addon {
    padding: 10px;
    text-align: right;
    border-top: @border-width-base @border-style-base @border-color-split;
  }

  &.slide-up-enter.slide-up-enter-active&-placement-topLeft,
  &.slide-up-enter.slide-up-enter-active&-placement-topRight,
  &.slide-up-appear.slide-up-appear-active&-placement-topLeft,
  &.slide-up-appear.slide-up-appear-active&-placement-topRight {
    animation-name: antSlideDownIn;
  }

  &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
  &.slide-up-enter.slide-up-enter-active&-placement-bottomRight,
  &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft,
  &.slide-up-appear.slide-up-appear-active&-placement-bottomRight {
    animation-name: antSlideUpIn;
  }

  &.slide-up-leave.slide-up-leave-active&-placement-topLeft,
  &.slide-up-leave.slide-up-leave-active&-placement-topRight {
    animation-name: antSlideDownOut;
  }

  &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft,
  &.slide-up-leave.slide-up-leave-active&-placement-bottomRight {
    animation-name: antSlideUpOut;
  }
}

.@{timepicker-prefix-cls} {
  .reset-component;
  position: relative;
  display: inline-block;
  width: @input-width-sm + 22px;
  outline: none;
  cursor: text;
  transition: opacity 0.3s;

  &-input {
    .input;
    &[disabled] {
      .disabled;
    }
  }

  &-open {
    opacity: 0;
  }

  &-icon,
  &-clear {
    position: absolute;
    top: 50%;
    right: @control-padding-horizontal - 1px;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    color: @disabled-color;
    line-height: 14px;
    transition: all 0.3s @ease-in-out;
    user-select: none;
    .@{timepicker-prefix-cls}-clock-icon {
      display: block;
      color: @disabled-color;
      line-height: 1;
    }
  }

  &-clear {
    z-index: 2;
    background: @input-bg;
    opacity: 0;
    pointer-events: none;
    &:hover {
      color: @text-color-secondary;
    }
  }
  &:hover &-clear {
    opacity: 1;
    pointer-events: auto;
  }

  &-large &-input {
    .input-lg;
  }

  &-small &-input {
    .input-sm;
  }

  &-small &-icon,
  &-small &-clear {
    right: @control-padding-horizontal-sm - 1px;
  }
}
