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

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

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

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

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

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

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

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

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>
.brutal-container {
  font-family: 'Bebas Neue', sans-serif;
  background: linear-gradient(45deg, #fef9c3, #fef08a);
}

.brutal-header {
  @apply fixed top-0 left-0 right-0 h-16 bg-white z-10;
  box-shadow: 8px 8px 0 #000;
  border: 4px solid #000;
}

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

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

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

.brutal-logo-text {
  @apply ml-2 text-2xl font-bold text-black;
  letter-spacing: 2px;
}

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

.brutal-nav-item {
  @apply text-black hover:text-red-600 transition-colors duration-300;
  font-weight: 900;
  letter-spacing: 1px;
}

.brutal-nav-item.active {
  @apply text-red-600;
}

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

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

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

.brutal-card {
  @apply bg-white overflow-hidden;
  box-shadow: 8px 8px 0 #000;
  border: 4px solid #000;
  transition: all 0.3s ease;
}

.brutal-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 12px 12px 0 #000;
}

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

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

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

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

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

.brutal-avatar {
  @apply w-10 h-10 flex items-center justify-center text-white font-bold;
  box-shadow: 4px 4px 0 #000;
  border: 2px solid #000;
}

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

.brutal-card-meta-title {
  @apply text-xl font-bold text-black;
  letter-spacing: 1px;
}

.brutal-card-meta-description {
  @apply text-sm text-gray-600;
}

.brutal-card-content {
  @apply text-black mb-4;
}

.brutal-card-actions {
  @apply flex items-center border-t-2 border-black pt-4;
}

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

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

.brutal-form-item-label {
  @apply mb-2 text-black font-bold;
  letter-spacing: 1px;
}

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

.brutal-input,
.brutal-select {
  @apply w-full px-4 py-2 bg-white border-4 border-black focus:border-red-600 text-black;
  box-shadow: 4px 4px 0 #000;
  transition: all 0.3s ease;
}

.brutal-input:focus,
.brutal-select:focus {
  box-shadow: 6px 6px 0 #000;
}

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

.brutal-switch input {
  @apply hidden;
}

.brutal-switch-inner {
  @apply absolute inset-0 bg-white transition-colors duration-300;
  box-shadow: 4px 4px 0 #000;
  border: 2px solid #000;
}

.brutal-switch-inner:after {
  content: '';
  @apply absolute w-5 h-5 bg-black top-0.5 left-0.5 shadow transition-transform duration-300;
  box-shadow: 2px 2px 0 #000;
}

.brutal-switch input:checked + .brutal-switch-inner {
  @apply bg-red-600;
}

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

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

.brutal-btn {
  @apply px-4 py-2 text-sm font-bold transition-all duration-300;
  box-shadow: 4px 4px 0 #000;
  letter-spacing: 1px;
}

.brutal-btn.primary {
  @apply bg-black text-white hover:bg-red-600;
  border: 2px solid #000;
}

.brutal-btn.secondary {
  @apply bg-red-600 text-white hover:bg-red-700;
  border: 2px solid #000;
}

.brutal-btn.outline {
  @apply bg-transparent text-black border-4 border-black hover:border-red-600;
}

.brutal-btn.text {
  @apply bg-transparent text-black hover:text-red-600;
}

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

.brutal-tabs-nav {
  @apply flex border-b-4 border-black;
}

.brutal-tabs-tab {
  @apply px-4 py-3 text-black cursor-pointer hover:text-red-600 transition-colors duration-300;
  font-weight: 900;
  letter-spacing: 1px;
}

.brutal-tabs-tab.active {
  @apply text-red-600 border-b-4 border-red-600;
}

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

.brutal-tabs-tabpane {
  @apply bg-white p-4;
  box-shadow: 8px 8px 0 #000;
  border: 4px solid #000;
}

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

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

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

.brutal-modal-content {
  @apply bg-white;
  box-shadow: 12px 12px 0 #000;
  border: 4px solid #000;
}

.brutal-modal-header {
  @apply flex justify-between items-center p-4 border-b-4 border-black;
}

.brutal-modal-title {
  @apply text-xl font-bold text-black;
  letter-spacing: 1px;
}

.brutal-modal-close {
  @apply text-black hover:text-red-600;
}

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

.brutal-modal-footer {
  @apply flex justify-end space-x-2 p-4 border-t-4 border-black;
}

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

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

.brutal-message-notice-content {
  @apply flex items-center px-4 py-3 bg-white;
  box-shadow: 8px 8px 0 #000;
  border: 4px solid #000;
}

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

.brutal-notification-notice {
  @apply mb-4 bg-white overflow-hidden;
  box-shadow: 8px 8px 0 #000;
  border: 4px solid #000;
}

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

.brutal-notification-notice-icon {
  @apply float-left mr-4 text-black;
}

.brutal-notification-notice-message {
  @apply text-xl font-bold text-black;
  letter-spacing: 1px;
}

.brutal-notification-notice-description {
  @apply mt-1 text-sm text-gray-600;
}

.brutal-notification-notice-close {
  @apply absolute top-4 right-4 text-black hover:text-red-600;
}
</style> 