/* 量化交易开发修炼手册 - 现代科技风格样式 */

/* 引入全局样式 */
@import url('/assets/style/style.css');

/* Quant Trading Course-specific styles override */

/* Course-specific styling */
.course-layout {
  display: flex;
  min-height: calc(100vh - 200px);
}

.course-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 0;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  border-radius: var(--border-radius);
}

.page-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

.content-block {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.content-block h2 {
  margin-bottom: 1rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-list {
  list-style: none;
  padding-left: 0;
}

.feature-list li {
  padding: 0.75rem 0 0.75rem 2rem;
  position: relative;
}

.feature-list li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success-color);
  font-weight: bold;
}

.grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.card {
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.card-text {
  color: var(--text-color);
  line-height: 1.6;
}

.tip-box {
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.tip-box.success {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid var(--success-color);
}

.tip-box.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--warning-color);
}

.tip-box.info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--info-color);
}

.tip-box .icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.tip-box .content .title {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table th {
  background: var(--primary-color);
  color: white;
  font-weight: bold;
}

table tr:hover {
  background: var(--hover-bg);
}

code {
  background: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  padding: 1rem;
}

.chapter-nav a {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: background 0.3s;
}

.chapter-nav a:hover {
  background: var(--primary-dark);
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Formula display */
.formula {
  background: var(--code-bg);
  padding: 1rem 2rem;
  text-align: center;
  font-size: 1.1rem;
  margin: 1rem 0;
  border-radius: var(--border-radius);
  overflow-x: auto;
}

/* Alert boxes */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--warning-color);
}

.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--info-color);
}

/* Responsive design */
@media (max-width: 768px) {
  .course-layout {
    flex-direction: column;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
  .formula {
    background: #2d2d2d;
  }
}

.dark .formula {
  background: #2d2d2d;
}

/* ========== 课程页面带左侧目录的布局 ========== */
.course-layout {
  display: flex;
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* 左侧目录 */
.course-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height, 64px) + var(--spacing-xl));
  height: calc(100vh - var(--header-height, 64px) - var(--spacing-2xl));
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
}

.course-sidebar-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.toc-nav {
  list-style: none;
}

.toc-nav li {
  margin-bottom: 2px;
}

.toc-nav a {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  border-left: 2px solid transparent;
}

.toc-nav a:hover {
  background: rgba(0, 212, 255, 0.05);
  color: var(--text-primary);
}

.toc-nav a.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--primary);
  border-left-color: var(--primary);
}

.toc-section {
  margin-bottom: var(--spacing-lg);
}

.toc-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  user-select: none;
}

.toc-section-title::after {
  content: '▸';
  font-size: 0.8em;
  margin-left: auto;
  opacity: 0.4;
  transition: transform 0.2s ease;
  display: inline-block;
}

.toc-section.open > .toc-section-title::after {
  transform: rotate(90deg);
}

.toc-section > ul {
  display: none;
}

.toc-section.open > ul {
  display: block;
}

.toc-section-title .section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

/* 主内容区 */
.course-main {
  flex: 1;
  min-width: 0;
}

/* 移动端隐藏侧边栏 */
@media (max-width: 1024px) {
  .course-sidebar {
    display: none;
  }

  .course-layout {
    display: block;
  }

  .course-main {
    width: 100%;
  }
}

/* 移动端目录按钮 */
.mobile-toc-btn {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--gradient-secondary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: var(--shadow-lg), var(--glow-purple);
  z-index: 1001;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-toc-btn:hover {
  transform: scale(1.1);
}

@media (max-width: 1024px) {
  .mobile-toc-btn {
    display: flex;
  }
}

/* 移动端目录弹窗 */
.mobile-toc-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  padding: var(--spacing-xl);
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.mobile-toc-modal.open {
  display: block;
}

.mobile-toc-content {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  max-width: 400px;
  margin: 0 auto;
  border: 1px solid var(--border-color);
}

.mobile-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.mobile-toc-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.mobile-toc-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mobile-toc-close:hover {
  background: rgba(255, 255, 255, 0.15);
}
