<template>
  <view class="brand-banner">
    <!-- Background image layer -->
    <image
      v-if="studioInfo?.bannerUrl"
      class="banner-bg"
      :src="studioInfo.bannerUrl"
      mode="aspectFill"
    />
    <!-- Dark overlay for readability -->
    <view class="banner-overlay" />

    <!-- Status bar spacer -->
    <view class="status-bar" :style="{ height: statusBarHeight + 'px' }" />

    <!-- Centered content -->
    <view class="banner-content">
      <!-- Circular logo -->
      <view class="logo-circle">
        <image
          v-if="studioInfo?.logo"
          class="logo-img"
          :src="studioInfo.logo"
          mode="aspectFit"
        />
        <text v-else class="logo-placeholder">FC</text>
      </view>

      <!-- Studio name -->
      <text class="studio-name">{{ studioInfo?.name || 'Focus Core' }}</text>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue'
import type { StudioConfig } from '@mp-pilates/shared'
import { getSystemLayout } from '../utils/system'

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

const statusBarHeight = ref(0)

onMounted(() => {
  statusBarHeight.value = getSystemLayout().statusBarHeight
})
</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%;
}

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

.status-bar {
  position: relative;
  z-index: 2;
}

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

.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: 160rpx;
  height: 160rpx;
}

.logo-placeholder {
  font-size: 64rpx;
  font-weight: 800;
  color: #333;
  letter-spacing: 4rpx;
}

.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>
