<template>
  <div class="company-shore-power">
    <div class="left" style="width: 40%;">
      <!-- 码头信息卡片 -->
      <div class="card digital-twin-card--deep-blue">
        <div class="card-title">
          <div class="vertical-line"></div>
          <img src="@/assets/svgs/data.svg" class="title-icon" />
          <span class="title-text">码头与泊位信息</span>
        </div>
        <div class="card-content">
          <div v-for="company in companyComparisonData" :key="company.name" class="company-section">
            <!-- 码头名称和总量 -->
            <div class="company-header">
              <div class="company-name">{{ company.name }}</div>
              <div class="company-total">总量: {{ company.value }}</div>
            </div>
            <!-- 泊位详情 -->
            <div class="overview-grid">
              <div v-for="(berth, index) in (company.children || [])" :key="index" class="overview-item">
                <div class="overview-value">{{ berth.value }}</div>
                
                <div class="overview-label">{{ berth.name }}</div>

              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

// 定义组件属性
interface ChartDataItem {
  name: string;
  value: number;
  children?: ChartDataItem[];
}

interface Props {
  companyComparisonData: ChartDataItem[];
}

const props = defineProps<Props>()
</script>

<style scoped>
.company-shore-power {
  display: flex;
  height: 100%;
  gap: 10px;
}

.left {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-content {
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

/* 总览网格样式 */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 4px;
  height: 100%;
}

.overview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.overview-label {
  text-align: center;
  font-size: 24px;
  color: #ccc;
  margin-bottom: 2px;
}

.overview-value {
  font-size: 36px;
  font-weight: bold;
  color: #1296db;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.overview-text {
  font-size: 10px;
  color: #999;
  text-align: center;
}

/* 企业区块样式 */
.company-section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.company-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* 企业头部样式 */
.company-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}

.company-name {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
}

.company-total {
  font-size: 24px;
  font-weight: bold;
  color: #1296db;
  background-color: rgba(18, 150, 219, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
</style>