// 项目预加载页面样式 - 纯 SCSS 实现

// 变量定义
$primary-color: #3880ff;
$success-color: #2dd36f;
$warning-color: #ffc409;
$danger-color: #eb445a;
$medium-color: #92949c;
$light-color: #f4f5f8;
$dark-color: #222428;
$white: #ffffff;
$border-radius: 12px;
$box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
$transition: all 0.3s ease;

// 主容器
.project-loader {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  // 头部
  .header {
    padding: 20px 0;
    text-align: center;

    .title {
      color: $white;
      font-size: 24px;
      font-weight: 600;
      margin: 0;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
  }

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

    .skeleton-loader {
      width: 100%;
      max-width: 400px;
      margin-bottom: 30px;

      .skeleton-header,
      .skeleton-card {
        height: 120px;
        background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
        background-size: 200% 100%;
        animation: loading 1.5s ease-in-out infinite;
        border-radius: $border-radius;
        margin-bottom: 12px;
      }

      .skeleton-header {
        height: 60px;
      }

      .skeleton-buttons {
        display: flex;
        gap: 12px;

        div {
          flex: 1;
          height: 44px;
          background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
          background-size: 200% 100%;
          animation: loading 1.5s ease-in-out infinite;
          border-radius: 8px;
        }
      }
    }

    @keyframes loading {
      0% {
        background-position: 200% 0;
      }
      100% {
        background-position: -200% 0;
      }
    }

    .spinner {
      width: 50px;
      height: 50px;
      margin: 20px 0;

      .spinner-circle {
        width: 100%;
        height: 100%;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top-color: $white;
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .loading-message {
      color: $white;
      font-size: 14px;
      margin-top: 12px;
      text-align: center;
    }
  }

  // 错误容器
  .error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
    text-align: center;

    .error-icon {
      width: 80px;
      height: 80px;
      margin-bottom: 20px;

      svg {
        width: 100%;
        height: 100%;
        fill: $danger-color;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
      }
    }

    .error-title {
      color: $white;
      font-size: 24px;
      font-weight: 600;
      margin: 0 0 12px;
    }

    .error-message {
      color: rgba(255, 255, 255, 0.9);
      font-size: 14px;
      margin: 0 0 24px;
      max-width: 300px;
      line-height: 1.5;
    }
  }

  // 创建项目引导容器
  .create-guide-container {
    animation: fadeIn 0.3s ease-in;
    max-width: 600px;
    margin: 0 auto;
  }

  // 卡片样式
  .card {
    background: $white;
    border-radius: $border-radius;
    box-shadow: $box-shadow;
    margin-bottom: 16px;
    overflow: hidden;
    transition: $transition;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .card-header {
      padding: 16px 20px;
      border-bottom: 1px solid $light-color;

      .card-title {
        font-size: 18px;
        font-weight: 600;
        color: $dark-color;
        margin: 0 0 4px;
        display: flex;
        align-items: center;
        gap: 8px;

        svg {
          width: 24px;
          height: 24px;
          flex-shrink: 0;
        }
      }

      .card-subtitle {
        font-size: 13px;
        color: $medium-color;
        margin: 0;
      }
    }

    .card-content {
      padding: 20px;

      > p {
        margin: 0;
        color: $medium-color;
        font-size: 14px;
        line-height: 1.5;
      }
    }
  }

  // 群聊信息卡片
  .group-info-card {
    .card-title {
      color: $primary-color;
    }
  }

  // 创建项目卡片
  .create-project-card {
    .card-title svg {
      stroke: $success-color;
    }

    .form-group {
      margin-bottom: 20px;

      label {
        display: block;
        font-size: 14px;
        font-weight: 500;
        color: $dark-color;
        margin-bottom: 8px;
      }

      .form-input {
        width: 100%;
        padding: 12px 16px;
        font-size: 15px;
        border: 2px solid $light-color;
        border-radius: 8px;
        transition: $transition;
        box-sizing: border-box;

        &:focus {
          outline: none;
          border-color: $primary-color;
        }

        &:disabled {
          background: $light-color;
          cursor: not-allowed;
        }

        &::placeholder {
          color: $medium-color;
        }
      }
    }
  }

  // 历史项目卡片
  .history-projects-card {
    .card-title svg {
      stroke: #3dc2ff;
    }

    .list {
      margin: -20px;

      .list-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        border-bottom: 1px solid $light-color;
        cursor: pointer;
        transition: $transition;

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

        &:hover {
          background: $light-color;
        }

        &:active {
          transform: scale(0.98);
        }

        .list-item-content {
          flex: 1;
          min-width: 0;

          .list-item-title {
            font-size: 16px;
            font-weight: 600;
            color: $dark-color;
            margin: 0 0 8px;
          }

          .list-item-meta {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;

            .list-item-stage {
              font-size: 13px;
              color: $medium-color;
            }
          }

          .list-item-date {
            font-size: 12px;
            color: $medium-color;
            margin: 0;
          }
        }

        .list-item-arrow {
          width: 20px;
          height: 20px;
          flex-shrink: 0;

          svg {
            width: 100%;
            height: 100%;
            stroke: $medium-color;
          }
        }
      }
    }
  }

  // 徽标样式
  .badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;

    &.status-pending {
      background: $warning-color;
      color: $dark-color;
    }

    &.status-active {
      background: $primary-color;
      color: $white;
    }

    &.status-completed {
      background: $success-color;
      color: $white;
    }

    &.status-paused {
      background: $medium-color;
      color: $white;
    }

    &.status-cancelled {
      background: $danger-color;
      color: $white;
    }

    &.status-default {
      background: $light-color;
      color: $dark-color;
    }
  }

  // 按钮样式
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: $transition;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

    svg {
      width: 20px;
      height: 20px;
      flex-shrink: 0;
    }

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }

    &:active {
      transform: translateY(0);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none !important;
    }

    &.btn-primary {
      background: linear-gradient(135deg, $primary-color 0%, #5260ff 100%);
      color: $white;

      &:hover {
        background: linear-gradient(135deg, #5260ff 0%, $primary-color 100%);
      }
    }

    &.btn-block {
      width: 100%;
    }

    .btn-spinner {
      width: 16px;
      height: 16px;
      border: 2px solid rgba(255, 255, 255, 0.3);
      border-top-color: $white;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }
  }

  // 用户信息底部
  .user-info-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: $border-radius;
    font-size: 13px;
    color: $dark-color;
    box-shadow: $box-shadow;

    svg {
      width: 20px;
      height: 20px;
      fill: $primary-color;
      flex-shrink: 0;
    }

    span {
      font-weight: 500;
    }
  }

  // 淡入动画
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  // 响应式适配
  @media (max-width: 480px) {
    padding: 12px;

    .header .title {
      font-size: 20px;
    }

    .card {
      .card-header {
        padding: 12px 16px;

        .card-title {
          font-size: 16px;
        }
      }

      .card-content {
        padding: 16px;
      }
    }

    .btn {
      padding: 10px 20px;
      font-size: 14px;
    }
  }
}
