/**
 * CACD Academy — Comments & Annotation Styles
 * 评论批注系统样式
 */

/* ========== 评论区 ========== */
.comments-section {
  background: var(--color-bg-alt, #f8f9fa);
  padding: var(--space-2xl, 48px) 0;
  border-top: 1px solid var(--color-border-light, #e9ecef);
}

.comments-section .container {
  max-width: 800px;
}

.comments-section-header {
  text-align: center;
  margin-bottom: var(--space-xl, 32px);
}

.comments-section-header h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm, 8px);
  color: var(--color-text, #212529);
}

.comments-section-header p {
  color: var(--color-text-light, #6c757d);
  font-size: 0.9rem;
}

#comments-container {
  background: #fff;
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-xl, 32px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  min-height: 200px;
}

/* 评论占位提示 */
.comments-placeholder {
  text-align: center;
  padding: var(--space-xl, 32px);
}

.comments-placeholder-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md, 16px);
}

.comments-placeholder h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-sm, 8px);
  color: var(--color-text, #212529);
}

.comments-placeholder p {
  color: var(--color-text-light, #6c757d);
  font-size: 0.9rem;
  margin-bottom: var(--space-md, 16px);
}

.comments-placeholder-tips {
  text-align: left;
  background: var(--color-bg-alt, #f8f9fa);
  padding: var(--space-md, 16px);
  border-radius: var(--radius-md, 8px);
  margin: var(--space-md, 16px) 0;
  font-size: 0.85rem;
}

.comments-placeholder-tips ol {
  margin: var(--space-sm, 8px) 0 0;
  padding-left: 20px;
}

.comments-placeholder-tips li {
  margin-bottom: var(--space-xs, 4px);
}

.comments-placeholder-tips code {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.comments-placeholder-note {
  font-size: 0.8rem;
  color: var(--color-primary, #4A5AFF);
  margin-top: var(--space-md, 16px);
}

/* ========== 批注模式切换按钮 ========== */
.annotation-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  background: linear-gradient(135deg, #4A5AFF, #6B7BFF);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(74,90,255,0.3);
  transition: all 0.3s ease;
}

.annotation-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74,90,255,0.4);
}

.annotation-toggle.active {
  background: linear-gradient(135deg, #D4AF37, #E8C87A);
  box-shadow: 0 4px 16px rgba(212,175,55,0.4);
}

body.annotation-mode-active {
  cursor: crosshair;
}

body.annotation-mode-active ::selection {
  background: rgba(212,175,55,0.3);
}

/* ========== 批注面板 ========== */
.annotation-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  z-index: 9999;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.annotation-panel.open {
  right: 0;
}

.annotation-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(135deg, #4A5AFF, #6B7BFF);
  color: #fff;
}

.annotation-panel-header h4 {
  margin: 0;
  font-size: 1rem;
}

.annotation-panel-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.annotation-panel-colors {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #e9ecef;
  gap: 8px;
}

.annotation-color-label {
  font-size: 0.85rem;
  color: #6c757d;
}

.annotation-color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

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

.annotation-color-dot.active {
  border-color: #212529;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #212529;
}

.annotation-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.annotation-empty {
  text-align: center;
  color: #adb5bd;
  font-size: 0.85rem;
  padding: 40px 20px;
}

.annotation-item {
  background: #f8f9fa;
  border-left: 4px solid #4A5AFF;
  padding: 12px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 12px;
}

.annotation-item-text {
  font-size: 0.82rem;
  color: #495057;
  font-style: italic;
  margin-bottom: 6px;
  line-height: 1.4;
}

.annotation-item-note {
  font-size: 0.9rem;
  color: #212529;
  margin-bottom: 8px;
  line-height: 1.5;
}

.annotation-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #adb5bd;
}

.annotation-item-delete {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
}

.annotation-item-delete:hover {
  text-decoration: underline;
}

.annotation-panel-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e9ecef;
}

.annotation-export-btn,
.annotation-clear-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.annotation-export-btn {
  background: #4A5AFF;
  color: #fff;
}

.annotation-export-btn:hover {
  background: #3a4adf;
}

.annotation-clear-btn {
  background: #f8f9fa;
  color: #dc3545;
  border: 1px solid #f5c6cb;
}

.annotation-clear-btn:hover {
  background: #f5c6cb;
}

/* ========== 批注弹窗 ========== */
.annotation-popup {
  position: absolute;
  z-index: 10000;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  padding: 16px;
  width: 300px;
  border: 1px solid #e9ecef;
}

.annotation-popup-text {
  font-size: 0.8rem;
  color: #6c757d;
  font-style: italic;
  margin-bottom: 10px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  line-height: 1.4;
}

.annotation-popup-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.85rem;
  resize: vertical;
  margin-bottom: 10px;
  font-family: inherit;
}

.annotation-popup-input:focus {
  outline: none;
  border-color: #4A5AFF;
  box-shadow: 0 0 0 3px rgba(74,90,255,0.1);
}

.annotation-popup-actions {
  display: flex;
  gap: 8px;
}

.annotation-popup-save,
.annotation-popup-cancel {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 500;
}

.annotation-popup-save {
  background: #4A5AFF;
  color: #fff;
}

.annotation-popup-save:hover {
  background: #3a4adf;
}

.annotation-popup-cancel {
  background: #f8f9fa;
  color: #6c757d;
}

.annotation-popup-cancel:hover {
  background: #e9ecef;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .annotation-panel {
    width: 100%;
    right: -100%;
  }
  
  .annotation-toggle {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.8rem;
  }
  
  .annotation-popup {
    width: calc(100vw - 32px);
    left: 16px !important;
  }
}
