<template>
  <div class="pixel-container min-h-screen bg-indigo-900">
    <!-- 顶部导航栏 -->
    <div class="pixel-header">
      <div class="pixel-header-content">
        <div class="pixel-logo">
          <img :src="logoUrl" alt="Pixel Art Logo" class="pixel-logo-img">
          <span class="pixel-logo-text">PIXEL ART</span>
        </div>
        <div class="pixel-nav">
          <a href="#" class="pixel-nav-item active">首页</a>
          <a href="#" class="pixel-nav-item">组件</a>
          <a href="#" class="pixel-nav-item">文档</a>
          <a href="#" class="pixel-nav-item">主题</a>
        </div>
        <div class="pixel-header-actions">
          <button class="pixel-btn text">
            <Search class="w-5 h-5" />
          </button>
          <button class="pixel-btn text">
            <Bell class="w-5 h-5" />
          </button>
          <button class="pixel-btn text">
            <User class="w-5 h-5" />
          </button>
        </div>
      </div>
    </div>

    <!-- 主要内容区 -->
    <div class="pixel-main">
      <!-- 卡片列表 -->
      <div class="pixel-card-list">
        <div v-for="card in cards" :key="card.id" class="pixel-card">
          <div class="pixel-card-cover">
            <img :src="card.cover" :alt="card.title" class="pixel-card-cover-img">
          </div>
          <div class="pixel-card-body">
            <div class="pixel-card-meta">
              <div class="pixel-card-meta-avatar">
                <div class="pixel-avatar" :class="card.avatarClass">
                  {{ card.initials }}
                </div>
              </div>
              <div class="pixel-card-meta-content">
                <h3 class="pixel-card-meta-title">{{ card.title }}</h3>
                <p class="pixel-card-meta-description">{{ card.description }}</p>
              </div>
            </div>
            <p class="pixel-card-content">{{ card.content }}</p>
            <div class="pixel-card-actions">
              <button class="pixel-btn text">
                <Heart class="w-5 h-5" />
                <span>{{ card.likes }}</span>
              </button>
              <button class="pixel-btn text">
                <MessageSquare class="w-5 h-5" />
                <span>{{ card.comments }}</span>
              </button>
              <button class="pixel-btn text">
                <Share2 class="w-5 h-5" />
              </button>
            </div>
          </div>
        </div>
      </div>

      <!-- 表单元素 -->
      <div class="pixel-form">
        <div class="pixel-form-item">
          <label class="pixel-form-item-label">文本输入</label>
          <div class="pixel-form-item-control">
            <input type="text" placeholder="请输入内容" class="pixel-input">
          </div>
        </div>
        <div class="pixel-form-item">
          <label class="pixel-form-item-label">密码输入</label>
          <div class="pixel-form-item-control">
            <input type="password" placeholder="请输入密码" class="pixel-input">
          </div>
        </div>
        <div class="pixel-form-item">
          <label class="pixel-form-item-label">下拉选择</label>
          <div class="pixel-form-item-control">
            <select class="pixel-select">
              <option>选项 1</option>
              <option>选项 2</option>
              <option>选项 3</option>
            </select>
          </div>
        </div>
        <div class="pixel-form-item">
          <label class="pixel-form-item-label">开关</label>
          <div class="pixel-form-item-control">
            <label class="pixel-switch">
              <input type="checkbox">
              <span class="pixel-switch-inner"></span>
            </label>
          </div>
        </div>
      </div>

      <!-- 按钮组 -->
      <div class="pixel-btn-group">
        <button class="pixel-btn primary">主要按钮</button>
        <button class="pixel-btn secondary">次要按钮</button>
        <button class="pixel-btn outline">轮廓按钮</button>
        <button class="pixel-btn text">文本按钮</button>
      </div>

      <!-- 标签页 -->
      <div class="pixel-tabs">
        <div class="pixel-tabs-nav">
          <div 
            v-for="tab in tabs" 
            :key="tab.id"
            class="pixel-tabs-tab"
            :class="{ active: activeTab === tab.id }"
            @click="activeTab = tab.id"
          >
            {{ tab.label }}
          </div>
        </div>
        <div class="pixel-tabs-content">
          <div v-if="activeTab === 'tab1'" class="pixel-tabs-tabpane">
            <p>标签页 1 的内容</p>
          </div>
          <div v-if="activeTab === 'tab2'" class="pixel-tabs-tabpane">
            <p>标签页 2 的内容</p>
          </div>
          <div v-if="activeTab === 'tab3'" class="pixel-tabs-tabpane">
            <p>标签页 3 的内容</p>
          </div>
        </div>
      </div>

      <!-- 对话框 -->
      <div v-if="showDialog" class="pixel-modal-mask">
        <div class="pixel-modal-wrap">
          <div class="pixel-modal">
            <div class="pixel-modal-content">
              <div class="pixel-modal-header">
                <div class="pixel-modal-title">对话框标题</div>
                <button class="pixel-modal-close" @click="showDialog = false">
                  <X class="w-5 h-5" />
                </button>
              </div>
              <div class="pixel-modal-body">
                <p>这是一个像素艺术风格的对话框示例。</p>
              </div>
              <div class="pixel-modal-footer">
                <button class="pixel-btn" @click="showDialog = false">取消</button>
                <button class="pixel-btn primary" @click="showDialog = false">确定</button>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 消息提示 -->
      <div v-if="showMessage" class="pixel-message">
        <div class="pixel-message-notice">
          <div class="pixel-message-notice-content">
            <Info class="w-5 h-5" />
            <span>这是一条消息提示</span>
          </div>
        </div>
      </div>

      <!-- 通知面板 -->
      <div v-if="showNotifications" class="pixel-notification">
        <div class="pixel-notification-notice">
          <div class="pixel-notification-notice-content">
            <div class="pixel-notification-notice-icon">
              <Bell class="w-5 h-5" />
            </div>
            <div class="pixel-notification-notice-message">通知标题</div>
            <div class="pixel-notification-notice-description">通知内容</div>
          </div>
          <button class="pixel-notification-notice-close" @click="showNotifications = false">
            <X class="w-5 h-5" />
          </button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { 
  Search, Bell, User, MoreVertical,
  Heart, MessageSquare, Share2, X,
  Info
} from 'lucide-vue-next'

