@use '../../styles/_ios-theme.scss' as *;
@use 'sass:color';
@use './requirements-confirm-card-alternative.scss' as *;

:host { 
  display: block; 
  height: 100%; 
  position: relative; // 确保子元素定位基准
}

// 新增：文本输入区域独立样式
.text-upload-section {
  margin-bottom: 1.5rem;
  
  .upload-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    
    h5 {
      margin: 0 0 0.75rem 0;
      font-size: 0.9rem;
      color: #333;
      font-weight: 600;
    }
    
    textarea {
      width: 100%;
      padding: 0.75rem;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 0.85rem;
      resize: vertical;
      margin-bottom: 0.75rem;
      
      &:focus {
        outline: none;
        border-color: #007bff;
      }
    }
    
    .btn-primary {
      background: #007bff;
      border: none;
      border-radius: 4px;
      padding: 0.5rem 1rem;
      color: white;
      font-size: 0.85rem;
      cursor: pointer;
      
      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }
    }
  }
}

// 新增：参考图片和CAD图纸并排布局 - 优化弹窗出现时的布局稳定性
.file-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  position: relative;
  z-index: 1; // 确保在正常文档流中
  margin-bottom: $ios-spacing-lg;
  
  // 移动端响应式
  @media (max-width: 768px) {
    grid-template-columns: 1fr;
    gap: $ios-spacing-sm;
  }
  
  // 平板端响应式
  @media (min-width: 769px) and (max-width: 1024px) {
    gap: $ios-spacing-md;
  }
  
  // 当弹窗出现时保持布局稳定
  .upload-item {
    position: relative;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    
    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    // 确保在弹窗出现时不会被遮挡或错位，优化层级管理
    &.image-item, &.cad-item {
      z-index: 2;
      
      // 当有弹窗显示时，降低交互优先级
      &.modal-active {
        pointer-events: none;
        opacity: 0.8;
      }
    }
    
    h5 {
      margin: 0 0 $ios-spacing-sm 0;
      font-size: $ios-font-size-xs;
      font-weight: $ios-font-weight-semibold;
      color: $ios-text-primary;
    }
    
    .file-upload-zone {
      border: 2px dashed $ios-border;
      border-radius: 8px;
      padding: $ios-spacing-lg;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s ease;
      
      &:hover {
        border-color: $ios-primary;
        background: rgba(0, 122, 255, 0.02);
      }
      
      svg {
        color: $ios-text-secondary;
        margin-bottom: $ios-spacing-sm;
      }
      
      p {
        margin: 0 0 $ios-spacing-xs 0;
        font-size: $ios-font-size-xs;
        color: $ios-text-primary;
        font-weight: $ios-font-weight-medium;
      }
      
      .hint {
        font-size: $ios-font-size-xs;
        color: $ios-text-secondary;
      }
    }
  }
}

