/* ============================================
   段永平投资哲学 - 左侧目录布局
   仿照巴菲特致股东信网站设计
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #c9302c;
  --primary-dark: #a02020;
  --primary-light: rgba(201,48,44,0.08);
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-text: #b8c5d6;
  --sidebar-active-bg: #c9302c;
  --content-bg: #f8f9fa;
  --text-main: #2c3e50;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --card-bg: #fff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 8px;
  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --gold: #d4a017;
  --green: #27ae60;
  --blue: #2980b9;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--content-bg);
  color: var(--text-main);
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

/* ============================================
   左侧目录
   ============================================ */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  overflow-y: auto;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s;
  display: flex; flex-direction: column;
  box-shadow: 2px 0 20px rgba(0,0,0,0.15);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.sidebar.collapsed { width: 0; }

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px;
}

.sidebar-brand {
  color: #fff; font-size: 1.1rem; font-weight: 700;
  text-decoration: none; line-height: 1.3;
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; white-space: nowrap;
  transition: opacity 0.3s;
}
.sidebar.collapsed .sidebar-brand { opacity: 0; }

.toggle-btn {
  background: rgba(255,255,255,0.1); border: none;
  color: var(--sidebar-text);
  width: 32px; height: 32px; border-radius: 6px;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.3s; flex-shrink: 0;
}
.toggle-btn:hover { background: rgba(255,255,255,0.2); }
.sidebar.collapsed .toggle-btn {
  position: fixed; left: 12px; top: 20px; z-index: 200;
  transform: rotate(180deg);
}

.sidebar-nav { padding: 16px 0; flex: 1; }
.nav-section { margin-bottom: 8px; }

.nav-section-title {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(184,197,214,0.4);
  padding: 12px 20px 6px;
  overflow: hidden; white-space: nowrap; transition: opacity 0.3s;
}
.sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none; font-size: 0.88rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
  overflow: hidden; white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; border-left-color: rgba(255,255,255,0.3); }
.nav-item.active { background: var(--primary); color: #fff; border-left-color: var(--primary); }
.sidebar.collapsed .nav-item { opacity: 0; pointer-events: none; }

.nav-icon { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.72rem; color: rgba(184,197,214,0.4);
  overflow: hidden; white-space: nowrap; transition: opacity 0.3s;
}
.sidebar.collapsed .sidebar-footer { opacity: 0; }

/* ============================================
   移动端
   ============================================ */
.hamburger {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 300;
  background: var(--sidebar-bg); color: #fff; border: none;
  border-radius: 8px; width: 40px; height: 40px;
  font-size: 1.2rem; cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.hamburger.active { display: flex; align-items: center; justify-content: center; }

.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 50;
}
.overlay.active { display: block; }

/* ============================================
   主内容区
   ============================================ */
.main {
  flex: 1; margin-left: 260px;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
  min-height: 100vh;
}
.sidebar.collapsed ~ .main { margin-left: 0; }

/* ============================================
   英雄区
   ============================================ */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff; padding: 72px 56px 56px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; right: -10%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(201,48,44,0.15) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--gold), var(--primary));
}

.hero h1 {
  font-size: 2.6rem; font-weight: 900; margin-bottom: 14px;
  letter-spacing: -0.02em; position: relative;
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.8));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 1.05rem; color: rgba(255,255,255,0.65);
  max-width: 640px; position: relative; line-height: 1.6;
}
.hero-stats {
  display: flex; gap: 40px; margin-top: 36px; position: relative;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  display: block; font-size: 2.2rem; font-weight: 900;
  color: var(--primary); line-height: 1;
}
.hero-stat-label {
  font-size: 0.75rem; color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px;
}

/* ============================================
   核心语录横幅
   ============================================ */
.quote-banner {
  background: linear-gradient(90deg, var(--primary), #e74c3c, var(--primary));
  color: #fff; padding: 22px 56px;
  font-size: 1rem; display: flex; align-items: center; gap: 16px;
  background-size: 200% 100%;
  animation: gradientShift 8s ease infinite;
}
@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.quote-banner .bq-icon { font-size: 2rem; flex-shrink: 0; opacity: 0.6; }
.quote-banner blockquote { font-style: italic; opacity: 0.97; line-height: 1.6; }
.quote-banner cite { font-size: 0.82rem; opacity: 0.7; display: block; margin-top: 4px; }

/* ============================================
   内容区
   ============================================ */
.content {
  padding: 44px 56px 64px; max-width: 1100px;
}

/* 章节标题 */
.section-title {
  font-size: 1.45rem; font-weight: 800; color: var(--text-main);
  margin-bottom: 24px; padding-bottom: 12px;
  border-bottom: 3px solid var(--primary);
  display: flex; align-items: center; gap: 10px;
}
.section-title .st-icon { font-size: 1.2rem; }

/* 通用卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; margin: 24px 0;
}

.card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card h3 { font-size: 1.05rem; margin-bottom: 10px; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.card h3 .icon { font-size: 1.2rem; }
.card p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.75; }
.card a { display: inline-block; margin-top: 12px; color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.card a:hover { text-decoration: underline; }

/* 引言卡片 */
.intro-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 28px 32px; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary); margin: 24px 0;
}
.intro-card p { font-size: 0.95rem; color: var(--text-main); line-height: 1.85; }

