/* ===== 全局样式 ===== */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-hover: #252d38;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --purple: #bc8cff;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== 导航栏 ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-nav {
  display: flex;
  gap: 4px;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* 移动端汉堡菜单 */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  width: 24px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ===== 主内容区 ===== */
.main-content {
  margin-top: 80px;
  padding: 24px 20px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Hero 区域 ===== */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto 32px;
}

/* ===== 功能卡片网格 ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s;
  display: block;
  cursor: pointer;
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  background: var(--bg-hover);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ===== 通用卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-success {
  background: var(--success);
  color: #0d1117;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-secondary); }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ===== 页面标题 ===== */
.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.page-header p { color: var(--text-secondary); font-size: 0.95rem; }

/* ===== 考试样式 ===== */
.quiz-question {
  margin-bottom: 24px;
}
.quiz-question .question-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}
.quiz-option:hover { border-color: var(--accent); background: var(--bg-hover); }
.quiz-option input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.quiz-option.selected { border-color: var(--accent); background: rgba(88,166,255,0.08); }
.quiz-option.correct { border-color: var(--success); background: rgba(63,185,80,0.1); }
.quiz-option.wrong { border-color: var(--danger); background: rgba(248,81,73,0.1); }

.progress-bar-wrap {
  background: var(--bg-secondary);
  border-radius: 99px;
  height: 6px;
  margin-bottom: 24px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.result-card {
  text-align: center;
  padding: 40px 24px;
}
.result-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.result-comment {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  text-align: left;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* ===== 兴趣爱好墙 ===== */
.hobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.hobby-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.hobby-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.hobby-card .name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.hobby-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.tag {
  background: rgba(88,166,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 0.78rem;
}
.hobby-card .bio {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ===== 文章博客 ===== */
.article-list { display: flex; flex-direction: column; gap: 16px; }

.article-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.article-item:hover { border-color: var(--accent); transform: translateX(4px); }
.article-item .article-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.article-item .article-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.article-item .article-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-detail { max-width: 720px; margin: 0 auto; }
.article-detail h1 { font-size: 1.8rem; margin-bottom: 12px; }
.article-detail .meta {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 28px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.article-body { line-height: 1.9; color: var(--text-secondary); }
.article-body h2, .article-body h3 { color: var(--text-primary); margin: 24px 0 12px; }
.article-body p { margin-bottom: 16px; }
.article-body code {
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 0.88em;
  color: var(--purple);
}
.article-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

/* ===== 管理员面板 ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th, .admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-secondary); font-weight: 500; background: var(--bg-secondary); }
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-table .actions { display: flex; gap: 8px; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-pending { background: rgba(210,153,34,0.15); color: var(--warning); border: 1px solid rgba(210,153,34,0.3); }
.badge-approved { background: rgba(63,185,80,0.15); color: var(--success); border: 1px solid rgba(63,185,80,0.3); }

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(60px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ===== 加载动画 ===== */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 管理员登录 ===== */
.login-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}
.login-box h2 { margin-bottom: 24px; text-align: center; }

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }

/* ===== 分割线 ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .navbar-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-direction: column; padding: 8px 16px; gap: 2px; }
  .navbar-nav.open { display: flex; }
  .hamburger { display: flex; }
  .main-content { padding: 16px; }
  .features-grid { grid-template-columns: 1fr; }
  .hobby-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 24px; }
  .card { padding: 18px; }
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 10px 10px; }
}
