<template>
  <div class="hydrology-forecast-container">
    <div class="secondary-title-container">
      <div 
        class="secondary-title" 
        :class="{ active: activeSecondaryTab === '水文预报' }"
        @click="selectSecondaryTab('水文预报')"
      >
        <span>水文预报</span>
      </div>
      <div 
        class="secondary-title" 
        :class="{ active: activeSecondaryTab === '水文预警' }"
        @click="selectSecondaryTab('水文预警')"
      >
        <span>水文预警</span>
      </div>
      <div 
        class="secondary-title" 
        :class="{ active: activeSecondaryTab === '水文预演' }"
        @click="selectSecondaryTab('水文预演')"
      >
        <span>水文预演</span>
      </div>
      <div 
        class="secondary-title" 
        :class="{ active: activeSecondaryTab === '水文预案' }"
        @click="selectSecondaryTab('水文预案')"
      >
        <span>水文预案</span>
      </div>
    </div>

    <HydrologyForecastPanel v-if="activeSecondaryTab === '水文预报'" />
    <HydrologyWarningPanel v-if="activeSecondaryTab === '水文预警'" />
    <HydrologySimulationPanel v-if="activeSecondaryTab === '水文预演'" />
    <HydrologyPlanPanel v-if="activeSecondaryTab === '水文预案'" />
  </div>
</template>

<script>
import HydrologyForecastPanel from '../components/HydrologyForecastPanel.vue'
import HydrologyWarningPanel from '../components/HydrologyWarningPanel.vue'
import HydrologySimulationPanel from '../components/HydrologySimulationPanel.vue'
import HydrologyPlanPanel from '../components/HydrologyPlanPanel.vue'

export default {
  name: 'HydrologyForecastView',
  components: {
    HydrologyForecastPanel,
    HydrologyWarningPanel,
    HydrologySimulationPanel,
    HydrologyPlanPanel
  },
  props: {
    activeSecondaryTab: {
      type: String,
      default: '水文预报'
    }
  },
  emits: ['selectSecondaryTab'],
  methods: {
    selectSecondaryTab(tab) {
      this.$emit('selectSecondaryTab', tab)
    }
  }
}
</script>

<style scoped>
.hydrology-forecast-container {
  width: 100%;
  height: 100%;
  position: relative;
}

.secondary-title-container {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 4;
}

.secondary-title {
  width: 159px;
  height: 31px;
  background-image: url('/src/assets/images/未选中底部标题.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.secondary-title span {
  background: linear-gradient(to bottom, #e2e8ff, #7bbef6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}

.secondary-title:hover,
.secondary-title.active {
  background-image: url('/src/assets/images/选中底部标题.png');
}

.secondary-title:hover span,
.secondary-title.active span {
  background: linear-gradient(to bottom, #e2e8ff, #62f6fb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
</style>