const logoUrl = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9IiNGRkZGRkYiLz48cmVjdCB4PSI0IiB5PSI0IiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIGZpbGw9IiMwMDAwMDAiLz48L3N2Zz4='

const showDialog = ref(false)
const showMessage = ref(false)
const showNotifications = ref(false)
const activeTab = ref('tab1')

const cards = ref([
  {
    id: 1,
    title: '卡片标题',
    description: '副标题',
    content: '这是卡片的内容，可以包含多行文本。',
    cover: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIwIiBoZWlnaHQ9IjI0MCIgdmlld0JveD0iMCAwIDMyMCAyNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjMyMCIgaGVpZ2h0PSIyNDAiIGZpbGw9IiNGRkZGRkYiLz48cmVjdCB4PSI0MCIgeT0iNDAiIHdpZHRoPSIyNDAiIGhlaWdodD0iMTYwIiBmaWxsPSIjMDAwMDAwIi8+PC9zdmc+',
    likes: 42,
    comments: 8,
    initials: 'JD',
    avatarClass: 'bg-black'
  },
  {
    id: 2,
    title: '另一个标题',
    description: '另一个副标题',
    content: '这是另一个卡片的内容。',
    cover: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIwIiBoZWlnaHQ9IjI0MCIgdmlld0JveD0iMCAwIDMyMCAyNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjMyMCIgaGVpZ2h0PSIyNDAiIGZpbGw9IiNGRkZGRkYiLz48cmVjdCB4PSI0MCIgeT0iNDAiIHdpZHRoPSIyNDAiIGhlaWdodD0iMTYwIiBmaWxsPSIjMDAwMDAwIi8+PC9zdmc+',
    likes: 36,
    comments: 5,
    initials: 'AB',
    avatarClass: 'bg-black'
  }
])

const tabs = ref([
  { id: 'tab1', label: '标签页 1' },
  { id: 'tab2', label: '标签页 2' },
  { id: 'tab3', label: '标签页 3' }
])
</script>

