/**
 * Annotation Styles
 * Highlights, labels, and annotation sidebar content
 */

/* ===== ANNOTATION HIGHLIGHTS ===== */

.annotation {
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
  border-radius: 2px;
  position: relative;
  display: inline;
}

/* Update annotation - subtle yellow highlight */
.annotation-update {
  background: rgba(251, 192, 45, 0.25);
  border-bottom: 2px solid #FBC02D;
  cursor: default;
  color: inherit;
}

.annotation-update:hover {
  background: rgba(251, 192, 45, 0.35);
}

/* Author annotation - purple highlight, clickable */
.annotation-author {
  background: rgba(80, 99, 249, 0.15);
  border-bottom: 2px solid #5063F9;
  cursor: pointer;
  color: inherit;
}

.annotation-author:hover {
  background: rgba(80, 99, 249, 0.25);
}

.annotation-author.active {
  background: rgba(80, 99, 249, 0.35);
  border-bottom-color: #3949AB;
}

/* Dark mode adjustments */
[data-theme="dark"] .annotation-update {
  background: rgba(251, 192, 45, 0.2);
  border-bottom-color: #F9A825;
  color: #E1E2F9;
}

[data-theme="dark"] .annotation-update:hover {
  background: rgba(251, 192, 45, 0.3);
}

[data-theme="dark"] .annotation-author {
  background: rgba(98, 115, 249, 0.2);
  border-bottom-color: #6273F9;
  color: #E1E2F9;
}

[data-theme="dark"] .annotation-author:hover {
  background: rgba(98, 115, 249, 0.3);
}

[data-theme="dark"] .annotation-author.active {
  background: rgba(98, 115, 249, 0.4);
  border-bottom-color: #7C8DFA;
}

/* ===== ANNOTATION LABELS (Desktop only) ===== */

.annotation-label {
  position: absolute;
  /* left and top set dynamically via JavaScript */
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 400;
  font-size: 12px;
  line-height: 18px;
  text-decoration-line: underline;
  color: #0E142B;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.annotation-label.label-update {
  color: #F57C00;
}

.annotation-label.label-author {
  color: #5063F9;
}

/* Dark mode label colors */
[data-theme="dark"] .annotation-label {
  color: #FFFFFF;
}

[data-theme="dark"] .annotation-label.label-update {
  color: #F9A825;
}

[data-theme="dark"] .annotation-label.label-author {
  color: #6273F9;
}

/* Mobile: Hide labels (will show on click) */
@media (max-width: 767px) {
  .annotation-label {
    display: none;
  }
}

/* Tablet: Hide labels */
@media (min-width: 768px) and (max-width: 1439px) {
  .annotation-label {
    display: none;
  }
}

/* Desktop: Show labels in right column */
@media (min-width: 1440px) {
  .annotation-label {
    display: block;
  }

  /* Adjust position when annotations sidebar is expanded */
  .layout-container.annotation-expanded .annotation-label {
    opacity: 0;
    pointer-events: none;
  }
}

/* ===== ANNOTATION SIDEBAR CONTENT ===== */

.annotations-container {
  display: flex;
  flex-direction: column;
}

.annotation-content {
  display: none;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: 0 var(--spacing-md) 0;
  background: var(--color-background);
  border-radius: var(--border-radius-lg);
  box-shadow: none;
  height: 100%;
  overflow-y: auto;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 300ms ease;
}

.annotation-content.active {
  display: flex;
  animation: fadeIn 300ms ease forwards;
}

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

/* Annotation header */
.annotation-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding-top: var(--spacing-xl);
  position: sticky;
  top: 0;
  background: var(--color-background);
  z-index: 2;
  margin-bottom: var(--spacing-md);
}

.annotation-title {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-size: 14px;
  line-height: 22px;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: var(--color-text-primary);
  margin: 0;
  padding: 0;
  flex-grow: 0;
  flex-shrink: 0;
}

/* Close button */
.annotation-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 200ms ease;
  flex-shrink: 0;
}

.annotation-close:hover {
  color: var(--color-text-primary);
}

/* Highlighted text display */
.annotation-highlighted-text {
  padding: 24px;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.08);
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #0E142B;
}

/* Dark mode */
[data-theme="dark"] .annotation-highlighted-text {
  background: var(--color-surface);
  box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.24);
  color: var(--color-text-primary);
}

/* Annotation body content */
.annotation-body {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.annotation-body h2 {
  font-size: 24px;
  line-height: 32px;
  margin-bottom: var(--spacing-sm);
  color: #5063F9;
}

[data-theme="dark"] .annotation-body h2 {
  color: #6273F9;
}

.annotation-body h3 {
  font-size: 20px;
  line-height: 28px;
  margin-bottom: var(--spacing-sm);
  color: #263C91;
}

[data-theme="dark"] .annotation-body h3 {
  color: #7C8DFA;
}

.annotation-body p {
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-relaxed);
}

.annotation-body ul,
.annotation-body ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.annotation-body li {
  margin-bottom: var(--spacing-sm);
  line-height: var(--line-height-relaxed);
}

.annotation-body strong {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

/* Mobile: Full screen modal with horizontal padding */
@media (max-width: 767px) {
  .annotation-content {
    position: fixed;
    inset: 0;
    z-index: 3000;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
    padding-left: 42px;
    padding-right: 42px;
  }
}

/* Tablet: Full screen modal */
@media (min-width: 768px) and (max-width: 1439px) {
  .annotation-content {
    position: fixed;
    inset: 0;
    z-index: 3000;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
}

/* Desktop: Sidebar */
@media (min-width: 1440px) {
  .annotation-content {
    position: sticky;
    top: var(--spacing-lg);
    max-height: calc(100vh - var(--spacing-lg) * 2);
  }
}

/* ===== SCROLLBAR STYLING (Annotation Content) ===== */

.annotation-content::-webkit-scrollbar {
  width: 8px;
}

.annotation-content::-webkit-scrollbar-track {
  background: transparent;
}

.annotation-content::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.annotation-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}
