/* ===== 防护：禁止选择/复制/拖拽（前台） ===== */
body:not(.admin-body) {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body:not(.admin-body) img {
  -webkit-user-drag: none;
  pointer-events: none;
}

/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #333; background: #f5f5f5; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* ===== 颜色变量 ===== */
:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --white: #ffffff;
  --dark: #1a1a2e;
  --gray: #6c757d;
  --light: #f8f9fa;
  --border: #e9ecef;
  --shadow: 0 4px 20px rgba(102,126,234,0.15);
  --radius: 12px;
}

/* ===== 容器 ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; padding: 10px 22px; border-radius: 25px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.3s; border: none; white-space: nowrap; }
.btn-primary { background: var(--gradient); color: var(--white); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); }
.btn-outline { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,0.7); }
.btn-outline:hover { background: rgba(255,255,255,0.15); }
.btn-hero-primary { background: var(--white); color: var(--primary); font-size: 16px; padding: 14px 32px; }
.btn-hero-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.2); }
.btn-hero-outline { background: transparent; color: var(--white); border: 2px solid var(--white); font-size: 16px; padding: 14px 32px; }
.btn-hero-outline:hover { background: rgba(255,255,255,0.15); }

/* ===== 导航栏 ===== */
.navbar { position: sticky; top: 0; z-index: 1000; background: var(--gradient); box-shadow: 0 2px 20px rgba(0,0,0,0.15); }
.nav-container { display: flex; align-items: center; padding: 0 20px; max-width: 1200px; margin: 0 auto; height: 64px; gap: 20px; }
.nav-logo { font-size: 20px; font-weight: 700; color: var(--white); flex-shrink: 0; }
.nav-menu { display: flex; gap: 8px; flex: 1; }
.nav-link { color: rgba(255,255,255,0.85); padding: 8px 16px; border-radius: 20px; font-size: 15px; transition: all 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--white); background: rgba(255,255,255,0.2); }
.nav-actions { display: flex; gap: 10px; flex-shrink: 0; }
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 22px; cursor: pointer; }

