// 上传成功弹窗样式
// @import '../../../styles/_variables';

// 强制组件脱离父容器的定位上下文
:host,
app-upload-success-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 99998 !important;
  pointer-events: none !important; // 默认不拦截事件，让遮罩层处理
  display: block !important;
}

// 弹窗背景遮罩
// 响应式断点
$mobile-breakpoint: 768px;
$tablet-breakpoint: 1024px;
$desktop-breakpoint: 1200px;

// 动画变量
$animation-duration-fast: 0.2s;
$animation-duration-normal: 0.3s;
$animation-duration-slow: 0.5s;
$animation-easing: cubic-bezier(0.25, 0.8, 0.25, 1);

// 弹窗背景遮罩 - 优化全屏居中布局
.modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px);
  z-index: 99999 !important; // 提高到最高级别确保在所有内容之上
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem;
  pointer-events: auto !important; // 确保可以接收点击事件
  
  // 强制所有设备都使用相同的居中布局
  @media (max-width: $mobile-breakpoint) {
    padding: 1rem;
    align-items: center; // 确保移动端也居中显示
  }
}

// 增强分析结果样式
.enhanced-analysis {
  margin-top: 24px;
  border-top: 1px solid #e5e5ea;
  padding-top: 24px;

  .analysis-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5ea;
    overflow-x: auto;
    padding-bottom: 12px;

    .tab-btn {
      padding: 8px 16px;
      border: none;
      background: #f8f9fa;
      color: #666;
      border-radius: 20px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      flex-shrink: 0;

      &:hover {
        background: #e9ecef;
        color: #495057;
      }

      &.active {
        background: #007AFF;
        color: white;
        box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
      }
    }
  }

  .tab-content {
    min-height: 200px;

    .analysis-section {
      margin-bottom: 20px;

      h6 {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;

        &::before {
          content: '';
          width: 4px;
          height: 16px;
          background: #007AFF;
          border-radius: 2px;
        }
      }

      .info-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f0f0f0;

        &:last-child {
          border-bottom: none;
        }

        .label {
          font-weight: 500;
          color: #666;
          font-size: 14px;
        }

        .value {
          font-weight: 600;
          color: #333;
          font-size: 14px;
        }
      }
    }

    // 色彩分析标签页样式
    .color-analysis-tab {
      // 色轮可视化样式
      .color-wheel-visualization {
        display: flex;
        justify-content: center;
        margin: 20px 0;
        
        .color-wheel-svg {
          filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
          
          circle, line {
            transition: all 0.3s ease;
          }
        }
      }
      
      .mood-atmosphere {
        display: flex;
        gap: 12px;
        margin-bottom: 12px;

        .mood, .atmosphere {
          padding: 6px 12px;
          background: #f8f9fa;
          border-radius: 16px;
          font-size: 13px;
          font-weight: 500;
          color: #495057;
        }
      }

      .suitable-spaces {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;

        .space-tag {
          padding: 4px 10px;
          background: #e3f2fd;
          color: #1976d2;
          border-radius: 12px;
          font-size: 12px;
          font-weight: 500;
        }
      }
    }

    // 形体分析标签页样式
    .form-analysis-tab {
      .overall-info {
        .metric {
          display: flex;
          align-items: center;
          gap: 12px;
          margin-bottom: 12px;

          .metric-label {
            min-width: 60px;
            font-size: 13px;
            font-weight: 500;
            color: #666;
          }

          .metric-bar {
            flex: 1;
            height: 8px;
            background: #f0f0f0;
            border-radius: 4px;
            overflow: hidden;

            .metric-fill {
              height: 100%;
              background: linear-gradient(90deg, #007AFF, #34C759);
              border-radius: 4px;
              transition: width 0.3s ease;
            }
          }

          .metric-value {
            min-width: 40px;
            text-align: right;
            font-size: 13px;
            font-weight: 600;
            color: #333;
          }
        }
      }
    }

    // 质感分析标签页样式
    .texture-analysis-tab {
      .texture-properties {
        .property-item {
          display: flex;
          align-items: center;
          gap: 12px;
          margin-bottom: 12px;

          .property-name {
            min-width: 60px;
            font-size: 13px;
            font-weight: 500;
            color: #666;
          }

          .property-bar {
            flex: 1;
            height: 6px;
            background: #f0f0f0;
            border-radius: 3px;
            overflow: hidden;

            .property-fill {
              height: 100%;
              background: linear-gradient(90deg, #FF9500, #FF6B35);
              border-radius: 3px;
              transition: width 0.3s ease;
            }
          }

          .property-value {
            min-width: 40px;
            text-align: right;
            font-size: 13px;
            font-weight: 600;
            color: #333;
          }
        }
      }

      .material-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;

        .material-tag {
          padding: 6px 12px;
          border-radius: 16px;
          font-size: 12px;
          font-weight: 500;

          &.primary {
            background: #fff3cd;
            color: #856404;
            border: 1px solid #ffeaa7;
          }

          &.secondary {
            background: #f8f9fa;
            color: #6c757d;
            border: 1px solid #dee2e6;
          }
        }
      }
    }

    // 纹理分析标签页样式
    .pattern-analysis-tab {
      .rhythm-tags {
        display: flex;
        gap: 12px;

        .rhythm-tag {
          padding: 8px 16px;
          background: #e8f5e8;
          color: #2e7d32;
          border-radius: 20px;
          font-size: 13px;
          font-weight: 500;
        }
      }
    }

    // 灯光分析标签页样式
    .lighting-analysis-tab {
      .lighting-info, .ambient-info {
        background: #f8f9fa;
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 16px;
      }
    }
  }
}

