/* ============================================
   全局样式
   ============================================ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ============================================
   头部导航
   ============================================ */
.header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
}

.nav { display: flex; gap: 8px; }
.nav-link {
  color: var(--text-light);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
}
.nav-link:hover,
.nav-link.active {
  background: rgba(99,102,241,.1);
  color: var(--primary);
}

/* ============================================
   主要内容
   ============================================ */
.main { flex: 1; padding: 40px 20px 60px; }

/* Hero */
.hero {
  text-align: center;
  padding: 60px 0 30px;
}
.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  color: var(--text-light);
  margin-top: 10px;
  font-size: 1.05rem;
}

/* 栏目区块 */
.section { margin-bottom: 48px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  position: relative;
  padding-left: 16px;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 4px;
  background: var(--primary);
  border-radius: 2px;
}
.section-more {
  color: var(--primary);
  font-size: .88rem;
  font-weight: 500;
}

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* 卡片 */
.card {
  display: block;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all .25s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.5;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 10px;
}
.card-tag {
  background: rgba(99,102,241,.1);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 500;
}
.card-excerpt {
  font-size: .92rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* ============================================
   页面头部
   ============================================ */
.page-header {
  text-align: center;
  padding: 40px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}
.page-header p {
  color: var(--text-light);
  margin-top: 6px;
}

/* 文章列表 */
.article-list { display: flex; flex-direction: column; gap: 12px; }

.article-item {
  display: block;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all .25s;
}
.article-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}
.article-item-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.article-item-meta {
  display: flex;
  gap: 12px;
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 8px;
}
.article-item-excerpt {
  font-size: .9rem;
  color: var(--text-light);
}

.empty {
  text-align: center;
  color: var(--text-light);
  padding: 60px 0;
  font-size: 1rem;
}

/* ============================================
   文章详情
   ============================================ */
.article-detail {
  max-width: 750px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.article-detail-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.article-detail-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.4;
}
.article-detail-meta {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  font-size: .88rem;
  color: var(--text-light);
}
.article-detail-content {
  font-size: 1rem;
  line-height: 1.9;
  color: #334155;
}
.article-detail-content h3 {
  font-size: 1.2rem;
  margin: 28px 0 12px;
  color: var(--text);
}
.article-detail-content p {
  margin-bottom: 16px;
}

.article-nav {
  text-align: center;
  margin-top: 30px;
  display: flex;
  justify-content: center;
  gap: 20px;
}
.btn-back {
  display: inline-block;
  padding: 10px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .92rem;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all .2s;
}
.btn-back:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ============================================
   404 页面
   ============================================ */
.page-404 {
  text-align: center;
  padding: 100px 0;
}
.page-404 h1 {
  font-size: 6rem;
  font-weight: 800;
  color: var(--primary);
  opacity: .3;
}
.page-404 p {
  font-size: 1.2rem;
  color: var(--text-light);
  margin: 10px 0 24px;
}

/* ============================================
   底部
   ============================================ */
.footer {
  text-align: center;
  padding: 30px 0;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: .85rem;
}

/* ============================================
   后台管理样式
   ============================================ */
.admin-body {
  background: #f1f5f9;
}

/* 登录 */
.login-box {
  width: 380px;
  margin: 120px auto 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.login-logo {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 30px;
  color: var(--text);
}

/* 后台布局 */
.admin-layout {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 220px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}
.admin-logo {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}
.admin-nav-item {
  padding: 10px 20px;
  color: var(--text);
  font-size: .92rem;
  font-weight: 500;
  transition: all .15s;
}
.admin-nav-item:hover {
  background: rgba(99,102,241,.08);
  color: var(--primary);
}
.admin-sidebar-footer {
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
}
.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
}

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
}
.stat-number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: .88rem;
  color: var(--text-light);
  margin-top: 6px;
}

/* 表单 */
.form-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.form-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.form-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .92rem;
  outline: none;
  transition: border .2s;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .92rem;
  outline: none;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 12px;
  transition: border .2s;
}
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-error {
  color: #ef4444;
  font-size: .85rem;
  margin-top: 8px;
  margin-bottom: 0;
}

/* 按钮 */
.btn-primary {
  display: inline-block;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary:hover {
  background: var(--primary-dark);
  opacity: 1;
}
.btn-block {
  width: 100%;
  margin-top: 8px;
}
.btn-sm {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.btn-danger {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
}

/* 提示 */
.alert {
  padding: 12px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
}
.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* 表格 */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.admin-table th {
  background: #f8fafc;
  padding: 14px 16px;
  text-align: left;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.admin-table tr:last-child td { border-bottom: none; }

/* 响应式 */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 10px; }
  .nav { flex-wrap: wrap; justify-content: center; }
  .card-grid { grid-template-columns: 1fr; }
  .article-detail { padding: 24px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .admin-sidebar-footer { border-top: none; border-left: 1px solid var(--border); padding-left: 12px; }
  .form-row { flex-direction: column; }
}
