/* ========================================
   aicampx.cn - 全局样式
   AI 训练营 · 学习社区 · 课程下载
   ======================================== */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --radius: 12px;
  --transition: all 0.25s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; transition: var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============ 导航栏 ============ */
.navbar {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.nav-logo {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: bold;
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover,
.nav-links a.active { color: var(--primary); }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.45); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-success { background: var(--success); color: white; }
.btn-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 2px 8px rgba(245,158,11,0.35);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,0.45); }

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
}

/* ============ Hero 区域 ============ */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}
.hero p {
  font-size: 18px;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 30px;
  position: relative;
  z-index: 1;
}
.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.hero .btn-primary { background: white; color: var(--primary-dark); }
.hero .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.hero .btn-gold { animation: pulse 2s infinite; }
@keyframes pulse {
  0%,100% { box-shadow: 0 2px 8px rgba(245,158,11,0.35); }
  50% { box-shadow: 0 4px 20px rgba(245,158,11,0.55); }
}

/* 统计数据 */
.stats-bar {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  margin-top: 50px;
  padding: 20px 0;
  position: relative;
  z-index: 1;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}
.stat-item { text-align: center; }
.stat-number {
  font-size: 28px;
  font-weight: 800;
  display: block;
}
.stat-label {
  font-size: 13px;
  opacity: 0.8;
}

/* ============ 内容区域通用 ============ */
.section { padding: 60px 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.section-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-more { font-size: 14px; color: var(--primary); font-weight: 600; }
.section-more:hover { text-decoration: underline; }

/* ============ 课程卡片 ============ */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.course-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.course-cover {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: white;
}
.course-body { padding: 18px; }
.course-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}
.course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 6px;
}
.course-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.tag-blue { background: #eff6ff; color: #3b82f6; }
.tag-green { background: #ecfdf5; color: #10b981; }
.tag-purple { background: #f5f3ff; color: #8b5cf6; }
.tag-orange { background: #fff7ed; color: #f97316; }
.tag-red { background: #fef2f2; color: #ef4444; }

.premium-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.price-free { color: var(--success); font-weight: 700; }
.price-paid { color: var(--danger); font-weight: 700; }
.download-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.download-btn-free { background: #ecfdf5; color: #10b981; }
.download-btn-free:hover { background: #d1fae5; }
.download-btn-premium { background: #fff7ed; color: #f97316; }
.download-btn-premium:hover { background: #ffedd5; }

/* ============ 论坛样式 ============ */
.forum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.forum-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.forum-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.forum-card.locked { opacity: 0.65; }
.forum-icon {
  font-size: 28px;
  margin-bottom: 10px;
}
.forum-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.forum-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.forum-stats {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}
.premium-lock {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 16px;
}

/* 帖子列表 */
.post-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 10px;
  display: block;
  text-decoration: none;
  color: inherit;
}
.post-item:hover { border-color: var(--primary-light); }
.post-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.post-pinned { color: var(--accent); font-size: 13px; }
.post-preview {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.post-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.post-author {
  display: flex;
  align-items: center;
  gap: 6px;
}
.post-author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-light);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* 帖子详情 */
.post-detail {
  max-width: 800px;
  margin: 0 auto;
}
.post-detail-header h1 { font-size: 24px; font-weight: 800; margin-bottom: 12px; }
.post-detail-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  line-height: 1.8;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-list { margin-top: 24px; }
.comment-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.comment-author-name { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--text-secondary); }
.comment-content { font-size: 14px; line-height: 1.6; }

/* ============ 登录/注册页 ============ */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}
.auth-container {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-title {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.form-switch {
  font-size: 13px;
  color: var(--text-secondary);
}
.form-switch a { color: var(--primary); font-weight: 600; }

/* 卡密激活 */
.activate-section {
  background: linear-gradient(135deg, #fefce8, #fffbeb);
  border: 1.5px dashed #fcd34d;
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}
.activate-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #92400e;
}

/* ============ 页脚 ============ */
.footer {
  background: #1e293b;
  color: #94a3b8;
  padding: 48px 0 24px;
  margin-top: 60px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-brand h3 { color: white; font-size: 20px; margin-bottom: 8px; }
.footer-brand p { font-size: 13px; line-height: 1.6; }
.footer-col h4 { color: white; font-size: 14px; margin-bottom: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; font-size: 13px; }
.footer-col a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 20px;
  text-align: center;
  font-size: 12px;
}

/* ============ 会员横幅 ============ */
.member-banner {
  background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
  border: 1.5px solid #fcd34d;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin: 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.member-banner-info h3 {
  font-size: 20px;
  color: #92400e;
  font-weight: 800;
  margin-bottom: 4px;
}
.member-banner-info p { font-size: 14px; color: #a16207; }
.member-price {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.price-tag {
  font-size: 28px;
  font-weight: 900;
  color: #dc2626;
}
.price-unit { font-size: 14px; color: #92400e; font-weight: 600; }

/* ============ 筛选器 ============ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-select {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-card);
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* ============ 搜索框 ============ */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  gap: 10px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  font-family: inherit;
}
.search-icon { color: var(--text-secondary); font-size: 18px; }

/* ============ Toast 提示 ============ */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ============ 分页 ============ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 30px;
}
.page-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============ Modal 弹窗 ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 16px; }
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

/* ============ 空状态 ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* ============ 加载动画 ============ */
.loading {
  text-align: center;
  padding: 40px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: white; flex-direction: column; padding: 16px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; font-size: 16px; }
  .menu-toggle { display: block; }
  .hero { padding: 50px 0 40px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .stat-number { font-size: 22px; }
  .courses-grid { grid-template-columns: 1fr; }
  .forum-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .member-banner { flex-direction: column; text-align: center; }
  .section-header { flex-direction: column; gap: 10px; align-items: flex-start; }
  .filter-bar { width: 100%; }
  .auth-container { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 15px; }
  .hero-actions { flex-direction: column; }
  .section-title { font-size: 20px; }
  .nav-logo { font-size: 18px; }
}
