/* Author: ひまわり(dtysky<dtysky@outlook.com>)
 * Github: https://github.com/dtysky
 * Create: 17/1/23
 */
@import "../../styles/config";

$container-width: 400px;

$time-picker-display-height: 58px;
$time-picker-center-padding: 32px;
$time-picker-days-row-height: 28px;

$time-picker-duration-time-day: 400ms;
$time-picker-duration-time-enter: 400ms;
$time-picker-duration-time-leave: 200ms;

@mixin translation-group($selector, $max-position: none, $enter-time: $time-picker-duration-time-enter, $leave-time: $time-picker-duration-time-leave) {
  #{$selector}-enter {
    opacity: 0;

    @if($max-position != none) {
      margin-top: $max-position;
    }
  }

  #{$selector}-enter-active {
    opacity: 1;

    @if($max-position != none) {
      margin-top: 0;
    }

    transition: all $enter-time ease-out;
  }

  #{$selector}-exit {
    opacity: 1;

    @if($max-position != none) {
      margin-top: 0;
    }
  }

  #{$selector}-exit-active {
    opacity: 0;

    @if($max-position != none) {
      margin-top: -$max-position;
    }

    transition: all $leave-time ease-out;
  }
}

.hana-time-picker {
  &-warp {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
  }

  &-container {
    &-container {
      position: fixed;
      z-index: $z-index-picker;
      margin-top: 4px;
      width: $container-width;
      padding: 24px 6px 6px 6px;
      border: 1px solid $date-picker-theme-front-color;
      border-radius: 4px;
      background: $date-picker-theme-back-color;
      overflow: hidden;
    }

    @include translation-group(&, none, 400ms, 400ms);
  }

  &-content {
    display: flex;
    width: 100%;
    height: 96px;
    margin: auto;
    color: $date-picker-font-main-color;
    font-size: 28px;
    font-weight: 200;
  }
  
  &-hour, &-minute, &-second {
    position: relative;
    width: 33.3%;
    height: 100%;
  }

  &-v-line {
    display: none;
    font-size: 24px;
    font-weight: 300;
    line-height: 42px;
  }

  &-select {
    display: flex;
    align-items: center;
    height: 100%;

    &-container {
      height: 28px;
    }

    &-icon {
      @extend %hanaicon;
      display: block;
      position: absolute;
      width: 25%;
      height: 28px;
      line-height: 28px;
      color: $time-picker-font-sub-color;
      font-size: 13px;
      cursor: pointer;
    }

    &-pre {
      text-align: right;
      @include hana-icon($time-picker-pre-icon);
    }

    &-content {
      position: absolute;
      width: 50%;
      margin-left: 25%;
      text-align: center;
      cursor: pointer;
      transition: all 0.4s linear;
    }

    &-next {
      text-align: left;
      margin-left: 75%;
      @include hana-icon($time-picker-next-icon);
    }

    @include translation-group(#{&}-close-pre, -12px);
    @include translation-group(#{&}-close-next, 12px);

    &-open {
      overflow: auto;
      height: 100%;
      top: 0;
      background-color: $time-picker-theme-back-color;

      &::-webkit-scrollbar {
        width: 8px;
        background: none;
      }

      &::-webkit-scrollbar-thumb {
        background-color: $time-picker-font-sub-color;
      }
    }

    @include translation-group(#{&}-open, none);

    &-open &-option {
      font-size: 14px;
      padding: 4px 0;

      &:hover {
        background-color: rgba($time-picker-theme-front-color, .6);
      }

      &-current {
        background-color: rgba($time-picker-theme-front-color, .6);
      }
    }
  }

  &-action-buttons {
    padding-top: 18px;
    width: 95%;
    text-align: right;
  }

  &-confirm-button, &-cancel-button, &-clear-button {
    border: none;
    background-color: transparent;
    color: #888;
    text-align: center;
    font-size: 14px;
    padding: 6px 12px;
    height: 28px;

    &:hover {
      color: #444;
      background-color: rgba(#ddd, 0.4);
    }
  }
}
