/* 5G核心网学习平台 - 全局样式 */
:root {
    --primary: #1a56db;
    --primary-light: #3b82f6;
    --primary-dark: #1e40af;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --gradient: linear-gradient(135deg, #1a56db 0%, #7c3aed 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-orange: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-dark: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

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

/* 顶部导航 */
.topnav { background: var(--gradient); color: white; padding: 16px 0; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.topnav .container { display: flex; align-items: center; justify-content: space-between; }
.topnav .brand { font-size: 20px; font-weight: 700; color: white; display: flex; align-items: center; gap: 8px; }
.topnav nav { display: flex; gap: 24px; align-items: center; }
.topnav nav a { color: rgba(255,255,255,0.85); font-size: 14px; font-weight: 500; transition: color 0.2s; }
.topnav nav a:hover, .topnav nav a.active { color: white; }
.topnav .logout-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.topnav .logout-btn:hover { background: rgba(255,255,255,0.25); }

/* 页面头部 */
.page-header { background: var(--gradient); color: white; padding: 48px; border-radius: 16px; margin-bottom: 32px; text-align: center; }
.page-header h1 { font-size: 36px; margin-bottom: 12px; }
.page-header p { opacity: 0.9; font-size: 16px; }

/* 卡片 */
.card { background: var(--card); padding: 24px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: all 0.3s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

/* 章节卡片网格 */
.chapters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.chapter-badge { display: inline-block; background: var(--gradient); color: white; padding: 3px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.chapter-badge.free { background: var(--gradient-green); }
.chapter-badge.locked { background: var(--gradient-orange); }

/* 按钮 */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; text-align: center; cursor: pointer; transition: all 0.3s; border: none; }
.btn-primary { background: var(--gradient); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(26,86,219,0.4); color: white; }
.btn-quiz { background: #ebf8ff; color: #3b82f6; border: 2px solid #3b82f6; }
.btn-quiz:hover { background: #3b82f6; color: white; }
.btn-success { background: var(--gradient-green); color: white; }

/* 区块 */
.section-block { padding: 32px; border-radius: 16px; margin-top: 32px; text-align: center; color: white; }
.section-block h2 { font-size: 26px; margin-bottom: 12px; }
.section-block p { opacity: 0.9; margin-bottom: 20px; }
.section-block .btn { background: white; padding: 14px 36px; font-size: 16px; border-radius: 10px; }

/* 付费内容渐变遮罩 */
.premium-content.content-locked {
    position: relative;
    max-height: 300px;
    overflow: hidden;
}
.premium-content.content-locked::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 200px;
    background: linear-gradient(transparent, white 85%);
    pointer-events: none;
}
/* 付费提示卡片 */
.paywall-gate { display: none; margin-top: -40px; position: relative; z-index: 2; }
.paywall { background: linear-gradient(135deg, #fef3c7, #fde68a); border: 2px solid #f59e0b; border-radius: 12px; padding: 32px; text-align: center; margin: 0; }
.paywall h3 { color: #92400e; margin-bottom: 12px; font-size: 20px; }
.paywall p { color: #78350f; margin-bottom: 12px; font-size: 15px; }
.paywall .unlock-btn { display: inline-block; background: var(--gradient); color: white; padding: 12px 32px; border-radius: 8px; font-size: 16px; font-weight: 600; text-decoration: none; transition: transform 0.2s; }
.paywall .unlock-btn:hover { transform: translateY(-2px); color: white; }
.paywall .qrcode-placeholder { width: 140px; height: 140px; background: #fff; border: 2px dashed #d97706; border-radius: 12px; margin: 12px auto; display: flex; align-items: center; justify-content: center; color: #92400e; font-size: 12px; }

/* 文章内容页 */
.doc-layout { display: flex; gap: 24px; }
.doc-sidebar { width: 260px; flex-shrink: 0; position: sticky; top: 80px; height: fit-content; max-height: calc(100vh - 100px); overflow-y: auto; }
.doc-sidebar .sidebar-toggle { display: none; }
.doc-sidebar ul { list-style: none; background: var(--card); border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.doc-sidebar li a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text-light); font-size: 14px; transition: all 0.2s; }
.doc-sidebar li a:hover, .doc-sidebar li a.active { background: #eff6ff; color: var(--primary); }
.doc-sidebar li a .lock-icon { float: right; color: #f59e0b; }
.doc-content { flex: 1; min-width: 0; }
.doc-content .card { padding: 40px; }
.doc-content h1 { font-size: 32px; margin-bottom: 8px; }
.doc-content h2 { font-size: 24px; margin-top: 40px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.doc-content h3 { font-size: 20px; margin-top: 28px; margin-bottom: 12px; }
.doc-content p { margin-bottom: 16px; }
.doc-content pre { background: #1e293b; color: #e2e8f0; padding: 20px; border-radius: 8px; overflow-x: auto; margin: 16px 0; font-size: 14px; }
.doc-content code { font-family: 'Fira Code', monospace; }
.doc-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc-content th, .doc-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; font-size: 14px; }
.doc-content th { background: #f1f5f9; font-weight: 600; }
.doc-content .mermaid { margin: 20px 0; text-align: center; }
.doc-content .diagram-caption { text-align: center; color: var(--text-light); font-size: 14px; margin-top: -12px; margin-bottom: 20px; font-style: italic; }

/* 测验 */
.quiz-container { max-width: 800px; margin: 0 auto; }
.quiz-question { background: var(--card); padding: 24px; border-radius: 12px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.quiz-question h3 { margin-bottom: 16px; font-size: 16px; }
.quiz-option { display: block; padding: 12px 16px; margin: 8px 0; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.quiz-option:hover { border-color: var(--primary-light); background: #eff6ff; }
.quiz-option.selected { border-color: var(--primary); background: #dbeafe; }
.quiz-option.correct { border-color: var(--success); background: #d1fae5; }
.quiz-option.wrong { border-color: var(--danger); background: #fee2e2; }
.quiz-result { text-align: center; padding: 32px; border-radius: 12px; margin-top: 24px; }
.quiz-result.pass { background: #d1fae5; color: #065f46; }
.quiz-result.fail { background: #fee2e2; color: #991b1b; }

/* 全站底部 */
.site-footer { background: #1e293b; color: #e2e8f0; padding: 48px 0 24px; margin-top: 60px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-author { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; }
.footer-author-text { flex: 1; min-width: 280px; }
.footer-author-text h3 { font-size: 20px; margin-bottom: 12px; color: #f8fafc; }
.footer-author-text p { font-size: 14px; color: #94a3b8; margin-bottom: 8px; line-height: 1.8; }
.footer-author-text .hl { color: #f59e0b; font-weight: 600; }
.footer-author-text .contact { font-size: 12px; color: #64748b; margin-top: 8px; }
.footer-qrs { display: flex; gap: 24px; flex-shrink: 0; }
.footer-qr { text-align: center; }
.footer-qr img { width: 120px; height: 120px; border-radius: 8px; border: 2px solid #334155; }
.footer-qr .qr-label { font-size: 13px; font-weight: 600; color: #f8fafc; margin-top: 8px; }
.footer-qr .qr-desc { font-size: 11px; color: #64748b; margin-top: 2px; }
.footer-bottom { text-align: center; margin-top: 32px; padding-top: 20px; border-top: 1px solid #334155; font-size: 12px; color: #64748b; }
.footer-bottom a { color: #94a3b8; }

/* 响应式 */
@media (max-width: 768px) {
    .doc-layout { flex-direction: column; }
    .doc-sidebar { width: 100%; position: static; }
    .topnav nav { gap: 12px; }
    .page-header { padding: 24px; }
    .page-header h1 { font-size: 24px; }
    .chapters-grid { grid-template-columns: 1fr; }
}