/* ============================================
   详情页结构
   ============================================ */
.page-header {
  padding: 44px 56px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  position: relative;
}
.page-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; width: 80px; height: 3px;
  background: var(--primary);
}
.page-header h1 {
  font-size: 1.85rem; font-weight: 900; color: var(--text-main);
  margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
}
.page-header p { color: var(--text-muted); font-size: 0.95rem; }

.page-content { padding: 40px 56px 64px; max-width: 900px; }

/* ============================================
   内容条目
   ============================================ */
.content-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 28px 32px; margin-bottom: 24px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  position: relative;
}
.content-item::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, var(--primary), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.content-item h3 {
  font-size: 1.15rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.content-item h3 .ci-icon { font-size: 1.2rem; }
.content-item h3 .ci-tag {
  font-size: 0.7rem; background: var(--primary-light); color: var(--primary);
  padding: 2px 10px; border-radius: 20px; font-weight: 600; margin-left: auto;
}
.content-item > p {
  font-size: 0.92rem; color: var(--text-main); line-height: 1.8; margin-bottom: 14px;
}
.content-item ul { padding-left: 20px; margin-top: 10px; }
.content-item li { font-size: 0.9rem; color: var(--text-main); line-height: 1.8; margin-bottom: 7px; }
.content-item li strong { color: var(--text-main); font-weight: 700; }

.highlight {
  background: linear-gradient(90deg, rgba(201,48,44,0.08), rgba(201,48,44,0.02));
  border-left: 3px solid var(--primary);
  padding: 14px 18px; border-radius: 0 6px 6px 0;
  margin-top: 14px; font-size: 0.92rem; color: var(--text-main); line-height: 1.75;
}
.highlight strong { color: var(--primary); }

.quote-text {
  font-style: italic; color: var(--text-muted); font-size: 0.88rem;
  padding: 12px 18px; border-left: 3px solid var(--primary);
  background: rgba(0,0,0,0.02); border-radius: 0 4px 4px 0;
  margin-top: 12px; line-height: 1.75;
}
.quote-text::before { content: '" '; font-size: 1.2em; color: var(--primary); }
.quote-text::after { content: ' "'; font-size: 1.2em; color: var(--primary); }

/* ============================================
   原文引用块（带日期）
   ============================================ */
.raw-quote {
  background: #fffbf0; border: 1px solid #f0e0b0;
  border-left: 4px solid var(--gold); border-radius: 0 6px 6px 0;
  padding: 16px 20px; margin-top: 16px; font-size: 0.88rem; color: #5a4a2a; line-height: 1.8;
}
.raw-quote .rq-source { font-size: 0.78rem; color: #a08050; margin-top: 8px; font-weight: 600; }
.raw-quote::before { content: '📜 '; }

/* ============================================
   时间线样式
   ============================================ */
.timeline {
  position: relative; padding-left: 28px; margin-top: 16px;
}
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--primary), rgba(201,48,44,0.2));
}
.timeline-item { position: relative; margin-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 6px;
  width: 12px; height: 12px; background: var(--primary);
  border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary);
}
.timeline-item p { font-size: 0.88rem; color: var(--text-main); line-height: 1.7; }
.timeline-item .tl-year { font-weight: 700; color: var(--primary); font-size: 0.85rem; }

/* ============================================
   对比表格
   ============================================ */
