<template>
  <div id="app">
    <!-- 背景效果 -->
    <AnimatedBackground />
    <ParticleEffect />
    
    <!-- 滚动进度指示器 -->
    <ScrollProgress />
    
    <!-- 加载动画 -->
    <LoadingSpinner :isLoading="isLoading" :loadingText="t('common.loading')" />
    
    <!-- 导航栏 -->
    <nav class="navbar" v-if="$route.name !== 'editor'">
      <div class="nav-container">
        <router-link to="/" class="nav-brand">
          <h1 class="brand-title">RamEx</h1>
          <span class="brand-subtitle">{{ t('nav.brandSubtitle') }}</span>
        </router-link>
        <div class="nav-menu">
          <router-link to="/projects" class="nav-link" active-class="nav-link--active">
            {{ t('nav.projects') }}
          </router-link>
          <LanguageSwitcher />
        </div>
      </div>
    </nav>

    <!-- 主要内容区域 -->
    <main class="main-content" :class="{ 'editor-mode': $route.name === 'editor' }">
      <router-view />
    </main>

    <!-- 页脚 -->
    <footer class="footer" v-if="$route.name === 'home'">
      <div class="footer-container">
        <p>{{ t('nav.footer') }}</p>
      </div>
    </footer>
    
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useI18n } from 'vue-i18n'
import AnimatedBackground from './components/AnimatedBackground.vue'
import ParticleEffect from './components/ParticleEffect.vue'
import LoadingSpinner from './components/LoadingSpinner.vue'
import ScrollProgress from './components/ScrollProgress.vue'
import LanguageSwitcher from './components/LanguageSwitcher.vue'

const { t } = useI18n()

// 响应式数据
const isLoading = ref(false)
</script>

<style scoped>
/* 全局样式重置和基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#app {
  min-height: 100vh;
  background: transparent;
  font-family: var(--ramex-font);
  line-height: 1.6;
  color: var(--ramex-text);
  position: relative;
  isolation: isolate;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--ramex-border);
  z-index: 1000;
  transition: border-color 0.15s ease;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  cursor: pointer;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ramex-text);
  margin: 0;
  letter-spacing: -0.03em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--ramex-text-muted);
  margin-top: -2px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: var(--ramex-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.85rem;
  border-radius: var(--ramex-radius);
  border: 1px solid transparent;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.nav-link:hover {
  color: var(--ramex-text);
  background: var(--ramex-bg-subtle);
}

.nav-link.router-link-active,
.nav-link.nav-link--active {
  color: var(--ramex-text);
  font-weight: 600;
  background: var(--ramex-bg-subtle);
  border-color: var(--ramex-border);
}

/* 主要内容区域（置于背景层之上） */
.main-content {
  margin-top: 70px;
  position: relative;
  z-index: 1;
}

/* 编辑器页面全屏样式 */
.main-content.editor-mode {
  margin-top: 0;
  height: 100vh;
  overflow: hidden;
}

/* 英雄区域样式 */
.hero-section {
  padding: 6rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  min-height: 80vh;
}

.hero-text {
  max-width: 600px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--ramex-text);
  letter-spacing: -0.04em;
}

.title-line {
  display: block;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--ramex-text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border-radius: var(--ramex-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.cta-button.primary {
  background: var(--ramex-accent);
  color: var(--ramex-bg);
  border: 1px solid var(--ramex-accent);
}

.cta-button.primary:hover {
  background: var(--ramex-accent-hover);
  border-color: var(--ramex-accent-hover);
}

.cta-button.secondary {
  background: var(--ramex-bg);
  color: var(--ramex-text);
  border: 1px solid var(--ramex-border-strong);
}

.cta-button.secondary:hover {
  background: var(--ramex-bg-subtle);
}

.arrow-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.cta-button.primary:hover .arrow-icon {
  transform: translateX(4px);
}

/* 英雄区域视觉元素 */
.hero-visual {
  position: relative;
  height: 500px;
}

.floating-cards {
  position: relative;
  width: 100%;
  height: 100%;
}

.card {
  position: absolute;
  background: var(--ramex-bg);
  border-radius: var(--ramex-radius);
  padding: 2rem;
  box-shadow: var(--ramex-shadow-md);
  border: 1px solid var(--ramex-border);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--ramex-border-strong);
  box-shadow: var(--ramex-shadow-md);
}

.card-1 {
  top: 20%;
  left: 10%;
  width: 280px;
}

.card-2 {
  top: 50%;
  right: 10%;
  width: 300px;
}

.card-3 {
  bottom: 20%;
  left: 20%;
  width: 260px;
}

.card-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ramex-text);
  margin-bottom: 0.5rem;
}

.card-content p {
  color: var(--ramex-text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* 功能特性区域 */
.features-section {
  padding: 6rem 2rem;
  background: var(--ramex-bg);
  border-top: 1px solid var(--ramex-divider);
}

.features-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ramex-text);
  margin-bottom: 3rem;
  letter-spacing: -0.03em;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--ramex-bg-subtle);
  padding: 2.5rem;
  border-radius: var(--ramex-radius);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  border: 1px solid var(--ramex-border);
}

.feature-card:hover {
  background: var(--ramex-bg);
  border-color: var(--ramex-border-strong);
}

.feature-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: var(--ramex-accent);
  border-radius: var(--ramex-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ramex-bg);
  font-size: 2rem;
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ramex-text);
  margin-bottom: 1rem;
}

.feature-description {
  color: var(--ramex-text-secondary);
  line-height: 1.6;
}

/* 快速开始区域 */
.quick-start-section {
  padding: 6rem 2rem;
  background: var(--ramex-bg);
  border-top: 1px solid var(--ramex-divider);
}

.quick-start-container {
  max-width: 1000px;
  margin: 0 auto;
}

.steps-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--ramex-bg-subtle);
  border: 1px solid var(--ramex-border);
  border-radius: var(--ramex-radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.step:hover {
  background: var(--ramex-bg);
  border-color: var(--ramex-border-strong);
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--ramex-accent);
  color: var(--ramex-bg);
  border-radius: var(--ramex-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.step-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ramex-text);
  margin-bottom: 0.5rem;
}

.step-description {
  color: var(--ramex-text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* 页脚 */
.footer {
  background: var(--ramex-accent);
  color: var(--ramex-text-muted);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--ramex-border-strong);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .nav-menu {
    gap: 1rem;
  }
  
  
  .card-1, .card-2, .card-3 {
    position: relative;
    margin: 1rem auto;
    width: 100%;
    max-width: 300px;
  }
  
  .floating-cards {
    height: auto;
  }
  
  .hero-visual {
    height: auto;
  }
}
</style>
