@import (reference) './variable.less';

@keyframes number-input-cursor {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.ant-rare-words-keyboard {
  color: @rare-words-keyboard-color;
  width: 0;
  height: 0;
  position: relative;
  overflow: hidden;

  &-modal {
    z-index: 998;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: @rare-words-bg;

    &.hide {
      visibility: hidden;
    }
  }

  &-kb {
    background: @rare-words-kb-bg;
    max-height: 1200 * @rpx;
    min-width: 100vw;
    position: fixed;
    bottom: 0;
    left: 0;
    transition: all 200ms linear;
    z-index: 999;

    &.hide {
      transform: translateY(100%);
      max-height: 0;
    }

    &_iphonex-safe {
      height: calc(constant(safe-area-inset-bottom) - 20 * @rpx);
      height: calc(env(safe-area-inset-bottom) - 20 * @rpx);
      width: 100%;
      background-color: @rare-words-kb-bg;
    }
  }

  &_header {
    background-color: @rare-words-kb-bg;
  }

  &-input_value {
    position: absolute;
    top: -64 * @rpx;
    left: 0;
    display: inline-block;
    height: 64 * @rpx;
    line-height: 64 * @rpx;
    border-top-left-radius: 8 * @rpx;
    border-top-right-radius: 8 * @rpx;
    background-color: @rare-words-kb-bg;
    padding-left: 20 * @rpx;
    padding-right: 20 * @rpx;
    border: 1 * @rpx solid @rare-words-border-color;
    border-bottom: 0;
    letter-spacing: 2 * @rpx;
    box-sizing: border-box;
    font-size: 24 * @rpx;
    color: @rare-words-keyboard-color;

    &.hide {
      display: none;
    }
  }

  &-match_words {
    display: flex;
    flex-flow: row nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 20 * @rpx 24 * @rpx 20 * @rpx 8 * @rpx;
    background: @rare-words-kb-bg;
    overflow: hidden;
    font-family: 'rare-words-font';

    &.absolute {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      box-sizing: border-box;
      z-index: 10000;
      padding-left: 0;
      overflow: auto;
    }

    &_wrap {
      min-height: 96 * @rpx;

      &::before {
        content: '';
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        background: @rare-words-inner-bg;
        width: 100%;
        height: 2 * @rpx;
        transform: scaleY(0.5);
        transform-origin: 0 0;
      }
    }

    &_item_tips {
      padding-left: 8 * @rpx;
      font-size: 28 * @rpx;
      color: @rare-words-item-tips-color;
      line-height: 34 * @rpx;

      &.loading {
        display: flex;
        flex-flow: row nowrap;
        align-items: center;
      }
    }

    &_inner {
      flex: 1;
      display: flex;
      flex-flow: row wrap;
      align-items: center;
      justify-content: flex-start;
      overflow: hidden;
      height: 56 * @rpx;
      white-space: nowrap;
      box-sizing: border-box;
      margin-right: -32 * @rpx;
      padding-right: 42 * @rpx;

      &.all {
        height: auto;
        margin-top: -20 * @rpx;
        position: relative;
        padding-left: 8 * @rpx;
        padding-right: 42 * @rpx;

        &::after {
          content: '';
          display: block;
          position: absolute;
          left: -64 * @rpx;
          bottom: 0;
          background: @rare-words-inner-bg;
          width: 100%;
          height: 2 * @rpx;
          transform: scaleY(0.5);
          transform-origin: 0 0;
        }
      }
    }

    &_item {
      color: @rare-words-inner-bg;
      width: 73 * @rpx;
      padding-left: 16 * @rpx;
      padding-right: 16 * @rpx;
      box-sizing: border-box;

      &.all {
        padding-top: 20 * @rpx;
        padding-bottom: 20 * @rpx;
        position: relative;

        &::after {
          content: '';
          display: block;
          position: absolute;
          left: -20 * @rpx;
          bottom: 0;
          background: @rare-words-inner-bg;
          width: 100%;
          height: 2 * @rpx;
          transform: scaleY(0.5);
          transform-origin: 0 0;
        }
      }

      &_text {
        font-size: 42 * @rpx;
        line-height: 57 * @rpx;
        user-select: none;
        color: @rare-words-keyboard-color;

        &:active {
          color: @rare-words-active-color;
        }

        &:hover {
          color: @rare-words-active-color;
        }
      }
    }

    &_hidden {
      visibility: hidden;
      position: absolute;
      top: -19998 * @rpx;
      left: -19998 * @rpx;
      width: 73 * @rpx;
      padding-left: 16 * @rpx;
      padding-right: 16 * @rpx;
      box-sizing: border-box;
    }

    &_right {
      width: 48 * @rpx;
      height: 48 * @rpx;
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: center;
      position: relative;
      margin-top: 4 * @rpx;
      color: @rare-words-keyboard-color;

      &.sticky {
        position: sticky !important;
        top: 0 !important;
        left: 0 !important;
      }

      &.overflow {
        &::before {
          content: '';
          display: block;
          width: 10 * @rpx;
          height: 100%;
          background: linear-gradient(
            to right,
            transparent,
            @rare-words-keyboard-bg
          );
          position: absolute;
          left: -32 * @rpx;
        }
      }
    }
  }

  &-loading {
    min-height: 34 * @rpx;
    margin-right: 12 * @rpx;
  }

  &_delete {
    font-size: 48 * @rpx;
  }

  &_down {
    font-size: 48 * @rpx;
  }

  &_pinyin {
    background: @rare-words-pinyin-color;
    padding-top: 16 * @rpx;
    padding-bottom: 16 * @rpx;

    &_row {
      display: flex;
      flex-flow: row nowrap;
      justify-content: center;
      background: @rare-words-pinyin-color;
      margin-bottom: 16 * @rpx;

      &:last-child {
        margin-bottom: 0;
      }
    }

    &_key {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 88 * @rpx;
      width: 63 * @rpx;
      background: @rare-words-pinyin-key-color;
      font-size: 36 * @rpx;
      color: @rare-words-keyboard-color;
      box-sizing: border-box;
      border-radius: 8 * @rpx;
      margin-right: 12 * @rpx;
      user-select: none;

      &:active {
        background: @rare-words-active-color;
        color: @rare-words-pinyin-key-color;
      }

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

      &.delete {
        width: 80 * @rpx;
      }
    }
  }

  &_error {
    background: @rare-words-pinyin-color;
    padding-top: 30 * @rpx;
    padding-bottom: 30 * @rpx;

    .ant-result-main {
      background: none;
      margin-bottom: 0;
      padding-top: 40 * @rpx;
      padding-bottom: 40 * @rpx;
    }

    .ant-result-message {
      text-align: center;
    }

    &-btns {
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: center;
    }
  }
}
