<template>
  <div class="wel-container">
    <!-- 顶部横幅 -->
    <div class="welcome-banner">
      <div class="banner-bg">
        <div class="bg-pattern"></div>
      </div>
      <div class="banner-content">
        <div class="logo-wrapper">
          <div class="logo-icon">武</div>
        </div>
        <h1 class="banner-title">武术赛事通</h1>
        <p class="banner-subtitle">专业的武术赛事管理平台</p>
        <div class="banner-time">
          <i class="el-icon-time"></i>
          {{ currentTime }}
        </div>
      </div>
    </div>

    <!-- 主要内容区域 -->
    <div class="main-content">
      <!-- 快速入口 -->
      <div class="section">
        <div class="section-header">
          <div class="header-line"></div>
          <h2 class="section-title">快速入口</h2>
          <div class="header-line"></div>
        </div>

        <div class="quick-access">
          <div class="access-card" @click="navigateTo('/martial/competition/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-s-flag"></i>
            </div>
            <div class="card-info">
              <h3>赛事管理</h3>
              <p>管理武术赛事</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/participant/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-user"></i>
            </div>
            <div class="card-info">
              <h3>参赛选手</h3>
              <p>管理参赛选手信息</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/order/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-s-order"></i>
            </div>
            <div class="card-info">
              <h3>赛事管理</h3>
              <p>查看和管理订单</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/project/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-menu"></i>
            </div>
            <div class="card-info">
              <h3>项目管理</h3>
              <p>武术项目管理</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/schedulePlan/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-date"></i>
            </div>
            <div class="card-info">
              <h3>赛程计划</h3>
              <p>比赛赛程安排</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/referee/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-user-solid"></i>
            </div>
            <div class="card-info">
              <h3>评委管理</h3>
              <p>裁判人员管理</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/score/index')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-medal"></i>
            </div>
            <div class="card-info">
              <h3>评分管理</h3>
              <p>比赛评分系统</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>

          <div class="access-card" @click="navigateTo('/martial/result/list')">
            <div class="card-bg"></div>
            <div class="card-icon">
              <i class="el-icon-trophy"></i>
            </div>
            <div class="card-info">
              <h3>成绩管理</h3>
              <p>比赛成绩查询</p>
            </div>
            <i class="card-arrow el-icon-arrow-right"></i>
          </div>
        </div>
      </div>

      <!-- 数据统计 -->
      <div class="section">
        <div class="section-header">
          <div class="header-line"></div>
          <h2 class="section-title">数据统计</h2>
          <div class="header-line"></div>
        </div>

        <div class="stats-grid">
          <div class="stat-card">
            <div class="stat-icon red">
              <i class="el-icon-s-order"></i>
            </div>
            <div class="stat-info">
              <div class="stat-label">总订单数</div>
              <div class="stat-value">{{ stats.totalOrders }}</div>
              <div class="stat-trend up">
                <i class="el-icon-top"></i>
                <span>12%</span>
              </div>
            </div>
          </div>

          <div class="stat-card">
            <div class="stat-icon orange">
              <i class="el-icon-s-custom"></i>
            </div>
            <div class="stat-info">
              <div class="stat-label">参赛人数</div>
              <div class="stat-value">{{ stats.totalParticipants }}</div>
              <div class="stat-trend up">
                <i class="el-icon-top"></i>
                <span>25%</span>
              </div>
            </div>
          </div>

          <div class="stat-card">
            <div class="stat-icon blue">
              <i class="el-icon-s-flag"></i>
            </div>
            <div class="stat-info">
              <div class="stat-label">进行中赛事</div>
              <div class="stat-value">{{ stats.ongoingEvents }}</div>
              <div class="stat-trend">
                <i class="el-icon-minus"></i>
                <span>0%</span>
              </div>
            </div>
          </div>

          <div class="stat-card">
            <div class="stat-icon green">
              <i class="el-icon-s-data"></i>
            </div>
            <div class="stat-info">
              <div class="stat-label">已完成赛事</div>
              <div class="stat-value">{{ stats.completedEvents }}</div>
              <div class="stat-trend up">
                <i class="el-icon-top"></i>
                <span>8%</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Wel',
  data() {
    return {
      currentTime: '',
      stats: {
        totalOrders: 0,
        totalParticipants: 0,
        ongoingEvents: 0,
        completedEvents: 0
      }
    };
  },
  mounted() {
    this.updateTime();
    setInterval(this.updateTime, 1000);
    this.loadStats();
  },
  methods: {
    updateTime() {
      const now = new Date();
      const year = now.getFullYear();
      const month = String(now.getMonth() + 1).padStart(2, '0');
      const day = String(now.getDate()).padStart(2, '0');
      const hours = String(now.getHours()).padStart(2, '0');
      const minutes = String(now.getMinutes()).padStart(2, '0');
      const seconds = String(now.getSeconds()).padStart(2, '0');
      this.currentTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
    },
    navigateTo(path) {
      this.$router.push(path);
    },
    loadStats() {
      // TODO: 从API加载真实统计数据
      this.stats = {
        totalOrders: 128,
        totalParticipants: 456,
        ongoingEvents: 3,
        completedEvents: 12
      };
    }
  }
};
</script>

