<template>
  <div class="page-container">
    <!-- 页眉设计 -->
    <div class="header">
      <div class="header-content">
        <div class="header-left">
          <h1>灌溉水采样点分析系统</h1>
        </div>
      </div>
      <div class="header-divider"></div>
    </div>

    <!-- 主内容区 -->
    <div class="main-content">
      <!-- 地图展示区域 -->
      <div class="dashboard-section">
        <div class="section-header">
          <div class="section-icon">🗺️</div>
          <h2 class="component-title">采样点地理分布</h2>
        </div>
        <div class="dashboard-card map-card">
          <div class="map-holder">
            <irrwatermap/>
          </div>
        </div>
      </div>

      <!-- 数据展示区域 - 上下排列 -->
      <div class="data-section">
        <!-- 数据列表 - 固定高度滚动条 -->
        <div class="dashboard-section">
          <div class="section-header">
            <div class="section-icon">📋</div>
            <h2 class="component-title">采样点水质数据</h2>
          </div>
          <div class="dashboard-card data-card">
            <div class="table-container">
              <Waterdataline/>
            </div>
          </div>
        </div>

        <!-- 图表分析 - 上下排列 -->
        <div class="dashboard-section">
          <div class="section-header">
            <div class="section-icon">📊</div>
            <h2 class="component-title">区域重金属分析</h2>
          </div>
          <div class="dashboard-card chart-card">
            <div class="chart-header">
              <h3>各区县重金属平均浓度对比</h3>
              <p>韶关市水环境重金属污染分布情况</p>
            </div>
            <Waterassaydata2/>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import Waterdataline from '@/components/irrpollution/waterdataline.vue';
import Waterassaydata2 from '@/components/irrpollution/waterassaydata2.vue';
import irrwatermap from '@/components/irrpollution/irrwatermap.vue';
</script>

<style scoped>
/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%);
  padding: 20px;
  gap: 25px;
  position: relative;
  overflow-x: hidden;
}

/* 页眉样式 */
.header {
  border-radius: 16px;
  padding: 25px;
}

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

.header-left h1 {
  color: #1a365d;
  font-size: 2.4rem;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-left p {
  color: #2d5986;
  font-size: 1.3rem;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
}

.data-indicator {
  display: flex;
  gap: 30px;
  padding: 15px 25px;
  background: rgba(235, 245, 255, 0.7);
  border-radius: 12px;
  border-left: 4px solid #3a9fd3;
}

.indicator-item {
  text-align: center;
}

.indicator-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #1a6fb0;
  line-height: 1.2;
}

.indicator-label {
  font-size: 1rem;
  color: #4a5568;
  font-weight: 500;
}

.header-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #cbd5e0, transparent);
}

/* 主内容区 */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
  flex: 1;
}

/* 区域标题 */
.dashboard-section {
  margin-bottom: 30px;
}

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

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

.component-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1a365d;
  position: relative;
  padding-left: 15px;
  flex-grow: 1;
}

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

.map-actions, .data-actions, .chart-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-action-btn, .data-select {
  padding: 8px 16px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.map-action-btn:hover {
  background: #f0f7ff;
}

.data-select {
  padding: 8px 12px;
}

/* 卡片设计 */
.dashboard-card {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 20px rgba(0, 60, 120, 0.12);
  transition: all 0.4s ease;
  overflow: hidden;
  position: relative;
}

.dashboard-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 60, 120, 0.18);
}

/* 地图容器 */
.map-card {
  height: 550px;
  position: relative;
}

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

.map-overlay {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 200;
}

.map-stats {
  display: flex;
  gap: 25px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  font-size: 1.8rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a6fb0;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.95rem;
  color: #4a5568;
  font-weight: 500;
}

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

/* 数据卡片 - 固定高度滚动条 */
.data-card {
  height: 450px;
  display: flex;
  flex-direction: column;
}

.table-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.pagination {
  display: flex;
  gap: 10px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-btn:hover {
  background: #edf2f7;
}

.page-btn.active {
  background: #4a9ef7;
  color: white;
  border-color: #4a9ef7;
}

/* 图表卡片 */
.chart-card {
  height: 600px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  margin-bottom: 20px;
}

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

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

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

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

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

.cadmium { background-color: #ff6b6b; }
.lead { background-color: #4ecdc4; }
.chromium { background-color: #ffd166; }
.arsenic { background-color: #6a0572; }

/* 页脚样式 */
.footer {
  margin-top: 30px;
  padding: 25px 0;
  text-align: center;
  color: #546e7a;
  font-size: 1rem;
  position: relative;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #cbd5e0, transparent);
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

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

/* 响应式设计 */
@media (max-width: 1200px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  
  .header-right {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .header-left h1 {
    font-size: 2rem;
  }
  
  .header-left p {
    font-size: 1.1rem;
  }
  
  .map-stats {
    gap: 15px;
    padding: 12px;
  }
  
  .stat-value {
    font-size: 1.6rem;
  }
  
  .data-card, .chart-card {
    height: 400px;
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 15px;
    gap: 20px;
  }
  
  .header {
    padding: 20px;
  }
  
  .header-left h1 {
    font-size: 1.8rem;
  }
  
  .component-title {
    font-size: 1.4rem;
  }
  
  .map-card {
    height: 450px;
  }
  
  .data-card, .chart-card {
    height: 350px;
  }
  
  .map-actions, .data-actions, .chart-actions {
    flex-wrap: wrap;
    margin-top: 10px;
  }
  
  .stat-item {
    flex-direction: column;
    text-align: center;
    gap: 5px;
  }
  
  .table-footer {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .header-left h1 {
    font-size: 1.6rem;
  }
  
  .component-title {
    font-size: 1.3rem;
    padding-left: 10px;
  }
  
  .component-title::before {
    width: 4px;
  }
  
  .map-card {
    height: 400px;
  }
  
  .data-card, .chart-card {
    height: 300px;
  }
  
  .map-stats {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .stat-item {
    flex: 0 0 calc(50% - 10px);
    margin-bottom: 10px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 8px;
  }
}
</style>