/* annotate.css — user highlight marks and colour-picker popover */

/* ── Highlight marks ─────────────────────────────────────────────────────── */
mark.hl-mark {
  border-radius: 2px;
  cursor: pointer;
  padding: 0 1px;
  transition: filter 0.1s;
}
mark.hl-yellow { background: rgba(255, 235,  59, 0.45); }
mark.hl-green  { background: rgba(165, 214, 167, 0.55); }
mark.hl-blue   { background: rgba(144, 202, 249, 0.55); }
mark.hl-pink   { background: rgba(244, 143, 177, 0.55); }
mark.hl-mark:hover { filter: brightness(0.82); }
mark.hl-others { opacity: 0.4; }

/* Softer in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) mark.hl-yellow { background: rgba(255, 235,  59, 0.22); }
  :root:not([data-theme="light"]) mark.hl-green  { background: rgba(165, 214, 167, 0.28); }
  :root:not([data-theme="light"]) mark.hl-blue   { background: rgba(144, 202, 249, 0.28); }
  :root:not([data-theme="light"]) mark.hl-pink   { background: rgba(244, 143, 177, 0.28); }
}
:root[data-theme="dark"] mark.hl-yellow { background: rgba(255, 235,  59, 0.22); }
:root[data-theme="dark"] mark.hl-green  { background: rgba(165, 214, 167, 0.28); }
:root[data-theme="dark"] mark.hl-blue   { background: rgba(144, 202, 249, 0.28); }
:root[data-theme="dark"] mark.hl-pink   { background: rgba(244, 143, 177, 0.28); }

/* ── Others-highlight toggle button (in site header) ────────────────────── */
#hl-others-toggle {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  font-size: 1rem;
  background: var(--accent-light);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}
#hl-others-toggle:hover { background: var(--kbd-btn-hover); }
#hl-others-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Colour-picker / note popover ────────────────────────────────────────── */
/* Override: author-stylesheet display rules beat UA-stylesheet [hidden]{display:none}.
   Any element inside the popover that has display:flex/block set here needs its own rule. */
#hl-popover[hidden],
.hl-pop-colors[hidden],
.hl-pop-actions[hidden],
.hl-pop-note[hidden] { display: none; }

#hl-popover {
  position: fixed;
  z-index: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(240px, 92vw);
}

.hl-pop-colors {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
}

.hl-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.hl-color-btn:hover { transform: scale(1.2); border-color: var(--text-muted); }
@media (hover: none) {
  .hl-color-btn { width: 36px; height: 36px; }
}

.hl-pop-note {
  font-family: var(--font-tamil);
  font-size: 0.85rem;
  line-height: 1.6;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 4rem;
}
.hl-pop-note:focus { outline: none; border-color: var(--accent); }
.hl-pop-note[readonly] {
  background: var(--accent-light);
  color: var(--text-muted);
  border-color: transparent;
  cursor: default;
  resize: none;
}

.hl-pop-readonly {
  font-family: var(--font-tamil);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.15rem 0;
}

.hl-pop-actions { display: flex; flex-direction: column; gap: 0.3rem; }

.hl-delete-btn {
  font-family: var(--font-tamil);
  font-size: 0.82rem;
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  border-radius: 99px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  width: 100%;
}
.hl-delete-btn:hover { background: rgba(192, 57, 43, 0.08); }
