/* MOMENTUM Project Page - Custom Styles
   Based on ZipNeRF template (jonbarron.info/zipnerf) with enhancements */

/* ===== Typography ===== */
body, td, th, tr, p, a {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #333;
}

h2 { font-weight: 700; }
h3 {
  font-weight: 700;
  margin-top: 45px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f0f0f0;
}

/* ===== Links ===== */
a { color: #1772d0; text-decoration: none; }
a:focus, a:hover { color: #f09228; text-decoration: none; }

/* ===== List Inline (Authors) ===== */
.list-inline { list-style: none; margin-left: -0.5em; margin-right: -0.5em; padding-left: 0; }
.list-inline > li { display: inline-block; margin-left: 0.5em; margin-right: 0.5em; }

/* ===== Conference Badge ===== */
.conference-badge {
  display: inline-block;
  padding: 4px 14px;
  background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
  color: #fff;
  font-weight: 700;
  font-size: 0.85em;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* ===== Resource Navigation Pills ===== */
.nav-pills.nav-justified > li {
  display: inline-block;
  float: none;
  width: auto;
}
.nav-pills.nav-justified {
  text-align: center;
}
.nav-pills > li > a {
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.9em;
}
.nav-pills > li > a h4 {
  margin: 4px 0 0;
  font-size: 13px;
}
.nav-pills > li > a:hover { background: #f5f5f5; }
.nav-pills > li > a image, .nav-pills > li > a img { display: block; margin: 0 auto 5px; }

.nav-pills > li.disabled > a {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-pills > li.disabled > a h4 { color: #999; }

.nav-pills > li.active-link > a {
  background: #1772d0;
  color: #fff;
  border-radius: 6px;
}
.nav-pills > li.active-link > a h4 { color: #fff; }
.nav-pills > li.active-link > a:hover { background: #1565c0; }

/* ===== Hero Video ===== */
.hero-video-container {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  margin: 10px 0 20px;
}
.hero-video-container video {
  display: block;
  width: 100%;
}
.hero-poster {
  width: 100%;
  display: block;
  border-radius: 8px;
}

/* ===== Metrics Banner ===== */
.metrics-banner {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  padding: 30px 0;
  margin: 30px 0;
  border-top: 2px solid #f0f0f0;
  border-bottom: 2px solid #f0f0f0;
  background: #fafbfc;
  border-radius: 8px;
}
.metric-item {
  text-align: center;
  padding: 12px 18px;
  min-width: 120px;
}
.metric-value {
  display: block;
  font-size: 2.4em;
  font-weight: 900;
  color: #1772d0;
  line-height: 1.1;
}
.metric-label {
  display: block;
  font-size: 0.78em;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 4px;
}

/* ===== Figure Containers ===== */
.figure-container {
  margin: 25px 0;
  text-align: center;
}
.figure-img {
  max-width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: box-shadow 0.3s ease;
}
.figure-img:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}
.figure-caption {
  margin-top: 12px;
  font-size: 0.88em;
  color: #555;
  line-height: 1.5;
}

/* ===== Mermaid Diagrams ===== */
.mermaid-container {
  margin: 25px 0;
  padding: 20px;
  background: #fafbfc;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow-x: auto;
}

/* ===== Demo Video Embeds ===== */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
}

/* ===== Demo Video Placeholders ===== */
.demo-placeholder {
  background: linear-gradient(135deg, #1a237e 0%, #283593 30%, #1565c0 70%, #0d47a1 100%);
  border-radius: 8px;
  padding: 70px 20px;
  text-align: center;
  color: white;
  margin: 20px 0;
  position: relative;
  overflow: hidden;
}
.demo-placeholder::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 60%);
}
.demo-placeholder .demo-icon {
  font-size: 3em;
  opacity: 0.6;
  margin-bottom: 15px;
}
.demo-placeholder p {
  font-size: 1.1em;
  color: rgba(255,255,255,0.8);
  margin: 0;
}
.demo-placeholder .demo-title {
  font-size: 1.3em;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

/* ===== Cross-Modal Coherence Bar Chart ===== */
.coherence-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 280px;
  padding: 20px 10px 0;
  margin: 30px 0 10px;
  border-bottom: 2px solid #e0e0e0;
}
.bar-group {
  text-align: center;
  flex: 1;
  padding: 0 8px;
}
.bar-pair {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  height: 220px;
}
.bar {
  width: 36px;
  border-radius: 4px 4px 0 0;
  transition: height 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  height: 0;
  position: relative;
}
.bar.baseline { background: #cfd8dc; }
.bar.momentum { background: #1772d0; }
.bar .bar-value {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75em;
  font-weight: 700;
  white-space: nowrap;
}
.bar.baseline .bar-value { color: #78909c; }
.bar.momentum .bar-value { color: #1772d0; }
.bar-label {
  margin-top: 8px;
  font-size: 0.8em;
  color: #555;
}
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 15px 0 5px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: #555;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.legend-swatch.baseline-swatch { background: #cfd8dc; }
.legend-swatch.momentum-swatch { background: #1772d0; }

/* ===== Results Tables ===== */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92em;
}
.results-table th {
  background: #f5f7fa;
  padding: 12px 14px;
  border-bottom: 2px solid #dee2e6;
  font-weight: 700;
  text-align: left;
  color: #333;
}
.results-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #eee;
}
.results-table tr:hover td { background: #f8f9ff; }
.results-table .highlight-cell {
  background: #e8f5e9;
  font-weight: 700;
  color: #2e7d32;
}
.results-table .accent-cell {
  color: #1772d0;
  font-weight: 700;
}

/* ===== Code Blocks ===== */
.code-block {
  background: #f5f7fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 18px 20px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  color: #37474f;
  position: relative;
}
.code-block .code-comment { color: #78909c; }
.code-block .code-command { color: #1772d0; font-weight: 600; }
.code-block .code-flag { color: #e65100; }

/* ===== BibTeX ===== */
.CodeMirror {
  font-size: 0.85em;
  height: auto;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}
.CodeMirror-scroll {
  overflow-y: hidden;
  overflow-x: auto;
}

/* ===== Section Dividers ===== */
.section-divider {
  margin: 50px 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

/* ===== Benchmarks Page Specifics ===== */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.95em;
}
.back-link:hover { color: #f09228; }

.category-card {
  border: 1px solid #e0e0e0;
  border-left: 4px solid #1772d0;
  border-radius: 4px;
  padding: 20px 24px;
  margin: 15px 0;
  background: #fff;
}
.category-card.cat-tool-selection { border-left-color: #e53935; }
.category-card.cat-relevance { border-left-color: #43a047; }
.category-card.cat-memory { border-left-color: #1e88e5; }
.category-card.cat-context { border-left-color: #ff9800; }
.category-card.cat-multi-turn { border-left-color: #8e24aa; }
.category-card.cat-error { border-left-color: #f4511e; }
.category-card.cat-edge { border-left-color: #00897b; }
.category-card.cat-adversarial { border-left-color: #d81b60; }

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.category-header h4 { margin: 0; font-weight: 700; }
.category-count {
  display: inline-block;
  background: #f0f0f0;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 700;
  color: #555;
}

.example-test {
  background: #f8f9fa;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 12px 16px;
  margin: 8px 0;
  font-size: 0.9em;
}
.example-test .test-input { color: #1772d0; font-weight: 600; }
.example-test .test-expected { color: #43a047; }

/* ===== Progress Bars (Category Accuracy) ===== */
.accuracy-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}
.accuracy-bar {
  flex: 1;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}
.accuracy-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
  background: #1772d0;
}
.accuracy-bar-fill.high { background: #43a047; }
.accuracy-bar-fill.medium { background: #ff9800; }
.accuracy-bar-fill.low { background: #e53935; }
.accuracy-value {
  font-weight: 700;
  font-size: 0.9em;
  min-width: 45px;
  text-align: right;
}

/* ===== Table of Contents (Benchmarks) ===== */
.toc {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 20px 25px;
  margin: 20px 0 30px;
}
.toc h4 { margin-top: 0; font-weight: 700; }
.toc ol { padding-left: 20px; margin: 0; }
.toc li { padding: 3px 0; }
.toc a { font-size: 0.95em; }

/* ===== Demo Carousel ===== */
.demo-carousel-section {
  margin: 30px 0 10px;
}
.demo-carousel-section h3 {
  margin-top: 20px;
}
#demo-carousel {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 10px;
}
#demo-carousel .item img {
  width: 100%;
  display: block;
}
#demo-carousel .item a {
  display: block;
  text-decoration: none;
  color: inherit;
}
#demo-carousel .carousel-caption {
  background: rgba(0,0,0,0.6);
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 20px;
  text-align: left;
}
#demo-carousel .carousel-caption h4 {
  margin: 0 0 4px;
  font-size: 1.1em;
  font-weight: 700;
}
#demo-carousel .carousel-caption p {
  margin: 0;
  font-size: 0.88em;
  opacity: 0.85;
}
#demo-carousel .carousel-indicators {
  bottom: 5px;
}
#demo-carousel .carousel-indicators li {
  border-color: rgba(255,255,255,0.6);
}
#demo-carousel .carousel-indicators .active {
  background-color: #fff;
}
#demo-carousel .carousel-control {
  background-image: none;
  width: 8%;
}
#demo-carousel .carousel-control .glyphicon {
  font-size: 24px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* ===== Sidebar TOC ===== */
#sidebar-toc {
  position: fixed;
  left: 16px;
  top: 80px;
  width: 200px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 0.78em;
  z-index: 100;
  display: none;
}
#sidebar-toc h4 {
  font-size: 0.85em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  margin: 0 0 10px;
  padding: 0 0 6px;
  border-bottom: 1px solid #e0e0e0;
}
#sidebar-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
#sidebar-toc li {
  margin: 0;
}
#sidebar-toc li a {
  display: block;
  padding: 3px 0 3px 12px;
  color: #888;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.5;
}
#sidebar-toc li a:hover {
  color: #333;
  text-decoration: none;
}
#sidebar-toc li a.toc-active {
  color: #1772d0;
  border-left-color: #1772d0;
  font-weight: 600;
}
#sidebar-toc .toc-group-label {
  display: block;
  padding: 10px 0 3px 0;
  font-size: 0.9em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #aaa;
}

/* Scrollbar styling for sidebar */
#sidebar-toc::-webkit-scrollbar { width: 3px; }
#sidebar-toc::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ===== Responsive ===== */
@media (min-width: 1400px) {
  #sidebar-toc { display: block; }
}

@media (max-width: 768px) {
  .metric-value { font-size: 1.8em; }
  .metric-item { padding: 8px 10px; min-width: 45%; }
  h2 { font-size: 1.4em; }
  h3 { font-size: 1.2em; }
  .demo-placeholder { padding: 50px 15px; }
  .bar { width: 24px; }
  .coherence-chart { height: 220px; }
  .bar-pair { height: 170px; }
  .nav-pills > li { margin-bottom: 8px; }
  .category-card { padding: 15px 18px; }
}

@media print {
  .demo-placeholder { background: #f0f0f0 !important; color: #333 !important; }
  .hero-video-container { box-shadow: none; }
  a { color: #333; }
  .metrics-banner { border: 1px solid #ccc; }
}