// 需求映射标签页样式
.mapping-analysis-tab {
  .mapping-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;

    .loading-spinner {
      width: 24px;
      height: 24px;
      border: 3px solid #e9ecef;
      border-top: 3px solid #007AFF;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }

    .loading-text {
      h6 {
        margin: 0 0 4px 0;
        font-size: 16px;
        font-weight: 600;
        color: #333;
      }

      p {
        margin: 0;
        font-size: 14px;
        color: #666;
      }
    }
  }

  .mapping-error {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 12px;
    margin-bottom: 20px;

    .error-icon {
      font-size: 20px;
      flex-shrink: 0;
    }

    .error-text {
      flex: 1;

      h6 {
        margin: 0 0 4px 0;
        font-size: 16px;
        font-weight: 600;
        color: #e53e3e;
      }

      p {
        margin: 0 0 12px 0;
        font-size: 14px;
        color: #c53030;
      }

      .retry-btn {
        padding: 8px 16px;
        background: #e53e3e;
        color: white;
        border: none;
        border-radius: 6px;
        font-size: 14px;
        cursor: pointer;
        transition: background 0.2s ease;

        &:hover {
          background: #c53030;
        }
      }
    }
  }

  .mapping-result {
    .atmosphere-preview {
      margin-top: 12px;

      .preview-image {
        width: 100%;
        max-width: 300px;
        height: auto;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      }
    }

    .mapping-subsection {
      margin-top: 20px;
      padding: 16px;
      background: #f8f9fa;
      border-radius: 8px;

      h7 {
        display: block;
        font-size: 14px;
        font-weight: 600;
        color: #495057;
        margin-bottom: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }

      .color-mappings {
        display: flex;
        flex-direction: column;
        gap: 8px;

        .color-mapping-item {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 8px 12px;
          background: white;
          border-radius: 6px;
          border: 1px solid #e9ecef;

          .color-swatch {
            width: 24px;
            height: 24px;
            border-radius: 4px;
            border: 1px solid #dee2e6;
            flex-shrink: 0;
          }

          .mapping-arrow {
            color: #6c757d;
            font-weight: bold;
          }

          .target-material {
            flex: 1;
            font-size: 14px;
            color: #495057;
          }

          .confidence {
            font-size: 12px;
            color: #6c757d;
            background: #e9ecef;
            padding: 2px 6px;
            border-radius: 10px;
          }
        }
      }

      .space-info {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 12px;
      }

      .material-mappings {
        display: flex;
        flex-direction: column;
        gap: 8px;

        .material-mapping-item {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 8px 12px;
          background: white;
          border-radius: 6px;
          border: 1px solid #e9ecef;

          .source-texture {
            font-size: 14px;
            color: #495057;
            font-weight: 500;
          }

          .mapping-arrow {
            color: #6c757d;
            font-weight: bold;
          }

          .target-material {
            flex: 1;
            font-size: 14px;
            color: #495057;
          }

          .properties {
            font-size: 12px;
            color: #6c757d;
            background: #e9ecef;
            padding: 2px 6px;
            border-radius: 10px;
          }
        }
      }
    }

    .mapping-actions {
      margin-top: 20px;
      display: flex;
      justify-content: center;

      .regenerate-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 20px;
        background: #007AFF;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;

        &:hover {
          background: #0056b3;
          transform: translateY(-1px);
        }

        svg {
          width: 16px;
          height: 16px;
        }
      }
    }
  }

  .mapping-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    text-align: center;

    .placeholder-icon {
      font-size: 48px;
      margin-bottom: 16px;
    }

    .placeholder-text {
      h6 {
        margin: 0 0 8px 0;
        font-size: 18px;
        font-weight: 600;
        color: #495057;
      }

      p {
        margin: 0;
        font-size: 14px;
        color: #6c757d;
      }
    }
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// 响应式设计
@media (max-width: 768px) {
  .enhanced-analysis {
    .analysis-tabs {
      .tab-btn {
        padding: 6px 12px;
        font-size: 13px;
      }
    }

    .tab-content {
      .analysis-section {
        h6 {
          font-size: 15px;
        }

        .info-item {
          flex-direction: column;
          align-items: flex-start;
          gap: 4px;

          .label, .value {
            font-size: 13px;
          }
        }
      }
    }
  }
}

