/* 设计师分配组件样式（复用 StageOrder 风格） */


.card{
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 15px;
}

.designer-card {
  .section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0 0 12px;

    &:not(:first-child) {
      margin-top: 24px;
    }
  }

  .loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;

    .spinner-sm {
      width: 24px;
      height: 24px;
      border: 3px solid var(--light-shade);
      border-top-color: var(--primary-color);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

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

  /* 已分配组员列表（基础样式） */
  .assigned-teams-section {
    margin-bottom: 24px;

    .team-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 12px;
    }

    .team-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px;
      border: 2px solid var(--light-shade);
      border-radius: 8px;
      background: var(--white);
      transition: all 0.2s;

      &.clickable {
        cursor: pointer;

        &:hover {
          border-color: rgba(var(--primary-rgb), 0.3);
          background: rgba(var(--primary-rgb), 0.03);
        }
      }

      .team-member {
        display: flex;
        align-items: center;
        gap: 12px;

        .member-avatar {
          width: 32px;
          height: 32px;
          border-radius: 50%;
          overflow: hidden;
          background: var(--light-shade);
          display: flex;
          align-items: center;
          justify-content: center;

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

          .avatar-icon {
            width: 32px;
            height: 32px;
            color: var(--primary-color);
          }
        }

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

          h5 {
            margin: 0 0 6px;
            font-size: 16px;
            font-weight: 700;
            color: var(--dark-color);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .member-spaces {
            margin: 0;
            font-size: 13px;
            color: var(--primary-color);
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 4px;

            &::before {
              content: '📦';
              font-size: 14px;
            }
          }
        }
      }

      .edit-icon {
        width: 20px;
        height: 20px;
        color: var(--medium-color);
      }
    }
  }

  /* 项目组选择 */
  .department-section {
    margin-bottom: 24px;

    .department-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 12px;
    }

    .department-item {
      position: relative;
      padding: 14px;
      border: 2px solid var(--light-shade);
      border-radius: 8px;
      background: var(--white);
      cursor: pointer;
      transition: all 0.3s;

      &:hover {
        border-color: rgba(var(--primary-rgb), 0.3);
        background: rgba(var(--primary-rgb), 0.03);
      }

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

        .selected-icon {
          color: var(--primary-color);
        }
      }

      h5 {
        margin: 0 0 6px;
        font-size: 16px;
        font-weight: 700;
        color: var(--dark-color);
      }

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

      .selected-icon {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 20px;
        height: 20px;
        color: var(--primary-color);
      }
    }
  }

  /* 组员选择 */
  .designer-section {
    .designer-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 12px;
    }

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

      &:hover {
        background-color: var(--light-shade);
        transform: translateX(2px);
      }

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

        .designer-info h4 {
          color: var(--primary-color);
        }
      }

      .designer-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        overflow: hidden;
        background: var(--light-shade);
        display: flex;
        align-items: center;
        justify-content: center;

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

        .avatar-icon {
          width: 48px;
          height: 48px;
          color: var(--medium-color);
        }
      }

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

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

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

      .selected-icon {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 20px;
        height: 20px;
        color: var(--primary-color);
      }
    }
  }
}

/* 模态框样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;

  .modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
  }

  .modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;

    .icon {
      width: 20px;
      height: 20px;
      color: var(--medium-color);
    }

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

      .icon { color: var(--dark-color); }
    }
  }
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;

  .designer-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.05) 0%, rgba(var(--primary-rgb), 0.02) 100%);
    border-radius: 10px;
    margin-bottom: 24px;

    .designer-avatar {
      width: 64px;
      height: 64px;
      border-radius: 50%;
      overflow: hidden;
      background: var(--white);
      border: 3px solid var(--primary-color);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);

      img { width: 100%; height: 100%; object-fit: cover; }
      .avatar-icon { width: 36px; height: 36px; }
    }

    .designer-name {
      font-size: 18px;
      font-weight: 600;
      color: var(--dark-color);
    }
  }

  .space-selection-section {
    .form-label {
      display: block;
      font-weight: 500;
      color: var(--dark-color);
      margin-bottom: 8px;
      font-size: 14px;
      .required { color: var(--danger-color); margin-left: 4px; }
    }

    .form-help {
      margin: 0 0 12px;
      font-size: 13px;
      color: var(--medium-color);
    }

    .space-checkbox-list {
      display: flex;
      flex-direction: column;
      gap: 10px;

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

        &:hover {
          background: var(--light-shade);
          border-color: rgba(var(--primary-rgb), 0.3);
        }

        input[type="checkbox"] {
          position: absolute;
          opacity: 0;
          cursor: pointer;
          width: 0;
          height: 0;

          &:checked + .checkbox-custom {
            background-color: var(--primary-color);
            border-color: var(--primary-color);

            &::after { display: block; }
          }

          &:checked ~ .space-name { font-weight: 600; }
        }

        .checkbox-custom {
          position: relative;
          height: 20px;
          width: 20px;
          background-color: var(--white);
          border: 2px solid var(--medium-color);
          border-radius: 4px;
          transition: all 0.3s;
          display: flex;
          align-items: center;
          justify-content: center;
          flex-shrink: 0;

          &::after {
            content: '';
            display: none;
            width: 5px;
            height: 10px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
          }
        }

        .space-name {
          flex: 1;
          font-size: 14px;
          color: var(--dark-color);
          transition: all 0.3s;
        }
      }
    }
  }
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--light-shade);

  .btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    &.btn-outline {
      background: white;
      color: var(--dark-color);
      border: 2px solid var(--light-shade);
    }

    &.btn-primary {
      background: var(--primary-color);
      color: white;
    }

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