/* annotate.css — Annotation tool styles
   All classes prefixed .ann- to avoid collisions with page styles */

/* ── Toolbar ─────────────────────────────────────────────────────── */
.ann-toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99998;
  display: flex;
  gap: 6px;
  align-items: center;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  font-family: system-ui, sans-serif;
}

.ann-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 32px;
  color: #475569;
  cursor: grab;
  font-size: 16px;
  user-select: none;
  flex-shrink: 0;
  padding-right: 2px;
}
.ann-drag-handle:hover { color: #94a3b8; }
.ann-drag-handle:active { cursor: grabbing; }

.ann-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s, color 0.15s;
}
.ann-btn:hover { background: #334155; color: #f1f5f9; }
.ann-btn.ann-active { background: #2d4691; color: #fff; }
.ann-btn-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0 4px;
  color: #94a3b8;
  user-select: none;
}
.ann-toolbar.ann-mode-on .ann-btn-label { color: #60a5fa; }

/* ── Hit layer (annotation mode) ─────────────────────────────────── */
.ann-hit-layer {
  position: fixed;
  inset: 0;
  z-index: 99997;
  cursor: crosshair;
}

/* ── Pin canvas (absolute, full document size) ────────────────────── */
.ann-pin-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none; /* pins themselves re-enable pointer-events */
}

/* ── Individual pin ───────────────────────────────────────────────── */
.ann-pin {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -100%) rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: transform 0.15s;
  border: 2px solid rgba(255,255,255,0.3);
}
.ann-pin:hover { transform: translate(-50%, -100%) rotate(-45deg) scale(1.15); }
.ann-pin-num {
  transform: rotate(45deg);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  user-select: none;
  line-height: 1;
}

/* ── Popover ──────────────────────────────────────────────────────── */
.ann-popover {
  position: fixed;
  z-index: 99999;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 16px;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: #e2e8f0;
}
.ann-popover h4 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ann-popover textarea {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  padding: 8px;
  resize: vertical;
  min-height: 72px;
  outline: none;
  margin-bottom: 10px;
}
.ann-popover input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 8px;
  outline: none;
  margin-bottom: 10px;
}
.ann-colors {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.ann-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}
.ann-color-swatch:hover { transform: scale(1.2); }
.ann-color-swatch.ann-selected { border-color: #fff; transform: scale(1.15); }
.ann-popover-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.ann-popover-actions button {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ann-btn-save { background: #2d4691; color: #fff; }
.ann-btn-save:hover { background: #3b5bdb; }
.ann-btn-cancel { background: #334155; color: #94a3b8; }
.ann-btn-cancel:hover { background: #475569; color: #e2e8f0; }
.ann-btn-delete { background: #7f1d1d; color: #fca5a5; }
.ann-btn-delete:hover { background: #991b1b; }
.ann-btn-edit { background: #334155; color: #94a3b8; }
.ann-btn-edit:hover { background: #475569; color: #e2e8f0; }

/* ── View popover meta ────────────────────────────────────────────── */
.ann-meta {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 8px;
}
.ann-view-text {
  background: #0f172a;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
}
.ann-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── List panel ───────────────────────────────────────────────────── */
.ann-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  z-index: 99998;
  background: #1e293b;
  border-left: 1px solid #334155;
  box-shadow: -4px 0 24px rgba(0,0,0,0.35);
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}
.ann-panel.ann-open { transform: translateX(0); }
.ann-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}
.ann-panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
}
.ann-panel-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.ann-panel-close:hover { color: #f1f5f9; }
.ann-panel-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}
.ann-panel-empty {
  padding: 32px 16px;
  text-align: center;
  color: #475569;
  font-size: 13px;
}
.ann-panel-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid #0f172a;
  transition: background 0.1s;
}
.ann-panel-row:hover { background: #0f172a; }
.ann-panel-pin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
}
.ann-panel-body { flex: 1; min-width: 0; }
.ann-panel-snippet {
  font-size: 13px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.ann-panel-meta {
  font-size: 11px;
  color: #64748b;
}

/* ── Toast ────────────────────────────────────────────────────────── */
.ann-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999999;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: #e2e8f0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.ann-toast.ann-show { opacity: 1; }