// 弹窗主容器 - 优化布局稳定性
.modal-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  position: relative;
  transform-origin: center;
  display: flex;
  flex-direction: column;
  margin: 0; // 移除所有边距，完全依赖flex居中
  pointer-events: auto !important; // 确保可以接收点击事件
  z-index: 100000 !important; // 比backdrop更高
  
  // 响应式调整 - 统一居中显示，避免布局冲突
  @media (max-width: $mobile-breakpoint) {
    max-width: calc(100% - 2rem); // 保持左右边距
    border-radius: 16px;
    max-height: 75vh;
    margin: 0; // 确保无边距
  }
  
  @media (min-width: $mobile-breakpoint) and (max-width: $tablet-breakpoint) {
    max-width: 90%;
    max-height: 78vh;
    margin: 0; // 确保无边距
  }
  
  @media (min-width: $tablet-breakpoint) {
    max-width: 600px;
    max-height: 80vh;
    margin: 0; // 确保无边距
  }
  
  // 深色模式适配
  @media (prefers-color-scheme: dark) {
    background: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }
}

// 弹窗头部
.modal-header {
  padding: 32px 32px 24px 32px; // 增加左右内边距，确保对称
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  
  // 响应式调整
  @media (max-width: $mobile-breakpoint) {
    padding: 24px 20px 20px 20px;
  }
  
  @media (min-width: $mobile-breakpoint) and (max-width: $tablet-breakpoint) {
    padding: 28px 28px 22px 28px;
  }
  
  .header-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    min-width: 0; // 防止内容溢出
    
    .success-icon {
      width: 48px;
      height: 48px;
      background: linear-gradient(135deg, #34C759, #30D158);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      
      svg {
        color: white;
        width: 24px;
        height: 24px;
      }
    }
    
    .header-text {
      flex: 1;
      min-width: 0; // 防止文本溢出
      
      h2 {
        margin: 0 0 8px 0;
        font-size: 20px;
        font-weight: 600;
        color: #1d1d1f;
        line-height: 1.2;
        
        // 响应式字体大小
        @media (max-width: $mobile-breakpoint) {
          font-size: 18px;
        }
      }
      
      p {
        margin: 0;
        font-size: 14px;
        color: #86868b;
        line-height: 1.4;
        
        @media (max-width: $mobile-breakpoint) {
          font-size: 13px;
        }
      }
    }
  }
  
  .close-button {
    width: 36px;
    height: 36px;
    border: none;
    background: #f2f2f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto !important; // 确保按钮可点击
    z-index: 100001 !important; // 确保在最上层
    flex-shrink: 0;
    margin-left: 16px; // 确保与内容区域有适当间距
    
    // 响应式调整
    @media (max-width: $mobile-breakpoint) {
      width: 32px;
      height: 32px;
      margin-left: 12px;
    }
    
    &:hover {
      background: #e5e5ea;
      transform: scale(1.05);
    }
    
    &:active {
      transform: scale(0.95);
    }
    
    svg {
      color: #86868b;
      width: 18px;
      height: 18px;
      
      @media (max-width: $mobile-breakpoint) {
        width: 16px;
        height: 16px;
      }
    }
  }
}

