<script setup lang="ts">
import { onMounted } from 'vue'
import { RouterView } from 'vue-router'
import { useUserStore } from '@/stores/user'
import AppLayout from '@/components/layout/AppLayout.vue'

const userStore = useUserStore()

onMounted(() => {
  // 初始化用户认证状态
  userStore.initializeAuth()
})
</script>

<template>
  <div id="app">
    <AppLayout>
      <RouterView />
    </AppLayout>
  </div>
</template>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 确保在所有缩放级别下都能正常显示 */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  zoom: 1;
}

/* 移除全屏相关样式，使用正常布局 */

html, body {
  height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

#app {
  min-height: 100vh;
  width: 100vw;
  display: block;
  position: relative;
}

/* 确保导航栏和横幅可见 */
.header {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1000 !important;
}

.hero-banner {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
}

/* 响应式容器 */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 响应式断点 */
@media (max-width: 1200px) {
  .container {
    max-width: 1140px;
    padding: 0 16px;
  }
}

@media (max-width: 992px) {
  .container {
    max-width: 960px;
    padding: 0 16px;
  }
}

@media (max-width: 768px) {
  .container {
    max-width: 720px;
    padding: 0 12px;
  }
}

@media (max-width: 576px) {
  .container {
    max-width: 540px;
    padding: 0 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 8px;
  }
}

/* 缩放兼容性 - 确保在所有缩放级别下都能正常显示 */
@media screen and (min-resolution: 2dppx) {
  body {
    zoom: 1;
  }
}

@media screen and (max-resolution: 1dppx) {
  body {
    zoom: 1;
  }
}

/* 工具类 */
.text-center {
  text-align: center;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-4 {
  margin-top: 1rem;
}

.p-4 {
  padding: 1rem;
}

/* 响应式显示工具类 */
.d-none {
  display: none !important;
}

.d-block {
  display: block !important;
}

@media (max-width: 768px) {
  .d-md-none {
    display: none !important;
  }

  .d-md-block {
    display: block !important;
  }
}

@media (max-width: 576px) {
  .d-sm-none {
    display: none !important;
  }

  .d-sm-block {
    display: block !important;
  }
}
</style>
