<template>
  <div class="retro-container min-h-screen bg-gradient-to-br from-orange-100 via-yellow-100 to-amber-100">
    <!-- 顶部应用栏 -->
    <div class="retro-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-amber-900 mr-4" />
          <h1 class="text-xl font-medium text-amber-900">Retro Design</h1>
        </div>
        <div class="flex items-center space-x-4">
          <button class="retro-icon-button">
            <Search class="w-5 h-5" />
          </button>
          <button class="retro-icon-button">
            <Bell class="w-5 h-5" />
          </button>
          <button class="retro-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="retro-card">
          <div class="p-4">
            <h2 class="text-lg font-medium mb-4 text-amber-900">导航菜单</h2>
            <nav class="space-y-2">
              <a href="#" class="retro-nav-item active">
                <Home class="w-5 h-5" />
                <span>首页</span>
              </a>
              <a href="#" class="retro-nav-item">
                <Inbox class="w-5 h-5" />
                <span>收件箱</span>
                <span class="retro-badge">12</span>
              </a>
              <a href="#" class="retro-nav-item">
                <Star class="w-5 h-5" />
                <span>收藏</span>
              </a>
              <a href="#" class="retro-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="retro-card">
            <div class="p-4">
              <h2 class="text-lg font-medium mb-4 text-amber-900">卡片列表</h2>
              <div class="space-y-4">
                <div class="retro-list-item">
                  <div class="retro-avatar bg-gradient-to-br from-orange-400 to-yellow-400">JD</div>
                  <div class="flex-1">
                    <h3 class="font-medium text-amber-900">卡片标题</h3>
                    <p class="text-amber-800">卡片副标题</p>
                  </div>
                  <button class="retro-icon-button">
                    <MoreVertical class="w-5 h-5" />
                  </button>
                </div>
                <div class="retro-list-item">
                  <div class="retro-avatar bg-gradient-to-br from-yellow-400 to-amber-400">AB</div>
                  <div class="flex-1">
                    <h3 class="font-medium text-amber-900">另一个标题</h3>
                    <p class="text-amber-800">另一个副标题</p>
                  </div>
                  <button class="retro-icon-button">
                    <MoreVertical class="w-5 h-5" />
                  </button>
                </div>
              </div>
            </div>
          </div>

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

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

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

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

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

    <!-- 对话框 -->
    <div v-if="showDialog" class="retro-dialog-overlay">
      <div class="retro-dialog">
        <div class="retro-dialog-header">
          <h3 class="text-amber-900">对话框标题</h3>
          <button class="retro-icon-button" @click="showDialog = false">
            <X class="w-5 h-5" />
          </button>
        </div>
        <div class="retro-dialog-content">
          <p class="text-amber-800">这是一个复古风格的对话框示例。</p>
        </div>
        <div class="retro-dialog-actions">
          <button class="retro-button text" @click="showDialog = false">取消</button>
          <button class="retro-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>
.retro-container {
  font-family: 'Press Start 2P', cursive;
  position: relative;
  overflow: hidden;
}

.retro-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d97706' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
  z-index: 0;
}

