// 确认需求阶段样式

// 加载容器
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 20px;

  ion-spinner {
    --color: var(--ion-color-primary);
    transform: scale(1.5);
    margin-bottom: 16px;
  }

  p {
    color: var(--ion-color-medium);
  }
}

// 确认需求容器
.stage-requirements-container {
  // 通用卡片样式
  ion-card {
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

    ion-card-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 16px;
      font-weight: 600;

      ion-icon {
        font-size: 20px;
        color: var(--ion-color-primary);
      }
    }

    ion-card-subtitle {
      color: var(--ion-color-medium);
      font-size: 12px;
      margin-top: 4px;
    }
  }

  // 必填标记
  .required {
    color: var(--ion-color-danger);
    margin-left: 4px;
  }

  // 空状态
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;

    ion-icon {
      font-size: 64px;
      color: var(--ion-color-medium);
      margin-bottom: 16px;
    }

    p {
      color: var(--ion-color-medium);
      margin-bottom: 16px;
    }
  }

  // 参考图片卡片
  .reference-images-card {
    .images-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;

      .image-item {
        position: relative;
        aspect-ratio: 1;
        border-radius: 8px;
        overflow: hidden;
        cursor: pointer;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }

        .image-overlay {
          position: absolute;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), transparent);
          display: flex;
          justify-content: space-between;
          padding: 8px;
          opacity: 1;
          transition: opacity 0.3s;

          ion-badge {
            height: fit-content;
            font-size: 10px;
            padding: 4px 8px;
          }

          ion-button {
            --padding-start: 8px;
            --padding-end: 8px;
            height: 32px;
          }
        }
      }

      .upload-placeholder {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px dashed var(--ion-color-light-shade);
        border-radius: 8px;
        background-color: var(--ion-color-light);
      }
    }
  }

  // CAD文件卡片
  .cad-files-card {
    ion-list {
      ion-item {
        --padding-start: 0;

        ion-icon[slot="start"] {
          font-size: 32px;
          color: var(--ion-color-primary);
          margin-right: 12px;
        }

        h3 {
          font-weight: 600;
          margin-bottom: 4px;
        }

        p {
          font-size: 12px;
          color: var(--ion-color-medium);
        }
      }
    }
  }

  // 需求清单卡片
  .requirements-card {
    .section {
      margin-bottom: 24px;
      padding-bottom: 24px;
      border-bottom: 1px solid var(--ion-color-light-shade);

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

      .section-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;

        h3 {
          margin: 0;
          font-size: 15px;
          font-weight: 600;
          color: var(--ion-color-dark);
        }
      }

      h3 {
        margin: 0 0 12px;
        font-size: 15px;
        font-weight: 600;
        color: var(--ion-color-dark);
      }

      .empty-text {
        color: var(--ion-color-medium);
        font-size: 13px;
        font-style: italic;
      }

      .space-item {
        padding: 16px;
        background-color: var(--ion-color-light);
        border-radius: 8px;
        margin-bottom: 12px;

        &:last-child {
          margin-bottom: 0;
        }

        .space-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 12px;

          ion-badge {
            font-size: 12px;
            padding: 6px 12px;
          }
        }

        ion-item {
          --background: white;
          --padding-start: 12px;
          border-radius: 4px;
          margin-bottom: 8px;

          &:last-child {
            margin-bottom: 0;
          }
        }

        ion-label[position="stacked"] {
          font-weight: 500;
          color: var(--ion-color-dark);
          font-size: 13px;
          margin-bottom: 6px;
        }
      }

      .budget-range {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 12px;

        .separator {
          font-size: 20px;
          font-weight: 600;
          color: var(--ion-color-medium);
          padding-top: 20px;
        }

        ion-item {
          --background: white;
          --padding-start: 12px;
          border-radius: 4px;
        }
      }
    }
  }

  // AI方案卡片
  .ai-solution-card {
    .ai-solution-content {
      .solution-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--ion-color-light-shade);

        ion-badge {
          display: flex;
          align-items: center;
          gap: 4px;
          padding: 6px 12px;
          font-size: 12px;

          ion-icon {
            font-size: 16px;
          }
        }
      }

      .spaces-solution {
        .space-solution-item {
          padding: 16px;
          background-color: var(--ion-color-light);
          border-radius: 8px;
          margin-bottom: 16px;

          &:last-child {
            margin-bottom: 0;
          }

          h4 {
            margin: 0 0 8px;
            font-size: 16px;
            font-weight: 600;
            color: var(--ion-color-dark);
          }

          .style-desc {
            margin: 0 0 16px;
            font-size: 13px;
            line-height: 1.6;
            color: var(--ion-color-medium);
          }

          .color-palette,
          .materials,
          .furniture {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;

            &:last-child {
              margin-bottom: 0;
            }

            .label {
              font-size: 12px;
              font-weight: 500;
              color: var(--ion-color-medium);
              white-space: nowrap;
            }

            .colors {
              display: flex;
              gap: 6px;

              .color-swatch {
                width: 32px;
                height: 32px;
                border-radius: 4px;
                border: 1px solid rgba(0, 0, 0, 0.1);
                box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
              }
            }

            .tags {
              display: flex;
              flex-wrap: wrap;
              gap: 6px;

              ion-badge {
                font-size: 11px;
                padding: 4px 8px;
              }
            }
          }
        }
      }

      .summary {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px solid var(--ion-color-light-shade);

        .summary-item {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 16px;
          background: linear-gradient(135deg, var(--ion-color-primary-tint), var(--ion-color-secondary-tint));
          border-radius: 8px;

          > ion-icon {
            font-size: 32px;
            color: var(--ion-color-primary);
            flex-shrink: 0;
          }

          .label {
            font-size: 11px;
            color: var(--ion-color-medium);
            margin: 0 0 4px;
          }

          h3 {
            margin: 0;
            font-size: 18px;
            font-weight: 700;
            color: var(--ion-color-primary);
          }

          p {
            margin: 0;
            font-size: 12px;
            line-height: 1.4;
            color: var(--ion-color-medium);
          }
        }
      }
    }
  }

  // 操作按钮
  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px 0;
    margin-top: 20px;

    ion-button {
      margin: 0;
      --border-radius: 8px;
      height: 48px;
      font-weight: 600;

      ion-icon {
        font-size: 20px;
      }
    }
  }
}

// 响应式适配
@media (min-width: 768px) {
  .stage-requirements-container {
    .reference-images-card {
      .images-grid {
        grid-template-columns: repeat(3, 1fr);
      }
    }

    .ai-solution-card {
      .ai-solution-content {
        .summary {
          grid-template-columns: repeat(2, 1fr);
        }
      }
    }
  }
}

@media (min-width: 1024px) {
  .stage-requirements-container {
    .reference-images-card {
      .images-grid {
        grid-template-columns: repeat(4, 1fr);
      }
    }
  }
}
