:root {
  --primary-color: #2196F3;
  --secondary-color: #FF4081;
  --accent-color: #4CAF50;
  --dark-bg: #1a237e;
  --light-bg: #f5f5f5;
  --text-dark: #333;
  --text-light: #fff;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
  color: var(--text-dark);
  margin: 0;
  padding: 0;
}

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 导航栏样式 */
.navbar-custom {
  background: linear-gradient(135deg, var(--dark-bg) 0%, #3f51b5 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-link {
  color: rgba(255,255,255,0.9) !important;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem !important;
  border-radius: 5px;
}

.nav-link:hover {
  background-color: rgba(255,255,255,0.1);
  color: var(--text-light) !important;
}

.nav-link.active {
  background-color: var(--primary-color);
  color: var(--text-light) !important;
}

/* 下拉菜单样式 */
.dropdown-menu {
  background: white;
  border: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 0.5rem 0;
  min-width: 200px;
}

.dropdown-item {
  padding: 0.75rem 1.5rem;
  color: var(--text-dark);
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(33, 150, 243, 0.1);
  color: var(--primary-color);
  padding-left: 2rem;
}

.dropdown-item.active {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
  color: white;
}

.navbar-custom .dropdown-toggle::after {
  border-color: rgba(255, 255, 255, 0.7);
}

.navbar-custom .dropdown-menu {
  margin-top: 0.5rem;
}

/* 页面标题 */
.page-title {
  color: var(--dark-bg);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--primary-color);
}

/* 卡片样式 */
.content-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-title {
  color: var(--dark-bg);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* 按钮样式 */
.btn-custom {
  padding: 0.75rem 2rem;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
  color: white;
}

.btn-secondary-custom {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #E91E63 100%);
  color: white;
}

/* 列表样式 */
.feature-list {
  list-style: none;
  padding: 0;
}

.feature-list li {
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.icon-blue {
  background-color: rgba(33, 150, 243, 0.1);
  color: var(--primary-color);
}

.icon-pink {
  background-color: rgba(255, 64, 129, 0.1);
  color: var(--secondary-color);
}

.icon-green {
  background-color: rgba(76, 175, 80, 0.1);
  color: var(--accent-color);
}

/* 公式样式 */
.formula-box {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-left: 5px solid var(--primary-color);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  border-radius: 12px;
  font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow-x: auto;
}

.formula-box .katex-display {
  margin: 0.5em 0 !important;
}

.formula-box .katex {
  font-size: 1.1em !important;
}

/* 页脚 */
.footer {
  background: linear-gradient(135deg, var(--dark-bg) 0%, #3f51b5 100%);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: auto;
}

/* 响应式 */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  
  .content-card {
    padding: 1.5rem;
  }
}

/* 图表容器 */
.chart-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  padding: 1.5rem;
  margin: 2rem 0;
}

/* 进度条 */
.progress-custom {
  height: 10px;
  border-radius: 5px;
  background-color: #e0e0e0;
  overflow: hidden;
}

.progress-bar-custom {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  transition: width 0.6s ease;
}

/* 首页特定样式 */
.home-page .hero-section {
  padding: 4rem 0;
}

.home-page .hero-buttons {
  margin-top: 2rem;
}

/* 表单样式 */
.form-control, .form-select {
  border-radius: 8px;
  padding: 0.75rem;
  border: 1px solid #ddd;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25);
}

.form-label {
  font-weight: 500;
  color: var(--text-dark);
}

/* 表格样式 */
.table {
  border-radius: 8px;
  overflow: hidden;
}

.table thead {
  background-color: var(--dark-bg);
  color: white;
}

.table-bordered td, .table-bordered th {
  border: 1px solid #dee2e6;
}

.table-danger {
  background-color: rgba(220, 53, 69, 0.1) !important;
}

.table-success {
  background-color: rgba(40, 167, 69, 0.1) !important;
}

/* 警告框样式 */
.alert {
  border-radius: 8px;
  border: none;
}

.alert-info {
  background-color: rgba(33, 150, 243, 0.1);
  color: var(--primary-color);
}

.alert-success {
  background-color: rgba(76, 175, 80, 0.1);
  color: var(--accent-color);
}

.alert-danger {
  background-color: rgba(255, 64, 129, 0.1);
  color: var(--secondary-color);
}

/* 统计结果显示 */
.stats-result {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.stat-item {
  flex: 1;
  min-width: 150px;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--dark-bg);
}

/* 步骤流程样式 */
.step-number {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: bold;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}

/* ================================
   流程图样式 (Flowchart)
   ================================ */
.flowchart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  margin: 2rem 0;
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.05) 0%, rgba(63, 81, 181, 0.05) 100%);
  border-radius: 12px;
}

