/* ==================== 笔记高亮样式 ==================== */

/* 临时高亮：保持选中文本的视觉选中效果 */
.annotator-temp-highlight {
  background-color: #b3d4fc !important;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  font-family: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  display: inline;
}

.annotator-highlight {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  font-family: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  display: inline;
  cursor: pointer;
  border-radius: 2px;
  transition: opacity 0.2s ease;
}

.annotator-highlight:hover {
  opacity: 0.85;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.annotator-highlight.annotator-flash {
  animation: annotatorFlash 1.5s ease;
}

@keyframes annotatorFlash {
  0%   { box-shadow: 0 0 0 0px rgba(255, 152, 0, 0.7); }
  50%  { box-shadow: 0 0 0 6px rgba(255, 152, 0, 0); }
  100% { box-shadow: 0 0 0 0px rgba(255, 152, 0, 0); }
}

/* ==================== 浮动工具栏 ==================== */

#annotator-toolbar {
  position: absolute;
  z-index: 9999;
  display: none;
  width: 260px;
  background: #fff;
  border-radius: 12px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.04),
    0 10px 40px rgba(0,0,0,0.12);
  padding: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border: 1px solid rgba(0,0,0,0.06);
}

.annotator-toolbar-title {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.annotator-colors {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.annotator-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.annotator-color-dot:hover {
  transform: scale(1.15);
}

.annotator-color-dot.active {
  border-color: #1a1a1a;
  transform: scale(1.1);
}

.annotator-input {
  width: 100%;
  min-height: 60px;
  border: 1.5px solid #e8e8e8;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.annotator-input:focus {
  border-color: #1a1a1a;
}

.annotator-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.annotator-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f0f0f0;
  color: #444;
}

.annotator-btn:hover {
  background: #e4e4e4;
}

.annotator-btn-primary {
  background: #1a1a1a;
  color: #fff;
}

.annotator-btn-primary:hover {
  background: #333;
}

/* ==================== 笔记面板 ==================== */

.annotator-panel {
  position: fixed;
  right: 0;
  top: 64px;
  bottom: 0;
  width: 280px;
  background: #fff;
  border-left: 1px solid rgba(0,0,0,0.08);
  box-shadow: -4px 0 24px rgba(0,0,0,0.06);
  z-index: 9998;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

.annotator-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  background: #fafafa;
}

.annotator-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.annotator-panel-count {
  background: #1a1a1a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.annotator-panel-close {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.annotator-panel-close:hover {
  background: rgba(0,0,0,0.06);
  color: #1a1a1a;
}

.annotator-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

#annotator-panel-toggle {
  position: fixed;
  right: calc(12% + 300px);
  bottom: 100px;
  z-index: 999;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: #1a1a1a;
  font-size: 20px;
  line-height: 52px;
  text-align: center;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.05),
    0 4px 8px rgba(0,0,0,0.08),
    0 8px 16px rgba(0,0,0,0.1),
    0 16px 32px rgba(0,0,0,0.12),
    0 2px 4px rgba(0,0,0,0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

#annotator-panel-toggle:hover {
  background: #1a1a1a;
  color: #ffffff;
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px rgba(0,0,0,0.06),
    0 8px 16px rgba(0,0,0,0.1),
    0 16px 32px rgba(0,0,0,0.14),
    0 24px 48px rgba(0,0,0,0.18),
    0 4px 8px rgba(0,0,0,0.08);
}

#annotator-panel-toggle:active {
  transform: translateY(-1px) scale(0.96);
  box-shadow:
    0 1px 2px rgba(0,0,0,0.05),
    0 4px 8px rgba(0,0,0,0.08),
    0 8px 16px rgba(0,0,0,0.1);
}

/* 暗色模式 */
[data-md-color-scheme="slate"] #annotator-panel-toggle {
  background: #2a2a2a;
  color: #ffffff;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.2),
    0 4px 8px rgba(0,0,0,0.25),
    0 8px 16px rgba(0,0,0,0.3),
    0 16px 32px rgba(0,0,0,0.35),
    0 2px 4px rgba(0,0,0,0.2);
}

[data-md-color-scheme="slate"] #annotator-panel-toggle:hover {
  background: #ffffff;
  color: #1a1a1a;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.15),
    0 8px 16px rgba(0,0,0,0.2),
    0 16px 32px rgba(0,0,0,0.25),
    0 24px 48px rgba(0,0,0,0.3),
    0 4px 8px rgba(0,0,0,0.15);
}

/* ==================== 笔记列表项 ==================== */