// 弹窗内容
.modal-content {
  padding: 0 32px 32px 32px; // 与头部保持一致的左右内边距
  overflow-y: auto;
  flex: 1;
  min-height: 0; // 确保flex子元素可以收缩
  
  // 自定义滚动条样式
  &::-webkit-scrollbar {
    width: 6px;
  }
  
  &::-webkit-scrollbar-track {
    background: transparent;
  }
  
  &::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    
    &:hover {
      background: rgba(0, 0, 0, 0.3);
    }
  }
  
  // 深色模式滚动条
  @media (prefers-color-scheme: dark) {
    &::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.3);
      
      &:hover {
        background: rgba(255, 255, 255, 0.4);
      }
    }
  }
  
  // 响应式调整
  @media (max-width: $mobile-breakpoint) {
    padding: 0 20px 24px 20px;
  }
  
  @media (min-width: $mobile-breakpoint) and (max-width: $tablet-breakpoint) {
    padding: 0 28px 28px 28px;
  }
}

// 上传文件列表
.uploaded-files {
  margin-bottom: 32px;
  
  h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    
    // 响应式字体大小
    @media (max-width: $mobile-breakpoint) {
      font-size: 16px;
      margin-bottom: 16px;
    }
  }
  
  .file-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .file-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #e5e5ea;
    transition: all 0.2s ease;
    
    // 响应式调整
    @media (max-width: $mobile-breakpoint) {
      padding: 12px;
      gap: 12px;
    }
    
    &:hover {
      background: #f5f5f7;
      border-color: #d1d1d6;
    }
    
    .file-icon {
      width: 48px;
      height: 48px;
      background: #007aff;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      
      // 响应式调整
      @media (max-width: $mobile-breakpoint) {
        width: 40px;
        height: 40px;
        border-radius: 8px;
      }
      
      svg {
        color: white;
        width: 24px;
        height: 24px;
        
        @media (max-width: $mobile-breakpoint) {
          width: 20px;
          height: 20px;
        }
      }
    }
    
    .file-preview {
      width: 48px;
      height: 48px;
      border-radius: 10px;
      overflow: hidden;
      flex-shrink: 0;
      
      @media (max-width: $mobile-breakpoint) {
        width: 40px;
        height: 40px;
        border-radius: 8px;
      }
      
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }
    
    .file-info {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 4px;
      
      .file-name {
        font-size: 15px;
        font-weight: 500;
        color: #1d1d1f;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
        
        @media (max-width: $mobile-breakpoint) {
          font-size: 14px;
        }
      }
      
      .file-size {
        font-size: 13px;
        color: #86868b;
        line-height: 1.2;
        
        @media (max-width: $mobile-breakpoint) {
          font-size: 12px;
        }
      }
    }
    
    .file-status {
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      
      &.success {
        svg {
          width: 20px;
          height: 20px;
          
          @media (max-width: $mobile-breakpoint) {
            width: 18px;
            height: 18px;
          }
        }
      }
    }
  }
}

