/* ═══════════════════════════════════════════════════════════════
   sm-annotate.css — Classroom annotation overlay + floating toolbar
   ═══════════════════════════════════════════════════════════════ */

/* Host must establish positioning context for the overlay */
.sm-annotate-host {
  position: relative;
}

/* SVG overlay — above tool content, below main SM toolbar (900) */
.sm-annotate-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  overflow: visible;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.sm-annotate-overlay.sm-annotate-mode-off {
  pointer-events: none;
}

.sm-annotate-overlay.sm-annotate-mode-on {
  pointer-events: all;
}

.sm-annotate-overlay.sm-annotate-hidden {
  visibility: hidden;
}

/* Strokes ignore hits unless erasing */
.sm-annotate-overlay path,
.sm-annotate-overlay line {
  pointer-events: none;
}

.sm-annotate-overlay.sm-annotate-eraser path,
.sm-annotate-overlay.sm-annotate-eraser line {
  cursor: crosshair;
  pointer-events: stroke;
}

.sm-annotate-overlay.sm-annotate-eraser path:hover,
.sm-annotate-overlay.sm-annotate-eraser line:hover {
  filter: drop-shadow(0 0 3px rgba(255, 0, 0, 0.6));
}

.sm-annotate-stroke-root {
  pointer-events: none;
}

.sm-annotate-overlay.sm-annotate-select-mode .sm-annotate-stroke-root {
  cursor: default;
}

.sm-annotate-overlay.sm-annotate-select-mode .sm-annotate-stroke-root path,
.sm-annotate-overlay.sm-annotate-select-mode .sm-annotate-stroke-root line {
  pointer-events: stroke;
  cursor: pointer;
}

.sm-annotate-stroke-root.sm-annotate-selected path,
.sm-annotate-stroke-root.sm-annotate-selected line {
  filter: drop-shadow(0 0 2px var(--sm-indigo)) drop-shadow(0 0 4px var(--sm-indigo));
}

.sm-annotate-marquee {
  fill: rgba(99, 102, 241, 0.12);
  stroke: var(--sm-indigo);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.sm-annotate-ui-layer {
  pointer-events: none;
}

.sm-annotate-btn.sm-annotate-delete-sel[disabled] {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ── Floating toolbar ─────────────────────────────────────────── */
.sm-annotate-toolbar {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
  padding: 6px 10px;
  background: var(--sm-surface-raised);
  border: 1px solid var(--sm-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  user-select: none;
  -webkit-user-select: none;
}

.sm-annotate-toolbar.sm-visible {
  display: flex;
}

.sm-annotate-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-height: 44px;
  flex-shrink: 0;
  margin-right: 2px;
  border-radius: 8px;
  color: var(--sm-text-muted);
  cursor: grab;
}

.sm-annotate-grip:active {
  cursor: grabbing;
}

.sm-annotate-grip svg {
  width: 14px;
  height: 14px;
  opacity: 0.65;
}

.sm-annotate-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.sm-annotate-sep {
  width: 1px;
  height: 28px;
  background: var(--sm-border);
  flex-shrink: 0;
  margin: 0 4px;
}

.sm-annotate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--sm-text);
  cursor: pointer;
  transition: background var(--sm-transition-fast);
}

.sm-annotate-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .sm-annotate-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sm-annotate-btn:focus-visible {
  outline: 2px solid var(--sm-indigo);
  outline-offset: 1px;
}

.sm-annotate-btn svg {
  width: 22px;
  height: 22px;
}

.sm-annotate-btn.sm-active {
  background: var(--sm-indigo);
  color: #fff;
}

.sm-annotate-btn.sm-active:hover {
  background: var(--sm-indigo);
  opacity: 0.92;
}

.sm-annotate-colour {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform var(--sm-transition-fast), border-color var(--sm-transition-fast);
}

.sm-annotate-colour:hover {
  transform: scale(1.08);
}

.sm-annotate-colour:focus-visible {
  outline: 2px solid var(--sm-indigo);
  outline-offset: 2px;
}

.sm-annotate-colour.sm-active {
  border-color: var(--sm-text);
  box-shadow: 0 0 0 1px var(--sm-surface-raised);
}

.sm-annotate-colour.sm-annotate-colour-white {
  border: 1px solid var(--sm-border);
}

.sm-annotate-colour.sm-annotate-colour-white.sm-active {
  border-color: var(--sm-text);
}

/* Main toolbar: annotate mode active */
.sm-toolbar-btn.sm-annotate-pen-active {
  background: var(--sm-indigo);
  color: #fff;
}

.sm-toolbar-btn.sm-annotate-pen-active:hover {
  background: var(--sm-indigo);
  opacity: 0.92;
}

[data-theme="dark"] .sm-annotate-toolbar {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
