@import url(../var.less);
@import url(./index.less);
@import url(./popper.less);
@import url(./tag.less);
@import url(./cascader-panel.less);

@cascader-prefix: ~"@{prefix}cascader";

.@{cascader-prefix}{
  display: inline-block;
  position: relative;
  font-size: @font-size-base;
  line-height: @input-height;

  &:not(.is-disabled):hover {
    .w-input__inner {
      cursor: pointer;
      border-color: @input-hover-border;
    }
  }

  .w-input {
    cursor: pointer;

    .w-input__inner {
      text-overflow: ellipsis;

      &:focus {
        border-color: @input-focus-border;
      }
    }

    .w-icon-arrow-down {
      transition: transform .3s;
      font-size: 14px;

      .is-reverse {
        transform: rotateZ(180deg);
      }
    }

    .w-icon-circle-close:hover {
      color: @input-clear-hover-color;
    }

    .is-focus {
      .w-input__inner {
        border-color: @input-focus-border;
      }
    }
  }

  &--medium {
    font-size: @input-medium-font-size;
    line-height: @input-medium-height;
  }

  &--small {
    font-size: @input-medium-font-size;
    line-height: @input-medium-height;
  }

  &.is-disabled {
    .w-cascader__label {
      z-index: @z-index-normal + 1;
      color: @disabled-font-color;
    }
  }

  &__dropdown {
    margin: 5px 0;
    font-size: @cascader-menu-font-size;
    background: @cascader-menu-fill;
    border: @cascader-menu-border;
    border-radius: @cascader-menu-radius;
    box-shadow: @cascader-menu-shadow;
  }

  &__tags {
    position: absolute;
    left: 0;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-wrap: wrap;
    line-height: normal;
    text-align: left;
    box-sizing: border-box;

    .w-tag {
      display: inline-flex;
      align-items: center;
      max-width: 100%;
      margin: 2px 0 2px 6px;
      text-overflow: ellipsis;
      background: @cascader-tag-background;

      &:not(.is-hit) {
        border-color: transparent;
      }

      > span {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .w-icon-close {
        flex: none;
        background-color: @placeholder-text-color;
        color: @color-white;

        &:hover {
          background-color: @secondary-text-color;
        }
      }
    }
  }

  &__suggestion-panel {
    border-radius: @cascader-menu-radius;
  }

  &__suggestion-list {
    max-height: 204px;
    margin: 0;
    padding: 6px 0;
    font-size: @font-size-base;
    color: @cascader-menu-font-color;
    text-align: center;
  }

  &__suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 34px;
    padding: 0 15px;
    text-align: left;
    outline: none;
    cursor: pointer;

    &:hover, &:focus {
      background: @cascader-node-background-hover;
    }

    &.is-checked {
      color: @cascader-menu-selected-font-color;
      font-weight: bold;
    }

    > span {
      margin-right: 10px;
    }
  }

  &__empty-text {
    margin: 10px 0;
    color: @cascader-color-empty;
  }

  &__search-input {
    flex: 1;
    height: 24px;
    min-width: 60px;
    margin: 2px 0 2px 15px;
    padding: 0;
    color: @cascader-menu-font-color;
    border: none;
    outline: none;
    box-sizing: border-box;

    &::placeholder {
      color: @placeholder-text-color;
    }
  }

  &__extend {
    .w-cascader-menu:first-child {
      border-right:@cascader-menu-border;
    }

    &--default {
      border-top: @cascader-menu-border;
      padding: 5px 12px;
    }
  }
}