<template>
  <div class="scene-integrated w">
    <div class="scene-inner flex" :style="{ background: dataInfo.themeColor }">
      <!-- 左侧标题区 -->
      <div class="scene-left">
        <div class="s-h-group flex">
          <h3 class="s-main-t">{{ dataInfo.mainTitle }}</h3>
          <span class="s-sub-t">{{ dataInfo.subTitle }}</span>
        </div>
        <div class="enter-pill" @click="onPath(dataInfo.jumpLink)">{{ dataInfo.btnText }} <i class="arr-ic"></i></div>
      </div>

      <!-- 右侧卡片区 -->
      <div class="scene-right flex-1">
        <div class="s-grid-h flex">
          <div class="s-item-card" :style="{ background: s.bgColor, opacity: s.opacity }" v-for="(s, i) in dataInfo.cardList" :key="i">
            <div class="item-top flex-between">
              <div class="item-info flex">
                <p class="item-t" :style="{ color: s.titleColor }">{{ s.title }}</p>
                <p class="item-d" :style="{ color: s.subTitleColor }">{{ s.subTitle }}</p>
              </div>
              <div class="item-arrow">
                <i class="icon-arr"></i>
              </div>
            </div>
            <div class="item-pic">
              <el-image class="item-img" :src="s.imageUrl" />
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup name="Index" lang="ts">
import { currentScenarioGlobalSetting } from '@/api/home/index-enterprise';
import { onPath } from '@/utils/siteConfig';
const dataInfo = ref<any>({
  cardList: []
});
currentScenarioGlobalSetting({}).then((res) => {
  if (res.code == 200) {
    dataInfo.value = res.data;
  }
});
const scenes = [
  { title: '耗材采购', desc: '纸墨随买随用', img: '@/assets/jd/scene_stationery.png' },
  { title: '防暑降温', desc: '守护员工健康', img: '@/assets/jd/scene_cooling.png' },
  { title: '员工团建', desc: '同心聚力', img: '@/assets/jd/scene_teambuilding.png' },
  { title: '营销物资', desc: '全场景解决方案', img: '@/assets/jd/scene_marketing.png' }
];
</script>

<style scoped>
.scene-integrated {
  margin-top: 15px;
}
.scene-inner {
  background: linear-gradient(90deg, #6be7b5 0%, #39d696 100%);
  border-radius: 12px;
  padding: 14px 20px;
  align-items: center;
  min-height: 140px;
}

.scene-left {
  width: 380px;
  color: #fff;
  padding-right: 20px;
}
.s-h-group {
  align-items: baseline;
  margin-bottom: 15px;
}
.s-main-t {
  font-size: 24px;
  font-weight: 800;
  white-space: nowrap;
}
.s-sub-t {
  font-size: 24px;
  font-weight: 800;
  opacity: 0.95;
  margin-left: 12px;
  white-space: nowrap;
}

.enter-pill {
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: #e1251b;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}
.arr-ic {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #e1251b;
  border-radius: 50%;
  margin-left: 6px;
  position: relative;
}
.arr-ic::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 4px;
  height: 4px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform: rotate(45deg);
}

.scene-right {
  overflow: hidden;
}
.s-grid-h {
  gap: 10px;
}

.s-item-card {
  flex: 1;
  background: #e8fbf1; /* Pale green background matching Figure 2 */
  border-radius: 10px;
  height: 130px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s;
}
.s-item-card:hover {
  transform: translateY(-3px);
}

.item-top {
  padding: 8px 12px;
  align-items: center;
}
.item-info {
  align-items: baseline;
  gap: 8px;
}
.item-t {
  font-size: 18px;
  font-weight: 900;
  color: #026034;
  white-space: nowrap;
}
.item-d {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-arrow {
  width: 16px;
  height: 16px;
  background: #34c759;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-arr {
  width: 4px;
  height: 4px;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform: rotate(45deg);
  margin-left: -1px;
}

.item-pic {
  flex: 1;
  overflow: hidden;
  padding: 0 8px 8px;
}
.item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

@media screen and (max-width: 1599px) {
  .scene-left {
    width: 340px;
  }
  .s-main-t {
    font-size: 20px;
  }
  .s-sub-t {
    font-size: 20px;
    font-weight: 800;
  }
  .s-item-card:nth-child(4) {
    display: none;
  } /* 当宽度小于 1600px 时隐藏第4个卡片 */
}

@media screen and (max-width: 1209px) {
  .s-item-card:nth-child(3) {
    display: none;
  } /* 宽度更小时隐藏第3个卡片 */
}
</style>
