<template>
  <div class="morphism-container min-h-screen bg-gradient-to-br from-purple-100 to-blue-100">
    <!-- 顶部导航栏 -->
    <div class="morphism-header">
      <div class="morphism-header-content">
        <div class="morphism-logo">
          <img :src="logoUrl" alt="Morphism Logo" class="morphism-logo-img">
          <span class="morphism-logo-text">Morphism</span>
        </div>
        <div class="morphism-nav">
          <a href="#" class="morphism-nav-item active">首页</a>
          <a href="#" class="morphism-nav-item">组件</a>
          <a href="#" class="morphism-nav-item">文档</a>
          <a href="#" class="morphism-nav-item">主题</a>
        </div>
        <div class="morphism-header-actions">
          <button class="morphism-btn text">
            <Search class="w-5 h-5" />
          </button>
          <button class="morphism-btn text">
            <Bell class="w-5 h-5" />
          </button>
          <button class="morphism-btn text">
            <User class="w-5 h-5" />
          </button>
        </div>
      </div>
    </div>

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

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

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

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

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

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

      <!-- 通知面板 -->
      <div v-if="showNotifications" class="morphism-notification">
        <div class="morphism-notification-notice">
          <div class="morphism-notification-notice-content">
            <div class="morphism-notification-notice-icon">
              <Bell class="w-5 h-5" />
            </div>
            <div class="morphism-notification-notice-message">通知标题</div>
            <div class="morphism-notification-notice-description">通知内容</div>
          </div>
          <button class="morphism-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 showDialog = ref(false)
const showMessage = ref(false)
const showNotifications = ref(false)
const activeTab = ref('tab1')

const logoUrl = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNiIgZmlsbD0idXJsKCNwYWludDApIi8+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJwYWludDAiIHgxPSIwIiB5MT0iMCIgeDI9IjMyIiB5Mj0iMzIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBzdG9wLWNvbG9yPSIjQjQ3RkZGIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY3RkJGIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PC9zdmc+'

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

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

<style scoped>
.morphism-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.morphism-header {
  @apply fixed top-0 left-0 right-0 h-16 backdrop-blur-md bg-white/30 z-10;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

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

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

.morphism-logo-img {
  @apply h-8 w-8;
}

.morphism-logo-text {
  @apply ml-2 text-xl font-medium text-gray-900;
}

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

.morphism-nav-item {
  @apply text-gray-600 hover:text-purple-500;
}

.morphism-nav-item.active {
  @apply text-purple-500;
}

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

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

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

.morphism-card {
  @apply backdrop-blur-md bg-white/30 rounded-xl overflow-hidden;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.morphism-card-cover-img {
  @apply w-full h-full object-cover;
}

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

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

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

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

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

.morphism-card-meta-title {
  @apply text-base font-medium text-gray-900;
}

.morphism-card-meta-description {
  @apply text-sm text-gray-500;
}

.morphism-card-content {
  @apply text-gray-600 mb-4;
}

.morphism-card-actions {
  @apply flex items-center border-t border-gray-100/50 pt-4;
}

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

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

.morphism-form-item-label {
  @apply mb-2 text-gray-600;
}

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

.morphism-input,
.morphism-select {
  @apply w-full px-4 py-2 backdrop-blur-md bg-white/30 rounded-xl border border-gray-200/50 focus:border-purple-500 focus:ring-1 focus:ring-purple-500;
}

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

.morphism-switch input {
  @apply hidden;
}

.morphism-switch-inner {
  @apply absolute inset-0 rounded-full backdrop-blur-md bg-white/30 transition-colors duration-300;
  box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.15);
}

.morphism-switch-inner:after {
  content: '';
  @apply absolute w-5 h-5 rounded-full bg-white top-0.5 left-0.5 shadow transition-transform duration-300;
}

.morphism-switch input:checked + .morphism-switch-inner {
  @apply bg-purple-500;
}

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

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

.morphism-btn {
  @apply px-4 py-2 rounded-xl text-sm font-medium transition-colors duration-300;
}

.morphism-btn.primary {
  @apply backdrop-blur-md bg-purple-500 text-white hover:bg-purple-600;
  box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.15);
}

.morphism-btn.secondary {
  @apply backdrop-blur-md bg-blue-500 text-white hover:bg-blue-600;
  box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.15);
}

.morphism-btn.outline {
  @apply backdrop-blur-md bg-white/30 text-gray-600 border border-gray-200/50 hover:border-purple-500 hover:text-purple-500;
}

.morphism-btn.text {
  @apply bg-transparent text-gray-600 hover:text-purple-500;
}

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

.morphism-tabs-nav {
  @apply flex border-b border-gray-200/50;
}

.morphism-tabs-tab {
  @apply px-4 py-3 text-gray-600 cursor-pointer hover:text-purple-500;
}

.morphism-tabs-tab.active {
  @apply text-purple-500 border-b-2 border-purple-500;
}

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

.morphism-tabs-tabpane {
  @apply backdrop-blur-md bg-white/30 rounded-xl p-4;
}

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

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

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

.morphism-modal-content {
  @apply backdrop-blur-md bg-white/30 rounded-xl shadow-lg;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.morphism-modal-header {
  @apply flex justify-between items-center p-4 border-b border-gray-200/50;
}

.morphism-modal-title {
  @apply text-lg font-medium text-gray-900;
}

.morphism-modal-close {
  @apply text-gray-400 hover:text-gray-500;
}

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

.morphism-modal-footer {
  @apply flex justify-end space-x-2 p-4 border-t border-gray-200/50;
}

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

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

.morphism-message-notice-content {
  @apply flex items-center px-4 py-3 backdrop-blur-md bg-white/30 rounded-xl shadow-lg;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.morphism-notification-notice {
  @apply mb-4 backdrop-blur-md bg-white/30 rounded-xl shadow-lg overflow-hidden;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

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

.morphism-notification-notice-icon {
  @apply float-left mr-4 text-purple-500;
}

.morphism-notification-notice-message {
  @apply text-base font-medium text-gray-900;
}

.morphism-notification-notice-description {
  @apply mt-1 text-sm text-gray-500;
}

.morphism-notification-notice-close {
  @apply absolute top-4 right-4 text-gray-400 hover:text-gray-500;
}
</style> 