.compare-table {
  width: 100%; border-collapse: collapse; margin-top: 16px;
  font-size: 0.88rem; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.compare-table th {
  background: var(--sidebar-bg); color: #fff;
  padding: 12px 16px; text-align: left; font-weight: 700;
}
.compare-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:nth-child(even) td { background: rgba(0,0,0,0.02); }
.compare-table .good { color: var(--green); font-weight: 700; }
.compare-table .bad { color: var(--primary); font-weight: 700; }

/* ============================================
   标签系统
   ============================================ */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-block; background: rgba(201,48,44,0.08);
  color: var(--primary); font-size: 0.75rem;
  padding: 3px 12px; border-radius: 20px; font-weight: 600;
}
.tag.blue { background: rgba(41,128,185,0.08); color: var(--blue); }
.tag.gold { background: rgba(212,160,23,0.1); color: #9a7b0a; }
.tag.green { background: rgba(39,174,96,0.08); color: var(--green); }

/* ============================================
   案例卡片
   ============================================ */
.case-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 28px 32px; margin-bottom: 28px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.case-card .cc-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.case-card h3 { font-size: 1.2rem; font-weight: 800; color: var(--text-main); flex: 1; }
.case-card .case-meta {
  font-size: 0.8rem; color: var(--primary); margin-bottom: 14px;
  font-weight: 600; display: flex; gap: 12px; flex-wrap: wrap;
}
.case-card p { font-size: 0.88rem; color: var(--text-main); line-height: 1.8; margin-bottom: 8px; }
.case-card ul { padding-left: 20px; }
.case-card li { font-size: 0.88rem; color: var(--text-main); line-height: 1.75; margin-bottom: 5px; }
.case-card .cc-insight {
  background: linear-gradient(90deg, rgba(201,48,44,0.06), rgba(201,48,44,0.02));
  border-left: 3px solid var(--primary); padding: 12px 16px;
  border-radius: 0 6px 6px 0; margin-top: 14px;
  font-size: 0.88rem; color: var(--text-main); line-height: 1.7;
}
.case-card .cc-insight strong { color: var(--primary); }

/* ============================================
   思维导图页
   ============================================ */
.mindmap-container { padding: 44px 56px; min-height: calc(100vh - 200px); }
.mindmap { position: relative; padding: 40px; overflow-x: auto; }
.mm-center {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 24px 36px; border-radius: 12px;
  font-weight: 900; font-size: 1.15rem; text-align: center;
  max-width: 300px; margin: 0 auto;
  box-shadow: 0 4px 20px rgba(201,48,44,0.35);
  position: relative; z-index: 2;
}
.mm-center::before {
  content: ''; position: absolute; inset: -8px;
  border: 2px solid rgba(201,48,44,0.2); border-radius: 16px;
}
.mm-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; margin-top: 36px;
}
.mm-branch {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
}
.mm-branch h4 { font-size: 0.98rem; font-weight: 700; margin-bottom: 14px; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.mm-branch ul { list-style: none; padding: 0; }
.mm-branch li {
  font-size: 0.85rem; color: var(--text-main); padding: 7px 0;
  border-bottom: 1px dashed var(--border); display: flex; align-items: flex-start; gap: 10px;
}
.mm-branch li:last-child { border-bottom: none; }
.mm-branch li::before { content: '→'; color: var(--primary); flex-shrink: 0; font-weight: 800; }

/* ============================================
   名言卡片
   ============================================ */
.quote-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 18px; margin-top: 24px; }
.quote-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 20px 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  position: relative;
}
.quote-card .qc-icon { font-size: 1.5rem; margin-bottom: 10px; }
.quote-card h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.quote-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; font-style: italic; }

/* ============================================
   分隔线
   ============================================ */
.divider {
  height: 1px; background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 36px 0;
}
.divider-text {
  text-align: center; margin: 36px 0;
  position: relative; color: var(--text-muted); font-size: 0.85rem;
}
.divider-text::before, .divider-text::after {
  content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: var(--border);
}
.divider-text::before { left: 0; }
.divider-text::after { right: 0; }

/* ============================================
   页脚
   ============================================ */
.footer {
  text-align: center; padding: 32px;
  color: var(--text-muted); font-size: 0.8rem;
  border-top: 1px solid var(--border); margin-top: 40px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: 260px; }
  .sidebar.collapsed .sidebar-brand, .sidebar.collapsed .nav-section-title,
  .sidebar.collapsed .nav-item, .sidebar.collapsed .sidebar-footer { opacity: 1; pointer-events: all; }
  .sidebar.collapsed ~ .main, .sidebar.mobile-open ~ .main { margin-left: 0; }
  .main { margin-left: 0; }
  .hamburger { display: flex !important; align-items: center; justify-content: center; }
  .content, .page-header, .page-content, .mindmap-container, .hero { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 72px; }
  .hero h1 { font-size: 1.6rem; }
  .hero-stats { gap: 16px; flex-wrap: wrap; }
  .card-grid { grid-template-columns: 1fr; }
  .quote-banner { padding: 16px 20px; }
  .section-title { font-size: 1.2rem; }
  .compare-table { font-size: 0.8rem; }
  .quote-cards { grid-template-columns: 1fr; }
}

/* ============================================
   通用布局
   ============================================ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* 特殊：金色高亮 */
.gold-border { border-left: 4px solid var(--gold) !important; }
.gold-border::before { background: linear-gradient(to bottom, var(--gold), rgba(212,160,23,0.2)) !important; }
