/* Tooltip styling for article rationale */
.tooltip-container {
  position: relative;
  display: inline-block;
}

/* Allow tooltips to break out of narrow containers */
.articles-in-book {
  overflow: visible !important;
}

.book-group {
  overflow: visible !important;
}

.tooltip {
  position: absolute;
  z-index: 99999;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 16px;
  background-color: #1f2937;
  color: white;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  white-space: normal;
  width: calc(15vw - 32px);
  min-width: 235px;
  max-width: 400px;
  word-wrap: break-word;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
  pointer-events: none;
}

.tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid #1f2937;
}

.tooltip-container:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* Loading state for articles section */
.articles-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #6b7280;
  font-size: 14px;
}

.articles-loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Smooth article addition animation */
.article-item {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Book grouping styles */
.book-group {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.book-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.book-name {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.articles-in-book {
  margin-left: 8px;
}