/* ============ Global ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-main: radial-gradient(circle at top left, #020617 0, #020617 35%, #020617 100%);
  --bg-card: rgba(15, 23, 42, 0.82);
  --bg-card-light: rgba(15, 23, 42, 0.96);
  --border-soft: rgba(148, 163, 184, 0.35);
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.2);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --thumb-radius: 14px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.8);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding-top: 32px;
}

/* ============ App Layout ============ */
.app-shell {
  display: flex;
  width: min(1400px, 100vw);   /* 整体框稍微宽一点 */
  height: auto;
  margin: 0 auto 20px;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.96),
    rgba(15, 23, 42, 0.85)
  );
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);

  resize: both;
  overflow: auto;
  max-width: 100vw;
  max-height: calc(100vh - 40px);
}

/* 左右分割条：拖动调整 sidebar 宽度 */
.sidebar-resizer {
  width: 6px;
  cursor: col-resize;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0.05),
    rgba(59, 130, 246, 0.9),
    rgba(15, 23, 42, 0.05)
  );
  border-left: 1px solid rgba(15, 23, 42, 0.9);
  border-right: 1px solid rgba(15, 23, 42, 0.9);
}

/* ============ Sidebar ============ */
.sidebar {
  width: 360px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: radial-gradient(circle at top, #020617, #020617 65%, #020617);
}

.sidebar-header {
  display: flex;
  gap: 14px;
  padding: 22px 22px 14px;
}

/* 圆形头像 */
.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.sidebar-subtitle {
  font-size: 14px;
  color: #a5b4fc;
  font-style: italic;
  margin-top: 0;
  margin-bottom: 12px;
}

.sidebar-motto {
  margin-top: 6px;
  font-size: 12px;
  color: #e5e7eb;
  line-height: 1.8;
}

/* HOME 和下面目录之间的分割线 */
.nav-group-divider {
  height: 1px;
  margin: 10px 0 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    rgba(248, 250, 252, 0.1),
    rgba(96, 165, 250, 0.9),
    rgba(15, 23, 42, 0.1)
  );
}

/* ============ View Toggle + Directory Title ============ */

/* 顶部视图切换：做成小标签 */
.view-toggle {
  display: flex;
  gap: 40px;
  padding: 0 20px 6px;
  margin: 10px 0 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  justify-content: center;
  width: 100%;
}

/* 切换按钮 */
.view-toggle-btn {
  flex: 0 0 auto;
  min-width: 110px;
  font-size: 11px;
  padding: 4px 18px;
  text-align: center;

  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.6);
  color: rgba(156, 163, 175, 0.95);
  cursor: pointer;
  transition:
    background 0.15s ease-out,
    color 0.15s ease-out,
    border 0.15s ease-out,
    transform 0.12s ease-out;
}

.view-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(191, 219, 254, 0.7);
  background: rgba(15, 23, 42, 0.9);
}

.view-toggle-btn.active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.9),
    rgba(37, 99, 235, 0.9)
  );
  color: #e5e7eb;
  border-color: rgba(191, 219, 254, 0.95);
}

/* 顶部目录标题：All venues / All topics */
.category-header {
  padding: 6px 18px 4px;
}

.category-main-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(191, 219, 254, 0.78);
  cursor: pointer;
  user-select: none;
}

/* 小圆点 */
.category-main-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #60a5fa;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.8);
}

/* hover 有一点点亮 */
.category-main-title:hover {
  color: rgba(226, 232, 240, 0.96);
}

/* 选中 All 时的状态 */
.category-main-title.active {
  color: #e5e7eb;
  font-weight: 500;
}

/* ============ Directory List ============ */

.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 230px;
  overflow-y: auto;
  padding: 0 16px 0 16px;
}

/* 顶层 venue/topic 项 */
.category-item {
  width: 100%;
  text-align: left;
  font-size: 13px;
  padding: 4px 9px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.2);
  color: rgba(209, 213, 219, 0.96);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background 0.16s ease-out,
    color 0.16s ease-out,
    border 0.16s ease-out,
    transform 0.12s ease-out;
}

.category-item:hover {
  background: rgba(30, 64, 175, 0.85);
  border-color: rgba(191, 219, 254, 0.75);
  transform: translateY(-1px);
}

.category-item.active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.98),
    rgba(30, 64, 175, 0.98)
  );
  border-color: rgba(191, 219, 254, 0.9);
  color: #e5e7eb;
}

