/* ============================================================
   PDF kommentieren / annotieren - eigenes Stylesheet
   Prefix: .annot-*  und  #ann-*
   ============================================================ */

.annot-card {
  max-width: 1280px;
  margin: 40px auto var(--space-8);
  padding: var(--space-6);
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
@media (max-width: 640px) {
  .annot-card { margin-top: 24px; padding: var(--space-4); }
}

/* ---- Dropzone ---- */
.annot-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-2xl);
  padding: var(--space-10) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.annot-dropzone:hover,
.annot-dropzone.drag-over {
  border-color: var(--color-primary);
  border-style: solid;
  background: var(--color-primary-light, rgba(37, 99, 235, 0.05));
}
.annot-dropzone-title { font-size: 18px; font-weight: var(--font-bold); color: var(--text-primary); }
.annot-dropzone-subtitle { font-size: 13px; color: var(--text-secondary); }
.annot-privacy {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: 12px; color: var(--text-secondary); margin: var(--space-3) 0 0;
}

/* ---- Toolbar ---- */
.annot-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary, #f8fafc);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}
.annot-tool-group {
  display: flex; align-items: center; gap: var(--space-2);
  padding-right: var(--space-3);
  border-right: 1px solid var(--border-color);
}
.annot-tool-group:last-child { border-right: none; padding-right: 0; }
.annot-tool-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.annot-tool-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.annot-tool-btn.active {
  background: var(--color-primary, #2563eb);
  border-color: var(--color-primary, #2563eb);
  color: #fff;
}
.annot-tool-btn.active svg { color: #fff; }

.annot-tool-colors { gap: 6px; }
.annot-color {
  width: 24px; height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: transform 0.15s;
  padding: 0;
}
.annot-color:hover { transform: scale(1.1); }
.annot-color.active {
  box-shadow: 0 0 0 2px var(--color-primary, #2563eb);
  transform: scale(1.15);
}

.annot-tool-stroke { gap: 8px; font-size: 12px; color: var(--text-secondary); }
.annot-tool-stroke input[type="range"] { width: 90px; }
.annot-label { font-size: 12px; color: var(--text-secondary); }

.annot-tool-actions { margin-left: auto; gap: 8px; }

/* ---- Workspace ---- */
.annot-workspace {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-4);
  min-height: 70vh;
}
@media (max-width: 900px) {
  .annot-workspace { grid-template-columns: 1fr; }
}

/* ---- Canvas-Container ---- */
.annot-canvas-wrap {
  position: relative;
  background: #e5e7eb;
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: 80vh;
  padding: var(--space-4);
}
.annot-canvas-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.annot-page {
  position: relative;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.annot-page-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}
.annot-page-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
  pointer-events: none;
}
.annot-page-svg { z-index: 3; }
.annot-page-label {
  position: absolute;
  bottom: 6px; right: 8px;
  font-size: 11px; color: #6b7280;
  background: rgba(255,255,255,0.85);
  padding: 2px 6px; border-radius: 4px;
  z-index: 4;
  pointer-events: none;
}

/* Cursor je nach Werkzeug */
.annot-canvas-wrap[data-tool="note"]      .annot-page { cursor: crosshair; }
.annot-canvas-wrap[data-tool="highlight"] .annot-page { cursor: crosshair; }
.annot-canvas-wrap[data-tool="pen"]       .annot-page { cursor: crosshair; }
.annot-canvas-wrap[data-tool="arrow"]     .annot-page { cursor: crosshair; }

/* Items im Overlay */
.annot-item { position: absolute; pointer-events: auto; }
.annot-item-note {
  width: 22px; height: 22px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #111;
  cursor: help;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}
.annot-item-highlight {
  opacity: 0.4;
  border-radius: 2px;
  pointer-events: none;
}

/* Loading */
.annot-loading {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}
.annot-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary, #2563eb);
  border-radius: 50%;
  animation: annot-spin 0.8s linear infinite;
}
@keyframes annot-spin { to { transform: rotate(360deg); } }

/* ---- Sidebar ---- */
.annot-sidebar {
  background: var(--bg-secondary, #f8fafc);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 80vh;
  overflow-y: auto;
}
.annot-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
}
.annot-sidebar-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.annot-counter {
  background: var(--color-primary, #2563eb);
  color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.annot-list { display: flex; flex-direction: column; gap: 6px; }
.annot-empty {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin: var(--space-4) 0;
}
.annot-list-item {
  display: grid;
  grid-template-columns: 8px 1fr 24px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-primary, #fff);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s;
}
.annot-list-item:hover { border-color: var(--color-primary, #2563eb); }
.annot-list-item-bullet {
  width: 8px; height: 8px; border-radius: 50%;
}
.annot-list-item-title {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
}
.annot-list-item-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.annot-list-item-del {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}
.annot-list-item-del:hover { background: #fee2e2; color: #dc2626; }

/* ---- Modal ---- */
.annot-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.annot-modal[hidden] { display: none; }
.annot-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
}
.annot-modal-dialog {
  position: relative;
  background: var(--bg-primary, #fff);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-xl, 0 20px 50px rgba(0,0,0,0.25));
}
.annot-modal-dialog h3 { margin: 0 0 var(--space-3); font-size: 16px; }
.annot-modal-dialog textarea {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: vertical;
  min-height: 90px;
  box-sizing: border-box;
}
.annot-modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: var(--space-3);
}

/* ---- Mobile responsive: Sidebar wird zu Bottom-Sheet ---- */
@media (max-width: 900px) {
  .annot-toolbar {
    position: relative;
    padding: var(--space-2) var(--space-3);
    gap: 6px;
  }
  .annot-tool-group {
    padding-right: 8px;
  }
  .annot-tool-btn span { display: none; }
  .annot-tool-actions { margin-left: auto; }

  .annot-sidebar {
    max-height: 40vh;
    position: sticky;
    bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
  }
}

@media (max-width: 480px) {
  .annot-tool-stroke { display: none; }
}
