/* ============================================================
   viewer.css — PDF viewer, toolbar, annotations, compare
   ============================================================ */

/* ── Viewer toolbar ── */
.viewer-toolbar {
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 6px;
  flex-shrink: 0;
  overflow-x: auto;
}
.viewer-toolbar-left   { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.viewer-toolbar-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; flex-shrink: 0; }
.viewer-toolbar-right  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.page-control { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.page-input {
  width: 44px; height: 30px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  outline: none;
}
.zoom-label {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  min-width: 52px;
  text-align: center;
  user-select: none;
}

/* ── Viewer body layout ── */
.viewer-body { flex: 1; display: flex; overflow: hidden; }

/* ── PDF canvas area ── */
.pdf-area {
  flex: 1;
  background: #374151;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 16px;
  position: relative;
}

.pdf-page-wrapper {
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  border-radius: 4px;
  overflow: visible; /* allow pins to overflow */
}

/* PDF.js canvas */
.pdf-page-wrapper canvas { display: block; }

/* ── Placeholder (shown when no real PDF) ── */
.pdf-placeholder {
  width: 600px;
  min-height: 780px;
  background: white;
  border-radius: 4px;
  padding: 48px;
  position: relative;
}
.pdf-placeholder-inner { display: flex; flex-direction: column; gap: 12px; }
.pdf-ph-line { height: 12px; background: #F1F5F9; border-radius: 6px; }
.pdf-ph-line.wide    { width: 80%; }
.pdf-ph-line.medium  { width: 60%; }
.pdf-ph-line.short   { width: 40%; }
.pdf-ph-line.heading { height: 20px; width: 50%; background: #E2E8F0; margin-bottom: 8px; }
.pdf-ph-box {
  height: 160px;
  background: linear-gradient(135deg, #F0F4FF, #E8F0FE);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: #93C5FD;
  margin: 16px 0;
}

/* ── Annotation pins ── */
.annotation-pin {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.annotation-pin:hover { transform: rotate(-45deg) scale(1.15); }
.annotation-pin .pin-inner {
  width: 10px; height: 10px;
  background: white;
  border-radius: 50%;
  transform: rotate(45deg);
}
.annotation-pin .pin-label {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  background: var(--sidebar-bg);
  color: white;
  font-size: 9px; font-weight: 700;
  padding: 3px 6px; border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis;
}
.annotation-pin:hover .pin-label { opacity: 1; }

/* ── Drawing canvas overlay ── */
.draw-canvas {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10;
  border-radius: 4px;
}
.draw-canvas.active { pointer-events: all; cursor: crosshair; }

/* ── Comment panel ── */
.comment-panel {
  width: 320px;
  background: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.comment-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.comment-panel-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; }
.comment-count {
  background: var(--accent); color: white;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
}
.comment-filters { display: flex; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.comment-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.comment-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.comment-item:hover { border-color: rgba(59,130,246,0.3); background: var(--surface); }
.comment-item.resolved { opacity: 0.55; }

.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comment-avatar { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: white; flex-shrink: 0; }
.comment-author { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.comment-time   { font-size: 10px; color: var(--text-muted); margin-left: auto; }
.comment-page-tag { font-size: 10px; font-weight: 600; color: var(--text-secondary); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.comment-text   { font-size: 12.5px; color: var(--text-primary); line-height: 1.5; margin-bottom: 8px; }
.comment-actions { display: flex; gap: 6px; align-items: center; }
.comment-action-btn { font-size: 10px; font-weight: 600; color: var(--text-muted); cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: var(--transition-fast); border: 1px solid transparent; }
.comment-action-btn:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border); }
.resolve-btn { margin-left: auto; color: var(--success); }
.resolve-btn:hover { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.2); }

.comment-add-box   { padding: 12px; border-top: 1px solid var(--border); }
.comment-hint      { font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.comment-input-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.comment-textarea {
  width: 100%; min-height: 64px;
  padding: 10px 12px;
  border: none; outline: none;
  font-family: 'Manrope', sans-serif;
  font-size: 12.5px; color: var(--text-primary);
  resize: none; background: white;
}
.comment-textarea::placeholder { color: var(--text-muted); }
.comment-input-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.comment-submit {
  padding: 5px 12px;
  background: var(--accent); color: white;
  border: none; border-radius: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 11px; font-weight: 700;
  cursor: pointer; transition: var(--transition-fast);
}
.comment-submit:hover { background: #2563EB; }

/* ── Version panel (dropdown) ── */
.version-panel {
  position: fixed;
  right: 320px; top: 128px;
  width: 260px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}
.version-panel.open { display: block; animation: slideInR 0.2s ease; }
.version-panel-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.version-list-inner { padding: 8px; }
.version-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition-fast); }
.version-item:hover { background: var(--surface); }
.version-item.current { background: rgba(59,130,246,0.05); }
.v-badge { width: 32px; height: 32px; background: linear-gradient(135deg, var(--accent), #2563EB); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; }
.v-badge.old { background: var(--surface-2); color: var(--text-secondary); }
.v-info { flex: 1; }
.v-name { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.v-date { font-size: 10px; color: var(--text-muted); }
.v-tick { color: var(--accent); font-size: 14px; }
.version-panel-footer { padding: 10px 16px; border-top: 1px solid var(--border); }

/* ── Compare view ── */
.compare-bar {
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}
.compare-bar-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; }
.compare-versions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.compare-version-tag { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.cvt-left  { background: rgba(59,130,246,0.1); color: var(--accent); }
.cvt-right { background: rgba(6,182,212,0.1); color: var(--accent-2); }
.compare-vs { font-size: 11px; color: var(--text-muted); font-weight: 600; }

.compare-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.compare-pane {
  overflow: auto;
  background: #374151;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 12px;
}
.compare-pane:first-child { border-right: 2px solid rgba(59,130,246,0.4); }
.compare-pane-label { align-self: stretch; text-align: center; padding: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; border-radius: 4px; }
.compare-pane-label.v1 { background: rgba(59,130,246,0.2); color: #93C5FD; }
.compare-pane-label.v2 { background: rgba(6,182,212,0.2); color: #67E8F9; }

/* Sync scroll toggle */
.sync-toggle { width: 32px; height: 18px; border-radius: 9px; cursor: pointer; position: relative; transition: background 0.2s; flex-shrink: 0; }
.sync-knob { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: all 0.2s; }