.flowchart-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.flowchart-node {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  text-align: center;
  min-width: 120px;
  max-width: 200px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.flowchart-node:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.flowchart-node.start,
.flowchart-node.end {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  border-radius: 20px;
}

.flowchart-node.process {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
}

.flowchart-node.decision {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
  transform: rotate(0deg);
}

.flowchart-node.decision-content {
  display: inline-block;
}

.flowchart-node.data {
  background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
  color: white;
  transform: skew(-10deg);
}

.flowchart-node.data-content {
  display: inline-block;
  transform: skew(10deg);
}

.flowchart-arrow {
  font-size: 1.5rem;
  color: var(--primary-color);
  font-weight: bold;
}

.flowchart-arrow-vertical {
  font-size: 1.5rem;
  color: var(--primary-color);
  font-weight: bold;
  padding: 0.5rem 0;
}

.flowchart-label {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.25rem;
}

.flowchart-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.flowchart-branch-label {
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
}

/* ================================
   序列图样式 (Sequence Diagram)
   ================================ */
.sequence-diagram {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  margin: 2rem 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

.sequence-participants {
  display: flex;
  justify-content: space-around;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 1rem;
}

.sequence-participant {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.sequence-participant-box {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1976D2 100%);
  color: white;
  border-radius: 8px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.sequence-lifeline {
  width: 2px;
  height: 300px;
  background: linear-gradient(180deg, var(--primary-color) 0%, rgba(33, 150, 243, 0.3) 100%);
  position: relative;
}

.sequence-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0;
}

.sequence-message {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(33, 150, 243, 0.05);
  border-radius: 8px;
  margin: 0.5rem 0;
}

.sequence-message-arrow {
  font-size: 1.25rem;
  color: var(--primary-color);
}

.sequence-message-text {
  flex: 1;
  font-weight: 500;
  color: var(--text-dark);
}

.sequence-message-note {
  font-size: 0.85rem;
  color: #888;
  font-style: italic;
}

/* ================================
   饼图/环形图容器样式
   ================================ */
.pie-chart-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem;
  margin: 2rem 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  align-items: center;
  justify-content: center;
}

.pie-chart-visual {
  width: 250px;
  height: 250px;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.pie-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pie-chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.pie-chart-legend-item:hover {
  background: rgba(33, 150, 243, 0.1);
}

.pie-chart-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.pie-chart-label {
  font-weight: 500;
  color: var(--text-dark);
}

.pie-chart-value {
  color: #666;
  margin-left: auto;
}

/* ================================
   对比表格增强样式
   ================================ */
.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.comparison-table thead {
  background: linear-gradient(135deg, var(--dark-bg) 0%, #3f51b5 100%);
  color: white;
}

.comparison-table th {
  padding: 1.25rem;
  font-weight: 600;
  text-align: left;
}

.comparison-table tbody tr {
  transition: background 0.2s ease;
}

.comparison-table tbody tr:nth-child(even) {
  background: rgba(33, 150, 243, 0.03);
}

.comparison-table tbody tr:hover {
  background: rgba(33, 150, 243, 0.08);
}

.comparison-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e0e0e0;
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-highlight {
  font-weight: 600;
  color: var(--primary-color);
}

.comparison-check {
  color: #4CAF50;
  font-size: 1.25rem;
}

.comparison-cross {
  color: #f44336;
  font-size: 1.25rem;
}

/* ================================
   决策树样式
   ================================ */
.decision-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  margin: 2rem 0;
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.05) 0%, rgba(245, 124, 0, 0.05) 100%);
  border-radius: 12px;
}

.decision-tree-node {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin: 0.5rem;
  position: relative;
}

.decision-tree-root {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
  margin-bottom: 1.5rem;
}

.decision-tree-branch {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.decision-tree-leaf {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  min-width: 150px;
}

.decision-tree-line {
  width: 2px;
  height: 1.5rem;
  background: var(--primary-color);
  margin: 0 auto;
}

.decision-tree-connector {
  height: 2px;
  background: var(--primary-color);
  flex: 1;
  max-width: 100px;
}

/* ================================
   统计卡片网格
   ================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card-enhanced {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-left: 4px solid var(--primary-color);
}

.stat-card-enhanced:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stat-card-enhanced.blue {
  border-left-color: #2196F3;
}

.stat-card-enhanced.green {
  border-left-color: #4CAF50;
}

.stat-card-enhanced.orange {
  border-left-color: #FF9800;
}

.stat-card-enhanced.purple {
  border-left-color: #9C27B0;
}

.stat-card-enhanced.red {
  border-left-color: #f44336;
}

.stat-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--dark-bg);
  margin: 0.5rem 0;
}

.stat-card-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.stat-card-sublabel {
  font-size: 0.8rem;
  color: #999;
}

/* ================================
   时间线样式
   ================================ */
.timeline {
  position: relative;
  padding: 2rem 0;
  margin: 2rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary-color) 0%, #3f51b5 100%);
  border-radius: 2px;
}

.timeline-item {
  display: flex;
  justify-content: flex-end;
  padding-right: 50%;
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item:nth-child(even) {
  justify-content: flex-start;
  padding-right: 0;
  padding-left: 50%;
}

.timeline-content {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  margin: 0 2rem;
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-item:nth-child(odd) .timeline-content {
  text-align: right;
}

.timeline-year {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

/* ================================
   金字塔图样式
   ================================ */
.pyramid-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  margin: 2rem 0;
}

.pyramid-level {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.25rem 0;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.pyramid-level:hover {
  transform: scale(1.02);
}

.pyramid-label-left,
.pyramid-label-right {
  font-size: 0.85rem;
  color: #666;
  padding: 0.25rem 0.5rem;
}

.pyramid-label-left {
  text-align: right;
  padding-right: 1rem;
}

.pyramid-label-right {
  text-align: left;
  padding-left: 1rem;
}

.pyramid-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0;
}

/* ================================
   响应式调整
   ================================ */
@media (max-width: 768px) {
  .flowchart-row {
    flex-direction: column;
  }

  .flowchart-arrow {
    transform: rotate(90deg);
  }

  .sequence-participants {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .sequence-lifeline {
    height: 200px;
  }

  .timeline::before {
    left: 20px;
  }

  .timeline-item,
  .timeline-item:nth-child(even) {
    padding-left: 50px;
    padding-right: 0;
    justify-content: flex-start;
  }

  .timeline-dot {
    left: 20px;
  }

  .timeline-content,
  .timeline-item:nth-child(odd) .timeline-content {
    text-align: left;
    margin: 0 0 0 1rem;
    max-width: none;
  }
}