<style scoped>
.pixel-container {
  font-family: 'Press Start 2P', cursive;
  background: linear-gradient(45deg, #1e1b4b, #312e81);
  image-rendering: pixelated;
}

.pixel-header {
  @apply fixed top-0 left-0 right-0 h-16 bg-indigo-800/90 backdrop-blur-sm z-10;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  border-bottom: 4px solid #4f46e5;
}

.pixel-header-content {
  @apply container mx-auto px-4 h-full flex items-center justify-between;
}

.pixel-logo {
  @apply flex items-center;
}

.pixel-logo-img {
  @apply h-8 w-8;
  image-rendering: pixelated;
}

.pixel-logo-text {
  @apply ml-2 text-xl font-medium text-indigo-200;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-nav {
  @apply flex items-center space-x-6;
}

.pixel-nav-item {
  @apply text-indigo-200 hover:text-indigo-100 transition-colors duration-300;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-nav-item.active {
  @apply text-indigo-100 font-medium;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-header-actions {
  @apply flex items-center space-x-2;
}

.pixel-main {
  @apply pt-20 pb-8 px-4;
}

.pixel-card-list {
  @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4;
}

.pixel-card {
  @apply bg-indigo-800 overflow-hidden;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  border: 4px solid #4f46e5;
  transition: all 0.3s ease;
}

.pixel-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

.pixel-card-cover {
  @apply relative h-48 overflow-hidden;
}

.pixel-card-cover-img {
  @apply w-full h-full object-cover;
  image-rendering: pixelated;
}

.pixel-card-body {
  @apply p-4;
}

.pixel-card-meta {
  @apply flex items-start mb-4;
}

.pixel-card-meta-avatar {
  @apply mr-4;
}

.pixel-avatar {
  @apply w-10 h-10 flex items-center justify-center text-white font-medium;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid #4f46e5;
}

.pixel-card-meta-content {
  @apply flex-1;
}

.pixel-card-meta-title {
  @apply text-base font-medium text-indigo-200;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-card-meta-description {
  @apply text-sm text-indigo-300;
}

.pixel-card-content {
  @apply text-indigo-100 mb-4;
}

.pixel-card-actions {
  @apply flex items-center border-t-2 border-indigo-700 pt-4;
}

.pixel-form {
  @apply space-y-4 mt-6;
}

.pixel-form-item {
  @apply flex flex-col;
}

.pixel-form-item-label {
  @apply mb-2 text-indigo-200;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-form-item-control {
  @apply flex-1;
}

.pixel-input,
.pixel-select {
  @apply w-full px-4 py-2 bg-indigo-800 border-2 border-indigo-700 focus:border-indigo-500 text-indigo-100;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.pixel-input:focus,
.pixel-select:focus {
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

.pixel-switch {
  @apply relative inline-block w-12 h-6;
}

.pixel-switch input {
  @apply hidden;
}

.pixel-switch-inner {
  @apply absolute inset-0 bg-indigo-700 transition-colors duration-300;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid #4f46e5;
}

.pixel-switch-inner:after {
  content: '';
  @apply absolute w-5 h-5 bg-indigo-200 top-0.5 left-0.5 shadow transition-transform duration-300;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.pixel-switch input:checked + .pixel-switch-inner {
  @apply bg-indigo-500;
}

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

.pixel-btn-group {
  @apply flex flex-wrap gap-2 mt-6;
}

.pixel-btn {
  @apply px-4 py-2 text-sm font-medium transition-all duration-300;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.pixel-btn.primary {
  @apply bg-indigo-500 text-white hover:bg-indigo-600;
  border: 2px solid #4f46e5;
}

.pixel-btn.secondary {
  @apply bg-purple-500 text-white hover:bg-purple-600;
  border: 2px solid #7c3aed;
}

.pixel-btn.outline {
  @apply bg-transparent text-indigo-200 border-2 border-indigo-700 hover:border-indigo-500;
}

.pixel-btn.text {
  @apply bg-transparent text-indigo-200 hover:text-indigo-100;
}

.pixel-tabs {
  @apply mt-6;
}

.pixel-tabs-nav {
  @apply flex border-b-2 border-indigo-700;
}

.pixel-tabs-tab {
  @apply px-4 py-3 text-indigo-200 cursor-pointer hover:text-indigo-100 transition-colors duration-300;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-tabs-tab.active {
  @apply text-indigo-100 font-medium border-b-2 border-indigo-500;
}

.pixel-tabs-content {
  @apply p-4;
}

.pixel-tabs-tabpane {
  @apply bg-indigo-800 p-4;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid #4f46e5;
}

.pixel-modal-mask {
  @apply fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50;
}

.pixel-modal-wrap {
  @apply fixed inset-0 overflow-auto;
}

.pixel-modal {
  @apply relative top-20 mx-auto w-full max-w-md;
}

.pixel-modal-content {
  @apply bg-indigo-800;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.2);
  border: 4px solid #4f46e5;
}

.pixel-modal-header {
  @apply flex justify-between items-center p-4 border-b-2 border-indigo-700;
}

.pixel-modal-title {
  @apply text-lg font-medium text-indigo-200;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-modal-close {
  @apply text-indigo-200 hover:text-indigo-100;
}

.pixel-modal-body {
  @apply p-4;
}

.pixel-modal-footer {
  @apply flex justify-end space-x-2 p-4 border-t-2 border-indigo-700;
}

.pixel-message {
  @apply fixed top-4 right-4 z-50;
}

.pixel-message-notice {
  @apply mb-4;
}

.pixel-message-notice-content {
  @apply flex items-center px-4 py-3 bg-indigo-800;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid #4f46e5;
}

.pixel-notification {
  @apply fixed top-4 right-4 z-50;
}

.pixel-notification-notice {
  @apply mb-4 bg-indigo-800 overflow-hidden;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
  border: 2px solid #4f46e5;
}

.pixel-notification-notice-content {
  @apply p-4;
}

.pixel-notification-notice-icon {
  @apply float-left mr-4 text-indigo-200;
}

.pixel-notification-notice-message {
  @apply text-base font-medium text-indigo-200;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.pixel-notification-notice-description {
  @apply mt-1 text-sm text-indigo-300;
}

.pixel-notification-notice-close {
  @apply absolute top-4 right-4 text-indigo-200 hover:text-indigo-100;
}
</style> 