<template>
  <view class="brand-banner">
    <!-- Background image layer with blur -->
    <image
      class="banner-bg"
      :src="bannerImage"
      mode="aspectFill"
    />
    <!-- Dark overlay for readability -->
    <view class="banner-overlay" />

    <!-- Centered content -->
    <view class="banner-content">
      <!-- Circular logo -->
      <view class="logo-circle">
        <image
          v-if="logoImage"
          class="logo-img"
          :src="logoImage"
          mode="aspectFill"
        />
        <view v-else class="logo-placeholder">
          <text>{{ studioName.slice(0, 1) || 'F' }}</text>
        </view>
      </view>

      <!-- Studio name -->
      <text class="studio-name">{{ studioName }}</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import type { StudioConfig } from '@mp-pilates/shared'

const props = defineProps<{
  studioInfo: StudioConfig | null
}>()

const fallbackBannerImage = 'https://plates-1251306435.cos.ap-guangzhou.myqcloud.com/mp/images/bannerBg.jpg'
const fallbackLogoImage = 'https://plates-1251306435.cos.ap-guangzhou.myqcloud.com/mp/images/logo.jpg'

const bannerImage = computed(() => props.studioInfo?.bannerUrl || fallbackBannerImage)
const logoImage = computed(() => props.studioInfo?.logo || fallbackLogoImage)
const studioName = computed(() => props.studioInfo?.name || 'Focus Core')
</script>

<style lang="scss" scoped>
.brand-banner {
  position: relative;
  width: 100%;
  height: 580rpx;
  overflow: hidden;
  background: linear-gradient(160deg, #E1F4FA 0%, $primary-color 50%, $primary-dark 100%);
}

.banner-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: blur(2px);
  transform: scale(1.05);
}

.banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba($primary-dark, 0.25);
}

.banner-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 120rpx;
}

.logo-circle {
  width: 200rpx;
  height: 200rpx;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.2);
}

.logo-img {
  width: 200rpx;
  height: 200rpx;
  border-radius: 50%;
}

.logo-placeholder {
  width: 200rpx;
  height: 200rpx;
  border-radius: 50%;
  font-size: 64rpx;
  font-weight: 800;
  color: #333;
  letter-spacing: 4rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-name {
  margin-top: 28rpx;
  font-size: 40rpx;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 6rpx;
  text-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.3);
}
</style>
