<template>
  <div class="glass-container min-h-screen bg-gradient-to-br from-purple-500 to-pink-500">
    <!-- 背景装饰 -->
    <div class="glass-bg-decorations">
      <div class="glass-bg-circle circle-1"></div>
      <div class="glass-bg-circle circle-2"></div>
      <div class="glass-bg-circle circle-3"></div>
    </div>

    <!-- 顶部应用栏 -->
    <div class="glass-app-bar">
      <div class="container mx-auto px-4 py-3 flex items-center justify-between">
        <div class="flex items-center">
          <Menu class="w-5 h-5 text-white mr-4" />
          <h1 class="text-xl font-medium text-white">Glassmorphism</h1>
        </div>
        <div class="flex items-center space-x-4">
          <button class="glass-icon-button">
            <Search class="w-5 h-5" />
          </button>
          <button class="glass-icon-button">
            <Bell class="w-5 h-5" />
          </button>
          <button class="glass-icon-button">
            <User class="w-5 h-5" />
          </button>
        </div>
      </div>
    </div>

    <!-- 主要内容区 -->
    <div class="container mx-auto p-6">
      <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
        <!-- 左侧导航 -->
        <div class="glass-card">
          <div class="p-4">
            <h2 class="text-lg font-medium mb-4 text-white">导航菜单</h2>
            <nav class="space-y-2">
              <a href="#" class="glass-nav-item active">
                <Home class="w-5 h-5" />
                <span>首页</span>
              </a>
              <a href="#" class="glass-nav-item">
                <Inbox class="w-5 h-5" />
                <span>收件箱</span>
                <span class="glass-badge">12</span>
              </a>
              <a href="#" class="glass-nav-item">
                <Star class="w-5 h-5" />
                <span>收藏</span>
              </a>
              <a href="#" class="glass-nav-item">
                <Settings class="w-5 h-5" />
                <span>设置</span>
              </a>
            </nav>
          </div>
        </div>

        <!-- 中间内容 -->
        <div class="md:col-span-2 space-y-6">
          <!-- 卡片列表 -->
          <div class="glass-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-white">卡片列表</h2>
              <div class="space-y-4">
                <div class="glass-list-item">
                  <div class="glass-avatar bg-white/20">JD</div>
                  <div class="flex-1">
                    <h3 class="font-medium text-white">卡片标题</h3>
                    <p class="text-white/80">卡片副标题</p>
                  </div>
                  <button class="glass-icon-button">
                    <MoreVertical class="w-5 h-5" />
                  </button>
                </div>
                <div class="glass-list-item">
                  <div class="glass-avatar bg-white/20">AB</div>
                  <div class="flex-1">
                    <h3 class="font-medium text-white">另一个标题</h3>
                    <p class="text-white/80">另一个副标题</p>
                  </div>
                  <button class="glass-icon-button">
                    <MoreVertical class="w-5 h-5" />
                  </button>
                </div>
              </div>
            </div>
          </div>

          <!-- 表单元素 -->
          <div class="glass-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-white">表单元素</h2>
              <div class="space-y-4">
                <div class="glass-input-group">
                  <label class="text-white/80">文本输入</label>
                  <input type="text" placeholder="请输入内容" class="glass-input">
                </div>
                <div class="glass-input-group">
                  <label class="text-white/80">密码输入</label>
                  <input type="password" placeholder="请输入密码" class="glass-input">
                </div>
                <div class="glass-input-group">
                  <label class="text-white/80">下拉选择</label>
                  <select class="glass-input">
                    <option>选项 1</option>
                    <option>选项 2</option>
                    <option>选项 3</option>
                  </select>
                </div>
                <div class="flex items-center space-x-4">
                  <label class="glass-checkbox">
                    <input type="checkbox">
                    <span class="glass-checkmark"></span>
                    <span class="text-white/80">复选框</span>
                  </label>
                  <label class="glass-radio">
                    <input type="radio" name="radio">
                    <span class="glass-radiomark"></span>
                    <span class="text-white/80">单选框</span>
                  </label>
                </div>
                <div class="glass-switch">
                  <input type="checkbox" id="switch1">
                  <label for="switch1" class="text-white/80">开关</label>
                </div>
              </div>
            </div>
          </div>

          <!-- 按钮组 -->
          <div class="glass-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-white">按钮样式</h2>
              <div class="flex flex-wrap gap-4">
                <button class="glass-button">主要按钮</button>
                <button class="glass-button outlined">次要按钮</button>
                <button class="glass-button text">文本按钮</button>
                <button class="glass-button icon">
                  <Plus class="w-5 h-5" />
                </button>
              </div>
            </div>
          </div>

          <!-- 进度指示器 -->
          <div class="glass-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-white">进度指示器</h2>
              <div class="space-y-4">
                <div class="glass-progress">
                  <div class="glass-progress-bar" style="width: 60%"></div>
                </div>
                <div class="glass-progress circular">
                  <div class="glass-progress-circle"></div>
                </div>
              </div>
            </div>
          </div>

          <!-- 对话框 -->
          <div class="glass-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-white">对话框示例</h2>
              <button class="glass-button" @click="showDialog = true">打开对话框</button>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 底部导航栏 -->
    <div class="glass-bottom-nav">
      <a href="#" class="glass-bottom-nav-item active">
        <Home class="w-6 h-6" />
        <span>首页</span>
      </a>
      <a href="#" class="glass-bottom-nav-item">
        <Search class="w-6 h-6" />
        <span>搜索</span>
      </a>
      <a href="#" class="glass-bottom-nav-item">
        <Plus class="w-6 h-6" />
        <span>添加</span>
      </a>
      <a href="#" class="glass-bottom-nav-item">
        <Bell class="w-6 h-6" />
        <span>通知</span>
      </a>
      <a href="#" class="glass-bottom-nav-item">
        <User class="w-6 h-6" />
        <span>我的</span>
      </a>
    </div>

    <!-- 对话框 -->
    <div v-if="showDialog" class="glass-dialog-overlay">
      <div class="glass-dialog">
        <div class="glass-dialog-header">
          <h3 class="text-white">对话框标题</h3>
          <button class="glass-icon-button" @click="showDialog = false">
            <X class="w-5 h-5" />
          </button>
        </div>
        <div class="glass-dialog-content">
          <p class="text-white/80">这是一个 Glassmorphism 风格的对话框示例。</p>
        </div>
        <div class="glass-dialog-actions">
          <button class="glass-button text" @click="showDialog = false">取消</button>
          <button class="glass-button" @click="showDialog = false">确定</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { 
  Menu, Search, Bell, User, Home, 
  Inbox, Star, Settings, MoreVertical,
  Plus, X
} from 'lucide-vue-next'

