/**
 * PisellSingleLineText 组件样式
 * 不依赖全局 antd token，使用内置样式
 */

.pisell-single-line-text {
  &-edit {
    position: relative;
    width: 100%;

    // Input 组件内置样式，覆盖 antd token 配置
    .ant-input,
    .ant-input-affix-wrapper {
      // 基础样式（基于 Figma 设计规范）
      font-size: 16px !important;
      line-height: 24px !important;
      
      // 边框和圆角
      border-radius: 8px !important;
      border: 1px solid #D0D5DD !important; // Gray/300
      
      // 内边距（Figma: 16px 12px）
      padding: 12px 16px !important;
      height: 48px !important; // 12px + 24px + 12px = 48px
      
      // 颜色
      color: #101828 !important; // Gray/900 - 输入文本
      background-color: #FFFFFF !important; // 背景色
      
      &::placeholder {
        color: #667085 !important; // Gray/500 - 占位符
      }
      
      // 聚焦态
      &:focus,
      &:focus-within {
        border-color: #D6BBFB !important; // Primary/300
        box-shadow: 0 0 0 4px #F4EBFF !important; // Primary/100
        outline: none !important;
      }
      
      // Hover 态
      &:hover:not(:focus):not(:focus-within):not([disabled]) {
        border-color: #B692F6 !important; // Primary/400
      }
      
      // 禁用态
      &[disabled],
      &.ant-input-disabled {
        background-color: #F9FAFB !important; // Gray/50
        color: #98A2B3 !important; // Gray/400
        border-color: #D0D5DD !important;
        cursor: not-allowed !important;
      }
    }
    
    // 前后缀容器样式
    .ant-input-affix-wrapper {
      padding: 0 !important;
      
      .ant-input-prefix {
        margin-right: 8px;
        margin-left: 16px;
        color: #667085; // Gray/500
        font-size: 16px;
      }
      
      .ant-input-suffix {
        margin-left: 8px;
        margin-right: 16px;
        color: #667085; // Gray/500
        font-size: 16px;
      }
      
      .ant-input {
        padding: 12px 0 !important;
        border: none !important;
        box-shadow: none !important;
        
        &:focus {
          box-shadow: none !important;
        }
      }
    }
    
    // 前后置标签样式
    .ant-input-group-wrapper {
      .ant-input-group-addon {
        background-color: #FFFFFF !important;
        border: 1px solid #D0D5DD !important;
        color: #344054 !important; // Gray/700
        font-size: 16px !important;
        padding: 12px 16px !important;
        
        &:first-child {
          border-right: none !important;
          border-radius: 8px 0 0 8px !important;
        }
        
        &:last-child {
          border-left: none !important;
          border-radius: 0 8px 8px 0 !important;
        }
      }
      
      .ant-input-wrapper {
        .ant-input,
        .ant-input-affix-wrapper {
          border-radius: 0 !important;
          
          &:first-child {
            border-radius: 8px 0 0 8px !important;
          }
          
          &:last-child {
            border-radius: 0 8px 8px 0 !important;
          }
        }
      }
    }
    
    // 清空按钮样式
    .ant-input-clear-icon {
      color: #667085 !important; // Gray/500
      font-size: 14px !important;
      
      &:hover {
        color: #344054 !important; // Gray/700
      }
    }
    
    // 字数统计样式
    .ant-input-show-count-suffix {
      color: #667085 !important; // Gray/500
      font-size: 14px !important;
    }
    
    // 错误状态样式
    .ant-input-status-error,
    .ant-input-affix-wrapper-status-error {
      border-color: #FDA29B !important; // Error/300
      
      &:focus,
      &:focus-within {
        border-color: #F97066 !important; // Error/400
        box-shadow: 0 0 0 4px #FEE4E2 !important; // Error/100
      }
      
      &:hover:not(:focus):not(:focus-within) {
        border-color: #F97066 !important; // Error/400
      }
    }
  }

  &-error {
    margin-top: 4px;
    font-size: 12px;
    color: #D92D20; // Error/600
    line-height: 1.5;
    animation: fadeIn 0.3s ease-in-out;
  }

  &-read {
    display: inline-block;
    line-height: 1.5;
  }

  &-link {
    transition: color 0.2s ease-in-out;

    &:hover {
      color: #6D48C4 !important; // 项目统一 hover 色
    }

    &:active {
      color: #5F3DA8 !important; // 项目统一 active 色
    }

    &:focus {
      outline: 2px solid rgba(127, 86, 218, 0.2);
      outline-offset: 2px;
    }
  }

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

// 错误提示淡入动画
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