// 颜色分析区域
.color-analysis-section {
  border-top: 1px solid #f0f0f0;
  padding-top: 24px;
  
  .section-header {
    margin-bottom: 24px;
    text-align: center;
    
    h4 {
      margin: 0 0 8px 0;
      font-size: 18px;
      font-weight: 600;
      color: #1d1d1f;
      
      @media (max-width: $mobile-breakpoint) {
        font-size: 16px;
      }
    }
    
    p {
      margin: 0;
      font-size: 14px;
      color: #86868b;
      line-height: 1.5;
      max-width: 400px;
      margin: 0 auto;
      
      @media (max-width: $mobile-breakpoint) {
        font-size: 13px;
      }
    }
  }
  
  // 分析按钮
  .analysis-action {
    text-align: center;
    padding: 20px 0 32px 0;
    
    .analyze-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 14px 28px;
      background: linear-gradient(135deg, #007aff, #0056cc);
      color: white;
      border: none;
      border-radius: 12px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s ease;
      min-width: 160px;
      
      @media (max-width: $mobile-breakpoint) {
        padding: 12px 24px;
        font-size: 14px;
        min-width: 140px;
      }
      
      &:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 12px 24px rgba(0, 122, 255, 0.25);
        background: linear-gradient(135deg, #0056cc, #003d99);
      }
      
      &:active {
        transform: translateY(0);
      }
      
      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
      }
      
      svg {
        width: 20px;
        height: 20px;
        
        @media (max-width: $mobile-breakpoint) {
          width: 18px;
          height: 18px;
        }
      }
    }
  }
  
  // 分析加载状态
  .analysis-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #f9f9f9;
    border-radius: 12px;
    position: relative; // 确保相对定位
    
    .loading-spinner {
      width: 32px;
      height: 32px;
      border: 3px solid #e5e5ea;
      border-top: 3px solid #007aff;
      border-radius: 50%;
      animation: spin 1s linear infinite;
      flex-shrink: 0;
    }
    
    .loading-text {
      h5 {
        margin: 0 0 4px 0;
        font-size: 14px;
        font-weight: 600;
        color: #1d1d1f;
      }
      
      p {
        margin: 0;
        font-size: 12px;
        color: #86868b;
      }
    }
  }
  
  // 分析结果
  .analysis-result {
    position: relative; // 确保相对定位
    
    .result-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      
      h5 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #1d1d1f;
        
        @media (max-width: $mobile-breakpoint) {
          font-size: 15px;
        }
      }
      
      .result-count {
        background: #34c759;
        color: white;
        font-size: 11px;
        font-weight: 600;
        padding: 4px 10px;
        border-radius: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }
    }
    
    .color-palette {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
      
      @media (max-width: $mobile-breakpoint) {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
      }
      
      .color-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        background: white;
        border: 1px solid #e5e5ea;
        border-radius: 12px;
        transition: all 0.2s ease;
        position: relative; // 确保相对定位
        
        @media (max-width: $mobile-breakpoint) {
          padding: 10px;
          gap: 10px;
        }
        
        &:hover {
          border-color: #007aff;
          box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1);
        }
        
        .color-swatch {
          width: 32px;
          height: 32px;
          border-radius: 8px;
          border: 2px solid rgba(255, 255, 255, 0.8);
          box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
          flex-shrink: 0;
          
          @media (max-width: $mobile-breakpoint) {
            width: 28px;
            height: 28px;
            border-radius: 6px;
          }
        }
        
        .color-info {
          flex: 1;
          min-width: 0;
          
          .color-value {
            font-size: 12px;
            font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
            color: #1d1d1f;
            margin-bottom: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: 500;
            
            @media (max-width: $mobile-breakpoint) {
              font-size: 11px;
            }
          }
          
          .color-percentage {
            font-size: 11px;
            color: #86868b;
            font-weight: 600;
            
            @media (max-width: $mobile-breakpoint) {
              font-size: 10px;
            }
          }
        }
      }
    }
    
    .result-actions {
      text-align: center;
      padding-top: 8px;
      
      .view-report-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 20px;
        background: #f2f2f7;
        color: #007aff;
        border: none;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 140px;
        position: relative; // 确保相对定位
        
        @media (max-width: $mobile-breakpoint) {
          padding: 10px 16px;
          font-size: 13px;
          min-width: 120px;
        }
        
        &:hover {
          background: #e5e5ea;
          transform: translateY(-1px);
        }
        
        &:active {
          transform: translateY(0);
        }
        
        svg {
          width: 18px;
          height: 18px;
          
          @media (max-width: $mobile-breakpoint) {
            width: 16px;
            height: 16px;
          }
        }
      }
    }
  }
}

// 弹窗底部操作区域
.modal-footer {
  padding: 24px 32px 32px;
  border-top: 1px solid #e5e5ea;
  background: #fafafa;
  border-radius: 0 0 20px 20px;
  
  @media (max-width: $tablet-breakpoint) {
    padding: 20px 24px 24px;
  }
  
  @media (max-width: $mobile-breakpoint) {
    padding: 16px 20px 20px;
  }
  
  .footer-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    align-items: center;
    
    @media (max-width: $mobile-breakpoint) {
      flex-direction: column-reverse;
      gap: 12px;
    }
    
    .secondary-btn,
    .primary-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 12px 24px;
      border-radius: 10px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      border: none;
      min-width: 120px;
      
      @media (max-width: $mobile-breakpoint) {
        width: 100%;
        padding: 14px 24px;
      }
      
      svg {
        width: 18px;
        height: 18px;
      }
    }
    
    .secondary-btn {
      background: #f2f2f7;
      color: #1d1d1f;
      
      &:hover {
        background: #e5e5ea;
        transform: translateY(-1px);
      }
      
      &:active {
        transform: translateY(0);
      }
    }
    
    .primary-btn {
      background: linear-gradient(135deg, #007aff 0%, #0056cc 100%);
      color: white;
      box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
      
      &:hover {
        background: linear-gradient(135deg, #0056cc 0%, #003d99 100%);
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
        transform: translateY(-1px);
      }
      
      &:active {
        transform: translateY(0);
        box-shadow: 0 2px 6px rgba(0, 122, 255, 0.3);
      }
      
      &:disabled {
        background: #c7c7cc;
        color: #8e8e93;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
      }
      
      .btn-spinner {
        width: 14px;
        height: 14px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top: 2px solid white;
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }
    }
  }
}

