/* Feedback Annotation Highlights - Google Docs-style text selection */

/* Persistent Annotation Highlight - Saved annotations on page */
.feedback-annotation-highlight {
  background-color: rgba(251, 191, 36, 0.3); /* amber-400 at 30% opacity */
  border-bottom: 2px solid rgb(251, 191, 36); /* amber-400 solid underline */
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  padding: 2px 0;
  border-radius: 2px;
}

.feedback-annotation-highlight:hover {
  background-color: rgba(251, 191, 36, 0.5); /* amber-400 at 50% opacity */
  border-color: rgb(245, 158, 11); /* amber-500 for emphasis */
}

/* Temporary Selection Highlight - During text selection */
.feedback-selection-highlight {
  background-color: rgba(59, 130, 246, 0.2); /* blue-500 at 20% opacity */
  border-bottom: 1px dashed rgb(59, 130, 246); /* blue-500 dashed underline */
  transition: opacity 0.3s ease-out;
  padding: 2px 0;
  border-radius: 2px;
}

.feedback-selection-highlight.fading {
  opacity: 0;
}

/* Annotation Preview Box in Form */
.annotation-preview {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-left: 4px solid rgb(59, 130, 246); /* blue-500 accent */
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.annotation-preview-content {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.annotation-preview-label {
  font-size: 0.75rem; /* text-xs */
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.annotation-preview-text {
  color: var(--color-text-primary);
  font-style: italic;
  font-size: 0.875rem; /* text-sm */
  line-height: 1.5;
  max-height: 80px;
  overflow-y: auto;
  padding-right: 8px;
}

.annotation-preview-text::before {
  content: """;
  color: var(--color-text-disabled);
}

.annotation-preview-text::after {
  content: """;
  color: var(--color-text-disabled);
}

.annotation-preview-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.annotation-preview-close:hover {
  background-color: var(--color-surface-secondary);
  color: var(--color-text-primary);
}

.annotation-preview-close:active {
  background-color: var(--color-surface-primary);
}

.annotation-preview-close svg {
  width: 16px;
  height: 16px;
}

/* Annotation Tooltip - Shown on hover over highlighted text */
.annotation-tooltip {
  position: absolute;
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--color-text-primary);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  max-width: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.annotation-tooltip.visible {
  opacity: 1;
}

.annotation-tooltip-author {
  font-weight: 600;
  margin-bottom: 4px;
}

.annotation-tooltip-content {
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}

/* Multiple Overlapping Annotations */
.feedback-annotation-highlight.stacked {
  background-image:
    linear-gradient(45deg, rgba(251, 191, 36, 0.3) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(251, 191, 36, 0.3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(251, 191, 36, 0.3) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(251, 191, 36, 0.3) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

/* Scrolled-to Feedback Card Highlight - Pink Flash */
.feedback-card-highlighted {
  animation: pinkFlash 1.5s ease-out;
}

@keyframes pinkFlash {
  0% {
    background-color: rgba(236, 72, 153, 0.3); /* pink-500 at 30% */
    box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.3);
  }
  50% {
    background-color: rgba(236, 72, 153, 0.15); /* pink-500 at 15% */
    box-shadow: 0 0 0 8px rgba(236, 72, 153, 0.15);
  }
  100% {
    background-color: transparent;
    box-shadow: 0 0 0 0 rgba(236, 72, 153, 0);
  }
}

/* Text Selection Cursor */
.feedback-enabled-area {
  cursor: text;
  user-select: text;
}

.feedback-enabled-area::selection {
  background-color: rgba(59, 130, 246, 0.3);
  color: inherit;
}

/* Loading State for Annotation Rendering */
.annotation-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-border);
  border-top-color: rgb(59, 130, 246);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
  .feedback-annotation-highlight {
    background-color: rgba(251, 191, 36, 0.2);
    border-color: rgba(251, 191, 36, 0.8);
  }

  .feedback-annotation-highlight:hover {
    background-color: rgba(251, 191, 36, 0.35);
  }

  .feedback-selection-highlight {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.6);
  }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
  .feedback-annotation-highlight {
    background-color: rgba(251, 191, 36, 0.5);
    border-bottom-width: 3px;
  }

  .feedback-selection-highlight {
    background-color: rgba(59, 130, 246, 0.3);
    border-bottom-width: 2px;
  }
}

/* Print Styles - Hide annotations when printing */
@media print {
  .feedback-annotation-highlight {
    background-color: transparent !important;
    border: none !important;
  }

  .annotation-preview,
  .annotation-tooltip {
    display: none !important;
  }
}
