/**
 * PisellPercent 组件样式
 * 基于 Figma 设计规范，与 PisellNumber 设计体系一致，覆盖时使用 pisell-lowcode-xxx
 */

.pisell-percent {
  display: inline-block;
  width: 100%;

  &-edit {
    position: relative;
    width: 100%;

    // InputNumber 外层（无边框避免双边框）
    .pisell-lowcode-input-number {
      width: 100% !important;
      font-size: 16px !important;
      line-height: 24px !important;
      border-radius: 8px !important;
      border: none !important;
      color: #101828 !important; // Gray/900
      background-color: #ffffff !important;

      .pisell-lowcode-input-number-input {
        height: 46px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
        line-height: 24px !important;
        color: #101828 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;

        &::placeholder {
          color: #667085 !important; // Gray/500
        }

        &:focus {
          box-shadow: none !important;
          outline: none !important;
        }
      }

      &.pisell-lowcode-input-number-focused,
      &:focus,
      &:focus-within {
        border-color: #d6bbfb !important; // Primary/300
        box-shadow: 0 0 0 4px #f4ebff !important; // Primary/100
        outline: none !important;
      }

      &:hover:not(.pisell-lowcode-input-number-disabled):not(.pisell-lowcode-input-number-focused) {
        border-color: #b692f6 !important; // Primary/400
      }

      &.pisell-lowcode-input-number-disabled {
        background-color: #f9fafb !important; // Gray/50
        border-color: #d0d5dd !important;
        cursor: not-allowed !important;

        .pisell-lowcode-input-number-input {
          color: #98a2b3 !important;
          cursor: not-allowed !important;
        }
      }

      // % 后缀
      .pisell-lowcode-input-number-prefix {
        margin-right: 8px;
        margin-left: 16px;
        color: #667085;
        font-size: 16px;
      }

      .pisell-lowcode-input-number-suffix {
        margin-left: 8px;
        margin-right: 16px;
        color: #667085;
        font-size: 16px;
      }

      .pisell-lowcode-input-number-handler-wrap {
        border-left: 1px solid #d0d5dd !important;
        background: #ffffff !important;

        .pisell-lowcode-input-number-handler {
          color: #667085;
          border-color: #d0d5dd;

          &:hover {
            color: #344054;
          }

          &.pisell-lowcode-input-number-handler-up-disabled,
          &.pisell-lowcode-input-number-handler-down-disabled {
            color: #98a2b3;
            cursor: not-allowed;
          }
        }
      }

      &.pisell-lowcode-input-number-status-error {
        border-color: #fda29b !important; // Error/300

        &.pisell-lowcode-input-number-focused,
        &:focus-within {
          border-color: #f97066 !important; // Error/400
          box-shadow: 0 0 0 4px #fee4e2 !important; // Error/100
        }

        &:hover:not(:focus-within) {
          border-color: #f97066 !important;
        }
      }
    }
  }

  // 错误提示（与设计体系一致）
  &-error {
    margin-top: 4px;
    font-size: 12px;
    color: #d92d20; // Error/600
    line-height: 1.5;
    animation: pisell-percent-fadeIn 0.3s ease-in-out;
  }

  &-read {
    color: #101828; // Gray/900
    font-size: 16px;
    line-height: 1.5;
  }

  // 进度条变体
  &-progress {
    width: 100%;

    .pisell-lowcode-progress {
      width: 100%;
    }
  }

  // 环形进度变体
  &-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  // 带滑块的编辑态
  &-with-slider {
    .pisell-lowcode-slider {
      margin-bottom: 16px;
    }
  }

  &-disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
}

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