/* ===== 英雄区 ===== */
.hero { padding: 80px 20px; text-align: center; min-height: 380px; display: flex; align-items: center; justify-content: center; }
.hero-content { max-width: 700px; }
.hero-title { font-size: clamp(28px, 5vw, 48px); font-weight: 800; color: var(--white); margin-bottom: 16px; text-shadow: 0 2px 10px rgba(0,0,0,0.2); }
.hero-subtitle { font-size: 18px; color: rgba(255,255,255,0.9); margin-bottom: 32px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ===== 快速链接 ===== */
.quick-links { background: var(--white); padding: 30px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.quick-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 16px; border: 2px dashed var(--border); border-radius: var(--radius); transition: all 0.3s; background: var(--light); }
.quick-card:hover { border-color: var(--primary); background: rgba(102,126,234,0.05); transform: translateY(-3px); }
.quick-icon { font-size: 32px; }
.quick-text { font-size: 14px; font-weight: 600; color: #555; }

/* ===== 分类区 ===== */
.categories-section { padding: 60px 0; background: var(--light); }
.section-title { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 36px; color: var(--dark); }
.section-title::after { content: ''; display: block; width: 60px; height: 4px; background: var(--gradient); margin: 12px auto 0; border-radius: 2px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cat-card { border-radius: var(--radius); overflow: hidden; transition: transform 0.3s, box-shadow 0.3s; }
.cat-card:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(102,126,234,0.25); }
.cat-img { position: relative; height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.cat-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(102,126,234,0.82) 0%, rgba(118,75,162,0.82) 100%); }
.cat-icon { font-size: 40px; position: relative; z-index: 1; }
.cat-name { font-size: 20px; font-weight: 700; color: var(--white); position: relative; z-index: 1; }
.cat-desc { font-size: 12px; color: rgba(255,255,255,0.85); position: relative; z-index: 1; text-align: center; padding: 0 16px; }

/* ===== 文章区 ===== */
.articles-section { padding: 60px 0; background: var(--white); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 36px; }
.view-all { color: var(--primary); font-weight: 600; font-size: 15px; }
.view-all:hover { text-decoration: underline; }
.articles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.article-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); transition: all 0.3s; border: 1px solid var(--border); }
.article-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.article-img { height: 180px; position: relative; background: var(--gradient); }
.article-cat-badge { position: absolute; top: 12px; left: 12px; background: var(--gradient); color: var(--white); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.article-body { padding: 18px; }
.article-title { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 10px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-excerpt { font-size: 13px; color: var(--gray); margin-bottom: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-meta { display: flex; justify-content: space-between; align-items: center; }
.article-date { display: flex; flex-direction: column; }
.date-day { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1; }
.date-month { font-size: 11px; color: var(--gray); }
.article-views { font-size: 12px; color: var(--gray); }

/* ===== 页脚 ===== */
.footer { background: var(--dark); color: rgba(255,255,255,0.8); padding: 50px 0 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-bottom: 40px; }
.footer-col h4 { color: var(--white); font-size: 16px; margin-bottom: 16px; }
.footer-col p { font-size: 14px; margin-bottom: 8px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: 14px; color: rgba(255,255,255,0.7); transition: color 0.3s; }
.footer-col ul li a:hover { color: var(--white); }
.footer-col a { color: rgba(255,255,255,0.7); }
.footer-col a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.5); }

/* ===== 新闻列表页 ===== */
.page-hero { padding: 50px 20px; text-align: center; color: var(--white); }
.page-hero-icon { font-size: 48px; margin-bottom: 12px; }
.page-hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 10px; }
.page-hero p { font-size: 16px; opacity: 0.9; }
.filter-bar { background: var(--white); padding: 20px 0; border-bottom: 1px solid var(--border); position: sticky; top: 64px; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.filter-bar .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--gray); background: var(--light); border: 1px solid var(--border); transition: all 0.3s; cursor: pointer; }
.filter-btn:hover, .filter-btn.active { background: var(--gradient); color: var(--white); border-color: transparent; }
.search-form { display: flex; gap: 8px; }
.search-input { padding: 8px 16px; border: 1px solid var(--border); border-radius: 20px; font-size: 14px; outline: none; width: 200px; }
.search-input:focus { border-color: var(--primary); }
.search-btn { background: var(--gradient); color: var(--white); border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 16px; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.page-btn { padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--primary); background: var(--white); border: 1px solid var(--border); transition: all 0.3s; }
.page-btn:hover, .page-btn.active { background: var(--gradient); color: var(--white); border-color: transparent; }