.annotator-empty {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 40px 10px;
  line-height: 1.8;
}

.annotator-item {
  background: #fafafa;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  border: 1px solid rgba(0,0,0,0.04);
}

.annotator-item:hover {
  background: #f0f0f0;
  transform: translateX(-2px);
}

.annotator-item-text {
  font-size: 12px;
  color: #333;
  line-height: 1.5;
  border-left: 3px solid #ffeb3b;
  padding-left: 8px;
  margin-bottom: 6px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.annotator-item-note {
  font-size: 12px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 6px;
  word-break: break-all;
}

.annotator-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #999;
}

.annotator-item-delete {
  background: none;
  border: none;
  color: #c00;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.annotator-item-delete:hover {
  background: rgba(204, 0, 0, 0.08);
}

/* ==================== 自定义确认对话框 ==================== */

.annotator-confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: annotatorFadeIn 0.2s ease;
}

@keyframes annotatorFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.annotator-confirm-dialog {
  background: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  width: 320px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: annotatorSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes annotatorSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.annotator-confirm-dialog .annotator-confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.annotator-confirm-dialog .annotator-confirm-message {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.annotator-confirm-dialog .annotator-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.annotator-confirm-dialog .annotator-confirm-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.annotator-confirm-dialog .annotator-confirm-btn.cancel {
  background: #f0f0f0;
  color: #444;
}

.annotator-confirm-dialog .annotator-confirm-btn.cancel:hover {
  background: #e4e4e4;
}

.annotator-confirm-dialog .annotator-confirm-btn.ok {
  background: #c62828;
  color: #fff;
}

.annotator-confirm-dialog .annotator-confirm-btn.ok:hover {
  background: #b71c1c;
}

[data-md-color-scheme="slate"] .annotator-confirm-dialog {
  background: #1e1e1e;
}

[data-md-color-scheme="slate"] .annotator-confirm-dialog .annotator-confirm-title {
  color: #eee;
}

[data-md-color-scheme="slate"] .annotator-confirm-dialog .annotator-confirm-message {
  color: #aaa;
}

[data-md-color-scheme="slate"] .annotator-confirm-dialog .annotator-confirm-btn.cancel {
  background: #333;
  color: #ccc;
}

[data-md-color-scheme="slate"] .annotator-confirm-dialog .annotator-confirm-btn.cancel:hover {
  background: #444;
}


@media (max-width: 768px) {
  .annotator-panel {
    width: 260px;
  }

  #annotator-panel-toggle {
    right: 16px;
    bottom: 90px;
    top: auto;
    width: 46px;
    height: 46px;
    line-height: 46px;
    font-size: 18px;
  }

  #annotator-toolbar {
    width: 220px;
    left: 10px !important;
    right: 10px !important;
  }
}

/* 暗色模式适配 */
[data-md-color-scheme="slate"] .annotator-panel {
  background: #1e1e1e;
  border-left-color: rgba(255,255,255,0.08);
}

[data-md-color-scheme="slate"] .annotator-panel-header {
  background: #252525;
  color: #eee;
  border-bottom-color: rgba(255,255,255,0.08);
}

[data-md-color-scheme="slate"] .annotator-item {
  background: #252525;
  border-color: rgba(255,255,255,0.06);
}

[data-md-color-scheme="slate"] .annotator-item:hover {
  background: #2a2a2a;
}

[data-md-color-scheme="slate"] .annotator-item-text {
  color: #ddd;
}

[data-md-color-scheme="slate"] .annotator-item-note {
  background: #1e1e1e;
  color: #ccc;
}

[data-md-color-scheme="slate"] #annotator-toolbar {
  background: #1e1e1e;
  border-color: rgba(255,255,255,0.1);
}

[data-md-color-scheme="slate"] .annotator-toolbar-title {
  color: #eee;
}

[data-md-color-scheme="slate"] .annotator-input {
  background: #252525;
  border-color: rgba(255,255,255,0.1);
  color: #eee;
}

[data-md-color-scheme="slate"] .annotator-btn {
  background: #333;
  color: #ccc;
}

[data-md-color-scheme="slate"] .annotator-btn:hover {
  background: #444;
}

/* 覆盖 Material 主题 TOP 按钮位置，与笔记按钮对齐 */
#back-to-top {
  position: fixed !important;
  right: calc(12% + 300px) !important;
  bottom: 32px !important;
  top: auto !important;
  z-index: 999;
}

/* 响应式适配 */
@media (max-width: 768px) {
  #back-to-top {
    right: 16px !important;
    bottom: 24px !important;
    top: auto !important;
  }
}