/* 二级目录 */
.category-venue-group {
  margin-bottom: 4px;
}

/* 展开/折叠：箭头 + 标题在一行 */
.category-main-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* 箭头本身 */
.category-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  font-size: 11px;
  opacity: 0.9;
  cursor: pointer;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

/* 折叠时箭头旋转 */
.category-item[data-collapsed="true"] .category-chevron {
  transform: rotate(-90deg);
  opacity: 0.7;
}

/* 顶层标题：Venue / Topic 名 */
.category-title {
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.1em;
  color: rgba(239, 246, 255, 0.96);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 论文列表 */
.paper-list {
  margin: 1px 0 3px 16px;
  padding-left: 8px;
  border-left: 1px solid rgba(37, 99, 235, 0.65);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 子标题：paper 名称，改成最多两行，不是一个省略号 */
.paper-title {
  font-size: 12px;
  font-weight: 400;
  color: rgba(209, 213, 219, 0.9);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* 单条论文项 */
.paper-item {
  width: 100%;
  text-align: left;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.45);
  color: rgba(209, 213, 219, 0.95);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background 0.16s ease-out,
    color 0.16s ease-out,
    border 0.16s ease-out,
    transform 0.12s ease-out;
}

.paper-item:hover {
  background: rgba(37, 99, 235, 0.92);
  border-color: rgba(191, 219, 254, 0.9);
  color: #f9fafb;
  transform: translateY(-1px);
}

.paper-item.active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 1),
    rgba(37, 99, 235, 0.98)
  );
  border-color: rgba(219, 234, 254, 0.98);
  color: #f9fafb;
}

/* 数量的小角标 */
.category-item-count {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.9);
}

.paper-item-count {
  font-size: 10px;
  color: rgba(148, 163, 184, 0.8);
}

/* Directory 滚动条美化 */
.category-list::-webkit-scrollbar {
  width: 4px;
}
.category-list::-webkit-scrollbar-track {
  background: transparent;
}
.category-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.7);
  border-radius: 999px;
}

/* ============ Sidebar Thumbs ============ */
.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(148, 163, 184, 0.85);
  margin: 8px 6px 6px;
}

/* FIGURES 上方渐变分割线 */
.sidebar-list .section-label:first-child {
  position: relative;
  padding-top: 10px;
  margin-top: 10px;
}

.sidebar-list .section-label:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    rgba(248, 250, 252, 0.1),
    rgba(96, 165, 250, 0.9),
    rgba(15, 23, 42, 0.1)
  );
}

.thumb-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  margin-bottom: 6px;
  border-radius: var(--thumb-radius);
  cursor: pointer;
  transition:
    background 0.16s ease-out,
    transform 0.12s ease-out,
    box-shadow 0.16s ease-out;
  border: 1px solid transparent;
  position: relative;
}

.thumb-item:hover {
  background: rgba(31, 41, 55, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.55);
}

.thumb-item.active {
  background: rgba(30, 64, 175, 0.88);
  border-color: rgba(191, 219, 254, 0.8);
  box-shadow: 0 12px 32px rgba(30, 64, 175, 0.9);
}

.thumb-image-wrap {
  flex-shrink: 0;
  width: 74px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: #020617;
  border: 1px solid rgba(31, 41, 55, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
}

.thumb-title {
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.thumb-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.thumb-badge {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.8);
  color: #e5e7eb;
}

/* ============ Sidebar Footer ============ */
.sidebar-footer {
  margin-top: auto;
  padding: 8px 18px 14px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-muted);
}

.sidebar-footer .footer-line:first-child {
  color: rgba(209, 213, 219, 0.98);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
}

.sidebar-footer .footer-line + .footer-line {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.9);
}

.sidebar-footer a {
  color: #bfdbfe;
  text-decoration: none;
}
.sidebar-footer a:hover {
  color: #e5e7eb;
}

/* ============ Viewer ============ */
.viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 18px;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 2px 14px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.95);
  margin-bottom: 12px;
}

