/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Roboto', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f7fa;
  transition: all 0.3s ease;
}

/* 暗色主题 */
body.dark {
  background-color: #1e1e2e;
  color: #e2e8f0;
}

/* 渐变背景 */
.gradient-bg {
  background: linear-gradient(135deg, #6366f1 0%, #10b981 100%);
  color: white;
}

/* 卡片式布局 */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body.dark .card {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background-color: #6366f1;
  color: white;
}

.btn-primary:hover {
  background-color: #4f46e5;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background-color: #10b981;
  color: white;
}

.btn-secondary:hover {
  background-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid #6366f1;
  color: #6366f1;
}

.btn-outline:hover {
  background-color: #6366f1;
  color: white;
}

body.dark .btn-outline {
  border-color: #818cf8;
  color: #818cf8;
}

body.dark .btn-outline:hover {
  background-color: #818cf8;
  color: white;
}

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

/* 导航栏 */
.navbar {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all 0.3s ease;
}

body.dark .navbar {
  background: #2d2d3f;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-logo {
  font-size: 24px;
  font-weight: 700;
  color: #6366f1;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-menu {
  display: flex;
  list-style: none;
  gap: 20px;
}

.navbar-menu li a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: color 0.3s ease;
}

body.dark .navbar-menu li a {
  color: #e2e8f0;
}

.navbar-menu li a:hover {
  color: #6366f1;
}

body.dark .navbar-menu li a:hover {
  color: #818cf8;
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

body.dark .navbar-toggle {
  color: #e2e8f0;
}

/* 主题切换按钮 */
.theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #333;
  transition: color 0.3s ease;
}

body.dark .theme-toggle {
  color: #e2e8f0;
}

/* 英雄区域 */
.hero {
  padding: 60px 0;
  text-align: center;
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #6366f1, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 30px;
  color: #666;
}

body.dark .hero p {
  color: #a3a3a3;
}

/* 学习路径 */
.learning-path {
  margin: 40px 0;
}

.path-timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}

.path-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: #e5e7eb;
}

body.dark .path-timeline::before {
  background: #4b5563;
}

.path-item {
  position: relative;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
}

.path-item:nth-child(odd) {
  flex-direction: row-reverse;
}

.path-content {
  flex: 1;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 0 20px;
  position: relative;
}

body.dark .path-content {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.path-content::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border: 10px solid transparent;
}

.path-item:nth-child(odd) .path-content::before {
  left: -20px;
  border-right-color: white;
}

body.dark .path-item:nth-child(odd) .path-content::before {
  border-right-color: #2d2d3f;
}

.path-item:nth-child(even) .path-content::before {
  right: -20px;
  border-left-color: white;
}

body.dark .path-item:nth-child(even) .path-content::before {
  border-left-color: #2d2d3f;
}

.path-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  border: 4px solid white;
  box-shadow: 0 0 0 2px #6366f1;
}

body.dark .path-dot {
  border-color: #2d2d3f;
}

.path-item.completed .path-dot {
  background: #10b981;
  box-shadow: 0 0 0 2px #10b981;
}

/* 代码编辑器 */
.editor-container {
  margin: 20px 0;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f3f4f6;
  padding: 10px 15px;
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid #e5e7eb;
}

body.dark .editor-header {
  background: #374151;
  border-bottom: 1px solid #4b5563;
}

.editor-title {
  font-weight: 600;
  color: #333;
}

body.dark .editor-title {
  color: #e2e8f0;
}

.editor-actions {
  display: flex;
  gap: 10px;
}

#editor {
  height: 400px;
  border-radius: 0 0 12px 12px;
}

.editor-output {
  margin-top: 20px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  min-height: 200px;
}

body.dark .editor-output {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* 数据集选择 */
.datasets-container {
  margin: 20px 0;
}

.datasets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.dataset-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.dataset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  border-color: #6366f1;
}

