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

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

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

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

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

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

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

      <!-- 通知面板 -->
      <div v-if="showNotifications" class="organic-notification">
        <div class="organic-notification-notice">
          <div class="organic-notification-notice-content">
            <div class="organic-notification-notice-icon">
              <Bell class="w-5 h-5" />
            </div>
            <div class="organic-notification-notice-message">通知标题</div>
            <div class="organic-notification-notice-description">通知内容</div>
          </div>
          <button class="organic-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,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9IiM0MEYyQTUiLz48L3N2Zz4='

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

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

<style scoped>
.organic-container {
  font-family: 'Quicksand', sans-serif;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.organic-header {
  @apply fixed top-0 left-0 right-0 h-16 bg-white/80 backdrop-blur-md z-10;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
  border-bottom: 1px solid rgba(16, 185, 129, 0.1);
}

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

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

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

.organic-logo-text {
  @apply ml-2 text-xl font-medium text-emerald-600;
}

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

.organic-nav-item {
  @apply text-emerald-600 hover:text-emerald-500 transition-colors duration-300;
}

.organic-nav-item.active {
  @apply text-emerald-500 font-medium;
}

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

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

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

.organic-card {
  @apply bg-white rounded-2xl overflow-hidden;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.1);
  transition: all 0.3s ease;
}

.organic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
}

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

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

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

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

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

.organic-avatar {
  @apply w-10 h-10 rounded-full flex items-center justify-center text-white font-medium;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

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

.organic-card-meta-title {
  @apply text-base font-medium text-emerald-600;
}

.organic-card-meta-description {
  @apply text-sm text-emerald-500;
}

.organic-card-content {
  @apply text-emerald-700 mb-4;
}

.organic-card-actions {
  @apply flex items-center border-t border-emerald-100 pt-4;
}

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

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

.organic-form-item-label {
  @apply mb-2 text-emerald-600;
}

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

.organic-input,
.organic-select {
  @apply w-full px-4 py-2 bg-white rounded-xl border border-emerald-200 focus:border-emerald-400 focus:ring-1 focus:ring-emerald-400 text-emerald-700;
  transition: all 0.3s ease;
}

.organic-input:focus,
.organic-select:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.organic-switch input {
  @apply hidden;
}

.organic-switch-inner {
  @apply absolute inset-0 rounded-full bg-emerald-100 transition-colors duration-300;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.organic-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;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.organic-switch input:checked + .organic-switch-inner {
  @apply bg-emerald-400;
}

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

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

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

.organic-btn.primary {
  @apply bg-emerald-500 text-white hover:bg-emerald-600;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.organic-btn.secondary {
  @apply bg-teal-500 text-white hover:bg-teal-600;
  box-shadow: 0 4px 10px rgba(20, 184, 166, 0.2);
}

.organic-btn.outline {
  @apply bg-transparent text-emerald-600 border border-emerald-200 hover:border-emerald-400;
}

.organic-btn.text {
  @apply bg-transparent text-emerald-600 hover:text-emerald-500;
}

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

.organic-tabs-nav {
  @apply flex border-b border-emerald-100;
}

.organic-tabs-tab {
  @apply px-4 py-3 text-emerald-600 cursor-pointer hover:text-emerald-500 transition-colors duration-300;
}

.organic-tabs-tab.active {
  @apply text-emerald-500 font-medium border-b-2 border-emerald-400;
}

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

.organic-tabs-tabpane {
  @apply bg-white rounded-2xl p-4;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

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

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

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

.organic-modal-content {
  @apply bg-white rounded-2xl shadow-lg;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

.organic-modal-header {
  @apply flex justify-between items-center p-4 border-b border-emerald-100;
}

.organic-modal-title {
  @apply text-lg font-medium text-emerald-600;
}

.organic-modal-close {
  @apply text-emerald-600 hover:text-emerald-500;
}

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

.organic-modal-footer {
  @apply flex justify-end space-x-2 p-4 border-t border-emerald-100;
}

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

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

.organic-message-notice-content {
  @apply flex items-center px-4 py-3 bg-white rounded-2xl shadow-lg;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

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

.organic-notification-notice {
  @apply mb-4 bg-white rounded-2xl shadow-lg overflow-hidden;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

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

.organic-notification-notice-icon {
  @apply float-left mr-4 text-emerald-600;
}

.organic-notification-notice-message {
  @apply text-base font-medium text-emerald-600;
}

.organic-notification-notice-description {
  @apply mt-1 text-sm text-emerald-500;
}

.organic-notification-notice-close {
  @apply absolute top-4 right-4 text-emerald-600 hover:text-emerald-500;
}
</style> 