/**
 * PisellMultipleSelect 组件样式
 * 基于 Figma 设计规范，覆盖时使用 pisell-lowcode-xxx
 */

.pisell-multiple-select {
  height: 48px !important;
  width: 100%;

  .pisell-lowcode-select-clear {
    color: #667085;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin: -22px -8px;
    padding: 10px 8px;

    &:hover {
      color: #344054;
    }
  }

  // Select 触发器（Figma 设计规范，与 SingleSelect / Input 体系一致）
  .pisell-lowcode-select:not(.pisell-lowcode-select-disabled):not(.pisell-lowcode-select-customize-input) {
    .pisell-lowcode-select-selector {
      font-size: 16px !important;
      line-height: 24px !important;
      border-radius: 8px !important;
      border: 1px solid #d0d5dd !important; // Gray/300
      padding: 12px 16px !important;
      min-height: 48px !important;
      color: #101828 !important; // Gray/900
      background-color: #ffffff !important;
    }

    // 多选模式：内边距适配标签，高度保持 48px
    &.pisell-lowcode-select-multiple .pisell-lowcode-select-selector {
      padding: 6px 16px !important;
      min-height: 48px !important;
    }

    &.pisell-lowcode-select-open .pisell-lowcode-select-selector {
      border-color: #d6bbfb !important; // Primary/300
      box-shadow: 0 0 0 4px #f4ebff !important; // Primary/100
    }

    &:not(.pisell-lowcode-select-open):not(.pisell-lowcode-select-disabled)
    .pisell-lowcode-select-selector:hover {
      border-color: #b692f6 !important; // Primary/400
    }

    &.pisell-lowcode-select-disabled .pisell-lowcode-select-selector {
      background-color: #f9fafb !important; // Gray/50
      color: #98a2b3 !important; // Gray/400
      border-color: #d0d5dd !important;
      cursor: not-allowed !important;
    }

    .pisell-lowcode-select-selection-placeholder {
      color: #667085 !important; // Gray/500
    }

    .pisell-lowcode-select-arrow {
      color: #667085;
    }


    // 多选标签（选择后展示的 item）高度 36px
    .pisell-lowcode-select-selection-item {
      border-radius: 6px !important;
      padding: 0 10px !important;
      margin-inline-end: 4px !important;
      height: 36px !important;
      min-height: 36px !important;
      line-height: 36px !important;

      &-content {
        line-height: 36px !important;
      }

      &-remove {
        margin-left: 4px !important;

        &:hover {
          background-color: transparent !important;
        }
      }
    }
  }

  &-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;

    // 下拉选项高度 48px（通过 getPopupContainer 挂到 wrapper 内，无需 :global）
    .pisell-multiple-select-dropdown .pisell-lowcode-select-item {
      min-height: 48px !important;
      height: 48px !important;
      line-height: 48px !important;
      padding: 0 16px !important;
      font-size: 16px !important;
    }
  }

  &-label {
    font-size: 14px;
    font-weight: 600;
    color: #344054; // Gray/700
    line-height: 20px;

    &-required::after {
      content: ' *';
      color: #d92d20; // Error/600
      margin-left: 0;
    }
  }

  &-helper-text {
    font-size: 14px;
    font-weight: 400;
    color: #667085; // Gray/500
    line-height: 20px;
  }

  &-error-text {
    font-size: 12px;
    font-weight: 400;
    color: #d92d20; // Error/600
    line-height: 1.5;
    animation: pisell-multiple-select-fadeIn 0.3s ease-in-out;
  }

  &-option-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  &-option-check {
    color: #7f56d9; // Primary/600
    font-size: 16px;
    margin-left: 8px;
  }

  // 错误状态（Figma 设计体系 Error 色）
  &-error {
    .pisell-lowcode-select .pisell-lowcode-select-selector {
      border-color: #fda29b !important; // Error/300

      &:hover {
        border-color: #f97066 !important; // Error/400
      }
    }

    .pisell-lowcode-select.pisell-lowcode-select-focused .pisell-lowcode-select-selector,
    .pisell-lowcode-select.pisell-lowcode-select-open .pisell-lowcode-select-selector {
      border-color: #f97066 !important; // Error/400
      box-shadow: 0 0 0 4px #fee4e2 !important; // Error/100
    }
  }

  // 聚合标签（maxTagPlaceholder）
  &-more-tag {
    display: inline-flex;
    align-items: center;
    background-color: #eaecf0;
    color: #344054; // Gray/700
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 16px;
    font-weight: 500;
    line-height: 24px;
    cursor: pointer;
    transition: background-color 0.2s ease;

    &:hover {
      background-color: #d0d5dd; // Gray/300
    }
  }

  // 只读状态
  &-readonly {
    &-display {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      align-items: center;
      min-height: 24px;
    }

    &-tag {
      margin: 0;
      cursor: default;
      border-radius: 12px;
      border: 1px solid transparent;
      font-size: 14px;
      line-height: 22px;
      padding: 2px 10px;

      &-icon {
        display: flex;
        align-items: center;
      }
    }

    &-more-tag {
      margin: 0;
      cursor: default;
      border-radius: 12px;
      border: 1px solid transparent;
      font-size: 14px;
      line-height: 22px;
      padding: 2px 10px;
    }

    &-empty {
      color: #667085;
      font-size: 16px;
      font-weight: 400;
      line-height: 24px;
    }
  }
}

// 下拉内搜索框（在 dropdown 内）
.pisell-select-search-wrapper {
  padding: 6px;
  border-bottom: 1px solid #eaecf0;
}

.pisell-select-search-input {
  padding: 9px 10px !important;
  font-size: 14px;

  .pisell-lowcode-input {
    font-size: 14px !important;
    color: #344054 !important;

    &::placeholder {
      color: #98a2b3 !important;
      font-size: 12px !important;
    }
  }

  &:hover,
  &:focus-within {
    background-color: transparent !important;
  }
}

@keyframes pisell-multiple-select-fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