.requirements-confirm-card {
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: $ios-spacing-md;
    
    h4 {
      margin: 0;
      font-size: $ios-font-size-sm;
      font-weight: $ios-font-weight-semibold;
      color: $ios-text-primary;
    }
    
    .header-actions {
      display: flex;
      align-items: center;
      gap: $ios-spacing-md;
      
      .btn-ghost {
        white-space: nowrap;
      }
    }
    
    .progress-indicator {
      display: flex;
      align-items: center;
      gap: $ios-spacing-xs;
      
      .progress-bar {
        width: 80px;
        height: 4px;
        background: $ios-border;
        border-radius: 2px;
        overflow: hidden;
        
        .progress-fill {
          height: 100%;
          background: linear-gradient(90deg, #007AFF 0%, #34C759 100%);
          transition: width 0.3s ease;
        }
      }
      
      .progress-text {
        font-size: $ios-font-size-xs;
        color: $ios-text-secondary;
        font-weight: $ios-font-weight-medium;
      }
    }
  }

  // 滑动条输入框样式
  .slider-container {
    display: flex;
    align-items: center;
    gap: $ios-spacing-xs;
    
    input[type="range"] {
      flex: 1;
    }
    
    .slider-input {
      width: 60px;
      padding: 4px 8px;
      border: 1px solid $ios-border;
      border-radius: 4px;
      font-size: $ios-font-size-xs;
      text-align: center;
      background: white;
      
      &:focus {
        outline: none;
        border-color: $ios-primary;
        box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
      }
    }
    
    .unit-label {
      font-size: $ios-font-size-xs;
      color: $ios-text-secondary;
      min-width: 20px;
    }
  }

  // 进度条样式
  .progress-container {
    margin-bottom: $ios-spacing-md;
    
    &.progress-updated {
      .progress-bar-fill {
        animation: progressPulse 0.5s ease;
      }
    }
    
    .progress-visual {
      display: flex;
      align-items: center;
      gap: $ios-spacing-md;
      
      .linear-progress {
        flex: 1;
        display: flex;
        align-items: center;
        gap: $ios-spacing-sm;
        
        .progress-track {
          flex: 1;
          height: 8px;
          background: $ios-background-secondary;
          border-radius: 4px;
          overflow: hidden;
          
          .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, #007AFF 0%, #34C759 100%);
            border-radius: 4px;
            transition: width 0.3s ease;
          }
        }
        
        .progress-text {
          font-size: $ios-font-size-sm;
          font-weight: $ios-font-weight-semibold;
          color: $ios-text-primary;
          min-width: 40px;
        }
      }
      
      .circular-progress {
        position: relative;
        width: 120px;
        height: 120px;
        
        .progress-circle {
          width: 100%;
          height: 100%;
          transform: rotate(-90deg);
          
          circle {
            transition: stroke-dashoffset 0.3s ease;
          }
        }
        
        .progress-text {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          text-align: center;
          
          .progress-percentage {
            font-size: $ios-font-size-lg;
            font-weight: $ios-font-weight-bold;
            color: $ios-text-primary;
          }
          
          .progress-label {
            font-size: $ios-font-size-xs;
            color: $ios-text-secondary;
          }
        }
      }
    }
  }

  // 进度统计样式
  .progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: $ios-spacing-sm;
    margin-bottom: $ios-spacing-md;
    
    .stat-item {
      text-align: center;
      padding: $ios-spacing-sm;
      background: $ios-background-secondary;
      border-radius: 8px;
      
      .stat-number {
        font-size: $ios-font-size-lg;
        font-weight: $ios-font-weight-bold;
        color: $ios-text-primary;
      }
      
      .stat-label {
        font-size: $ios-font-size-xs;
        color: $ios-text-secondary;
        margin-top: 2px;
      }
    }
  }

  // 标签页导航
  .tab-navigation {
    display: flex;
    background: $ios-background-secondary;
    border-radius: 8px;
    padding: 2px;
    margin-bottom: $ios-spacing-md;
    
    .tab-button {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: $ios-spacing-xs;
      padding: $ios-spacing-sm $ios-spacing-xs;
      border: none;
      background: transparent;
      color: $ios-text-secondary;
      font-size: $ios-font-size-xs;
      font-weight: $ios-font-weight-medium;
      border-radius: 6px;
      transition: all 0.2s ease;
      cursor: pointer;
      
      svg {
        width: 14px;
        height: 14px;
      }
      
      &:hover {
        color: $ios-text-primary;
        background: rgba(0, 122, 255, 0.1);
      }
      
      &.active {
        background: white;
        color: $ios-primary;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
      }
    }
  }

  // 标签页内容
  .tab-content {
    min-height: 300px;
  }

  // 素材解析部分
  .materials-section {
    // 文本输入区域 - 独立一行
    .text-upload-section {
      margin-bottom: $ios-spacing-lg;
      
      .upload-item.text-item {
        h5 {
          margin: 0 0 $ios-spacing-sm 0;
          font-size: $ios-font-size-xs;
          font-weight: $ios-font-weight-semibold;
          color: $ios-text-primary;
        }
        
        textarea {
          width: 100%;
          padding: $ios-spacing-sm;
          border: 1px solid $ios-border;
          border-radius: 6px;
          font-size: $ios-font-size-xs;
          resize: vertical;
          margin-bottom: $ios-spacing-sm;
          
          &:focus {
            outline: none;
            border-color: $ios-primary;
            box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
          }
        }
      }
    }

    // 参考图片和CAD图纸并排布局
    .file-upload-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2%;
      margin-bottom: $ios-spacing-lg;
      
      // 移动端响应式 - 改为垂直布局
      @media (max-width: 768px) {
        grid-template-columns: 1fr;
        gap: $ios-spacing-md;
      }
      
      .upload-item {
        &.image-item, &.cad-item {
          h5 {
            margin: 0 0 $ios-spacing-sm 0;
            font-size: $ios-font-size-xs;
            font-weight: $ios-font-weight-semibold;
            color: $ios-text-primary;
          }
          
          .file-upload-zone {
            border: 2px dashed $ios-border;
            border-radius: 8px;
            padding: $ios-spacing-lg;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            min-height: 120px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            
            &:hover {
              border-color: $ios-primary;
              background: rgba(0, 122, 255, 0.02);
            }
            
            svg {
              color: $ios-text-secondary;
              margin-bottom: $ios-spacing-sm;
            }
            
            p {
              margin: 0 0 $ios-spacing-xs 0;
              font-size: $ios-font-size-xs;
              color: $ios-text-primary;
              font-weight: $ios-font-weight-medium;
            }
            
            .hint {
              font-size: $ios-font-size-xs;
              color: $ios-text-secondary;
            }
          }
        }
      }
    }

    // 保留原有的upload-grid样式作为备选方案
    .upload-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: $ios-spacing-md;
      margin-bottom: $ios-spacing-lg;
      
      .upload-item {
        h5 {
          margin: 0 0 $ios-spacing-sm 0;
          font-size: $ios-font-size-xs;
          font-weight: $ios-font-weight-semibold;
          color: $ios-text-primary;
        }
        
        textarea {
          width: 100%;
          padding: $ios-spacing-sm;
          border: 1px solid $ios-border;
          border-radius: 6px;
          font-size: $ios-font-size-xs;
          resize: vertical;
          margin-bottom: $ios-spacing-sm;
          
          &:focus {
            outline: none;
            border-color: $ios-primary;
            box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
          }
        }
        
        .file-upload-zone {
          border: 2px dashed $ios-border;
          border-radius: 8px;
          padding: $ios-spacing-lg;
          text-align: center;
          cursor: pointer;
          transition: all 0.2s ease;
          
          &:hover {
            border-color: $ios-primary;
            background: rgba(0, 122, 255, 0.02);
          }
          
          svg {
            color: $ios-text-secondary;
            margin-bottom: $ios-spacing-sm;
          }
          
          p {
            margin: 0 0 $ios-spacing-xs 0;
            font-size: $ios-font-size-xs;
            color: $ios-text-primary;
            font-weight: $ios-font-weight-medium;
          }
          
          .hint {
            font-size: $ios-font-size-xs;
            color: $ios-text-secondary;
          }
        }
      }
    }
    
    .materials-list {
      position: relative;
      z-index: 3; // 确保素材列表在弹窗层级之下但高于其他内容
      
      h5 {
        margin: 0 0 $ios-spacing-sm 0;
        font-size: $ios-font-size-xs;
        font-weight: $ios-font-weight-semibold;
        color: $ios-text-primary;
      }
      
      .material-cards {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: $ios-spacing-sm;
        
        // 响应式布局优化
        @media (max-width: 768px) {
          grid-template-columns: 1fr;
          gap: $ios-spacing-xs;
        }
        
        @media (min-width: 769px) and (max-width: 1024px) {
          grid-template-columns: repeat(2, 1fr);
        }
        
        .material-card {
          border: 1px solid $ios-border;
          border-radius: 6px;
          padding: $ios-spacing-sm;
          background: white;
          position: relative;
          transition: transform 0.2s ease, box-shadow 0.2s ease;
          
          // 防止弹窗出现时布局错乱，优化对齐
          &:hover {
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            z-index: 4; // 悬停时提升层级
          }
          
          &.material-text {
            border-left: 3px solid #34C759;
          }
          
          &.material-image {
            border-left: 3px solid #FF9500;
          }
          
          &.material-cad {
            border-left: 3px solid #007AFF;
          }
          
          .material-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: $ios-spacing-xs;
            
            .material-type {
              font-size: $ios-font-size-xs;
              font-weight: $ios-font-weight-medium;
              color: $ios-text-secondary;
              text-transform: uppercase;
            }
          }
          
          .material-name {
            font-size: $ios-font-size-xs;
            color: $ios-text-primary;
            margin-bottom: $ios-spacing-xs;
            font-weight: $ios-font-weight-medium;
          }
          
          .parsed-info {
            .parsed-tags {
              .tag-group {
                margin-bottom: $ios-spacing-xs;
                
                .tag-label {
                  font-size: $ios-font-size-xs;
                  color: $ios-text-secondary;
                  margin-right: $ios-spacing-xs;
                }
                
                .tag {
                  display: inline-block;
                  background: $ios-background-secondary;
                  color: $ios-text-primary;
                  padding: 2px 6px;
                  border-radius: 4px;
                  font-size: $ios-font-size-xs;
                  margin-right: 4px;
                }
              }
            }
            
            .analysis-results {
              .color-info {
                margin-bottom: $ios-spacing-sm;
                
                .color-temp {
                  font-size: $ios-font-size-xs;
                  color: $ios-text-secondary;
                }
              }
              
              .enhanced-analysis {
                .analysis-section {
                  margin-bottom: $ios-spacing-md;
                  padding: $ios-spacing-sm;
                  background: rgba(0, 122, 255, 0.02);
                  border-radius: 6px;
                  border: 1px solid rgba(0, 122, 255, 0.1);
                  
                  h6 {
                    margin: 0 0 $ios-spacing-xs 0;
                    font-size: $ios-font-size-xs;
                    font-weight: $ios-font-weight-semibold;
                    color: $ios-primary;
                  }
                  
                  .color-wheel-info {
                    display: flex;
                    align-items: center;
                    gap: $ios-spacing-xs;
                    margin-bottom: $ios-spacing-xs;
                    
                    .color-wheel-icon {
                      display: flex;
                      align-items: center;
                      justify-content: center;
                      width: 24px;
                      height: 24px;
                      
                      svg {
                        color: $ios-primary;
                      }
                    }
                    
                    span {
                      font-size: $ios-font-size-xs;
                      color: $ios-text-secondary;
                      margin-right: $ios-spacing-sm;
                    }
                  }
                  
                  .psychology-info {
                    display: flex;
                    gap: $ios-spacing-xs;
                    flex-wrap: wrap;
                    
                    .mood-tag, .atmosphere-tag {
                      display: inline-block;
                      background: rgba(52, 199, 89, 0.1);
                      color: #34C759;
                      padding: 2px 6px;
                      border-radius: 4px;
                      font-size: $ios-font-size-xs;
                      font-weight: $ios-font-weight-medium;
                    }
                    
                    .atmosphere-tag {
                      background: rgba(255, 149, 0, 0.1);
                      color: #FF9500;
                    }
                  }
                  
                  .form-metrics {
                    .metric-item {
                      display: flex;
                      align-items: center;
                      gap: $ios-spacing-sm;
                      margin-bottom: $ios-spacing-xs;
                      
                      .metric-label {
                        font-size: $ios-font-size-xs;
                        color: $ios-text-secondary;
                        min-width: 60px;
                      }
                      
                      .metric-bar {
                        flex: 1;
                        height: 4px;
                        background: $ios-border;
                        border-radius: 2px;
                        overflow: hidden;
                        
                        .metric-fill {
                          height: 100%;
                          background: linear-gradient(90deg, #34C759, #007AFF);
                          transition: width 0.3s ease;
                        }
                      }
                    }
                  }
                  
                  .material-info {
                    display: flex;
                    gap: $ios-spacing-xs;
                    flex-wrap: wrap;
                    
                    .material-tag, .surface-tag {
                      display: inline-block;
                      background: rgba(175, 82, 222, 0.1);
                      color: #AF52DE;
                      padding: 2px 6px;
                      border-radius: 4px;
                      font-size: $ios-font-size-xs;
                      font-weight: $ios-font-weight-medium;
                    }
                    
                    .surface-tag {
                      background: rgba(255, 45, 85, 0.1);
                      color: #FF2D55;
                    }
                  }
                  
                  .pattern-info {
                    display: flex;
                    gap: $ios-spacing-xs;
                    flex-wrap: wrap;
                    
                    .pattern-tag {
                      display: inline-block;
                      background: rgba(88, 86, 214, 0.1);
                      color: #5856D6;
                      padding: 2px 6px;
                      border-radius: 4px;
                      font-size: $ios-font-size-xs;
                      font-weight: $ios-font-weight-medium;
                    }
                  }
                  
                  .lighting-info {
                    display: flex;
                    gap: $ios-spacing-xs;
                    flex-wrap: wrap;
                    
                    .mood-tag {
                      display: inline-block;
                      background: rgba(255, 204, 0, 0.1);
                      color: #FFCC00;
                      padding: 2px 6px;
                      border-radius: 4px;
                      font-size: $ios-font-size-xs;
                      font-weight: $ios-font-weight-medium;
                    }
                    
                    .brightness-tag {
                      display: inline-block;
                      background: rgba(255, 149, 0, 0.1);
                      color: #FF9500;
                      padding: 2px 6px;
                      border-radius: 4px;
                      font-size: $ios-font-size-xs;
                      font-weight: $ios-font-weight-medium;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

  // 需求映射部分
  .mapping-section {
    .consistency-warning {
      display: flex;
      align-items: center;
      gap: $ios-spacing-xs;
      padding: $ios-spacing-sm;
      background: rgba(255, 59, 48, 0.1);
      border: 1px solid rgba(255, 59, 48, 0.2);
      border-radius: 6px;
      color: #FF3B30;
      font-size: $ios-font-size-xs;
      margin-bottom: $ios-spacing-md;
      
      svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
      }
    }
    
    .indicator-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: $ios-spacing-lg;
      
      .indicator-group {
        h5 {
          margin: 0 0 $ios-spacing-sm 0;
          font-size: $ios-font-size-xs;
          font-weight: $ios-font-weight-semibold;
          color: $ios-text-primary;
          padding-bottom: $ios-spacing-xs;
          border-bottom: 1px solid $ios-border;
        }
        
        .indicator-item {
          margin-bottom: $ios-spacing-md;
          
          label {
            display: block;
            font-size: $ios-font-size-xs;
            color: $ios-text-secondary;
            margin-bottom: $ios-spacing-xs;
            font-weight: $ios-font-weight-medium;
          }
          
          .slider-container {
            display: flex;
            align-items: center;
            gap: $ios-spacing-sm;
            
            input[type="range"] {
              flex: 1;
              height: 4px;
              background: $ios-border;
              border-radius: 2px;
              outline: none;
              -webkit-appearance: none;
              appearance: none;
              
              &::-webkit-slider-thumb {
                  -webkit-appearance: none;
                  appearance: none;
                  width: 16px;
                height: 16px;
                background: #007AFF;
                border-radius: 50%;
                cursor: pointer;
              }
              
              &::-moz-range-thumb {
                width: 16px;
                height: 16px;
                background: #007AFF;
                border-radius: 50%;
                cursor: pointer;
                border: none;
              }
            }
            
            .slider-value {
              font-size: $ios-font-size-xs;
              color: $ios-text-primary;
              font-weight: $ios-font-weight-medium;
              min-width: 40px;
              text-align: right;
            }
          }

          // RGB控件样式
          .rgb-controls {
            display: flex;
            flex-direction: column;
            gap: $ios-spacing-xs;
            
            .rgb-slider {
              display: flex;
              align-items: center;
              gap: $ios-spacing-xs;
              
              span:first-child {
                font-size: $ios-font-size-xs;
                font-weight: $ios-font-weight-semibold;
                color: $ios-text-secondary;
                width: 12px;
              }
              
              input[type="range"] {
                flex: 1;
                height: 4px;
                background: $ios-border;
                border-radius: 2px;
                outline: none;
                -webkit-appearance: none;
                appearance: none;
                
                &::-webkit-slider-thumb {
                  -webkit-appearance: none;
                  appearance: none;
                  width: 14px;
                  height: 14px;
                  background: #007AFF;
                  border-radius: 50%;
                  cursor: pointer;
                }
              }
              
              span:last-child {
                font-size: $ios-font-size-xs;
                color: $ios-text-primary;
                font-weight: $ios-font-weight-medium;
                min-width: 30px;
                text-align: right;
              }
            }
            
            .color-preview {
              width: 100%;
              height: 30px;
              border-radius: 6px;
              border: 1px solid $ios-border;
              margin-top: $ios-spacing-xs;
              transition: background-color 0.1s ease; // 减少过渡时间，提高响应速度
              // 移除默认背景色，完全依赖Angular绑定
              will-change: background-color; // 优化GPU渲染
            }
          }
        }
      }
    }

    // 预设氛围样式
    .atmosphere-presets {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: $ios-spacing-sm;
      
      .preset-card {
        display: flex;
        align-items: center;
        gap: $ios-spacing-sm;
        padding: $ios-spacing-sm;
        border: 1px solid $ios-border;
        border-radius: 8px;
        background: white;
        cursor: pointer;
        transition: all 0.2s ease;
        
        &:hover {
          border-color: #007AFF;
          background: rgba(0, 122, 255, 0.02);
        }
        
        .preset-color {
          width: 40px;
          height: 40px;
          border-radius: 6px;
          border: 1px solid $ios-border;
          flex-shrink: 0;
        }
        
        .preset-info {
          flex: 1;
          
          .preset-name {
            font-size: $ios-font-size-xs;
            font-weight: $ios-font-weight-semibold;
            color: $ios-text-primary;
            margin-bottom: 2px;
          }
          
          .preset-details {
            font-size: $ios-font-size-xs;
            color: $ios-text-secondary;
            margin-bottom: $ios-spacing-xs;
          }
          
          .preset-materials {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            
            .material-tag {
              display: inline-block;
              background: $ios-background-secondary;
              color: $ios-text-secondary;
              padding: 2px 6px;
              border-radius: 4px;
              font-size: $ios-font-size-xs;
            }
          }
        }
      }
    }
  }

  // 进度管理样式
  .progress-section {
    .progress-overview {
      display: flex;
      gap: 2rem;
      margin-bottom: 2rem;
      
      .progress-stats {
        flex: 1;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
        
        .stat-item {
          text-align: center;
          padding: 1rem;
          background: #f8f9fa;
          border-radius: 8px;
          
          .stat-number {
            font-size: 2rem;
            font-weight: 600;
            color: #007AFF;
            margin-bottom: 0.5rem;
          }
          
          .stat-label {
            font-size: 0.875rem;
            color: #666;
          }
        }
      }
      
      .progress-chart {
        .chart-container {
          display: flex;
          justify-content: center;
          align-items: center;
          
          .progress-circle {
            position: relative;
            
            .progress-text {
              position: absolute;
              top: 50%;
              left: 50%;
              transform: translate(-50%, -50%);
              text-align: center;
              
              .progress-percentage {
                font-size: 1.5rem;
                font-weight: 600;
                color: #34C759;
              }
              
              .progress-label {
                font-size: 0.75rem;
                color: #666;
                margin-top: 0.25rem;
              }
            }
          }
        }
      }
    }
    
    .history-section {
      margin-bottom: 2rem;
      
      .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        
        h5 {
          margin: 0;
          color: #333;
        }
        
        .history-controls {
          display: flex;
          gap: 1rem;
          align-items: center;
          
          .history-select {
            padding: 0.5rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: white;
            min-width: 200px;
          }
        }
      }
      
      .history-timeline {
        .timeline-item {
          display: flex;
          align-items: flex-start;
          margin-bottom: 1rem;
          cursor: pointer;
          padding: 0.5rem;
          border-radius: 4px;
          transition: background-color 0.2s;
          
          &:hover {
            background: #f8f9fa;
          }
          
          .timeline-marker {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: #007AFF;
            margin-right: 1rem;
            margin-top: 0.25rem;
            flex-shrink: 0;
          }
          
          .timeline-content {
            flex: 1;
            
            .timeline-header {
              display: flex;
              justify-content: space-between;
              margin-bottom: 0.25rem;
              
              .timeline-time {
                font-weight: 500;
                color: #333;
              }
              
              .timeline-author {
                color: #666;
                font-size: 0.875rem;
              }
            }
            
            .timeline-summary {
              color: #666;
              font-size: 0.875rem;
            }
          }
        }
      }
      
      .empty-history {
        text-align: center;
        padding: 2rem;
        color: #666;
        
        p {
          margin-bottom: 1rem;
        }
      }
    }
    
    .status-distribution {
      h5 {
        margin-bottom: 1rem;
        color: #333;
      }
      
      .status-bars {
        .status-bar {
          margin-bottom: 1rem;
          
          .status-info {
            display: flex;
            justify-content: space-between;
            margin-bottom: 0.5rem;
            
            .status-name {
              font-weight: 500;
              color: #333;
            }
            
            .status-count {
              color: #666;
            }
          }
          
          .status-progress {
            height: 8px;
            background: #e5e5ea;
            border-radius: 4px;
            overflow: hidden;
            
            .progress-bar {
              height: 100%;
              transition: width 0.3s ease;
              
              &.confirmed {
                background: #34C759;
              }
              
              &.pending {
                background: #FF9500;
              }
              
              &.rejected {
                background: #FF3B30;
              }
            }
          }
        }
      }
    }
  }

  // 协作验证部分
  .collaboration-section {
    .list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: $ios-spacing-md;
      padding-bottom: $ios-spacing-sm;
      border-bottom: 1px solid $ios-border;
      
      h5 {
        margin: 0;
        font-size: $ios-font-size-sm;
        font-weight: $ios-font-weight-semibold;
        color: $ios-text-primary;
      }
      
      .list-controls {
        display: flex;
        gap: $ios-spacing-sm;
      }
    }
    
    .requirements-list {
      .requirement-item {
        border: 1px solid $ios-border;
        border-radius: 8px;
        padding: $ios-spacing-md;
        margin-bottom: $ios-spacing-md;
        background: white;
        transition: all 0.2s ease;
        
        &.confirmed {
          border-color: #34C759;
          background: rgba(52, 199, 89, 0.02);
        }
        
        &.rejected {
          border-color: #FF3B30;
          background: rgba(255, 59, 48, 0.02);
        }
        
        &.pending {
          border-color: #FF9500;
          background: rgba(255, 149, 0, 0.02);
        }
        
        .requirement-header {
          display: flex;
          justify-content: space-between;
          align-items: flex-start;
          margin-bottom: $ios-spacing-sm;
          
          .requirement-info {
            flex: 1;
            
            h6 {
              margin: 0 0 $ios-spacing-xs 0;
              font-size: $ios-font-size-sm;
              font-weight: $ios-font-weight-semibold;
              color: $ios-text-primary;
            }
            
            p {
              margin: 0 0 $ios-spacing-xs 0;
              font-size: $ios-font-size-xs;
              color: $ios-text-secondary;
              line-height: 1.4;
            }
            
            .requirement-tags {
              display: flex;
              gap: $ios-spacing-xs;
              flex-wrap: wrap;
              
              .tag {
                display: inline-block;
                background: $ios-background-secondary;
                color: $ios-text-secondary;
                padding: 2px 6px;
                border-radius: 4px;
                font-size: $ios-font-size-xs;
              }
            }
          }
          
          .requirement-meta {
            display: flex;
            flex-direction: column;
            gap: $ios-spacing-xs;
            align-items: flex-end;
            
            .priority-select {
              padding: 4px 8px;
              border: 1px solid $ios-border;
              border-radius: 4px;
              font-size: $ios-font-size-xs;
              background: white;
              
              &:focus {
                outline: none;
                border-color: #007AFF;
              }
            }
            
            .status-badge {
              padding: 2px 8px;
              border-radius: 12px;
              font-size: $ios-font-size-xs;
              font-weight: $ios-font-weight-medium;
              
              &.confirmed {
                background: #34C759;
                color: white;
              }
              
              &.rejected {
                background: #FF3B30;
                color: white;
              }
              
              &.pending {
                background: #FF9500;
                color: white;
              }
            }
          }
        }
        
        .requirement-actions {
          display: flex;
          gap: $ios-spacing-sm;
          align-items: center;
          
          .unread-indicator {
            display: inline-block;
            width: 6px;
            height: 6px;
            background: #FF3B30;
            border-radius: 50%;
            margin-left: 4px;
          }
        }
        
        .comments-section {
          margin-top: $ios-spacing-md;
          padding-top: $ios-spacing-md;
          border-top: 1px solid $ios-border;
          
          .comments-list {
            margin-bottom: $ios-spacing-md;
            
            .comment-item {
              padding: $ios-spacing-sm;
              border: 1px solid $ios-border;
              border-radius: 6px;
              margin-bottom: $ios-spacing-sm;
              background: $ios-background-secondary;
              
              &.resolved {
                opacity: 0.6;
                background: rgba(52, 199, 89, 0.05);
              }
              
              .comment-header {
                display: flex;
                align-items: center;
                gap: $ios-spacing-sm;
                margin-bottom: $ios-spacing-xs;
                
                .comment-author {
                  font-size: $ios-font-size-xs;
                  font-weight: $ios-font-weight-semibold;
                  color: $ios-text-primary;
                }
                
                .comment-role {
                  font-size: $ios-font-size-xs;
                  color: $ios-text-secondary;
                  background: white;
                  padding: 1px 4px;
                  border-radius: 3px;
                }
                
                .comment-time {
                  font-size: $ios-font-size-xs;
                  color: $ios-text-tertiary;
                  margin-left: auto;
                }
              }
              
              .comment-content {
                font-size: $ios-font-size-xs;
                color: $ios-text-primary;
                line-height: 1.4;
              }
            }
          }
          
          .add-comment {
            display: flex;
            gap: $ios-spacing-sm;
            align-items: flex-end;
            
            textarea {
              flex: 1;
              padding: $ios-spacing-xs;
              border: 1px solid $ios-border;
              border-radius: 6px;
              font-size: $ios-font-size-xs;
              resize: vertical;
              min-height: 60px;
              
              &:focus {
                outline: none;
                border-color: #007AFF;
              }
            }
          }
        }
      }
    }
  }

  // 进度管理部分
  .progress-section {
    .progress-overview {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: $ios-spacing-lg;
      margin-bottom: $ios-spacing-lg;
      
      .progress-stats {
        display: flex;
        gap: $ios-spacing-lg;
        
        .stat-item {
          text-align: center;
          
          .stat-number {
            font-size: 24px;
            font-weight: $ios-font-weight-bold;
            color: $ios-primary;
            margin-bottom: $ios-spacing-xs;
          }
          
          .stat-label {
            font-size: $ios-font-size-xs;
            color: $ios-text-secondary;
          }
        }
      }
      
      .progress-chart {
        .chart-container {
          position: relative;
          
          .progress-circle {
            position: relative;
            
            .progress-text-center {
              position: absolute;
              top: 50%;
              left: 50%;
              transform: translate(-50%, -50%);
              text-align: center;
              
              .progress-percentage {
                font-size: 18px;
                font-weight: $ios-font-weight-bold;
                color: $ios-primary;
              }
              
              .progress-label {
                font-size: $ios-font-size-xs;
                color: $ios-text-secondary;
              }
            }
          }
        }
      }
    }
    
    .timeline {
      h5 {
        margin: 0 0 $ios-spacing-sm 0;
        font-size: $ios-font-size-xs;
        font-weight: $ios-font-weight-semibold;
        color: $ios-text-primary;
      }
      
      .timeline-list {
        .timeline-item {
          display: flex;
          align-items: center;
          gap: $ios-spacing-sm;
          padding: $ios-spacing-sm 0;
          border-bottom: 1px dashed $ios-border;
          
          &:last-child {
            border-bottom: none;
          }
          
          .timeline-marker {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: $ios-border;
            flex-shrink: 0;
          }
          
          &.status-confirmed .timeline-marker {
            background: #34C759;
          }
          
          &.status-rejected .timeline-marker {
            background: #FF3B30;
          }
          
          &.status-pending .timeline-marker {
            background: #007AFF;
          }
          
          .timeline-content {
            .timeline-title {
              font-size: $ios-font-size-xs;
              color: $ios-text-primary;
              font-weight: $ios-font-weight-medium;
            }
            
            .timeline-status {
              font-size: $ios-font-size-xs;
              color: $ios-text-secondary;
            }
          }
        }
      }
    }
  }

  // 通用按钮样式
  .btn-primary, .btn-success, .btn-ghost {
    border: none;
    border-radius: 6px;
    font-size: $ios-font-size-xs;
    font-weight: $ios-font-weight-medium;
    cursor: pointer;
    transition: all 0.2s ease;
    
    &.btn-sm {
      padding: 6px 12px;
    }
    
    &.btn-xs {
      padding: 4px 8px;
    }
    
    &:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
  }
  
  .btn-primary {
    background: $ios-primary;
    color: white;
    
    &:hover:not(:disabled) {
      background: color.adjust($ios-primary, $lightness: -10%);
    }
  }
  
  .btn-success {
    background: #34C759;
    color: white;
    
    &:hover:not(:disabled) {
      background: color.adjust(#34C759, $lightness: -10%);
    }
  }
  
  .btn-ghost {
    background: transparent;
    color: $ios-text-secondary;
    border: 1px solid $ios-border;
    
    &:hover:not(:disabled) {
      background: $ios-background-secondary;
      color: $ios-text-primary;
    }
  }
}

// 进度动画
@keyframes progressPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

// 全局通知样式
.execution-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #4CAF50;
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  
  &.error {
    background: #f44336;
  }
  
  &.warning {
    background: #ff9800;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

// 紧凑型流程进度指示器
.compact-stage-indicators {
  display: flex;
  align-items: center;
  margin: 0 16px;
  
  .stage-chain {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .stage-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    
    .stage-number {
      font-size: 11px;
      font-weight: bold;
    }
    
    // 已完成状态 - 绿色
    &.stage-completed {
      background: linear-gradient(135deg, #10b981, #059669);
      box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
      
      &:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
      }
    }
    
    // 进行中状态 - 红色
    &.stage-in-progress {
      background: linear-gradient(135deg, #ef4444, #dc2626);
      box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
      animation: pulse-red 2s infinite;
      
      &:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
      }
    }
    
    // 未进行状态 - 黄色
    &.stage-pending {
      background: linear-gradient(135deg, #f59e0b, #d97706);
      box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
      
      &:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
      }
    }
  }
  
  .stage-connector {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    transition: all 0.3s ease;
    
    &.completed {
      background: linear-gradient(90deg, #10b981, #059669);
    }
    
    &.pending {
      background: #e5e7eb;
    }
  }
}

// 进行中状态的脉冲动画
@keyframes pulse-red {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.6);
  }
}

// 更新header-actions布局
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  
  .btn-ghost {
    flex-shrink: 0;
  }
  
  .compact-stage-indicators {
    flex-shrink: 0;
  }
  
  .progress-indicator {
    flex-shrink: 0;
  }
}

// 保存状态区域
.save-section {
  margin-top: 24px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  
  .save-status {
    display: flex;
    align-items: center;
    gap: 8px;
    
    .save-icon {
      font-size: 16px;
      font-weight: bold;
      
      &.save-icon-saved {
        color: #10b981;
      }
      
      &.save-icon-saving {
        color: #3b82f6;
        animation: spin 1s linear infinite;
      }
      
      &.save-icon-error {
        color: #ef4444;
      }
      
      &.save-icon-unsaved {
        color: #f59e0b;
      }
    }
    
    .save-text {
      font-size: 14px;
      color: #64748b;
    }
  }
  
  .save-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    
    .btn-secondary {
      padding: 8px 16px;
      background: #3b82f6;
      color: white;
      border: none;
      border-radius: 6px;
      font-size: 14px;
      cursor: pointer;
      transition: all 0.2s ease;
      
      &:hover:not(:disabled) {
        background: #2563eb;
        transform: translateY(-1px);
      }
      
      &:disabled {
        background: #94a3b8;
        cursor: not-allowed;
        transform: none;
      }
      
      .loading-spinner {
        display: inline-block;
        width: 12px;
        height: 12px;
        border: 2px solid transparent;
        border-top: 2px solid currentColor;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-right: 8px;
      }
    }
    
    .auto-save-toggle {
      .toggle-label {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        
        .toggle-input {
          display: none;
        }
        
        .toggle-slider {
          width: 40px;
          height: 20px;
          background: #cbd5e1;
          border-radius: 10px;
          position: relative;
          transition: all 0.3s ease;
          
          &::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 2px;
            width: 16px;
            height: 16px;
            background: white;
            border-radius: 50%;
            transition: all 0.3s ease;
          }
        }
        
        .toggle-input:checked + .toggle-slider {
          background: #10b981;
          
          &::after {
            transform: translateX(20px);
          }
        }
        
        .toggle-text {
          font-size: 14px;
          color: #64748b;
        }
      }
    }
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}