// iOS风格变量定义
$ios-primary: #007AFF;
$ios-primary-dark: #0062CC;
$ios-secondary: #34C759;
$ios-success: #34C759;
$ios-warning: #FF9500;
$ios-danger: #FF3B30;
$ios-text-primary: #000000;
$ios-text-secondary: #3C3C43;
$ios-text-tertiary: #8E8E93;
$ios-border: #D1D1D6;
$ios-background: #FFFFFF;
$ios-background-secondary: #F2F2F7;
$ios-background-tertiary: #E5E5EA;
$ios-shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
$ios-shadow-md: 0 4px 10px rgba(0,0,0,0.1);
$ios-shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
$ios-radius: 10px;
$ios-radius-lg: 16px;
$ios-radius-sm: 6px;
$ios-radius-full: 50px;
$ios-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
$ios-font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
$ios-spacing-xs: 4px;
$ios-spacing-sm: 8px;
$ios-spacing-md: 16px;
$ios-spacing-lg: 24px;
$ios-spacing-xl: 32px;

.team-assignment-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  font-family: $ios-font-family;

  .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
  }

  .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    background: $ios-background;
    border-radius: $ios-radius-lg;
    box-shadow: $ios-shadow-lg;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: $ios-spacing-lg;
    background: linear-gradient(135deg, $ios-background 0%, $ios-background-secondary 100%);
    border-bottom: 1px solid $ios-border;
    flex-shrink: 0;

    .modal-title {
      font-size: 20px;
      font-weight: 600;
      color: $ios-text-primary;
      margin: 0;
    }

    .close-btn {
      background: none;
      border: none;
      color: $ios-text-secondary;
      cursor: pointer;
      padding: $ios-spacing-sm;
      border-radius: $ios-radius-sm;
      transition: $ios-transition;

      &:hover {
        background: $ios-background-tertiary;
        color: $ios-text-primary;
      }
    }
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: $ios-spacing-lg;

    .assignment-section {
      .section-title {
        font-size: 18px;
        font-weight: 600;
        color: $ios-text-primary;
        margin: 0 0 $ios-spacing-sm 0;
      }

      .section-subtitle {
        font-size: 14px;
        color: $ios-text-secondary;
        margin: 0 0 $ios-spacing-lg 0;
      }
    }

    .designer-list {
      display: flex;
      flex-direction: column;
      gap: $ios-spacing-md;

      .designer-card {
        background: $ios-background;
        border: 2px solid $ios-border;
        border-radius: $ios-radius-lg;
        padding: $ios-spacing-lg;
        cursor: pointer;
        transition: $ios-transition;
        position: relative;
        overflow: hidden;

        &:hover {
          border-color: color-mix(in srgb, $ios-primary 50%, $ios-border);
          box-shadow: $ios-shadow-md;
        }

        &.selected {
          border-color: $ios-primary;
          background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(0, 122, 255, 0.02) 100%);
          box-shadow: 0 4px 20px rgba(0, 122, 255, 0.15);
        }

        .designer-info {
          display: flex;
          align-items: flex-start;
          gap: $ios-spacing-md;
          margin-bottom: $ios-spacing-md;

          .designer-avatar {
            width: 60px;
            height: 60px;
            border-radius: $ios-radius-full;
            overflow: hidden;
            flex-shrink: 0;
            border: 2px solid $ios-border;
            background: linear-gradient(135deg, $ios-background-secondary 0%, $ios-background-tertiary 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;

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

            &:hover img {
              transform: scale(1.05);
            }
          }

          .designer-details {
            flex: 1;

            .designer-name {
              font-size: 16px;
              font-weight: 600;
              color: $ios-text-primary;
              margin: 0 0 $ios-spacing-xs 0;
            }

            .designer-role {
              font-size: 14px;
              color: $ios-text-secondary;
              margin: 0 0 $ios-spacing-sm 0;
            }

            .designer-skills {
              display: flex;
              flex-wrap: wrap;
              gap: $ios-spacing-xs;

              .skill-tag {
                background: linear-gradient(135deg, $ios-background-secondary 0%, rgba(0, 122, 255, 0.1) 100%);
                color: $ios-primary;
                padding: 4px 12px;
                border-radius: $ios-radius;
                font-size: 12px;
                font-weight: 600;
                border: 1px solid rgba(0, 122, 255, 0.2);
                transition: $ios-transition;

                &:hover {
                  background: linear-gradient(135deg, rgba(0, 122, 255, 0.1) 0%, rgba(0, 122, 255, 0.2) 100%);
                  transform: translateY(-1px);
                  box-shadow: 0 2px 4px rgba(0, 122, 255, 0.2);
                }
              }
            }
          }
        }

        .workload-status {
          margin-bottom: $ios-spacing-md;

          .workload-indicator {
            display: flex;
            align-items: center;
            gap: $ios-spacing-sm;

            .workload-text {
              font-size: 14px;
              font-weight: 500;
              min-width: 60px;
            }

            .workload-bar {
              flex: 1;
              height: 8px;
              background: $ios-background-tertiary;
              border-radius: 4px;
              overflow: hidden;
              box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);

              .workload-fill {
                height: 100%;
                border-radius: 4px;
                transition: $ios-transition;
                position: relative;
                overflow: hidden;

                &::after {
                  content: '';
                  position: absolute;
                  top: 0;
                  left: -100%;
                  width: 100%;
                  height: 100%;
                  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
                  animation: shimmer 2s infinite;
                }
              }
            }

            @keyframes shimmer {
              0% { left: -100%; }
              100% { left: 100%; }
            }

            &.low {
              .workload-text { color: $ios-success; }
              .workload-fill { background: $ios-success; }
            }

            &.medium {
              .workload-text { color: $ios-warning; }
              .workload-fill { background: $ios-warning; }
            }

            &.high {
              .workload-text { color: $ios-danger; }
              .workload-fill { background: $ios-danger; }
            }
          }
        }

        .recent-tasks {
          .tasks-title {
            font-size: 14px;
            font-weight: 600;
            color: $ios-text-primary;
            margin: 0 0 $ios-spacing-sm 0;
          }

          .task-list {
            display: flex;
            flex-direction: column;
            gap: $ios-spacing-xs;

            .task-item {
              display: flex;
              align-items: center;
              gap: $ios-spacing-sm;
              padding: $ios-spacing-xs $ios-spacing-sm;
              background: $ios-background-secondary;
              border-radius: $ios-radius-sm;
              font-size: 12px;

              .task-name {
                flex: 1;
                color: $ios-text-primary;
                font-weight: 500;
              }

              .task-stage {
                padding: 2px 6px;
                border-radius: $ios-radius-sm;
                font-weight: 500;
                font-size: 11px;

                &.modeling { background: #E3F2FD; color: #1976D2; }
                &.rendering { background: #F3E5F5; color: #7B1FA2; }
                &.soft-decoration { background: #E8F5E8; color: #388E3C; }
                &.post-production { background: #FFF3E0; color: #F57C00; }
              }

              .task-deadline {
                color: $ios-text-tertiary;
                font-size: 11px;
              }
            }
          }

          .no-tasks {
            color: $ios-text-tertiary;
            font-size: 12px;
            text-align: center;
            padding: $ios-spacing-sm;
            background: $ios-background-secondary;
            border-radius: $ios-radius-sm;
            margin: 0;
          }
        }

        .selection-indicator {
          position: absolute;
          top: $ios-spacing-md;
          right: $ios-spacing-md;
          width: 32px;
          height: 32px;
          background: $ios-primary;
          border-radius: $ios-radius-full;
          display: flex;
          align-items: center;
          justify-content: center;
          color: white;
          box-shadow: $ios-shadow-sm;
        }
      }
    }
  }

  .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: $ios-spacing-md;
    padding: $ios-spacing-lg;
    background: $ios-background-secondary;
    border-top: 1px solid $ios-border;
    flex-shrink: 0;

    .btn-cancel {
      padding: $ios-spacing-sm $ios-spacing-lg;
      background: none;
      border: 1px solid $ios-border;
      color: $ios-text-secondary;
      border-radius: $ios-radius;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: $ios-transition;

      &:hover {
        background: $ios-background-tertiary;
        color: $ios-text-primary;
      }
    }

    .btn-confirm {
      padding: $ios-spacing-md $ios-spacing-xl;
      background: linear-gradient(135deg, $ios-primary 0%, $ios-primary-dark 100%);
      border: none;
      color: white;
      border-radius: $ios-radius;
      font-size: 16px;
      font-weight: 600;
      cursor: pointer;
      transition: $ios-transition;
      box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
      position: relative;
      overflow: hidden;

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s;
      }

      &:hover:not(:disabled) {
        background: linear-gradient(135deg, $ios-primary-dark 0%, #004499 100%);
        box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
        transform: translateY(-1px);

        &::before {
          left: 100%;
        }
      }

      &:active:not(:disabled) {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
      }

      &:disabled {
        background: $ios-text-tertiary;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;

        &::before {
          display: none;
        }
      }
    }
  }

  // 响应式设计
  @media (max-width: 768px) {
    .modal-content {
      width: 95%;
      max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
      padding: $ios-spacing-md;
    }

    .designer-list .designer-card {
      padding: $ios-spacing-md;

      .designer-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: $ios-spacing-sm;

        .designer-avatar {
          width: 50px;
          height: 50px;
        }
      }
    }
  }
}