const showDialog = ref(false)
</script>

<style scoped>
.glass-container {
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}

.glass-bg-decorations {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.glass-bg-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
}

.glass-bg-circle.circle-1 {
  width: 300px;
  height: 300px;
  background: #ff6b6b;
  top: -100px;
  left: -100px;
}

.glass-bg-circle.circle-2 {
  width: 400px;
  height: 400px;
  background: #4ecdc4;
  bottom: -200px;
  right: -100px;
}

.glass-bg-circle.circle-3 {
  width: 200px;
  height: 200px;
  background: #ffd166;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.glass-app-bar {
  @apply sticky top-0 z-10;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-icon-button {
  @apply p-2 rounded-full text-white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.glass-icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.glass-card {
  @apply rounded-xl p-4;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-nav-item {
  @apply flex items-center space-x-3 p-2 rounded-lg text-white/80;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.glass-nav-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.glass-nav-item.active {
  @apply text-white;
  background: rgba(255, 255, 255, 0.2);
}

.glass-badge {
  @apply bg-white/20 text-white text-xs px-2 py-1 rounded-full;
  backdrop-filter: blur(10px);
}

.glass-list-item {
  @apply flex items-center space-x-4 p-2 rounded-lg;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.glass-list-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

.glass-avatar {
  @apply w-10 h-10 rounded-full flex items-center justify-center text-white font-medium;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

.glass-input-group {
  @apply space-y-1;
}

.glass-input {
  @apply w-full px-3 py-2 rounded-lg text-white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-input::placeholder {
  @apply text-white/50;
}

.glass-checkbox,
.glass-radio {
  @apply flex items-center space-x-2 cursor-pointer;
}

.glass-checkmark,
.glass-radiomark {
  @apply w-5 h-5 rounded;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-checkmark {
  @apply rounded;
}

.glass-radiomark {
  @apply rounded-full;
}

.glass-checkbox input:checked + .glass-checkmark,
.glass-radio input:checked + .glass-radiomark {
  background: rgba(255, 255, 255, 0.2);
}

.glass-switch {
  @apply flex items-center space-x-2;
}

.glass-switch input {
  @apply hidden;
}

.glass-switch label {
  @apply relative inline-block w-12 h-6 rounded-full cursor-pointer;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.glass-switch label:after {
  content: '';
  @apply absolute w-5 h-5 bg-white rounded-full top-0.5 left-0.5;
  transition: all 0.2s ease;
}

.glass-switch input:checked + label {
  background: rgba(255, 255, 255, 0.2);
}

.glass-switch input:checked + label:after {
  @apply translate-x-6;
}

.glass-button {
  @apply px-4 py-2 rounded-lg text-white;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.glass-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.glass-button.outlined {
  @apply bg-transparent border border-white/20;
}

.glass-button.text {
  @apply bg-transparent border-none;
}

.glass-button.icon {
  @apply p-2 rounded-full;
}

.glass-progress {
  @apply h-2 rounded-full overflow-hidden;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.glass-progress-bar {
  @apply h-full bg-white/20 rounded-full;
}

.glass-progress.circular {
  @apply w-12 h-12 rounded-full;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.glass-progress-circle {
  @apply w-full h-full rounded-full border-4 border-white/20;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.glass-bottom-nav {
  @apply fixed bottom-0 left-0 right-0 flex justify-around items-center py-2;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-bottom-nav-item {
  @apply flex flex-col items-center space-y-1 text-white/80;
}

.glass-bottom-nav-item.active {
  @apply text-white;
}

.glass-dialog-overlay {
  @apply fixed inset-0 bg-black/50 flex items-center justify-center;
  backdrop-filter: blur(10px);
}

.glass-dialog {
  @apply rounded-xl p-4 w-full max-w-md;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-dialog-header {
  @apply flex justify-between items-center p-4 border-b border-white/10;
}

.glass-dialog-content {
  @apply p-4;
}

.glass-dialog-actions {
  @apply flex justify-end space-x-2 p-4 border-t border-white/10;
}
</style> 