body.dark .dataset-card {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark .dataset-card:hover {
  border-color: #818cf8;
}

.dataset-card.active {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

body.dark .dataset-card.active {
  border-color: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

.dataset-name {
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

body.dark .dataset-name {
  color: #e2e8f0;
}

.dataset-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

body.dark .dataset-description {
  color: #a3a3a3;
}

/* 代码示例库 */
.examples-container {
  margin: 20px 0;
}

.examples-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.example-tab {
  padding: 8px 16px;
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.example-tab:hover {
  background: #e5e7eb;
}

.example-tab.active {
  background: #6366f1;
  color: white;
}

body.dark .example-tab {
  background: #374151;
  color: #e2e8f0;
}

body.dark .example-tab:hover {
  background: #4b5563;
}

body.dark .example-tab.active {
  background: #818cf8;
  color: white;
}

.examples-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.example-item {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.example-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body.dark .example-item {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.example-title {
  font-weight: 600;
  margin-bottom: 10px;
  color: #333;
}

body.dark .example-title {
  color: #e2e8f0;
}

.example-code {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 14px;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
  color: #333;
}

body.dark .example-code {
  background: #1f2937;
  color: #e2e8f0;
}

/* 函数速查表 */
.cheatsheet-container {
  position: sticky;
  top: 100px;
  height: fit-content;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

body.dark .cheatsheet-container {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.cheatsheet-title {
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
}

body.dark .cheatsheet-title {
  color: #e2e8f0;
}

.cheatsheet-category {
  margin-bottom: 15px;
}

.cheatsheet-category-title {
  font-weight: 500;
  margin-bottom: 10px;
  color: #6366f1;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.dark .cheatsheet-category-title {
  color: #818cf8;
}

.cheatsheet-functions {
  list-style: none;
  margin-left: 15px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.cheatsheet-functions.expanded {
  max-height: 500px;
}

.cheatsheet-function {
  margin-bottom: 8px;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  color: #333;
}

body.dark .cheatsheet-function {
  color: #e2e8f0;
}

.cheatsheet-function:hover {
  background-color: #f3f4f6;
}

body.dark .cheatsheet-function:hover {
  background-color: #374151;
}

/* 挑战页面 */
.challenges-container {
  margin: 20px 0;
}

.challenges-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.challenge-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.challenge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  border-color: #6366f1;
}

body.dark .challenge-card {
  background: #2d2d3f;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark .challenge-card:hover {
  border-color: #818cf8;
}

.challenge-card.completed {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

body.dark .challenge-card.completed {
  border-color: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

.challenge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.challenge-title {
  font-weight: 600;
  color: #333;
}

body.dark .challenge-title {
  color: #e2e8f0;
}

.challenge-difficulty {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.difficulty-easy {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.difficulty-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.difficulty-hard {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.challenge-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

body.dark .challenge-description {
  color: #a3a3a3;
}

/* 数据探索页面 */
.explore-container {
  margin: 20px 0;
}

.upload-area {
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  margin-bottom: 30px;
  transition: all 0.3s ease;
  background: white;
}

body.dark .upload-area {
  border-color: #4b5563;
  background: #2d2d3f;
}

.upload-area:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.05);
}

body.dark .upload-area:hover {
  background: rgba(129, 140, 248, 0.1);
}

.upload-area.dragover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

body.dark .upload-area.dragover {
  background: rgba(52, 211, 153, 0.1);
}

.upload-icon {
  font-size: 48px;
  color: #9ca3af;
  margin-bottom: 20px;
}

body.dark .upload-icon {
  color: #6b7280;
}

.upload-text {
  font-size: 16px;
  color: #666;
  margin-bottom: 20px;
}

body.dark .upload-text {
  color: #a3a3a3;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .navbar-menu {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    opacity: 0;
    visibility: hidden;
  }

  body.dark .navbar-menu {
    background: #2d2d3f;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
  }

  .navbar-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .navbar-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 36px;
  }

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

  .path-item {
    flex-direction: row !important;
    padding-left: 60px;
  }

  .path-dot {
    left: 20px;
  }

  .path-content::before {
    left: -20px !important;
    border-right-color: white !important;
  }

  body.dark .path-content::before {
    border-right-color: #2d2d3f !important;
  }

  .datasets-grid,
  .examples-list,
  .challenges-list {
    grid-template-columns: 1fr;
  }

  .cheatsheet-container {
    position: static;
  }
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* 加载动画 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.loading-panda {
  width: 60px;
  height: 60px;
  animation: pandaEat 2s infinite ease-in-out;
}

@keyframes pandaEat {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(15deg);
  }
}

/* 庆祝特效 */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background-color: #f00;
  border-radius: 50%;
  animation: confettiFall 3s ease-in-out forwards;
  z-index: 1000;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* 进度条 */
.progress-container {
  width: 100%;
  background: #e5e7eb;
  border-radius: 20px;
  height: 10px;
  margin: 10px 0;
  overflow: hidden;
}

body.dark .progress-container {
  background: #4b5563;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* 表格样式 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark .data-table {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.data-table th,
.data-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

body.dark .data-table th,
body.dark .data-table td {
  border-bottom: 1px solid #4b5563;
}

.data-table th {
  background-color: #f3f4f6;
  font-weight: 600;
  color: #333;
}

body.dark .data-table th {
  background-color: #374151;
  color: #e2e8f0;
}

.data-table tr:hover {
  background-color: #f9fafb;
}

body.dark .data-table tr:hover {
  background-color: #374151;
}

/* 响应式表格 */
@media (max-width: 768px) {
  .data-table {
    display: block;
    overflow-x: auto;
  }
}