<template>
  <SmallBorder>
    <div class="go-workshop-scene">
      <div class="header">
        <div class="title">
          <div class="title-text">
            <span :style="{
              color: option.titleColor,
              fontSize: option.titleSize + 'px',
              fontWeight: option.fontWeight,
              fontStyle: option.fontStyle,
              marginLeft: option.paddingX + 'px',
              marginTop: option.paddingY + 'px',
              letterSpacing: option.letterSpacing + 'px'
            }">{{ option.title }}</span>
          </div>
        </div>
        <a class="link" :style="{ color: option.linkColor }">{{ option.linkText }}</a>
      </div>
      <div class="content">
        <div class="scene-row" :style="{ backgroundImage: `url(${backgrounds[0]})` }">
            <div class="scene-name-1" :style="{ color: option.sceneNameColor, fontSize: option.sceneNameSize + 'px' }">危化品库</div>
		  <div class="metrics-container">
              <div class="metric-top-1">
                <div class="metric-label">
                  <span :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">场景总数</span>
                </div>
                <div class="metric-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">262</div>
              </div>
              <div class="metric-top-2">
                <div class="metric-label">
                  <span :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">智控场景</span>
                </div>
                <div class="metric-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">6852</div>
              </div>
          </div>
        </div>
        <div class="scene-row reverse" :style="{ backgroundImage: `url(${backgrounds[1]})` }">
            <div class="scene-name-2" :style="{ color: option.sceneNameColor, fontSize: option.sceneNameSize + 'px' }">危废品库</div>
		  <div class="metrics-container">
              <div class="metric-bottom-1">
                <div class="metric-label">
                  <span :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">智控场景</span>
                </div>
                <div class="metric-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">6852</div>
              </div>
              <div class="metric-bottom-2">
                <div class="metric-label">
                  <span :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">场景总数</span>
                </div>
                <div class="metric-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">262</div>
              </div>
          </div>
        </div>
      </div>
    </div>
  </SmallBorder>
</template>

<script setup lang="ts">
import { PropType, computed } from 'vue'
import { option as configOption } from './config'
import bg1 from './assets/6.png'
import bg2 from './assets/04.png'
import SmallBorder from '../SmallBorder/index.vue'

const backgrounds = [bg1, bg2]

const props = defineProps({
  chartConfig: {
    type: Object as PropType<{ option: typeof configOption }>,
    required: true
  }
})

const option = computed(() => props.chartConfig.option)
</script>

<style lang="scss" scoped>
.go-workshop-scene {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  padding: 12px;
  padding-top: 0; // Let the header handle top padding
  box-sizing: border-box;
  display: flex;
  flex-direction: column;

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; // More space
    margin-top: 5px;

    .title {
      display: flex;
      align-items: center;
	   margin-left: 35px;
      margin-top: 5px;

      .title-text {
        height: 35px;
        display: flex;
        align-items: center;
        padding: 0 20px 0 20px;
      }
    }

    .link {
      cursor: pointer;
      font-size: 16px; // Bigger link text
      margin-right: 20px;
    }
  }

  .content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; // Center the rows vertically
    gap: 20px; // Space between rows
  }

  .scene-row {
    display: flex;
    align-items: center;
    padding: 0 25px;
    height: 120px; // Taller rows
    background-size: 100% 100%;
    background-repeat: no-repeat;

    &.reverse {
      flex-direction: row-reverse;

      .scene-name-2 {
        margin-right: 90px;
        margin-left: 25px;
      }
      
      .metrics-container {
        margin-right: auto;
        margin-left: 0;
      }
    }
  }

  .scene-icon-container {
    position: relative;
    width: 72px; // Bigger icon container
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.5) 0%, rgba(15, 28, 61, 0) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    .yellow-dot {
      position: absolute;
      top: 8px;
      left: 8px; // Positioned differently in 1.png
      width: 0px;
      height: 0px;
      background-color: #FFD700;
      border-radius: 50%;
    }

    .scene-icon {
      font-size: 36px;
      color: #ffffff;
    }
  }

  .scene-name-1,
  .scene-name-2 {
    font-weight: bold;
  }

  .scene-name-1 {
    margin-left: 95px;
  }

  .metrics-container {
    display: flex;
    align-items: center;
    margin-left: auto;

    .separator {
      width: 1px;
      height: 50px;
      background-color: #00E5FF;
      margin: 0 30px;
      position: relative;

      &::before, &::after {
        content: '';
        position: absolute;
        left: -2px;
        width: 5px;
        height: 5px;
        background-color: #00E5FF;
        border-radius: 50%;
      }
      &::before {
        top: -1px;
      }
      &::after {
        bottom: -1px;
      }
    }
  }

  .metric-top-1,
  .metric-top-2,
  .metric-bottom-1,
  .metric-bottom-2 {
    display: flex;
    flex-direction: column;
    align-items: center;

    .metric-label {
      display: flex;
      align-items: center;
      margin-bottom: 8px;

      .point {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        margin-right: 10px;
      }
    }

    .metric-value {
      font-weight: bold;
      position: relative;
      left: 9px; // Visually center the value under the text
    }
  }
  .metric-top-1 {
    position: relative;
    left: -85px;
  }
  .metric-top-2 {
    position: relative;
    left: -30px;
  }
  .metric-bottom-1 {
    position: relative;
    left: 15px;
  }
  .metric-bottom-2 {
    position: relative;
    left:70px;
  }
}
</style>


