<template>
  <div class="tech-showcase">
    <div class="showcase-grid">
      <!-- 五金工具卡片 -->
      <div class="showcase-card large-card">
        <div class="card-content">
          <h2 class="card-title">五金工具</h2>
          <div class="card-divider"></div>
          <p class="card-description">小五金模具、电动工具、手动工具</p>
          <button class="learn-button">Learn more</button>
        </div>
      </div>

      <!-- 上排卡片: CAD设计工作站和笔记本工作站 -->
      <div class="top-row">
        <!-- CAD设计工作站卡片 - 较宽 -->
        <div class="showcase-card card-wide medium-card">
          <div class="card-overlay"></div>
        </div>

        <!-- 工作站卡片 - 较窄 -->
        <div class="showcase-card medium-card card-narrow">
          <div class="card-overlay"></div>
        </div>
      </div>

      <!-- 下排卡片: 工业机器人和CAD工业设计 -->
      <div class="bottom-row">
        <!-- 工业机器人卡片 - 较窄 -->
        <div class="showcase-card medium-card card-narrow">
          <div class="card-overlay"></div>
        </div>

        <!-- CAD工业设计卡片 - 较宽 -->
        <div class="showcase-card medium-card card-wide">
          <div class="card-overlay"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
  // 组件逻辑可以在此添加
</script>

<style scoped>
  .tech-showcase {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 80px 0px;
    background-color: #fff;
  }

  .showcase-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    height: 600px;
  }

  .top-row,
  .bottom-row {
    display: flex;
    gap: 20px;
  }

  .top-row {
    grid-column: 2;
    grid-row: 1;
  }

  .bottom-row {
    grid-column: 2;
    grid-row: 2;
  }

  .showcase-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  .showcase-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  }

  /* 五金工具卡片 */
  .large-card {
    grid-column: 1;
    grid-row: 1 / span 2;
    background-image: url('@/assets/images/hardware-tools.png');
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  /* 宽卡片占70% */
  .card-wide {
    flex: 7;
  }

  /* 窄卡片占30% */
  .card-narrow {
    flex: 3;
  }

  /* CAD设计工作站卡片 - 较宽 */
  .top-row .card-wide {
    background-image: url('@/assets/images/cad-workstation.png');
  }

  /* 工作站卡片 - 较窄 */
  .top-row .card-narrow {
    background-image: url('@/assets/images/laptop-workspace.png');
  }

  /* 工业机器人卡片 - 较窄 */
  .bottom-row .card-narrow {
    background-image: url('@/assets/images/industrial-robots.png');
  }

  /* CAD工业设计卡片 - 较宽 */
  .bottom-row .card-wide {
    background-image: url('@/assets/images/cad-industrial-design.png');
  }

  .card-content {
    position: relative;
    z-index: 2;
    padding: 30px;
    color: white;
    text-align: center;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .large-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
  }

  .card-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 15px;
  }

  .card-divider {
    width: 40px;
    height: 3px;
    background-color: white;
    margin: 0 auto 15px;
  }

  .card-description {
    font-size: 1rem;
    margin-bottom: 20px;
  }

  .learn-button {
    background-color: #1a73e8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    align-self: center;
    transition: background-color 0.3s;
    margin-top: 60px;
  }

  .learn-button:hover {
    background-color: #1557b0;
  }

  .card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.3s;
  }

  .medium-card:hover .card-overlay {
    background: rgba(0, 0, 0, 0.4);
  }

  @media (max-width: 992px) {
    .showcase-grid {
      grid-template-columns: 1fr;
      grid-template-rows: auto;
      height: auto;
    }

    .large-card {
      height: 300px;
      grid-row: 1;
    }

    .top-row,
    .bottom-row {
      grid-column: 1;
    }

    .top-row {
      grid-row: 2;
    }

    .bottom-row {
      grid-row: 3;
    }

    .card-wide,
    .card-narrow {
      height: 250px;
    }
  }

  @media (max-width: 576px) {
    .top-row,
    .bottom-row {
      flex-direction: column;
      gap: 20px;
    }

    .card-wide,
    .card-narrow {
      height: 200px;
    }
  }
</style>
