/* ============================================
   精灵社区 - 清爽版
   ============================================ */

/* ---- 默认主题（紫色幻境） ---- */
:root, [data-theme="purple"] {
  --primary: #667eea; --primary-dark: #5a67d8; --primary-light: #a3bffa;
  --secondary: #764ba2; --accent: #f472b6;
  --gradient-primary: linear-gradient(135deg,#667eea,#764ba2,#a78bfa);
  --gradient-bg: linear-gradient(135deg,#f0eef6,#e8e4f0,#f5f0ff);
  --bg: #f0eef6; --bg-card: #ffffff; --bg-nav: rgba(255,255,255,0.92);
  --text: #1d1d1f; --text-secondary: #6e6e73; --text-muted: #a1a1a6;
  --border: #e5e5ea; --border-light: #f2f2f7;
}

/* ---- 主题：极光蓝 ---- */
[data-theme="blue"] {
  --primary: #4facfe; --primary-dark: #3b82f6; --primary-light: #93c5fd;
  --secondary: #2563eb; --accent: #06b6d4;
  --gradient-primary: linear-gradient(135deg,#4facfe,#2563eb,#06b6d4);
  --gradient-bg: linear-gradient(135deg,#eef2f8,#e0f2fe,#f0f9ff);
  --bg: #eef2f8; --bg-card: #ffffff; --bg-nav: rgba(255,255,255,0.92);
}

/* ---- 主题：翡翠森林 ---- */
[data-theme="green"] {
  --primary: #34d399; --primary-dark: #10b981; --primary-light: #6ee7b7;
  --secondary: #059669; --accent: #fbbf24;
  --gradient-primary: linear-gradient(135deg,#34d399,#059669,#10b981);
  --gradient-bg: linear-gradient(135deg,#ecfdf5,#d1fae5,#f0fdf4);
  --bg: #ecfdf5; --bg-card: #ffffff; --bg-nav: rgba(255,255,255,0.92);
}

/* ---- 主题：日落余晖 ---- */
[data-theme="orange"] {
  --primary: #fb923c; --primary-dark: #f97316; --primary-light: #fdba74;
  --secondary: #ea580c; --accent: #fbbf24;
  --gradient-primary: linear-gradient(135deg,#fb923c,#ea580c,#fbbf24);
  --gradient-bg: linear-gradient(135deg,#fff7ed,#ffedd5,#fef3c7);
  --bg: #fff7ed; --bg-card: #ffffff; --bg-nav: rgba(255,255,255,0.92);
}

/* ---- 主题：樱花物语 ---- */
[data-theme="pink"] {
  --primary: #f472b6; --primary-dark: #ec4899; --primary-light: #f9a8d4;
  --secondary: #db2777; --accent: #a78bfa;
  --gradient-primary: linear-gradient(135deg,#f472b6,#db2777,#a78bfa);
  --gradient-bg: linear-gradient(135deg,#fdf2f8,#fce7f3,#f5f3ff);
  --bg: #fdf2f8; --bg-card: #ffffff; --bg-nav: rgba(255,255,255,0.92);
}

/* ---- 主题：暗夜女王 ---- */
[data-theme="dark"] {
  --primary: #a78bfa; --primary-dark: #8b5cf6; --primary-light: #c4b5fd;
  --secondary: #7c3aed; --accent: #f472b6;
  --gradient-primary: linear-gradient(135deg,#a78bfa,#7c3aed,#f472b6);
  --gradient-bg: linear-gradient(135deg,#0a0a12,#1a0a2e,#0f0f1a);
  --bg: #0a0a12; --bg-card: #1c1c1e; --bg-nav: rgba(28,28,30,0.95);
  --text: #f5f5f7; --text-secondary: #98989d; --text-muted: #636366;
  --border: #38383a; --border-light: #2c2c2e;
  --shadow: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

/* ---- 基础 ---- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif; font-size:15px; line-height:1.5; color:var(--text); background:var(--bg); min-height:100vh; overflow-x:hidden; }
html { background:var(--bg); }
a { color:var(--primary); text-decoration:none; }
img { max-width:100%; display:block; }
.container { max-width:680px; margin:0 auto; padding:0 16px; }
.main { padding-top:calc(var(--header-height) + 8px); min-height:calc(100vh - var(--header-height)); }

/* ---- 头部 ---- */
.header { position:fixed; top:0; left:0; right:0; height:var(--header-height); background:var(--bg-nav); backdrop-filter:blur(20px); border-bottom:1px solid var(--border-light); z-index:1000; }
.header-inner { display:flex; align-items:center; height:100%; padding:0 16px; gap:8px; max-width:680px; margin:0 auto; }
.logo { font-size:17px; font-weight:700; color:var(--text); flex-shrink:0; }

/* ---- 按钮 ---- */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:4px; padding:8px 16px; font-size:13px; font-weight:600; border:none; border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); text-decoration:none; line-height:1.4; }
.btn-sm { padding:5px 10px; font-size:12px; }
.btn-lg { padding:12px 24px; font-size:15px; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); color:#fff; }
.btn-blue { background:var(--gradient-blue); color:#fff; }
.btn-green { background:var(--gradient-green); color:#fff; }
.btn-orange { background:var(--gradient-orange); color:#fff; }
.btn-pink { background:var(--gradient-pink); color:#fff; }
.btn-purple { background:var(--gradient-purple); color:#fff; }
.btn-outline { background:transparent; border:1px solid var(--border); color:var(--text-secondary); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-success { background:#48bb78; color:#fff; }
.btn-danger { background:#f56565; color:#fff; }

/* ---- 卡片 ---- */
.card { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); margin-bottom:12px; overflow:hidden; }
.card-header { padding:14px 16px; border-bottom:1px solid var(--border-light); display:flex; align-items:center; justify-content:space-between; }
.card-header h3 { font-size:14px; font-weight:600; }
.card-body { padding:16px; }

/* ---- 提示 ---- */
.alert { padding:10px 14px; border-radius:var(--radius-sm); margin-bottom:12px; font-size:13px; }
.alert-success { background:#f0fff4; color:#276749; border:1px solid #c6f6d5; }
.alert-error { background:#fff5f5; color:#9b2c2c; border:1px solid #fed7d7; }
.alert-info { background:#ebf8ff; color:#2b6cb0; border:1px solid #bee3f8; }

/* ---- 表单 ---- */
.form-group { margin-bottom:14px; }
.form-group label { display:block; margin-bottom:4px; font-weight:500; font-size:13px; color:var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { width:100%; padding:10px 12px; font-size:14px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg-card); color:var(--text); transition:var(--transition); font-family:inherit; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 2px rgba(102,126,234,0.1); }
.form-row { display:flex; gap:10px; flex-wrap:wrap; }
.input-group { display:flex; gap:6px; }
.input-group input { flex:1; }
.form-actions { display:flex; gap:8px; margin-top:16px; flex-wrap:wrap; }

/* ---- 首页横幅 ---- */
.home-hero { position:relative; border-radius:var(--radius); overflow:hidden; margin-bottom:16px; min-height:200px; display:flex; align-items:center; justify-content:center; }
.home-hero-bg { position:absolute; top:0; left:0; width:100%; height:100%; object-fit:cover; }
.home-hero-overlay { position:absolute; top:0; left:0; width:100%; height:100%; background:var(--gradient-primary); }
.home-hero-content { position:relative; z-index:1; text-align:center; padding:36px 20px; }
.home-hero-title { font-size:28px; font-weight:800; color:#fff; text-shadow:0 2px 10px rgba(0,0,0,0.15); margin-bottom:6px; }
.home-hero-sub { font-size:14px; color:rgba(255,255,255,0.85); margin-bottom:24px; }
.home-hero-actions { display:flex; gap:14px; justify-content:center; }
.hero-btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:14px 32px; font-size:16px; font-weight:600; border:none; border-radius:12px; cursor:pointer; transition:var(--transition); text-decoration:none; min-width:140px; }
.hero-btn-primary { background:#fff; color:var(--primary); box-shadow:0 4px 20px rgba(0,0,0,0.15); }
.hero-btn-primary:hover { transform:translateY(-2px); box-shadow:0 8px 30px rgba(0,0,0,0.2); color:var(--primary-dark); }
.hero-btn-outline { background:transparent; border:2px solid rgba(255,255,255,0.4); color:#fff; backdrop-filter:blur(4px); }
.hero-btn-outline:hover { border-color:#fff; background:rgba(255,255,255,0.1); transform:translateY(-2px); }

/* ---- 首页区块 ---- */
.home-section { margin-bottom:20px; }
.home-section .section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.home-section .section-header h2 { font-size:15px; font-weight:700; }

/* ---- 帖子列表 ---- */
.post-list { display:flex; flex-direction:column; gap:8px; }
.post-list-item { display:flex; gap:10px; background:var(--bg-card); border-radius:var(--radius-sm); padding:10px 12px; box-shadow:var(--shadow); transition:var(--transition); }
.post-list-item:hover { box-shadow:var(--shadow-md); }
.post-list-image { width:48px; height:48px; flex-shrink:0; border-radius:var(--radius-sm); overflow:hidden; background:var(--border-light); }
.post-list-image img { width:100%; height:100%; object-fit:cover; }
.post-list-body { flex:1; min-width:0; }
.post-list-meta { display:flex; gap:4px; margin-bottom:2px; flex-wrap:wrap; }
.post-category { font-size:10px; font-weight:600; color:var(--primary); background:rgba(102,126,234,0.1); padding:1px 6px; border-radius:6px; }
.post-list-body h3 { font-size:14px; font-weight:600; margin-bottom:2px; line-height:1.3; }
.post-excerpt { font-size:12px; color:var(--text-muted); margin-bottom:4px; display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.post-list-footer { display:flex; gap:8px; font-size:11px; color:var(--text-muted); }
.post-list-footer i { margin-right:2px; font-size:10px; }

/* ---- 帖子详情 ---- */
.post-detail { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.post-detail-title { padding:12px 16px; }
.post-detail-title h1 { font-size:18px; font-weight:700; margin-bottom:8px; }
.post-detail-meta { display:flex; gap:10px; font-size:12px; color:var(--text-muted); flex-wrap:wrap; }
.post-detail-body { padding:0 16px 16px; }
.post-detail-image { margin-bottom:12px; border-radius:var(--radius-sm); overflow:hidden; max-height:240px; }
.post-detail-image img { width:100%; object-fit:contain; }
.post-detail-content { font-size:14px; line-height:1.7; color:var(--text-secondary); white-space:pre-wrap; }
.post-tags { display:flex; gap:4px; flex-wrap:wrap; margin-top:12px; padding-top:12px; border-top:1px solid var(--border); }
.tag { font-size:11px; padding:3px 10px; background:var(--border-light); border-radius:10px; color:var(--text-secondary); }
.tag:hover { background:var(--primary); color:#fff; }
.post-download { text-align:center; margin-top:20px; padding:20px; border-radius:var(--radius-sm); }
.post-actions { display:flex; gap:8px; padding:12px 16px; border-top:1px solid var(--border); }
.post-actions .btn { flex:1; }
.fav-btn.active { background:#fff5f5; border-color:#f56565; color:#f56565; }

/* ---- 评论 ---- */
.comments-section { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; margin-top:12px; }
.comment-item { display:flex; gap:8px; padding:10px 0; border-bottom:1px solid var(--border-light); }
.comment-avatar img { width:28px; height:28px; border-radius:50%; object-fit:cover; }
.comment-body { flex:1; }
.comment-header { display:flex; align-items:center; gap:4px; margin-bottom:2px; }
.comment-time { font-size:11px; color:var(--text-muted); margin-left:auto; }
.comment-content { font-size:13px; color:var(--text-secondary); }
.replies { margin-top:6px; padding-left:12px; border-left:2px solid var(--border); }

/* ---- 分类 ---- */
.category-item { display:flex; align-items:center; gap:8px; padding:8px 12px; color:var(--text-secondary); font-size:13px; border-left:3px solid transparent; }
.category-item:hover { background:rgba(102,126,234,0.04); color:var(--primary); }
.category-item.active { background:rgba(102,126,234,0.06); color:var(--primary); font-weight:500; }
.category-item .count { margin-left:auto; font-size:11px; color:var(--text-muted); }

/* ---- 页面标题 ---- */
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.page-header h1 { font-size:18px; font-weight:700; }
.section { margin-bottom:16px; }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.section-header h2 { font-size:15px; font-weight:600; }

/* ---- 空状态 ---- */
.empty-state { text-align:center; padding:32px 20px; color:var(--text-muted); }
.empty-state i { font-size:32px; color:var(--border); margin-bottom:8px; }
.empty-state h3 { font-size:15px; font-weight:600; margin-bottom:4px; color:var(--text-secondary); }

/* ---- 分页 ---- */
.pagination ul { display:flex; gap:4px; list-style:none; justify-content:center; flex-wrap:wrap; margin-top:12px; }
.pagination li a, .pagination li span { display:flex; align-items:center; justify-content:center; min-width:30px; height:30px; font-size:12px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); }
.pagination li a:hover { border-color:var(--primary); color:var(--primary); }
.pagination li.active span { background:var(--primary); color:#fff; border-color:transparent; }

/* ---- 管理后台 ---- */
.admin-layout { display:flex; flex-direction:column; gap:12px; }
.admin-sidebar { width:100%; background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.admin-sidebar-header { padding:10px 14px; background:var(--gradient-primary); color:#fff; }
.admin-nav-link { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:var(--radius-sm); color:var(--text-secondary); font-size:13px; }
.admin-nav-link:hover { background:rgba(102,126,234,0.04); color:var(--primary); }
.admin-nav-link.active { background:rgba(102,126,234,0.08); color:var(--primary); font-weight:500; }
.admin-main { flex:1; }
.stats-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:16px; }
.stat-card { padding:12px; border-radius:var(--radius); background:var(--bg-card); box-shadow:var(--shadow); position:relative; }
.stat-card::before { content:''; position:absolute; top:0; left:0; width:3px; height:100%; }
.stat-blue::before { background:var(--primary); }
.stat-green::before { background:#48bb78; }
.stat-number { display:block; font-size:18px; font-weight:700; }
.stat-label { font-size:11px; color:var(--text-muted); }
.admin-table { width:100%; border-collapse:collapse; font-size:13px; display:block; overflow-x:auto; }
.admin-table th { text-align:left; padding:8px 10px; font-weight:500; color:var(--text-muted); font-size:12px; border-bottom:2px solid var(--border); white-space:nowrap; }
.admin-table td { padding:8px 10px; border-bottom:1px solid var(--border-light); }
.action-cell { white-space:nowrap; display:flex; gap:4px; }
.filter-bar { display:flex; gap:4px; margin-bottom:10px; flex-wrap:wrap; }

/* ---- 个人中心 ---- */
.profile-page { max-width:500px; margin:0 auto; }
.profile-cover { height:120px; border-radius:var(--radius); overflow:hidden; margin-bottom:-40px; position:relative; }
.profile-cover img { width:100%; height:100%; object-fit:cover; }
.profile-cover::after { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background:linear-gradient(transparent 60%, rgba(0,0,0,0.2)); }
.profile-card { background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; text-align:center; margin-top:-40px; position:relative; z-index:1; }
.profile-stats { display:flex; background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; margin-bottom:12px; }
.stat-item { flex:1; text-align:center; padding:12px; border-right:1px solid var(--border-light); }
.stat-item:last-child { border-right:none; }
.stat-num { display:block; font-size:18px; font-weight:700; }
.stat-label { display:block; font-size:11px; color:var(--text-muted); }

/* ---- 页脚 ---- */
.footer { display:none !important; }
.bottom-nav { display:none !important; }
.back-to-top { display:none !important; }

/* ---- 工具 ---- */
.text-muted { color:var(--text-muted); }
.text-center { text-align:center; }

/* ---- 响应式 ---- */
@media (min-width:768px) {
  .nav-desktop { display:flex; }
  .menu-toggle { display:none; }
  .bottom-nav { display:none; }
  .admin-layout { flex-direction:row; }
  .admin-sidebar { width:180px; flex-shrink:0; position:sticky; top:76px; }
  .category-layout { flex-direction:row; }
  .category-sidebar { width:200px; flex-shrink:0; }
}

/* ============================================
   超级管理员铭牌（永久会员金色徽章）
   ============================================ */
.super-badge {
  display:inline-flex; align-items:center; gap:4px;
  padding:2px 10px 2px 6px;
  border-radius:20px;
  font-size:11px; font-weight:700;
  background:linear-gradient(135deg,#f59e0b,#f97316);
  color:#fff;
  box-shadow:0 0 12px rgba(245,158,11,0.4),0 0 4px rgba(245,158,11,0.3);
  position:relative;
  animation:superGlow 2s ease-in-out infinite;
  text-shadow:0 1px 2px rgba(0,0,0,0.2);
}
.super-badge .medal {
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; border-radius:50%;
  background:linear-gradient(135deg,#fbbf24,#f59e0b);
  color:#92400e;
  font-size:9px;
  box-shadow:0 0 6px rgba(251,191,36,0.5);
}
.super-badge-lg {
  padding:4px 14px 4px 8px;
  font-size:13px; font-weight:700;
  border-radius:24px;
  background:linear-gradient(135deg,#f59e0b,#f97316,#ef4444);
  box-shadow:0 0 20px rgba(245,158,11,0.5),0 0 8px rgba(245,158,11,0.3);
  animation:superGlow 1.5s ease-in-out infinite;
}
.super-badge-lg .medal {
  width:20px; height:20px; font-size:11px;
  background:linear-gradient(135deg,#fbbf24,#f59e0b,#f97316);
  box-shadow:0 0 8px rgba(251,191,36,0.6);
}
.super-badge-sm {
  padding:1px 8px 1px 4px;
  font-size:10px;
  border-radius:16px;
}
.super-badge-sm .medal {
  width:12px; height:12px; font-size:7px;
}

@keyframes superGlow {
  0%,100% { box-shadow:0 0 12px rgba(245,158,11,0.4),0 0 4px rgba(245,158,11,0.3); }
  50% { box-shadow:0 0 20px rgba(245,158,11,0.6),0 0 12px rgba(245,158,11,0.4); }
}

/* ---- 超级管理员头像边框 ---- */
.avatar-super {
  border:2px solid #f59e0b !important;
  box-shadow:0 0 12px rgba(245,158,11,0.4) !important;
}

/* ============================================
   博客式帖子卡片
   ============================================ */
.blog-grid {
  display:flex; flex-direction:column; gap:12px;
}
.blog-card {
  background:var(--bg-card); border-radius:var(--radius); box-shadow:var(--shadow);
  overflow:hidden; transition:var(--transition);
  display:flex; flex-direction:column;
}
.blog-card:hover { box-shadow:var(--shadow-md); transform:translateY(-1px); }
.blog-card-image {
  position:relative; width:100%; height:180px; overflow:hidden; background:var(--border-light);
}
.blog-card-image img {
  width:100%; height:100%; object-fit:cover;
  transition:transform 0.4s ease;
}
.blog-card:hover .blog-card-image img { transform:scale(1.05); }
.blog-card-image .blog-card-overlay {
  position:absolute; bottom:0; left:0; right:0;
  height:40%; background:linear-gradient(transparent,rgba(0,0,0,0.5));
}
.blog-card-image .blog-card-category {
  position:absolute; top:10px; left:10px;
  font-size:10px; font-weight:600;
  padding:3px 10px; border-radius:8px;
  background:rgba(102,126,234,0.9); color:#fff;
  backdrop-filter:blur(4px);
}
.blog-card-image .blog-card-badges {
  position:absolute; top:10px; right:10px;
  display:flex; gap:4px;
}
.blog-card-image .blog-card-badges .badge-tag {
  font-size:9px; font-weight:600; padding:2px 8px; border-radius:6px;
  background:rgba(0,0,0,0.5); color:#fff; backdrop-filter:blur(4px);
}
.blog-card-image .blog-card-badges .badge-tag.top { background:rgba(239,68,68,0.8); }
.blog-card-image .blog-card-badges .badge-tag.recommend { background:rgba(52,211,153,0.8); }
.blog-card-body { padding:14px 16px; flex:1; display:flex; flex-direction:column; }
.blog-card-title { font-size:16px; font-weight:700; margin-bottom:6px; line-height:1.3; }
.blog-card-title a { color:var(--text); }
.blog-card-title a:hover { color:var(--primary); }
.blog-card-excerpt {
  font-size:13px; color:var(--text-secondary); line-height:1.6;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
  margin-bottom:10px; flex:1;
}
.blog-card-excerpt .read-more { color:var(--primary); font-weight:500; }
.blog-card-footer {
  display:flex; align-items:center; gap:10px;
  padding-top:10px; border-top:1px solid var(--border-light);
  font-size:11px; color:var(--text-muted);
}
.blog-card-footer .author-avatar {
  width:22px; height:22px; border-radius:50%; object-fit:cover; flex-shrink:0;
}
.blog-card-footer .author-name { font-weight:500; color:var(--text-secondary); }
.blog-card-footer .stats { margin-left:auto; display:flex; gap:8px; }
.blog-card-footer .stats i { font-size:10px; margin-right:1px; }

/* ============================================
   分享按钮
   ============================================ */
.share-btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 16px; font-size:13px; font-weight:600;
  border:none; border-radius:var(--radius-sm); cursor:pointer;
  transition:var(--transition); text-decoration:none;
  background:var(--gradient-blue); color:#fff;
  box-shadow:0 2px 8px rgba(79,172,254,0.3);
}
.share-btn:hover { transform:translateY(-1px); box-shadow:0 4px 16px rgba(79,172,254,0.4); color:#fff; }
.share-btn:active { transform:translateY(0); }
.share-btn.copied { background:var(--gradient-green); box-shadow:0 2px 8px rgba(52,211,153,0.3); }

/* ============================================
   Toast 提示
   ============================================ */
.toast {
  position:fixed; bottom:80px; left:50%; transform:translateX(-50%) translateY(20px);
  background:var(--text); color:var(--bg); padding:10px 20px;
  border-radius:var(--radius-sm); font-size:13px; font-weight:500;
  box-shadow:0 4px 20px rgba(0,0,0,0.2);
  opacity:0; transition:all 0.3s ease; z-index:9999;
  pointer-events:none; white-space:nowrap;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
.toast.success { background:#10b981; color:#fff; }
.toast.error { background:#ef4444; color:#fff; }