<style lang="scss" scoped>
.wel-container {
  min-height: 100vh;
  background: #f5f5f5;
}

.welcome-banner {
  position: relative;
  height: 280px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;

  &::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
      radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
      radial-gradient(circle at 70% 50%, rgba(0, 0, 0, 0.1) 0%, transparent 50%);
    animation: bgRotate 30s linear infinite;
  }
}

@keyframes bgRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.bg-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 60px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 60px);
}

.banner-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
}

.logo-wrapper {
  margin-bottom: 20px;
}

.logo-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 900;
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.banner-title {
  font-size: 42px;
  font-weight: 700;
  margin: 0 0 12px 0;
  letter-spacing: 6px;
  text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.banner-subtitle {
  font-size: 16px;
  margin: 0 0 20px 0;
  opacity: 0.95;
  letter-spacing: 3px;
}

.banner-time {
  display: inline-block;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.15);
  padding: 10px 24px;
  border-radius: 24px;
  backdrop-filter: blur(5px);

  i {
    margin-right: 8px;
  }
}

.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

.section {
  margin-bottom: 50px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.header-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, #dc2626, transparent);
  max-width: 150px;
}

.section-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  position: relative;
  padding: 0 16px;

  &::before,
  &::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #dc2626;
    border-radius: 50%;
  }

  &::before {
    left: 0;
  }

  &::after {
    right: 0;
  }
}

.quick-access {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.access-card {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    transform: scaleY(0);
    transition: transform 0.3s ease;
  }

  .card-bg {
    position: absolute;
    right: -20px;
    top: -20px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    transition: all 0.4s ease;
  }

  &:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(220, 38, 38, 0.2);

    &::before {
      transform: scaleY(1);
    }

    .card-bg {
      transform: scale(1.5);
      opacity: 0.8;
    }

    .card-icon {
      background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
      color: #fff;
      transform: scale(1.1) rotate(5deg);
    }

    .card-arrow {
      transform: translateX(6px);
      opacity: 1;
    }
  }

  .card-icon {
    position: relative;
    z-index: 1;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #fef2f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #dc2626;
    transition: all 0.3s ease;
    flex-shrink: 0;
  }

  .card-info {
    position: relative;
    z-index: 1;
    flex: 1;

    h3 {
      margin: 0 0 6px 0;
      font-size: 17px;
      font-weight: 600;
      color: #1a1a1a;
    }

    p {
      margin: 0;
      font-size: 13px;
      color: #666;
    }
  }

  .card-arrow {
    position: relative;
    z-index: 1;
    font-size: 20px;
    color: #dc2626;
    opacity: 0.5;
    transition: all 0.3s ease;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;

  &:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);

    .stat-icon {
      transform: scale(1.1) rotate(-5deg);
    }
  }

  .stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    transition: all 0.3s ease;
    flex-shrink: 0;

    &.red {
      background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    }

    &.orange {
      background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    }

    &.blue {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    }

    &.green {
      background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    }
  }

  .stat-info {
    flex: 1;
    position: relative;

    .stat-label {
      font-size: 13px;
      color: #666;
      margin-bottom: 8px;
    }

    .stat-value {
      font-size: 32px;
      font-weight: 700;
      color: #1a1a1a;
      line-height: 1;
    }

    .stat-trend {
      position: absolute;
      top: 0;
      right: 0;
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 12px;
      color: #999;

      &.up {
        color: #10b981;
      }

      i {
        font-size: 14px;
      }
    }
  }
}

@media (max-width: 768px) {
  .banner-title {
    font-size: 32px;
  }

  .quick-access {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
</style>
