/* ===== 共享页面样式 ===== */
:root {
  --primary: #1a3a6e;
  --primary-light: #2b5ea7;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== 顶部导航 ===== */
.page-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(26,58,110,0.97);
  backdrop-filter: blur(10px);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.page-header .logo {
  font-size: 20px; font-weight: 800; color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.page-header .logo .badge { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.page-header nav { display: flex; align-items: center; gap: 8px; }
.page-header nav a {
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 14px;
  padding: 8px 16px; border-radius: 6px; transition: all 0.2s;
}
.page-header nav a:hover, .page-header nav a.active { background: rgba(255,255,255,0.15); color: #fff; }
.page-header nav .nav-login-btn { border: 1px solid rgba(255,255,255,0.4); }
.page-header nav .nav-register-btn { background: var(--accent); color: #fff; font-weight: 600; }
.page-header nav .nav-register-btn:hover { background: var(--accent-hover); }

/* ===== 用户下拉菜单 ===== */
.nav-user-dropdown { position: relative; }
.nav-user-btn {
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; gap: 6px;
}
.nav-user-menu {
  position: absolute; right: 0; top: 100%; margin-top: 0;
  background: #fff; border-radius: 8px; box-shadow: var(--shadow-lg);
  min-width: 160px; padding: 8px 0; display: none;
}
/* 透明桥接区域，防止鼠标从按钮移到菜单时丢失hover */
.nav-user-menu::before {
  content: ''; position: absolute; top: -10px; left: 0; right: 0; height: 10px; background: transparent;
}
.nav-user-dropdown:hover .nav-user-menu { display: block; }
.nav-user-menu a {
  display: block; color: var(--text); padding: 10px 16px; text-decoration: none; font-size: 14px;
  border-radius: 0;
}
.nav-user-menu a:hover { background: var(--bg); color: var(--primary); }

/* ===== 页面容器 ===== */
.page-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* ===== 卡片 ===== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(43,94,167,0.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; border: none; text-decoration: none; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 认证页面 ===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a3a6e 0%, #2b5ea7 100%);
  padding: 24px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-card .auth-title { font-size: 24px; font-weight: 800; color: var(--primary); margin-bottom: 8px; text-align: center; }
.auth-card .auth-subtitle { font-size: 14px; color: var(--text-light); text-align: center; margin-bottom: 32px; }
.auth-card .auth-links { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-light); }
.auth-card .auth-links a { color: var(--primary-light); text-decoration: none; font-weight: 600; }
.auth-card .auth-links a:hover { text-decoration: underline; }
.auth-card .btn { width: 100%; margin-top: 8px; }

/* ===== 文章列表 ===== */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.article-item {
  background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; text-decoration: none; color: inherit;
}
.article-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.article-item .cover {
  height: 180px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 28px; font-weight: 800;
  overflow: hidden;
}
.article-item .cover img { width: 100%; height: 100%; object-fit: cover; }
.article-item .body { padding: 16px; }
.article-item .category { display: inline-block; font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; }
.article-item h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; color: var(--text); line-height: 1.4; }
.article-item p { font-size: 14px; color: var(--text-light); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article-item .meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--text-light); }

/* ===== 文章详情 ===== */
.article-detail { background: #fff; border-radius: 12px; padding: 40px; box-shadow: var(--shadow); text-align: left; }
.article-detail h1 { font-size: 28px; font-weight: 800; color: var(--text); margin-bottom: 16px; line-height: 1.3; }
.article-detail .meta { display: flex; gap: 16px; align-items: center; font-size: 14px; color: var(--text-light); margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.article-detail .content { font-size: 16px; line-height: 1.8; color: var(--text); text-align: left; }
.article-detail .content h2 { font-size: 22px; font-weight: 700; margin: 28px 0 12px; color: var(--primary); }
.article-detail .content h3 { font-size: 18px; font-weight: 700; margin: 24px 0 10px; color: var(--text); }
.article-detail .content p { margin-bottom: 16px; }
.article-detail .content ul, .article-detail .content ol { margin: 0 0 16px 1.5em; }
.article-detail .content li { margin-bottom: 6px; }
.article-detail .content img { max-width: 100%; border-radius: 8px; margin: 16px 0; }
.article-detail .content blockquote { border-left: 4px solid var(--accent); padding: 12px 20px; margin: 16px 0; background: #f8fafc; border-radius: 0 8px 8px 0; color: var(--text-light); }
.article-detail .content a { color: var(--primary); text-decoration: underline; }
.article-detail .content strong { font-weight: 700; }

/* ===== 支付页面 ===== */
.payment-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.plan-card {
  border: 2px solid var(--border); border-radius: 12px; padding: 24px; cursor: pointer; transition: all 0.2s;
  text-align: center;
}
.plan-card.selected { border-color: var(--accent); background: #fffbeb; }
.plan-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.plan-card .price { font-size: 36px; font-weight: 900; color: var(--primary); margin: 12px 0; }
.plan-card .price small { font-size: 16px; font-weight: 400; }
.plan-card ul { list-style: none; text-align: left; margin-top: 16px; }
.plan-card ul li { padding: 6px 0; font-size: 14px; color: var(--text-light); display: flex; align-items: center; gap: 8px; }
.plan-card ul li::before { content: '✓'; color: var(--accent); font-weight: 700; }

.pay-method { display: flex; gap: 12px; margin: 20px 0; }
.pay-method-item {
  flex: 1; border: 2px solid var(--border); border-radius: 8px; padding: 16px; cursor: pointer;
  text-align: center; transition: all 0.2s;
}
.pay-method-item.selected { border-color: var(--primary); background: #eff6ff; }
.pay-method-item .icon { font-size: 32px; }
.pay-method-item .name { font-size: 14px; font-weight: 600; margin-top: 8px; }

.qr-display { text-align: center; padding: 24px; }
.qr-display img { border-radius: 12px; box-shadow: var(--shadow); }
.qr-display .hint { font-size: 14px; color: var(--text-light); margin-top: 12px; }

/* ===== 后台管理 ===== */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 24px; min-height: calc(100vh - 60px); }
.admin-sidebar { background: #fff; border-radius: 12px; padding: 16px; box-shadow: var(--shadow); height: fit-content; position: sticky; top: 80px; }
.admin-sidebar a {
  display: block; padding: 10px 16px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 14px; font-weight: 500;
  transition: all 0.2s; margin-bottom: 4px;
}
.admin-sidebar a:hover { background: var(--bg); }
.admin-sidebar a.active { background: var(--primary); color: #fff; }

.admin-content { padding: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 900; color: var(--primary); }
.stat-card .value.accent { color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
table th { text-align: left; padding: 12px 8px; font-size: 13px; color: var(--text-light); border-bottom: 2px solid var(--border); font-weight: 600; }
table td { padding: 12px 8px; font-size: 14px; border-bottom: 1px solid var(--border); }
table tr:hover { background: #f8fafc; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-published { background: #dbeafe; color: #1e40af; }

/* ===== 编辑器 ===== */
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.editor-toolbar button {
  padding: 6px 12px; border: 1px solid var(--border); background: #fff; border-radius: 4px;
  cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.editor-toolbar button:hover { background: var(--bg); border-color: var(--primary-light); }
.editor-content { min-height: 400px; border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 15px; line-height: 1.8; }
.editor-content:focus { outline: none; border-color: var(--primary-light); }

/* ===== 响应式 ===== */
/* ===== 主站导航栏用户状态 ===== */
#nav-user .nav-login-btn {
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 14px;
  padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.35);
  transition: all 0.2s; white-space: nowrap;
}
#nav-user .nav-login-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
#nav-user .nav-register-btn {
  background: var(--accent); color: #fff; text-decoration: none; font-size: 14px;
  padding: 6px 14px; border-radius: 6px; font-weight: 600; transition: all 0.2s; white-space: nowrap;
}
#nav-user .nav-register-btn:hover { background: var(--accent-hover); }

/* 适配主站深色导航栏 */
.navbar .nav-user-dropdown .nav-user-btn {
  background: rgba(255,255,255,0.15); color: #fff;
}
.navbar .nav-user-menu a { color: var(--text); }
.navbar .nav-user-menu a:hover { background: var(--bg); color: var(--primary); }

@media (max-width: 768px) {
  #nav-user { display: none !important; }
  .page-header nav { display: none; }
  .page-header nav.mobile { display: flex; gap: 4px; }
  .payment-wrap { grid-template-columns: 1fr; }
  .admin-wrap { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; display: flex; overflow-x: auto; }
  .admin-sidebar a { white-space: nowrap; }
  .article-grid { grid-template-columns: 1fr; }
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
