.lm_filter_wrapper {
  .lm_filter_container {
    .lm_filter {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      font-size: 12px;

      // 自定义筛选
      .lm_filter_custom {
        display: inline-flex;
        gap: 8px;

        .lm_filter_custom_select {
          display: inline-flex;
          align-items: center;
          justify-content: space-between;
          min-width: 100px;
          max-width: 180px;
          height: 32px;
          padding: 0 8px;
          color: var(--font2-color);
          line-height: 1;
          border: 1px solid var(--color-15);
          border-radius: 2px;
          cursor: pointer;
          transition: 0.3s;

          &.small {
            height: 24px;
          }

          .lm_filter_custom_select_label {
            span {
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
          }

          .lm_filter_custom_select_icon {
            color: var(--text-color);
            font-size: @lm-font-size-base;
            transition: 0.3s;
          }

          &:hover {
            border-color: var(--primary-hover-color);
          }

          &.expand {
            color: var(--text-color);
            border-color: var(--primary-hover-color);

            .lm_filter_custom_select_icon {
              transform: rotateX(180deg);
            }
          }
        }

        .lm_filter_custom_line {
          width: 1px;
          height: 32px;
          background-color: var(--background-color-hover);
        }
      }

      .lm_filter_search {
        width: 140px;
        max-width: 140px;
      }

      .lm_filter_complex {
        display: inline-flex;
      }

      &.lm_filter_small {
        .lm_filter_custom_line {
          height: 24px;
        }
      }
    }
  }
}

.lm_filter_basic_item {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
  vertical-align: middle;
  border-radius: 2px;
  cursor: pointer;
  transition: 0.3s;

  &.small {
    height: 24px;
  }

  // 悬浮/展开/选中都展示背景色
  &:hover,
  &.expand,
  &.active {
    background-color: var(--color-4);
  }

  .filter_item_label {
    flex: 0 0 auto;
  }

  .filter_item_value {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    max-width: 552px;
    overflow: hidden;
    color: var(--text-color);
    transition: 0.3s;

    span {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }
  }

  .filter_item_icon {
    color: var(--text-color);
    font-size: 14px;
    transition: 0.3s;

    &.addon_before {
      color: var(--font-color);
    }

    .icon_clear {
      display: none;
    }
  }

  &.expand {
    .filter_item_icon.addon_after {
      transform: rotateX(180deg);
    }
  }

  &.active {
    .filter_item_value {
      color: var(--primary-color);
    }

    // 选中时不转动清除图标
    .filter_item_icon.addon_after {
      transform: rotateX(180deg);
    }

    // 高级筛选选中
    &.lm_filter_complex_item {
      .filter_item_icon,
      .filter_item_label {
        color: var(--primary-color);
      }
    }

    // 存在选中项时，hover展示
    &:hover {
      .icon_down {
        display: none;
      }
      .icon_clear {
        display: inline-block;
      }
    }
  }
}

// 下拉样式
.ant-dropdown {
  // 解决级联选择的偏移不同问题
  &.filter_dropdown_container_cascader > div {
    transform: translateY(-4px);
  }

  &.filter_dropdown_container_date .ant-picker {
    transform: translateY(-36px);
    visibility: hidden;
  }
}

// 单选、多选、级联选择下拉菜单样式
.filter_dropdown {
  display: flex;
  flex-flow: column;
  background-color: #fff;
  box-shadow: 0 2px 6px var(--box-shadow-color);

  .filter_header {
    min-height: 40px;
    padding: 8px;
    border-bottom: 1px solid #eee;

    .filter_header_operate {
      display: flex;
      align-items: center;
      justify-content: space-between;

      .filter_header_operate_checked {
        display: inline-flex;
        align-items: center;
      }

      .filter_reset {
        color: var(--primary-color);
        font-size: 12px;
        cursor: pointer;
      }

      .filter_tip {
        color: var(--text-color);
        font-size: 12px;
      }
    }

    .ant-input-group {
      line-height: 1;
    }

    input {
      font-size: 12px;
    }

    .ant-input-search + .filter_header_operate {
      margin-top: 8px;
    }
  }

  .filter_body {
    width: 100%;

    .virtual_list {
      min-width: 168px;
      max-height: 224px;
      overflow: auto;
    }

    .filter_item {
      display: flex;
      gap: 8px;
      align-items: center;
      justify-content: space-between;
      min-width: 120px;
      height: 32px;
      padding: 0 8px;
      font-size: 12px;
      white-space: nowrap;
      cursor: pointer;
      transition: 0.3s;

      &.last_item {
        border-top: 1px solid var(--line-color);
      }

      .filter_item_content {
        flex: auto;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;

        &.lm-checkbox > span:last-child {
          max-width: none;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }

      .filter_item_operate {
        display: inline-flex;
        gap: 4px;
        align-items: center;

        .icon_hover {
          font-size: 16px;
          opacity: 0;
          transition: 0.3s;

          &:hover {
            color: var(--primary-color);
          }
        }
      }

      &[disabled] {
        display: none;
      }

      &.checked {
        color: var(--font-color);
        background-color: var(--primary-select-color);
      }

      &:hover {
        background-color: var(--background-color);

        .filter_item_operate .icon_hover {
          opacity: 1;
        }
      }
    }
  }

  .filter_footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
    letter-spacing: 1px;
    border-top: 1px solid #eee;

    button {
      padding: 0 8px;
      font-size: 12px;
    }

    .footer_save {
      color: var(--primary-color);
      cursor: pointer;
      transition: 0.3s;
    }

    .footer_clear {
      color: var(--text-color);
      cursor: pointer;
      transition: 0.3s;

      &:hover {
        color: var(--font-color);
      }
    }
  }

  .filter_empty {
    display: flex;
    flex-flow: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: auto;
    padding: 16px 8px;
    color: #666;
    font-size: 12px;

    .filter_empty_text {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 20px;
      color: var(--font-color);
    }
  }

  // 组件的样式重置
  .ant-checkbox-wrapper {
    flex: 1;
    align-items: center;
    font-size: 12px;

    .ant-checkbox {
      top: initial;
    }
  }
}

// 抽屉组件样式
.ant-drawer {
  .ant-drawer-header {
    .ant-drawer-title {
      font-size: @lm-font-size-base;
    }
  }

  &.lm_filter_drawer {
    // 自定义筛选抽屉样式
    .filter_drawer_group {
      font-size: 12px;
      line-height: 1;

      .ant-form-item {
        margin-bottom: 16px;
      }

      .ant-form-item-label {
        padding-bottom: 0;

        label {
          font-size: 12px;
        }
      }

      input {
        font-size: 12px;
      }

      // 单选按钮
      .ant-radio-wrapper {
        display: inline-flex;
        align-items: center;
        font-size: 12px;

        .ant-radio {
          top: 0;
        }
      }
    }

    .filter_drawer_group_add {
      padding: 0 0 8px;

      .ant-btn {
        max-width: initial;
        font-size: 12px;
      }
    }

    .filter_drawer_group_list {
      .filter_drawer_group_item {
        margin-bottom: var(--gap);

        .item_box {
          padding: calc(var(--gap) * 2);
          line-height: 1;
          background: var(--background-color);
          border: 1px solid transparent;
          border-radius: 2px;
          cursor: pointer;
          transition: 0.3s;

          .item_header {
            display: flex;
            align-items: center;
            justify-content: space-between;

            .item_header_title {
              font-weight: 500;
              font-size: 12px;
            }

            .item_header_icon {
              color: #8c8c8c;
              font-size: 16px;
              transition: 0.3s;

              &.icon_plus {
                color: var(--font-color);
              }

              &:hover {
                color: var(--font-color);
              }
            }
          }

          .item_tags {
            display: flex;
            flex-flow: wrap;
            gap: var(--gap);
            padding-top: 12px;

            .ant-tag {
              margin: 0;
              color: var(--font-color);
              background-color: var(--background-color);

              &.add_tags {
                background: transparent;
                border-style: dashed;
                cursor: pointer;
                &:hover {
                  color: var(--primary-color);
                  border-color: var(--primary-color);
                }
              }
            }

            .tag-input {
              width: 78px;
              margin-right: 8px;
              vertical-align: top;
            }
          }
        }
      }
    }

    // 高级筛选抽屉样式
    .complex_filter_body {
      .checked_group {
        margin-bottom: 24px;
      }

      .list_group {
        .list_group_title {
          font-weight: 500;
          font-size: @lm-font-size-base;
          line-height: 1.25;
        }

        .list_group_search {
          margin: 16px 0;
        }
      }
    }
  }

  // 高级筛选二层抽屉
  &.lm_det_drawer {
    .checkbox_tag {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 24px;
      padding: 0 8px;
      color: var(--font-color);
      font-size: 12px;
      background-color: var(--stripe-color);
      border-radius: 2px;
      cursor: pointer;
      transition: 0.3s;

      &:hover,
      &.active {
        color: #fff;
        background-color: var(--primary-color);
      }
    }

    .ant-form-item {
      margin-bottom: 16px;

      .ant-form-item-label > label {
        font-weight: 500;
      }
    }

    .auto_height {
      max-height: 418px;
      overflow-y: auto;
    }

    // 单选按钮
    .ant-radio-wrapper {
      display: inline-flex;
      align-items: center;
      font-size: 12px;

      .ant-radio {
        top: 0;
      }
    }

    .ant-select {
      width: 100%;
      font-size: 12px;
    }

    // 自定义表单样式
    .custom_form {
      display: flex;
      flex-flow: column;
      gap: 24px;
      height: 100%;

      .custom_label {
        margin-bottom: 16px;
        color: var(--font-color);
        font-weight: 500;
        font-size: @lm-font-size-base;
      }

      // 自适应高度
      .custom_full {
        display: flex;
        flex: 1;
        flex-flow: column;
      }
    }
  }
}

// 日期区间下拉框
.lm_filter_dropdown_picker {
  padding: 0 !important; // 解决下拉菜单偏移问题

  .filter_picker_box {
    display: flex;

    .filter_picker_aside {
      padding: 6px 0;
      font-size: 12px;
      border-right: 1px solid var(--background-color-hover);

      .filter_picker_aside_item {
        display: flex;
        align-items: center;
        height: 32px;
        padding: 0 8px;
        cursor: pointer;
        transition: 0.3s;

        &:hover,
        &.active {
          background-color: var(--primary-select-color);
        }
      }
    }

    .filter_picker_main {
      .filter_picker_header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 40px;
        padding: 0 16px;
        line-height: 1;
        border-bottom: 1px solid var(--background-color-hover);

        .ant-radio-button-wrapper {
          color: var(--font2-color);
          font-size: 12px;

          &:hover,
          &.ant-radio-button-wrapper-checked {
            color: var(--primary-color);
          }
        }
      }
    }
  }

  .ant-picker-range-arrow {
    display: none;
  }
}

// 级联选择弹窗
.ant-select-dropdown.ant-cascader-dropdown {
  padding: 0;
}
