<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :span="24">
        <div class="header-section">
          <h1 class="system-title">联合作战指挥系统入口</h1>
          <p class="system-desc">请选择下方功能模块进入</p>
        </div>
      </el-col>
    </el-row>

    <el-row :gutter="30" type="flex" justify="center" style="margin-top: 30px;">

      <el-col :xs="24" :sm="8" :md="6">
        <el-card shadow="hover" class="entry-card" @click.native="goCesium">
          <div class="card-content">
            <div class="icon-wrapper blue">
              <i class="el-icon-map-location"></i>
            </div>
            <h3>三维全屏地图</h3>
            <p>Cesium三维地球态势展示</p>
            <el-button type="text" class="enter-btn">点击进入 &gt;</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :xs="24" :sm="8" :md="6">
        <el-card shadow="hover" class="entry-card" @click.native="goSelectRoom">
          <div class="card-content">
            <div class="icon-wrapper green">
              <i class="el-icon-office-building"></i>
            </div>
            <h3>选择/管理房间</h3>
            <p>进入大厅查看或创建作战室</p>
            <el-button type="text" class="enter-btn">点击进入 &gt;</el-button>
          </div>
        </el-card>
      </el-col>

      <el-col :xs="24" :sm="8" :md="6">
        <el-card shadow="hover" class="entry-card" @click.native="goChildRoom">
          <div class="card-content">
            <div class="icon-wrapper orange">
              <i class="el-icon-s-operation"></i>
            </div>
            <h3>进入子房间</h3>
            <p>直接进入作战推演与标绘界面</p>
            <el-button type="text" class="enter-btn">点击进入 &gt;</el-button>
          </div>
        </el-card>
      </el-col>

    </el-row>

    <div class="footer-tips">
      <i class="el-icon-info"></i> 当前系统版本：v3.9.1 (Customized)
    </div>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      // 如果有需要的数据可以在这里定义
    };
  },
  methods: {
    // 1. 跳转到 Cesium 地图
    goCesium() {
      // 这里的 path 必须和你 router/index.js 里配置的一致
      this.$router.push({ path: "/cesiumMap" }).catch(() => {});
    },

    // 2. 跳转到 选择房间页面
    goSelectRoom() {
      this.$router.push({ path: "/selectRoom" }).catch(() => {});
    },

    // 3. 跳转到 子房间页面 (你提供的那个红色的作战界面)
    goChildRoom() {
      this.$router.push({ path: "/childRoom" }).catch(() => {});
    }
  }
};
</script>

<style scoped lang="scss">
.home {
  padding: 40px;
  background-color: #f5f7fa;
  min-height: calc(100vh - 84px); /* 减去若依顶部导航的高度 */
  display: flex;
  flex-direction: column;

  .header-section {
    text-align: center;
    margin-bottom: 20px;

    .system-title {
      font-size: 32px;
      color: #303133;
      font-weight: 600;
      margin-bottom: 10px;
    }

    .system-desc {
      font-size: 16px;
      color: #909399;
    }
  }

  .entry-card {
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 280px; /* 固定高度让卡片整齐 */
    position: relative;
    overflow: hidden;

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

      .enter-btn {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .card-content {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      padding: 20px;
      text-align: center;

      h3 {
        font-size: 20px;
        color: #303133;
        margin: 20px 0 10px;
      }

      p {
        font-size: 14px;
        color: #909399;
        margin: 0;
        line-height: 1.6;
      }
    }
  }

  /* 图标样式 */
  .icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin-bottom: 10px;

    &.blue {
      background-color: rgba(64, 158, 255, 0.1);
      color: #409EFF;
    }

    &.green {
      background-color: rgba(103, 194, 58, 0.1);
      color: #67C23A;
    }

    &.orange {
      background-color: rgba(230, 162, 60, 0.1);
      color: #E6A23C;
    }
  }

  /* 进入按钮动画 */
  .enter-btn {
    margin-top: 20px;
    font-size: 14px;
    opacity: 0; /* 默认隐藏 */
    transform: translateY(10px);
    transition: all 0.3s;
  }

  .footer-tips {
    text-align: center;
    margin-top: auto; /* 推到底部 */
    padding-top: 40px;
    color: #C0C4CC;
    font-size: 13px;
  }
}
</style>
