/* ===== Papers Page Styles ===== */

/* --- Nav link active state --- */
.nav-link.active {
  color: #3b82f6;
  font-weight: 600;
}

/* --- Main Content --- */
.papers-main {
  padding: 0 0 80px;
  background: #f8fafc;
}

.papers-main-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

/* --- Sidebar Navigation --- */
.papers-sidebar {
  position: sticky;
  top: 80px;
  width: 200px;
  min-width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8ecf1;
  padding: 16px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e8ecf1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
  cursor: pointer;
}

.sidebar-link:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.sidebar-link.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-count {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 400;
}

.sidebar-link.active .sidebar-count {
  color: #93c5fd;
}

/* --- Papers Content Area --- */
.papers-content {
  flex: 1;
  min-width: 0;
}

/* --- Paper Section --- */
.section-anchor {
  scroll-margin-top: 64px;
}

.paper-grid-spaced {
  margin-bottom: 64px;
}

.paper-grid-spaced:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px 0 16px;
  border-bottom: 2px solid #f1f5f9;
  position: sticky;
  top: 64px;
  background: #f8fafc;
  z-index: 10;
}

.section-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  color: #fff;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.section-subtitle {
  font-size: 13px;
  color: #94a3b8;
}

/* --- Paper Grid --- */
.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* --- Paper Card --- */
.paper-card {
  display: block;
  background: #fff;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.25s;
  position: relative;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.paper-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.paper-card:hover .paper-link-icon {
  opacity: 1;
  color: #3b82f6;
}

.paper-link-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  opacity: 0;
  transition: all 0.25s;
}

.paper-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.paper-year {
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
  padding: 2px 8px;
  border-radius: 5px;
}

.paper-impact {
  font-size: 11px;
  color: #f59e0b;
  font-weight: 600;
}

.paper-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.paper-authors {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-source {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-style: italic;
}

.paper-abstract {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Paper Tags --- */
.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.paper-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}

.paper-tag.blue {
  color: #2563eb;
  background: #eff6ff;
}

.paper-tag.purple {
  color: #7c3aed;
  background: #f5f3ff;
}

.paper-tag.green {
  color: #16a34a;
  background: #f0fdf4;
}

.paper-tag.orange {
  color: #ea580c;
  background: #fff7ed;
}

.paper-tag.pink {
  color: #db2777;
  background: #fdf2f8;
}

.paper-tag.cyan {
  color: #0891b2;
  background: #ecfeff;
}

.paper-tag.yellow {
  color: #b45309;
  background: #fffbeb;
}

.paper-tag.indigo {
  color: #4f46e5;
  background: #eef2ff;
}

.paper-tag.teal {
  color: #0d9488;
  background: #f0fdfa;
}

.paper-tag.fuchsia {
  color: #a21caf;
  background: #fdf4ff;
}

.paper-tag.emerald {
  color: #059669;
  background: #ecfdf5;
}

/* --- Mobile TOC --- */
.mobile-toc-fab {
  display: none;
  position: fixed;
  bottom: 124px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 89;
  color: #6366f1;
  transition: all 0.3s;
}
.mobile-toc-fab svg { width: 20px; height: 20px; }
.mobile-toc-fab:active { transform: scale(0.92); }

.mobile-toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.mobile-toc-overlay.active { opacity: 1; pointer-events: auto; }

.mobile-toc-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 55vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12);
  z-index: 300;
  transform: translateY(100%);
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1);
  overflow: hidden;
  flex-direction: column;
}
.mobile-toc-panel.active { transform: translateY(0); pointer-events: auto; }

.mobile-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.mobile-toc-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.mobile-toc-close {
  width: 30px; height: 30px;
  border-radius: 8px; border: none;
  background: #f1f5f9; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.mobile-toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 24px;
  -webkit-overflow-scrolling: touch;
}

.mobile-toc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  transition: all 0.2s;
}
.mobile-toc-item:active { background: #f1f5f9; }
.mobile-toc-item.active {
  background: linear-gradient(135deg,#eff6ff,#f5f0ff);
  color: #3b82f6;
  font-weight: 600;
}
.mobile-toc-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.mobile-toc-count {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
}

/* --- Responsive --- */
@media (max-width: 1100px) {
  .papers-sidebar {
    display: none;
  }
  .mobile-toc-fab, .mobile-toc-overlay, .mobile-toc-panel {
    display: flex;
  }
  .papers-main-inner {
    max-width: 1200px;
  }
}

@media (max-width: 900px) {
  .paper-grid {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 17px;
  }
}

@media (max-width: 600px) {
  .papers-main-inner {
    padding: 0 16px;
  }

  .paper-card {
    padding: 14px;
  }

  .section-header {
    gap: 12px;
  }

  .section-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}