/* ===== 文章详情页 ===== */
.article-main { padding: 40px 0 60px; }
.article-layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; }
.breadcrumb { font-size: 13px; color: var(--gray); margin-bottom: 20px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.article-header { margin-bottom: 24px; }
.article-tags { margin-bottom: 12px; }
.tag { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.tag-cat { background: var(--gradient); color: var(--white); }
.article-h1 { font-size: clamp(22px, 3vw, 32px); font-weight: 800; color: var(--dark); line-height: 1.4; margin-bottom: 12px; }
.article-info { display: flex; gap: 20px; font-size: 14px; color: var(--gray); }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; max-height: 450px; }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-lead { background: rgba(102,126,234,0.08); border-left: 4px solid var(--primary); padding: 16px 20px; border-radius: 0 8px 8px 0; font-size: 16px; color: #444; margin-bottom: 24px; line-height: 1.8; }
.article-body-content { font-size: 16px; line-height: 1.9; color: #333; }
.article-body-content h2 { font-size: 22px; font-weight: 700; color: var(--dark); margin: 28px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.article-body-content h3 { font-size: 18px; font-weight: 700; color: var(--dark); margin: 20px 0 10px; }
.article-body-content p { margin-bottom: 16px; }
.article-body-content img { border-radius: 8px; margin: 16px 0; }
.article-keywords { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }
.kw-tag { display: inline-block; padding: 4px 12px; margin: 4px; background: var(--light); border: 1px solid var(--border); border-radius: 15px; font-size: 13px; color: var(--gray); transition: all 0.3s; }
.kw-tag:hover { background: var(--gradient); color: var(--white); border-color: transparent; }

/* ===== 侧边栏 ===== */
.article-sidebar { }
.sidebar-widget { background: var(--white); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.widget-title { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--gradient); background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.related-item { display: flex; gap: 12px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.related-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.related-img { width: 70px; height: 55px; border-radius: 8px; flex-shrink: 0; background: var(--gradient); }
.related-info { flex: 1; }
.related-title { font-size: 13px; color: var(--dark); line-height: 1.5; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-date { font-size: 12px; color: var(--gray); }
.cat-nav-item { display: block; padding: 9px 14px; border-radius: 8px; font-size: 14px; color: #555; transition: all 0.3s; margin-bottom: 4px; }
.cat-nav-item:hover { background: rgba(102,126,234,0.1); color: var(--primary); }

/* ===== 后台通用 ===== */
.admin-body { background: #f0f2f5; min-height: 100vh; }
.admin-sidebar { position: fixed; left: 0; top: 0; width: 240px; height: 100vh; background: var(--dark); overflow-y: auto; z-index: 100; }
.admin-logo { padding: 24px 20px; font-size: 18px; font-weight: 700; color: var(--white); border-bottom: 1px solid rgba(255,255,255,0.1); }
.admin-nav { padding: 16px 0; }
.admin-nav-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: rgba(255,255,255,0.7); font-size: 14px; transition: all 0.3s; }
.admin-nav-item:hover, .admin-nav-item.active { color: var(--white); background: rgba(255,255,255,0.1); }
.admin-nav-item .icon { font-size: 18px; width: 24px; }
.admin-main { margin-left: 240px; min-height: 100vh; }
.admin-topbar { background: var(--white); padding: 0 30px; height: 60px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 8px rgba(0,0,0,0.08); }
.admin-topbar h2 { font-size: 18px; font-weight: 700; color: var(--dark); }
.admin-content { padding: 30px; }
.admin-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 24px; }
.admin-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 20px; color: var(--dark); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; background: var(--gradient); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-info h4 { font-size: 26px; font-weight: 800; color: var(--dark); }
.stat-info p { font-size: 13px; color: var(--gray); }
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #444; margin-bottom: 8px; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.3s; font-family: inherit; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.btn-save { background: var(--gradient); color: var(--white); padding: 11px 28px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; }
.btn-save:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(102,126,234,0.4); }
.btn-danger { background: #ff4757; color: var(--white); padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-edit { background: var(--gradient); color: var(--white); padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer; }
.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--light); padding: 12px 16px; font-size: 13px; font-weight: 700; color: #444; text-align: left; border-bottom: 2px solid var(--border); }
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: rgba(102,126,234,0.03); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-published { background: #e8f5e9; color: #2e7d32; }
.badge-draft { background: #fff3e0; color: #e65100; }
.badge-archived { background: #f3e5f5; color: #6a1b9a; }
.alert { padding: 12px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gradient); }
.login-box { background: var(--white); border-radius: 16px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; font-size: 36px; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--dark); margin-bottom: 30px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.no-related { font-size: 13px; color: var(--gray); text-align: center; padding: 10px 0; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nav-menu, .nav-actions { display: none; }
  .nav-menu.open, .nav-actions.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--gradient); padding: 16px; gap: 8px; }
  .nav-toggle { display: block; }
  .nav-container { position: relative; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .articles-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .filter-bar .container { flex-direction: column; align-items: flex-start; }
  .search-form { width: 100%; }
  .search-input { flex: 1; }
  .admin-sidebar { width: 200px; }
  .admin-main { margin-left: 200px; }
  .article-sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .articles-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 26px; }
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
