/* T11: PDF 注釈ビューア(テキストレイヤ＋ハイライト/メモ オーバレイ)。
   文献パネル/レビューキュー両ビューアで共有。CSP: style-src 'self' 適合。 */

/* canvas を包む位置基準。canvas の中央寄せ余白はここへ移す。 */
.annot-wrap {
  position: relative;
  margin: 8px auto;
}
.annot-wrap > canvas {
  display: block;
  margin: 0;
}

/* ── テキストレイヤ(pdf.js renderTextLayer 互換の最小スタイル) ── */
.annot-textlayer {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  line-height: 1;
  z-index: 1;
}
.annot-textlayer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
}
.annot-textlayer ::selection { background: rgba(0, 100, 255, 0.3); }
.annot-textlayer ::-moz-selection { background: rgba(0, 100, 255, 0.3); }
/* renderTextLayer が生成する整列補助要素 */
.annot-textlayer .endOfContent {
  display: block;
  position: absolute;
  inset: 100% 0 0;
  z-index: -1;
  cursor: default;
  user-select: none;
}

/* ── ハイライト/メモ オーバレイ ── */
.annot-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* 既定は素通し(テキスト選択を妨げない) */
}
/* 閲覧モード(mode=none)では個々のハイライトをクリック可能に */
.annot-overlay.annot-view .annot-hl,
.annot-overlay.annot-view .annot-note-badge { pointer-events: auto; }

.annot-hl {
  position: absolute;
  background: rgba(255, 235, 59, 0.4);
  border-radius: 1px;
  cursor: pointer;
  mix-blend-mode: multiply;
}
.annot-note-badge {
  position: absolute;
  width: 16px;
  height: 16px;
  margin-left: -4px;
  margin-top: -10px;
  color: #b8860b;
  background: #fffbe6;
  border: 1px solid #e0c200;
  border-radius: 50%;
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ── 注釈ツールバー(モード/色) ── */
.annot-toolbar .annot-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
}
.annot-toolbar .annot-swatch.active { border-color: #333; }
.annot-toolbar .annot-mode.active { background-color: #0d6efd; color: #fff; }

/* ── 編集ポップオーバー ── */
.annot-popover {
  position: fixed;
  z-index: 2000;
  width: 240px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  padding: 8px;
  font-size: 13px;
}
.annot-popover textarea {
  width: 100%;
  min-height: 60px;
  resize: vertical;
  font-size: 13px;
}
.annot-popover .annot-pop-swatches { display: flex; gap: 6px; margin: 6px 0; }

/* ── 注釈一覧 ── */
.annot-list { max-height: 200px; overflow-y: auto; font-size: 12px; }
.annot-list .annot-list-item { cursor: pointer; }
.annot-list .annot-list-item:hover { background: rgba(13, 110, 253, .08); }
