/*
 * ORC Annotate
 * Version: 1.4.4
 * Fixes:
 * - Sticky toolbar in content column
 * - Show / Hide annotations
 * - Eraser mode for highlights + drawings
 * - Note layer no longer blocks clicks to highlights
 */

.orc-annotate-root {
  position: relative;
  overflow: visible;
}

.orc-annotate-stage {
  position: relative;
  border-radius: 1rem;
  overflow: visible;
}

/* ===============================
   STICKY TOOLBAR
   =============================== */

.orc-annotate-toolbar-slot {
  position: sticky;
  top: var(--orc-annotate-sticky-top, 100px);
  z-index: 1040;
  width: 100%;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  overflow: visible;
}

.orc-annotate-toolbar-slot-inner {
  width: 100%;
  display: flex;
  justify-content: center;
}

.orc-annotate-toolbar-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  pointer-events: none;
}

.orc-annotate-toolbar {
  pointer-events: auto;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 999px;
  box-shadow: none;
  padding: 0.45rem 0.55rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(100% - 1rem);
}

.orc-annotate-toolbar .btn {
  border-radius: 999px;
}

.orc-annotate-toolbar .markup-mode-btn.active {
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2);
}

/* ===============================
   OVERLAY / LAYERS
   =============================== */

.orc-annotate-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.orc-annotate-overlay.is-drawing,
.orc-annotate-overlay.is-note {
  pointer-events: auto;
}

.orc-annotate-overlay.is-drawing,
.orc-annotate-overlay.is-note {
  cursor: crosshair;
}

.orc-annotate-draw-svg,
.orc-annotate-note-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* IMPORTANT: full layers should not catch clicks by default */
.orc-annotate-draw-svg {
  pointer-events: none;
}

.orc-annotate-note-layer {
  pointer-events: none;
}

/* In eraser mode, only actual drawn strokes should catch clicks */
.orc-annotate-root.orc-annotate-mode-eraser .orc-annotate-draw-svg * {
  pointer-events: visibleStroke;
}

/* ===============================
   HIGHLIGHTS
   =============================== */

.orc-annotate-highlight {
  border-radius: 0.2rem;
  padding: 0 0.05rem;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.orc-annotate-highlight.yellow {
  background: rgba(255, 230, 109, 0.78);
}

.orc-annotate-highlight.pink {
  background: rgba(255, 175, 204, 0.78);
}

.orc-annotate-highlight.blue {
  background: rgba(173, 216, 255, 0.78);
}

/* ===============================
   DRAWING
   =============================== */

.orc-annotate-path {
  fill: none;
  stroke: #dc3545;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: visibleStroke;
}

/* ===============================
   NOTES
   =============================== */

.orc-annotate-note {
  position: absolute;
  width: 220px;
  min-height: 120px;
  background: #fff7bf;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 0.75rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  overflow: hidden;
  pointer-events: auto;
}

.orc-annotate-note.selected {
  outline: 2px solid #0d6efd;
  outline-offset: 1px;
}

.orc-annotate-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(0,0,0,0.05);
  cursor: move;
  font-size: 0.85rem;
  font-weight: 600;
}

.orc-annotate-note-body {
  padding: 0.6rem;
}

.orc-annotate-note-body textarea {
  width: 100%;
  min-height: 80px;
  border: 0;
  background: transparent;
  resize: vertical;
  outline: none;
  font-size: 0.95rem;
}

.orc-annotate-note-delete {
  border: 0;
  background: transparent;
  line-height: 1;
  font-size: 1rem;
  padding: 0;
  color: #6c757d;
}

.orc-annotate-note-delete:hover {
  color: #dc3545;
}

/* ===============================
   BUTTON COLORS
   =============================== */

.btn-orc-highlight-yellow {
  background: rgba(255, 230, 109, 0.95);
  border-color: rgba(0,0,0,0.12);
  color: #212529;
}

.btn-orc-highlight-pink {
  background: rgba(255, 175, 204, 0.95);
  border-color: rgba(0,0,0,0.12);
  color: #212529;
}

.btn-orc-highlight-blue {
  background: rgba(173, 216, 255, 0.95);
  border-color: rgba(0,0,0,0.12);
  color: #212529;
}

/* ===============================
   SHOW / HIDE ANNOTATIONS
   =============================== */

.orc-annotate-root.orc-annotate-hidden .orc-annotate-overlay {
  display: none !important;
}

.orc-annotate-root.orc-annotate-hidden .orc-annotate-highlight {
  background: transparent !important;
}

/* ===============================
   ERASER AFFORDANCE
   =============================== */

.orc-annotate-root.orc-annotate-mode-eraser .orc-annotate-highlight {
  cursor: pointer;
}

.orc-annotate-root.orc-annotate-mode-eraser .orc-annotate-path {
  cursor: pointer;
}

.orc-annotate-root.orc-annotate-mode-eraser .orc-annotate-highlight:hover {
  outline: 1px dashed rgba(0,0,0,0.5);
}

.orc-annotate-root.orc-annotate-mode-eraser .orc-annotate-path:hover {
  stroke-width: 5;
}

/* ===============================
   RESPONSIVE
   =============================== */

@media (max-width: 991.98px) {
  .orc-annotate-toolbar-slot {
    min-height: 80px;
  }
}

@media (max-width: 767.98px) {
  .orc-annotate-toolbar {
    border-radius: 1rem;
    justify-content: center;
  }

  .orc-annotate-note {
    width: 190px;
  }
}