/* ============================================================
   Annotations — inline commenting layer styles
   ============================================================ */

/* ---- Highlights ---- */
mark.ann-hl {
  background: rgba(255, 212, 59, 0.35);
  border-bottom: 2px solid rgba(255, 186, 8, 0.6);
  border-radius: 2px;
  padding: 0.05em 0;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}

mark.ann-hl:hover {
  background: rgba(255, 212, 59, 0.55);
  border-bottom-color: rgba(255, 160, 0, 0.8);
}

mark.ann-hl--active {
  background: rgba(255, 186, 8, 0.5);
  border-bottom-color: #f59e0b;
  animation: ann-pulse 0.6s ease-out;
}

mark.ann-hl--resolved {
  background: rgba(200, 200, 200, 0.2);
  border-bottom: 1px dashed rgba(150, 150, 150, 0.4);
}

mark.ann-hl--resolved:hover {
  background: rgba(200, 200, 200, 0.35);
}

@keyframes ann-pulse {
  0%   { background: rgba(255, 186, 8, 0.7); }
  100% { background: rgba(255, 186, 8, 0.5); }
}


/* ---- Tooltip (floating annotate button) ---- */
.ann-tooltip {
  position: absolute;
  z-index: 10000;
  pointer-events: auto;
  transform: translateX(-50%);
  transition: opacity 0.15s;
}

.ann-tooltip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05);
  transition: transform 0.15s, background 0.15s;
}

.ann-tooltip-btn:hover {
  background: #2563eb;
  transform: scale(1.1);
}

.ann-tooltip-btn:active {
  transform: scale(0.95);
}


/* ---- Sidebar ---- */
.ann-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  pointer-events: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: #1a1d23;
  line-height: 1.5;
}

.ann-sidebar * {
  box-sizing: border-box;
}

/* Toggle tab */
.ann-sidebar-toggle {
  pointer-events: auto;
  position: fixed;
  top: 80px;
  right: 0;
  z-index: 10000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #e2e5ea;
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  box-shadow: -2px 2px 8px rgba(0,0,0,0.08);
  transition: background 0.15s, right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: #5f6673;
  flex-shrink: 0;
}

.ann-sidebar-toggle:hover {
  background: #f0f2f5;
  color: #2563eb;
}

.ann-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Panel */
.ann-sidebar-panel {
  pointer-events: auto;
  width: 380px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e2e5ea;
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.ann-sidebar--open .ann-sidebar-panel {
  transform: translateX(0);
}

.ann-sidebar--open .ann-sidebar-toggle {
  right: 380px;
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* Header */
.ann-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e5ea;
  flex-shrink: 0;
}

.ann-sidebar-header h3 {
  font-size: 15px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}

.ann-sidebar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ann-toggle-resolved {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #5f6673;
  cursor: pointer;
  user-select: none;
}

.ann-toggle-resolved input {
  cursor: pointer;
  accent-color: #2563eb;
}

.ann-sidebar-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.ann-sidebar-close:hover {
  color: #1a1d23;
  background: #f3f4f6;
}

/* Body */
.ann-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  overscroll-behavior: contain;
}

.ann-sidebar-body::-webkit-scrollbar {
  width: 5px;
}

.ann-sidebar-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* Empty state */
.ann-empty {
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
}

.ann-empty p:first-child {
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 6px;
}

.ann-empty-hint {
  font-size: 13px;
}


/* ---- Annotation Card ---- */
.ann-card {
  background: #f8f9fb;
  border: 1px solid #e2e5ea;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: default;
}

.ann-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.ann-card--active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ann-card--resolved {
  opacity: 0.7;
}

.ann-card--new {
  background: #eff4ff;
  border-color: #93c5fd;
}

/* Quote excerpt */
.ann-card-quote {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  border-left: 3px solid #d1d5db;
  line-height: 1.45;
  word-break: break-word;
}

.ann-card--active .ann-card-quote {
  border-left-color: #2563eb;
}

/* Card header */
.ann-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ann-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.ann-avatar--sm {
  width: 20px;
  height: 20px;
  font-size: 9px;
}

.ann-author {
  font-size: 13px;
  font-weight: 600;
  color: #1a1d23;
}

.ann-time {
  font-size: 11px;
  color: #9ca3af;
  margin-left: auto;
}

.ann-resolved-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #16a34a;
  background: #f0fdf4;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Card body */
.ann-card-body {
  font-size: 13.5px;
  color: #374151;
  margin-bottom: 8px;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.55;
}

/* Card footer (action buttons) */
.ann-card-footer {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ann-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}


/* ---- Buttons ---- */
.ann-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid #e2e5ea;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: #5f6673;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  font-family: inherit;
}

.ann-btn:hover {
  background: #f3f4f6;
  color: #1a1d23;
  border-color: #cbd5e1;
}

.ann-btn--primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.ann-btn--primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}

.ann-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ann-btn--danger {
  color: #dc2626;
}

.ann-btn--danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.ann-btn--small {
  padding: 3px 8px;
  font-size: 11.5px;
}

.ann-btn--tiny {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
}


/* ---- Input ---- */
.ann-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #1a1d23;
  line-height: 1.5;
  resize: vertical;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ann-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ann-input::placeholder {
  color: #9ca3af;
}


/* ---- Replies ---- */
.ann-replies {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid #e2e5ea;
}

.ann-reply {
  padding: 6px 0;
}

.ann-reply + .ann-reply {
  border-top: 1px solid #f3f4f6;
}

.ann-reply-body {
  font-size: 13px;
  color: #374151;
  margin: 4px 0;
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.5;
}

.ann-reply-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.ann-reply-form {
  margin-top: 8px;
}


/* ---- Toast ---- */
.ann-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', -apple-system, sans-serif;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.ann-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ann-toast--success {
  background: #1e293b;
  color: #fff;
}

.ann-toast--error {
  background: #dc2626;
  color: #fff;
}


/* ---- Responsive ---- */
@media (max-width: 768px) {
  .ann-sidebar-panel {
    width: 100vw;
  }

  .ann-sidebar-toggle {
    top: 60px;
  }
}

/* ---- Print ---- */
@media print {
  .ann-sidebar,
  .ann-tooltip,
  .ann-toast {
    display: none !important;
  }

  mark.ann-hl {
    background: none !important;
    border-bottom: none !important;
    padding: 0 !important;
  }
}
