// 订单分配阶段样式

// 加载容器
.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-order-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;
  }

  // 客户信息卡片
  .customer-card {
    ion-item {
      --padding-start: 0;
      margin-bottom: 12px;

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

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

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

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

  // 项目基本信息卡片
  .project-info-card {
    ion-item {
      margin-bottom: 16px;

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

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

    ion-input,
    ion-select,
    ion-textarea {
      --background: var(--ion-color-light);
      --padding-start: 12px;
      --padding-end: 12px;
      border-radius: 8px;
    }
  }

  // 报价明细卡片
  .quotation-card {
    .space-section {
      margin-bottom: 24px;
      padding-bottom: 24px;
      border-bottom: 1px solid var(--ion-color-light-shade);

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

      .space-header {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
        padding: 8px 12px;
        background: linear-gradient(135deg, var(--ion-color-primary) 0%, var(--ion-color-secondary) 100%);
        border-radius: 8px;
        color: white;

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

        h3 {
          margin: 0;
          font-size: 15px;
          font-weight: 600;
        }
      }

      .process-grid {
        display: grid;
        gap: 12px;

        .process-item {
          padding: 12px;
          background-color: var(--ion-color-light);
          border-radius: 8px;
          border: 2px solid transparent;
          transition: all 0.3s;

          &.enabled {
            background-color: white;
            border-color: var(--ion-color-primary-tint);
          }

          .process-header {
            display: flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            margin-bottom: 8px;

            ion-checkbox {
              margin-right: 4px;
            }

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

          .process-inputs {
            display: grid;
            gap: 8px;
            padding-top: 12px;
            border-top: 1px solid var(--ion-color-light-shade);

            ion-item {
              --background: transparent;
              --padding-start: 0;
              --inner-padding-end: 0;

              ion-label {
                font-size: 12px;
                color: var(--ion-color-medium);
                margin-bottom: 4px;
              }

              ion-input {
                --background: var(--ion-color-light);
                --padding-start: 8px;
                border-radius: 4px;
                font-size: 14px;
              }

              ion-note {
                font-size: 12px;
                color: var(--ion-color-medium);
                margin-left: 8px;
              }
            }

            .process-subtotal {
              text-align: right;
              font-size: 13px;
              font-weight: 600;
              color: var(--ion-color-primary);
              margin-top: 4px;
            }
          }
        }
      }
    }

    .total-section {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px;
      margin-top: 20px;
      background: linear-gradient(135deg, var(--ion-color-success) 0%, var(--ion-color-success-shade) 100%);
      border-radius: 8px;

      .total-label {
        font-size: 16px;
        font-weight: 600;
        color: white;
      }

      .total-amount {
        font-size: 24px;
        font-weight: 700;
        color: white;
      }
    }
  }

  // 设计师分配卡片
  .designer-card {
    .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: 0;
      }
    }

    .designer-grid {
      display: grid;
      gap: 12px;

      .designer-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        background-color: var(--ion-color-light);
        border-radius: 8px;
        border: 2px solid transparent;
        cursor: pointer;
        transition: all 0.3s;

        &:hover {
          background-color: var(--ion-color-light-shade);
        }

        &.selected {
          background-color: white;
          border-color: var(--ion-color-primary);
          box-shadow: 0 4px 12px rgba(var(--ion-color-primary-rgb), 0.2);
        }

        ion-avatar {
          width: 48px;
          height: 48px;
          flex-shrink: 0;

          ion-icon {
            font-size: 48px;
            color: var(--ion-color-medium);
          }
        }

        .designer-info {
          flex: 1;
          min-width: 0;

          h4 {
            margin: 0 0 4px;
            font-size: 15px;
            font-weight: 600;
            color: var(--ion-color-dark);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

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

        .selected-icon {
          font-size: 28px;
          color: var(--ion-color-primary);
          flex-shrink: 0;
        }
      }
    }
  }

  // 操作按钮
  .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-order-container {
    .quotation-card {
      .space-section {
        .process-grid {
          grid-template-columns: repeat(2, 1fr);
        }
      }
    }

    .designer-card {
      .designer-grid {
        grid-template-columns: repeat(2, 1fr);
      }
    }
  }
}

@media (min-width: 1024px) {
  .stage-order-container {
    .quotation-card {
      .space-section {
        .process-grid {
          grid-template-columns: repeat(4, 1fr);
        }
      }
    }

    .designer-card {
      .designer-grid {
        grid-template-columns: repeat(3, 1fr);
      }
    }
  }
}
