<template>
  <div class="page-container">
    <!-- 页面标题区域 -->
    <div class="header-section">
      <div class="header-content">
        <div class="section-icon">📊</div>
        <h1 class="system-title">韶关市涉重企业重金属排放调查</h1>
      </div>
    </div>
    
    <!-- 地图展示区域 -->
    <div class="dashboard-section ">
      <div class="section-header">
        <div class="section-icon">🗺️</div>
        <h2 class="section-title">涉重企业地理分布</h2>
      </div>
      <div class="map-container">
        <div class="map-holder">
          <atmcompanymap/>
        </div>
      </div>
    </div>
    
    <!-- 数据展示区域 - 上下排列 -->
    <div class="data-section">
      <!-- 企业数据列表 -->
      <div class="dashboard-section table-section">
        <div class="section-header">
          <div class="section-icon">📋</div>
          <h2 class="section-title">涉重企业数据列表</h2>
          <div class="data-info">
            <span class="info-item">数据更新时间: 2025-08-16</span>
          </div>
        </div>
        <div class="data-card">
          <div class="table-container">
            <atmcompanyline/>
          </div>
        </div>
      </div>
      
      <!-- 排放分析图表 -->
      <div class="dashboard-section chart-section">
        <div class="section-header">
          <div class="section-icon">📊</div>
          <h2 class="section-title">大气颗粒物排放统计</h2>
          <div class="emission-info">
            <span class="info-item">单位: 吨/年 (t/a)</span>
            <span class="info-item">统计周期: 2025年</span>
          </div>
        </div>
        <div class="chart-card">
          <div class="chart-header">
            <h3>各区县企业平均大气颗粒物排放量</h3>
          </div>
          <div class="chart-container">
            <HeavyMetalEnterprisechart/>
          </div>
          
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import atmcompanyline from '@/components/atmpollution/atmcompanyline.vue';
import atmcompanymap from '@/components/atmpollution/atmcompanymap.vue';
import HeavyMetalEnterprisechart from '@/components/atmpollution/heavyMetalEnterprisechart.vue';
</script>

<style scoped>
/* 基础样式重置 */
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f9ff 0%, #e9ecef 100%);
  padding: 25px;
  gap: 20px;
  position: relative;
  overflow-x: hidden;
}

/* 页眉区域 */
.header-section {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  position: relative;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.system-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a365d;
  margin: 0;
  position: relative;
  padding-left: 15px;
  flex-grow: 1;
}

.system-title::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, #4a9ef7, #3acfd5);
  border-radius: 2px;
}


.header-actions {
  display: flex;
  gap: 15px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 极 0.3);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.btn-icon {
  font-size: 1.2rem;
}

.header-stats {
  display: flex;
  gap: 20px;
}

.stat-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15极 px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-icon {
  font-size: 2.5rem;
  color: #4a9ef7;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.stat-label {
  font-size: 1rem;
  color: #cbd5e0;
  font-weight: 500;
}

/* 地图区域 */
.dashboard-section {
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.section-icon {
  font-size: 2.2rem;
  color: #3a9fd3;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 600;
  color: #1a365d;
  margin: 0;
  position: relative;
  padding-left: 10px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 80%;
  background: linear-gradient(to bottom, #4a9ef7, #3acfd5);
  border-radius: 2px;
}

.map-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  font-size: 0.9rem;
  color: #4a5568;
}

.control-select {
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
}

.map-container {
  position: relative;
  height: 550px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.map-holder {
  position: relative;
  height: 100%;
  z-index: 100;
}

.map-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  display: flex;
  gap: 15px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 10px 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.high-risk { background-color: #e53e3e; }
.medium-risk { background-color: #dd6b20; }
.low-risk { background-color: #38a169; }

/* 数据展示区域 - 上下排列 */
.data-section {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* 企业数据列表 - 固定高度滚动条 */
.data-card {
  height: 450px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-container {
  height: 100%;
  overflow-y: auto;
  padding: 15px;
}

/* 图表区域 - 固定高度 */
.chart-card {
  height: 600px;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.chart-container {
  flex: 1;
  min-height: 0; /* 修复flex容器滚动问题 */
}

.data-info, .emission-info {
  display: flex;
  gap: 20px;
  margin-left: 30px;
  font-size: 0.9rem;
  color: #4a5568;
}

.chart-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.chart-header h3 {
  font-size: 1.4rem;
  color: #1a365d;
  margin: 0 0 5px 0;
}

.chart-header p {
  font-size: 1rem;
  color: #718096;
  margin: 0;
}

.chart-legend {
  display: flex;
  justify-content: center;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.legend-item .primary {
  background-color: #3182ce;
}

/* 页脚区域 */
.footer-section {
  margin-top: 30px;
  padding: 20px 0;
  text-align: center;
  color: #546e7a;
  font-size: 1rem;
  border-top: 1px solid #e2e8f0;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #718096;
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .header-stats {
    flex-wrap: wrap;
  }
  
  .stat-card {
    flex: 0 0 calc(50% - 10px);
    margin-bottom: 10px;
  }
}

@media (max-width: 900px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .system-title {
    font-size: 2rem;
  }
  
  .section-title {
    font-size: 1.6rem;
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 15px;
    gap: 20px;
  }
  
  .map-container {
    height: 450px;
  }
  
  .data-card, .chart-card {
    height: 350px;
  }
  
  .section-header {
    flex-wrap: wrap;
  }
  
  .map-controls {
    margin-top: 10px;
    width: 100%;
  }
  
  .data-info, .emission-info {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .system-title {
    font-size: 1.8rem;
  }
  
  .section-title {
    font-size: 1.4rem;
  }
  
  .map-container {
    height: 400px;
  }
  
  .data-card, .chart-card {
    height: 300px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 5px;
  }
  
  .header-stats {
    gap: 10px;
  }
  
  .stat-card {
    flex: 0 0 100%;
  }
}
</style>