// 动画
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

// 响应式设计
@media (max-width: 768px) {
  .modal-backdrop {
    padding: 10px;
  }
  
  .modal-header {
    padding: 20px 16px 12px;
    
    .header-content {
      gap: 12px;
      
      .success-icon {
        width: 40px;
        height: 40px;
        
        svg {
          width: 20px;
          height: 20px;
        }
      }
      
      .header-text {
        h3 {
          font-size: 18px;
        }
        
        p {
          font-size: 13px;
        }
      }
    }
  }
  
  .modal-body {
    padding: 0 16px;
  }
  
  .modal-footer {
    padding: 12px 16px 20px;
    
    .footer-actions {
      flex-direction: column-reverse;
      
      .secondary-btn,
      .primary-btn {
        width: 100%;
        justify-content: center;
      }
    }
  }
  
  .color-analysis-section {
    .color-palette {
      grid-template-columns: 1fr;
    }
  }
}

// 深色模式支持
@media (prefers-color-scheme: dark) {
  .modal-container {
    background: #1c1c1e;
    
    .modal-header {
      border-bottom-color: #38383a;
      
      .header-text {
        h3 {
          color: #f2f2f7;
        }
        
        p {
          color: #8e8e93;
        }
      }
      
      .close-btn {
        background: #2c2c2e;
        
        &:hover {
          background: #3a3a3c;
        }
        
        svg {
          color: #8e8e93;
        }
      }
    }
    
    .uploaded-files-section {
      h4 {
        color: #f2f2f7;
      }
      
      .file-item {
        background: #2c2c2e;
        border-color: #48484a;
        
        .file-info {
          .file-name {
            color: #f2f2f7;
          }
          
          .file-size {
            color: #8e8e93;
          }
        }
      }
    }
    
    .color-analysis-section {
      .section-header {
        h4 {
          color: #f2f2f7;
        }
        
        p {
          color: #8e8e93;
        }
      }
      
      .analysis-loading {
        background: #2c2c2e;
        
        .loading-text {
          h5 {
            color: #f2f2f7;
          }
          
          p {
            color: #8e8e93;
          }
        }
      }
      
      .analysis-result {
        .result-header {
          h5 {
            color: #f2f2f7;
          }
          
          .result-count {
            background: #2c2c2e;
            color: #8e8e93;
          }
        }
        
        .color-palette {
          .color-item {
            background: #2c2c2e;
            border-color: #48484a;
            
            .color-info {
              .color-value {
                color: #f2f2f7;
              }
              
              .color-percentage {
                color: #8e8e93;
              }
            }
          }
        }
        
        .result-actions {
          .view-report-btn {
            background: #2c2c2e;
            
            &:hover {
              background: #3a3a3c;
            }
          }
        }
        
        .color-description {
          background: linear-gradient(135deg, #2c2c2e 0%, #1c1c1e 100%);
          border-color: #48484a;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
          
          .description-header {
            h6 {
              color: #f2f2f7;
            }
            
            p {
              color: #8e8e93;
            }
          }
          
          .description-content {
            background: #1c1c1e;
            border-color: #48484a;
            color: #f2f2f7;
            
            &:hover {
              border-color: #0a84ff;
              box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
            }
            
            &::-webkit-scrollbar-thumb {
              background: rgba(10, 132, 255, 0.4);
              
              &:hover {
                background: rgba(10, 132, 255, 0.6);
              }
            }
            
            &.empty {
              background: #2c2c2e;
              color: #8e8e93;
              border-color: #48484a;
            }
          }
          
          .description-actions {
            .copy-btn {
              background: linear-gradient(135deg, #0a84ff 0%, #0056cc 100%);
              box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
              
              &:hover {
                background: linear-gradient(135deg, #0056cc 0%, #003d99 100%);
                box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
              }
              
              &.copied {
                background: linear-gradient(135deg, #30d158 0%, #28a745 100%);
                box-shadow: 0 4px 12px rgba(48, 209, 88, 0.3);
                
                &:hover {
                  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
                  box-shadow: 0 6px 20px rgba(48, 209, 88, 0.4);
                }
              }
            }
          }
        }
      }
    }
    
    .modal-footer {
      border-top-color: #38383a;
      
      .footer-actions {
        .secondary-btn {
          background: #2c2c2e;
          color: #f2f2f7;
          
          &:hover {
            background: #3a3a3c;
          }
        }
      }
    }
  }
}