.viewer-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.viewer-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.viewer-subline {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.viewer-progress {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: rgba(191, 219, 254, 0.95);
  background: radial-gradient(circle at top left, #0b1120, #020617);
}

.viewer-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 右侧卡片变窄，居中放在 viewer 区域内 */
.viewer-card {
  flex: 1;
  min-height: 0;
  max-width: 860px;
  margin: 0 auto;
  border-radius: 20px;
  background: #f9fafb;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.4);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

/* 顶部：左边标签信息 + 右边工具栏 */
.viewer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}

.viewer-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 标签行 */
.viewer-tag-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

/* 标签 */
.viewer-tag {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.viewer-tag.secondary {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

/* 标签下面的小说明文字 */
.tag-caption {
  font-size: 11px;
  color: #9ca3af;
}

/* 右侧工具栏：缩放 + 模式 */
.viewer-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* 缩放按钮区域 */
.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}

.zoom-btn {
  min-width: 38px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease-out,
    color 0.15s ease-out,
    border 0.15s ease-out,
    transform 0.12s ease-out;
}

.zoom-btn:hover {
  background: #1d4ed8;
  border-color: #bfdbfe;
  transform: translateY(-1px);
}

.zoom-btn:active {
  transform: translateY(0);
}

/* 交互模式：做成一个小「标签栏」 */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
}

/* 胶囊底板 */
.mode-pill-group {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: #e5e7eb;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

/* 模式按钮：浅色风格 */
.mode-btn {
  min-width: 52px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease-out,
    color 0.15s ease-out,
    box-shadow 0.15s ease-out,
    transform 0.12s ease-out;
}

.mode-btn:hover {
  transform: translateY(-1px);
}

/* 选中模式：白底 + 细小阴影 */
.mode-btn.active {
  background: #ffffff;
  color: #111827;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
}

/* 图像区域 */
.viewer-image-frame {
  flex: 1;
  min-height: 0;
  background: radial-gradient(circle at top, #e5e7eb, #f9fafb 40%, #e5e7eb);
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  position: relative;   /* 让箭头等绝对定位 */
  overflow: auto;
}

.viewer-image-frame img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  display: block;
  transform-origin: center center;
}

/* 不同模式的鼠标形状 */
.viewer-image-frame.mode-click {
  cursor: default;
}

.viewer-image-frame.mode-zoom {
  cursor: zoom-in;
}

.viewer-image-frame.mode-drag {
  cursor: grab;
}

.viewer-image-frame.mode-drag.panning {
  cursor: grabbing;
}

/* 放大镜 lens */
.magnifier-lens {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  border: 2px solid rgba(37, 99, 235, 0.95);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.6);
  pointer-events: none;
  display: none;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: rgba(249, 250, 251, 0.4);
  mix-blend-mode: normal;
}

/* 悬浮在图展示框右侧中间的左右箭头（白色透明） */
.nav-arrows {
  position: absolute;          /* 相对 .viewer-image-frame 定位 */
  top: 50%;                    /* 垂直居中 */
  right: 18px;                 /* 靠右一点 */
  transform: translateY(-50%); /* 自身向上移半个高度，实现居中 */
  display: flex;
  gap: 8px;
  z-index: 30;                 /* 比放大镜等都高一点 */
  pointer-events: none;        /* 容器不吃事件，只让按钮吃 */
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;

  /* 边框稍微粗一点 & 更实一点 */
  border: 1.5px solid rgba(255, 255, 255, 0.9);

  /* 透明度降低 = 更不透明，更醒目 */
  background: rgba(255, 255, 255, 0.85);

  /* 箭头本身变粗一点 */
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.3);
  transition: background 0.15s ease-out, transform 0.12s ease-out,
              box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

/* 悬停效果可以保留/微调 */
.nav-btn:hover {
  background: #ffffff;
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.45);
}


.nav-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Notes block */
.notes-block {
  margin-top: 6px;
  padding: 8px 10px 10px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.notes-title {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
}

.notes-hint {
  font-size: 11px;
  color: #9ca3af;
}

#figureNotes {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
}

#figureNotes:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa22;
}

/* Footer */
.viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.viewer-footer a {
  color: #bfdbfe;
  text-decoration: none;
  border-bottom: 1px dotted rgba(191, 219, 254, 0.7);
}

.viewer-footer a:hover {
  color: #e5e7eb;
  border-bottom-style: solid;
}

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
    height: auto;
    resize: none;
    max-height: none;
  }

  .sidebar {
    width: 100%;
    height: 260px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .sidebar-resizer {
    display: none;
  }

  .sidebar-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
  }

  .thumb-item {
    min-width: 230px;
  }

  .viewer {
    height: calc(100vh - 260px - 40px);
  }

  .viewer-card {
    max-width: 100%;
  }
}