.retro-app-bar {
  @apply sticky top-0 z-10 bg-orange-100/50 backdrop-blur-sm;
  border-bottom: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-icon-button {
  @apply p-2 rounded-full text-amber-900;
  transition: all 0.3s ease;
  background: rgba(180, 83, 9, 0.1);
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-icon-button:hover {
  @apply bg-amber-200 text-amber-900;
  transform: scale(1.1);
}

.retro-card {
  @apply rounded-lg p-4 bg-orange-100/50 backdrop-blur-sm;
  border: 2px solid rgba(180, 83, 9, 0.2);
  transition: all 0.3s ease;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

.retro-card:hover {
  @apply bg-orange-100/70;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.1);
}

.retro-nav-item {
  @apply flex items-center space-x-3 p-2 rounded-lg text-amber-900;
  transition: all 0.3s ease;
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-nav-item:hover {
  @apply bg-amber-200 text-amber-900;
}

.retro-nav-item.active {
  @apply bg-amber-200 text-amber-900;
  background: linear-gradient(45deg, rgba(180, 83, 9, 0.1), rgba(146, 64, 14, 0.1));
}

.retro-badge {
  @apply bg-amber-500 text-white text-xs px-2 py-1 rounded-full;
}

.retro-list-item {
  @apply flex items-center space-x-4 p-2 rounded-lg;
  transition: all 0.3s ease;
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-list-item:hover {
  @apply bg-amber-200;
}

.retro-avatar {
  @apply w-10 h-10 rounded-full flex items-center justify-center text-white font-medium;
}

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

.retro-input {
  @apply w-full px-3 py-2 rounded-lg text-amber-900;
  background: rgba(180, 83, 9, 0.1);
  border: 2px solid rgba(180, 83, 9, 0.2);
  transition: all 0.3s ease;
}

.retro-input:focus {
  @apply outline-none;
  background: rgba(180, 83, 9, 0.2);
  border-color: rgba(180, 83, 9, 0.4);
}

.retro-input::placeholder {
  @apply text-amber-400;
}

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

.retro-checkmark,
.retro-radiomark {
  @apply w-5 h-5 rounded;
  background: rgba(180, 83, 9, 0.1);
  border: 2px solid rgba(180, 83, 9, 0.2);
  transition: all 0.3s ease;
}

.retro-checkmark {
  @apply rounded;
}

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

.retro-checkbox input:checked + .retro-checkmark,
.retro-radio input:checked + .retro-radiomark {
  @apply bg-amber-500 border-amber-500;
}

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

.retro-switch input {
  @apply hidden;
}

.retro-switch label {
  @apply relative inline-block w-12 h-6 rounded-full cursor-pointer;
  background: rgba(180, 83, 9, 0.1);
  transition: all 0.3s ease;
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-switch label:after {
  content: '';
  @apply absolute w-5 h-5 bg-amber-100 rounded-full top-0.5 left-0.5;
  transition: all 0.3s ease;
}

.retro-switch input:checked + label {
  @apply bg-amber-500;
}

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

.retro-button {
  @apply px-4 py-2 rounded-lg text-amber-900;
  background: linear-gradient(45deg, rgba(180, 83, 9, 0.1), rgba(146, 64, 14, 0.1));
  border: 2px solid rgba(180, 83, 9, 0.2);
  transition: all 0.3s ease;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.retro-button:hover {
  @apply bg-amber-200;
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

.retro-button.outlined {
  @apply bg-transparent border border-amber-300;
}

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

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

.retro-progress {
  @apply h-1 rounded-full overflow-hidden;
  background: rgba(180, 83, 9, 0.1);
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-progress-bar {
  @apply h-full rounded-full;
  background: linear-gradient(45deg, rgba(180, 83, 9, 0.5), rgba(146, 64, 14, 0.5));
}

.retro-progress.circular {
  @apply w-12 h-12 rounded-full;
  background: rgba(180, 83, 9, 0.1);
  border: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-progress-circle {
  @apply w-full h-full rounded-full border-4;
  border-image: linear-gradient(45deg, rgba(180, 83, 9, 0.5), rgba(146, 64, 14, 0.5)) 1;
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
}

.retro-bottom-nav {
  @apply fixed bottom-0 left-0 right-0 bg-orange-100/50 backdrop-blur-sm flex justify-around items-center py-2;
  border-top: 2px solid rgba(180, 83, 9, 0.2);
}

.retro-bottom-nav-item {
  @apply flex flex-col items-center space-y-1 text-amber-900;
  transition: all 0.3s ease;
}

.retro-bottom-nav-item:hover {
  @apply text-amber-900;
}

.retro-bottom-nav-item.active {
  @apply text-amber-900;
  background: linear-gradient(45deg, rgba(180, 83, 9, 0.1), rgba(146, 64, 14, 0.1));
}

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

.retro-dialog {
  @apply rounded-lg p-4 bg-orange-100/80 backdrop-blur-sm w-full max-w-md;
  border: 2px solid rgba(180, 83, 9, 0.2);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

.retro-dialog-header {
  @apply flex justify-between items-center p-4 border-b border-amber-800;
}

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

.retro-dialog-actions {
  @apply flex justify-end space-x-2 p-4 border-t border-amber-800;
}
</style> 